Skip to content

Commit

Permalink
Merge pull request #23 from skalahonza/driver_api_refactoring
Browse files Browse the repository at this point in the history
Driver api refactoring
  • Loading branch information
skalahonza authored Mar 18, 2017
2 parents ad23b25 + 999ef1e commit 8d8b850
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DriversBackup/DriversBackup.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<ItemGroup>
<Compile Include="Models\DriverBackup.cs" />
<Compile Include="Models\DriverInformation.cs" />
<Compile Include="Models\General.INIFiles.cs" />
<Compile Include="Models\INIFiles.cs" />
<Compile Include="MVVM\AppSettings.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
Expand Down
20 changes: 9 additions & 11 deletions DriversBackup/Models/DriverBackup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public DriverBackup()
/// <summary>
/// Returns a list of drivers registered on a system.
/// </summary>
/// <returns>ArrayList containing driver information</returns>
/// <returns>yList containing driver information</returns>
public List<DriverInformation> ListDrivers(bool showMicrosoft = false)
{
var driverList = new List<DriverInformation>();
Expand Down Expand Up @@ -56,8 +56,7 @@ public List<DriverInformation> ListDrivers(bool showMicrosoft = false)

try
{
// Add information to our ArrayList.

// Add information to result List.
tmpDesc = regDriver.GetValue("DriverDesc").ToString();
tmpProvider = regDriver.GetValue("ProviderName").ToString();
}
Expand All @@ -70,20 +69,19 @@ public List<DriverInformation> ListDrivers(bool showMicrosoft = false)

if (tmpProvider.Length > 0 && tmpDesc.Length > 0)
{
// add non microsoft driver
if (tmpProvider != "Microsoft")
{
driverList.Add(
new DriverInformation(tmpProvider, tmpDesc, deviceGuid, regDriverNumber)
);
}
else
//if microsoft drivers ae required, add them too
else if (showMicrosoft)
{
if (showMicrosoft)
{
driverList.Add(
new DriverInformation(tmpProvider, tmpDesc, deviceGuid, regDriverNumber)
);
}
driverList.Add(
new DriverInformation(tmpProvider, tmpDesc, deviceGuid, regDriverNumber)
);
}

}
Expand All @@ -98,8 +96,8 @@ public List<DriverInformation> ListDrivers(bool showMicrosoft = false)
}
}

// free resources
regDeviceGuiDs.Close();

return driverList;
}

Expand Down
10 changes: 5 additions & 5 deletions DriversBackup/Models/DriverInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace DriversBackup.Models
/// <summary>
/// Object setup for binding to our ArrayList.
/// </summary>
public class DriverInformation:ViewModelBase
public class DriverInformation : ViewModelBase
{
private bool isSelected;

Expand All @@ -16,10 +16,10 @@ public DriverInformation(string driverProvider, string driverDescription, string
DriverDeviceGuid = driverDeviceGuid;
DriverId = driverId;
}
public string DriverProvider { get; }
public string DriverDescription { get; }
public string DriverDeviceGuid { get; }
public string DriverId { get; }
public string DriverProvider { get; private set; }
public string DriverDescription { get; private set; }
public string DriverDeviceGuid { get; private set; }
public string DriverId { get; private set; }
public bool IsSelected
{
get { return isSelected; }
Expand Down
Binary file not shown.

0 comments on commit 8d8b850

Please sign in to comment.