Skip to content

Commit 639bd8f

Browse files
authored
Merge pull request #66 from GeneralLibrary/dev
Dev
2 parents a42bdc8 + 2b8a7d1 commit 639bd8f

File tree

227 files changed

+3432
-8427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+3432
-8427
lines changed

imgs/bowl.jpeg

100 KB
Loading
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>false</IsPackable>
9+
<IsTestProject>true</IsTestProject>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
15+
<PackageReference Include="xunit" Version="2.5.3"/>
16+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<Using Include="Xunit"/>
21+
</ItemGroup>
22+
23+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace GeneralUpdate.Bowl.Test;
2+
3+
public class UnitTest1
4+
{
5+
[Fact]
6+
public void Test1()
7+
{
8+
}
9+
}

src/c#/GeneralUpdate.Bowl/Bowl.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44

55
namespace GeneralUpdate.Bowl;
66

7-
public class Bowl
7+
/// <summary>
8+
/// Surveillance Main Program.
9+
/// </summary>
10+
public sealed class Bowl
811
{
912
private IStrategy _strategy;
1013

@@ -14,7 +17,7 @@ public Bowl(MonitorParameter parameter = null)
1417
_strategy!.SetParameter(parameter);
1518
}
1619

17-
private void CreateStrategy()
20+
private Bowl CreateStrategy()
1821
{
1922
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2023
{
@@ -24,6 +27,11 @@ private void CreateStrategy()
2427
{
2528
_strategy = new LinuxStrategy();
2629
}
30+
31+
if (_strategy == null)
32+
throw new PlatformNotSupportedException("Unsupported operating system");
33+
34+
return this;
2735
}
2836

2937
public Bowl SetParameter(MonitorParameter parameter)
@@ -35,5 +43,9 @@ public Bowl SetParameter(MonitorParameter parameter)
3543
return this;
3644
}
3745

38-
public void Launch() => _strategy.Launch();
46+
public Bowl Launch()
47+
{
48+
_strategy.Launch();
49+
return this;
50+
}
3951
}

src/c#/GeneralUpdate.Bowl/Strategys/AbstractStrategy.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ public abstract class AbstractStrategy : IStrategy
1111
private readonly IReadOnlyList<string> _sensitiveCharacter = new List<string>
1212
{
1313
"Exit",
14-
"exit"
14+
"exit",
15+
"EXIT"
1516
};
1617

1718
public virtual void Launch()

src/c#/GeneralUpdate.Bowl/Strategys/LinuxStrategy.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,16 @@ namespace GeneralUpdate.Bowl.Strategys;
88

99
public class LinuxStrategy : AbstractStrategy
1010
{
11-
/*procdump-3.3.0-0.cm2.x86_64.rpm:
12-
适合系统:此RPM包可能适用于基于CentOS或RHEL的某些派生版本,具体来说是CM2版本。CM2通常指的是ClearOS 7.x或类似的社区维护版本。
13-
procdump-3.3.0-0.el8.x86_64.rpm:
14-
适合系统:此RPM包适用于Red Hat Enterprise Linux 8 (RHEL 8)、CentOS 8及其他基于RHEL 8的发行版。
15-
procdump_3.3.0_amd64.deb:
16-
适合系统:此DEB包适用于Debian及其衍生发行版,如Ubuntu,适用于64位系统(amd64架构)。*/
11+
/*procdump-3.3.0-0.cm2.x86_64.rpm:
12+
Compatible Systems: This RPM package may be suitable for certain CentOS or RHEL-based derivatives, specifically the CM2 version. CM2 typically refers to ClearOS 7.x or similar community-maintained versions.
13+
14+
procdump-3.3.0-0.el8.x86_64.rpm:
15+
Compatible Systems: This RPM package is suitable for Red Hat Enterprise Linux 8 (RHEL 8), CentOS 8, and other RHEL 8-based distributions.
16+
17+
procdump_3.3.0_amd64.deb:
18+
Compatible Systems: This DEB package is suitable for Debian and its derivatives, such as Ubuntu, for 64-bit systems (amd64 architecture).*/
1719

18-
private IReadOnlyList<string> procdump_amd64 = new List<string> { "Ubuntu", "Debian" };
20+
private IReadOnlyList<string> _rocdumpAmd64 = new List<string> { "Ubuntu", "Debian" };
1921
private IReadOnlyList<string> procdump_el8_x86_64 = new List<string> { "Red Hat", "CentOS", "Fedora" };
2022
private IReadOnlyList<string> procdump_cm2_x86_64 = new List<string> { "ClearOS" };
2123

@@ -64,9 +66,9 @@ private void Install()
6466

6567
private string GetPacketName()
6668
{
67-
string packageFileName = string.Empty;
68-
LinuxSystem system = GetSystem();
69-
if (procdump_amd64.Contains(system.Name))
69+
var packageFileName = string.Empty;
70+
var system = GetSystem();
71+
if (_rocdumpAmd64.Contains(system.Name))
7072
{
7173
packageFileName = $"procdump_3.3.0_amd64.deb";
7274
}
@@ -105,9 +107,7 @@ private LinuxSystem GetSystem()
105107

106108
return new LinuxSystem(distro, version);
107109
}
108-
else
109-
{
110-
throw new FileNotFoundException("Cannot determine the Linux distribution. The /etc/os-release file does not exist.");
111-
}
110+
111+
throw new FileNotFoundException("Cannot determine the Linux distribution. The /etc/os-release file does not exist.");
112112
}
113113
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
8+
<IsPackable>false</IsPackable>
9+
<IsTestProject>true</IsTestProject>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
14+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0"/>
15+
<PackageReference Include="xunit" Version="2.5.3"/>
16+
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3"/>
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<Using Include="Xunit"/>
21+
</ItemGroup>
22+
23+
</Project>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace GeneralUpdate.Client.Test;
2+
3+
public class UnitTest1
4+
{
5+
[Fact]
6+
public void Test1()
7+
{
8+
}
9+
}

0 commit comments

Comments
 (0)