-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
1,011 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.23107.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NVIDIA INF Modifier", "WPFApp\NVIDIA INF Modifier.csproj", "{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Application x:Class="WPFApp.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WPFApp" StartupUri="MainWindow.xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" d1p1:Ignorable="d" xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:WPFApp.ViewModel" /> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Windows; | ||
|
||
namespace WPFApp | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace WPFApp | ||
{ | ||
public class DeviceIDParser | ||
{ | ||
private string rawID; | ||
|
||
public DeviceIDParser(string deviceID) | ||
{ | ||
rawID = deviceID; | ||
Parse(); | ||
} | ||
|
||
private void Parse() | ||
{ | ||
string tmp = rawID.ToLower(); | ||
tmp = tmp.Replace("pci\\", ""); | ||
|
||
var strings = tmp.Split('&'); | ||
|
||
foreach (var substring in strings) | ||
{ | ||
if (substring.StartsWith("ven_")) | ||
Vendor = substring.Substring(4); | ||
else if (substring.StartsWith("dev_")) | ||
Device = substring.Substring(4); | ||
else if (substring.StartsWith("subsys_")) | ||
SubSys = substring.Substring(7); | ||
} | ||
} | ||
|
||
public string Vendor { get; set; } | ||
public string Device { get; set; } | ||
public string SubSys { get; set; } | ||
|
||
public string SubSys1 | ||
{ | ||
get | ||
{ | ||
return SubSys.Substring(0, 4); | ||
} | ||
} | ||
public string SubSys2 | ||
{ | ||
get | ||
{ | ||
return SubSys.Substring(4, 4); | ||
} | ||
} | ||
|
||
public bool IsValid | ||
{ | ||
get | ||
{ | ||
return (Vendor != null && Device != null && SubSys != null); | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace WPFApp | ||
{ | ||
public class INFPathFinder | ||
{ | ||
private string _rootPath; | ||
|
||
public INFPathFinder(string rootDir) | ||
{ | ||
_rootPath = rootDir; | ||
|
||
var nvdmiFiles = new DirectoryInfo(_rootPath).GetFiles("nvdmi.inf", SearchOption.AllDirectories); | ||
|
||
if (nvdmiFiles != null) | ||
{ | ||
nvdmi = nvdmiFiles[0].FullName; | ||
} | ||
} | ||
|
||
public string nvdmi { get; set; } | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Window | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:WPFApp" | ||
xmlns:ViewModel="clr-namespace:WPFApp.ViewModel" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" x:Class="WPFApp.MainWindow" | ||
mc:Ignorable="d" | ||
Title="NVIDIA INF Modifier" Height="284.157" Width="483.885" Loaded="Window_Loaded"> | ||
<Grid> | ||
<StackPanel> | ||
<GroupBox Header="Highlight the NVIDIA GPU" Margin="10,0"> | ||
<StackPanel Margin="10,10,10,10" HorizontalAlignment="Stretch"> | ||
<DataGrid x:Name="devicesDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" ItemsSource="{Binding Devices}" SelectedItem="{Binding SelectedDevice}" HorizontalAlignment="Stretch" EnableRowVirtualization="True" AutoGenerateColumns="False"> | ||
<DataGrid.Columns> | ||
<DataGridTextColumn x:Name="keyColumn" Width="*" IsReadOnly="True" Header="Device Description" Binding="{Binding Key}"/> | ||
<!--DataGridTextColumn x:Name="valueColumn" Width="Auto" IsReadOnly="True" Header="Device Id" Binding="{Binding Value}"/--> | ||
</DataGrid.Columns> | ||
</DataGrid> | ||
</StackPanel> | ||
</GroupBox> | ||
|
||
<GroupBox Header="Select the folder where the NVIDIA driver has been extracted" Margin="10,10"> | ||
<Grid HorizontalAlignment="Stretch"> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition /> | ||
<ColumnDefinition Width="85"/> | ||
</Grid.ColumnDefinitions> | ||
<TextBox Grid.Column="0" HorizontalAlignment="Stretch" Text="{Binding FolderPath}"/> | ||
<Button x:Name="BrowseButton" Grid.Column="1" Content="Browse" HorizontalAlignment="Right" Width="80" Height="21" VerticalAlignment="Top" Click="BrowseButton_Click"/> | ||
</Grid> | ||
</GroupBox> | ||
|
||
</StackPanel> | ||
<Button x:Name="ModifyButton" Content="Modify INF Files" Click="ModifyButton_Click" VerticalAlignment="Bottom" IsEnabled="{Binding CanModify}" HorizontalAlignment="Right" Margin="0,0,10,10"/> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
using WPFApp.ViewModel; | ||
|
||
namespace WPFApp | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
MainViewModel viewmodel = new MainViewModel(); | ||
|
||
private void Window_Loaded(object sender, RoutedEventArgs e) | ||
{ | ||
this.DataContext = viewmodel; | ||
} | ||
|
||
private void BrowseButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
viewmodel.BrowseForFolder(); | ||
} | ||
|
||
private void ModifyButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
viewmodel.ModifyINFFiles(); | ||
} | ||
} | ||
} |
Oops, something went wrong.