Skip to content

Commit ab3ffd8

Browse files
author
KELEV6
committed
Refactoring, save to excel, display text on new results tab
1 parent 8b246d8 commit ab3ffd8

39 files changed

Lines changed: 1011 additions & 317 deletions

FreeDiskSpace/FreeDiskSpace.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,19 @@ public FreeDiskSpace(DriveInfo drive)
2626
}
2727

2828

29-
public override string ToString()
29+
30+
31+
public override string getDisplayName()
32+
{
33+
return this.Name;
34+
}
35+
36+
public override Dictionary<string, string> getItems()
3037
{
31-
return $"{this.Name} [AvailaibleSpace '{this.AvailaibleSpace} kB']";
38+
return new Dictionary<string, string>()
39+
{
40+
{ "AvailaibleSpace", $"{AvailaibleSpace.ToString()} kB" }
41+
};
3242
}
3343

3444

FreeDiskSpace/FreeDiskSpace.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
32+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|AnyCPU'">
33+
<OutputPath>bin\Release 2\</OutputPath>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
36+
<PlatformTarget>x86</PlatformTarget>
37+
<OutputPath>bin\x86\Debug\</OutputPath>
38+
</PropertyGroup>
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
40+
<PlatformTarget>x86</PlatformTarget>
41+
<OutputPath>bin\x86\Release\</OutputPath>
42+
</PropertyGroup>
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|x86'">
44+
<PlatformTarget>x86</PlatformTarget>
45+
<OutputPath>bin\x86\Release 2\</OutputPath>
46+
</PropertyGroup>
3247
<ItemGroup>
3348
<Reference Include="System" />
3449
<Reference Include="System.Core" />

FreeDiskSpace/FreeDiskSpaceDiff.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public override List<DiffResult> Start()
3131
if (afterItem == null)
3232
{
3333
//Drive has been deleted
34-
results.Add(DiffResult.Removed(beforeItem.ToString()));
34+
results.Add(DiffResult.Removed(beforeItem));
3535
continue;
3636
}
3737

3838

3939
//Drive space modified
4040
if((beforeItem.AvailaibleSpace != afterItem.AvailaibleSpace))
4141
{
42-
results.Add(DiffResult.Modified(beforeItem.ToString(), afterItem.ToString()));
42+
results.Add(DiffResult.Modified(beforeItem, afterItem));
4343
continue;
4444
}
4545
}
@@ -51,7 +51,7 @@ public override List<DiffResult> Start()
5151
//New Drive
5252
if(beforeItem == null)
5353
{
54-
results.Add(DiffResult.Added(afterItem.ToString()));
54+
results.Add(DiffResult.Added(afterItem));
5555
}
5656

5757

FreeDiskSpace/FreeDiskSpaceScanner.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ public override List<Component> Scan()
2525
List<Component> drives = new List<Component>();
2626

2727
foreach (DriveInfo drive in DriveInfo.GetDrives())
28-
drives.Add(new FreeDiskSpace(drive));
29-
28+
{
29+
if(drive.DriveType == DriveType.Fixed && drive.IsReady)
30+
drives.Add(new FreeDiskSpace(drive));
31+
}
32+
3033
Listener.sendStringToUI($"Scanned {drives.Count} drives availaible space");
3134

3235
return drives;

InstalledPrograms64bitsScanner/InstalledProgram64bits.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,19 @@ public InstalledProgram64bits()
3434

3535
}
3636

37-
public override string ToString()
37+
38+
public override string getDisplayName()
39+
{
40+
return this.DisplayName;
41+
}
42+
43+
public override Dictionary<string, string> getItems()
3844
{
39-
return $"{this.DisplayName} [Version {this.DisplayVersion}]";
45+
return new Dictionary<string, string>()
46+
{
47+
{ "Name", DisplayName },
48+
{ "Version", DisplayVersion }
49+
};
4050
}
4151

4252
}

InstalledPrograms64bitsScanner/InstalledProgram64bitsDiff.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public override List<DiffResult> Start()
3131
if (afterItem == null)
3232
{
3333
//Product has been uninstalled, no longer exists in the registry
34-
results.Add(DiffResult.Removed(beforeItem.ToString()));
34+
results.Add(DiffResult.Removed(beforeItem));
3535
continue;
3636
}
3737

3838

3939
if((beforeItem.DisplayName != afterItem.DisplayName) || (beforeItem.DisplayVersion != afterItem.DisplayVersion))
4040
{
4141
//DisplayName or DisplayVersion modified
42-
results.Add(DiffResult.Modified(beforeItem.ToString(), afterItem.ToString()));
42+
results.Add(DiffResult.Modified(beforeItem, afterItem));
4343
continue;
4444
}
4545
}
@@ -51,7 +51,7 @@ public override List<DiffResult> Start()
5151
if(beforeItem == null)
5252
{
5353
//Product didn't exist before, it has been installed
54-
results.Add(DiffResult.Added(afterItem.ToString()));
54+
results.Add(DiffResult.Added(afterItem));
5555
}
5656

5757

InstalledPrograms64bitsScanner/InstalledPrograms64bitsScanner.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,21 @@
2929
<ErrorReport>prompt</ErrorReport>
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
32+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|AnyCPU'">
33+
<OutputPath>bin\Release 2\</OutputPath>
34+
</PropertyGroup>
35+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
36+
<PlatformTarget>x86</PlatformTarget>
37+
<OutputPath>bin\x86\Debug\</OutputPath>
38+
</PropertyGroup>
39+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
40+
<PlatformTarget>x86</PlatformTarget>
41+
<OutputPath>bin\x86\Release\</OutputPath>
42+
</PropertyGroup>
43+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|x86'">
44+
<PlatformTarget>x86</PlatformTarget>
45+
<OutputPath>bin\x86\Release 2\</OutputPath>
46+
</PropertyGroup>
3247
<ItemGroup>
3348
<Reference Include="System" />
3449
<Reference Include="System.Core" />

InstalledProgramsScanner/InstalledProgram32bits.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,19 @@ public InstalledProgram32bits()
3434

3535
}
3636

37-
public override string ToString()
37+
38+
public override string getDisplayName()
3839
{
39-
return $"{this.DisplayName} [Version {this.DisplayVersion}]";
40+
return this.DisplayName;
4041
}
4142

43+
public override Dictionary<string, string> getItems()
44+
{
45+
return new Dictionary<string, string>()
46+
{
47+
{ "Name", DisplayName },
48+
{ "Version", DisplayVersion }
49+
};
50+
}
4251
}
4352
}

InstalledProgramsScanner/InstalledProgram32bitsDiff.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ public override List<DiffResult> Start()
3131
if (afterItem == null)
3232
{
3333
//Product has been uninstalled, no longer exists in the registry
34-
results.Add(DiffResult.Removed(beforeItem.ToString()));
34+
results.Add(DiffResult.Removed(beforeItem));
3535
continue;
3636
}
3737

3838

3939
if((beforeItem.DisplayName != afterItem.DisplayName) || (beforeItem.DisplayVersion != afterItem.DisplayVersion))
4040
{
4141
//DisplayName or DisplayVersion modified
42-
results.Add(DiffResult.Modified(beforeItem.ToString(), afterItem.ToString()));
42+
results.Add(DiffResult.Modified(beforeItem, afterItem));
4343
continue;
4444
}
4545
}
@@ -51,7 +51,7 @@ public override List<DiffResult> Start()
5151
if(beforeItem == null)
5252
{
5353
//Product didn't exist before, it has been installed
54-
results.Add(DiffResult.Added(afterItem.ToString()));
54+
results.Add(DiffResult.Added(afterItem));
5555
}
5656

5757

InstalledProgramsScanner/InstalledPrograms32bitsScanner.csproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,24 @@
5454
<ErrorReport>prompt</ErrorReport>
5555
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
5656
</PropertyGroup>
57+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|AnyCPU'">
58+
<OutputPath>bin\Release 2\</OutputPath>
59+
</PropertyGroup>
60+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|x64'">
61+
<OutputPath>bin\x64\Release 2\</OutputPath>
62+
</PropertyGroup>
63+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
64+
<PlatformTarget>x86</PlatformTarget>
65+
<OutputPath>bin\x86\Debug\</OutputPath>
66+
</PropertyGroup>
67+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
68+
<PlatformTarget>x86</PlatformTarget>
69+
<OutputPath>bin\x86\Release\</OutputPath>
70+
</PropertyGroup>
71+
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release 2|x86'">
72+
<PlatformTarget>x86</PlatformTarget>
73+
<OutputPath>bin\x86\Release 2\</OutputPath>
74+
</PropertyGroup>
5775
<ItemGroup>
5876
<Reference Include="System" />
5977
<Reference Include="System.Core" />

0 commit comments

Comments
 (0)