Skip to content

Commit 1fbd8f3

Browse files
committed
Initial Commit
1 parent d24c3cc commit 1fbd8f3

18 files changed

Lines changed: 1011 additions & 0 deletions

NVIDIA INF Modder.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NVIDIA INF Modifier", "WPFApp\NVIDIA INF Modifier.csproj", "{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E3B6AA6E-F7C3-4086-9BFB-6D487E68C980}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

WPFApp/App.xaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<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">
2+
<Application.Resources>
3+
<ResourceDictionary>
4+
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" xmlns:vm="clr-namespace:WPFApp.ViewModel" />
5+
</ResourceDictionary>
6+
</Application.Resources>
7+
</Application>

WPFApp/App.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Windows;
7+
8+
namespace WPFApp
9+
{
10+
/// <summary>
11+
/// Interaction logic for App.xaml
12+
/// </summary>
13+
public partial class App : Application
14+
{
15+
}
16+
}

WPFApp/DeviceIDParser.cs

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace WPFApp
7+
{
8+
public class DeviceIDParser
9+
{
10+
private string rawID;
11+
12+
public DeviceIDParser(string deviceID)
13+
{
14+
rawID = deviceID;
15+
Parse();
16+
}
17+
18+
private void Parse()
19+
{
20+
string tmp = rawID.ToLower();
21+
tmp = tmp.Replace("pci\\", "");
22+
23+
var strings = tmp.Split('&');
24+
25+
foreach (var substring in strings)
26+
{
27+
if (substring.StartsWith("ven_"))
28+
Vendor = substring.Substring(4);
29+
else if (substring.StartsWith("dev_"))
30+
Device = substring.Substring(4);
31+
else if (substring.StartsWith("subsys_"))
32+
SubSys = substring.Substring(7);
33+
}
34+
}
35+
36+
public string Vendor { get; set; }
37+
public string Device { get; set; }
38+
public string SubSys { get; set; }
39+
40+
public string SubSys1
41+
{
42+
get
43+
{
44+
return SubSys.Substring(0, 4);
45+
}
46+
}
47+
public string SubSys2
48+
{
49+
get
50+
{
51+
return SubSys.Substring(4, 4);
52+
}
53+
}
54+
55+
public bool IsValid
56+
{
57+
get
58+
{
59+
return (Vendor != null && Device != null && SubSys != null);
60+
}
61+
}
62+
63+
}
64+
}

WPFApp/INFPathFinder.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Text;
6+
7+
namespace WPFApp
8+
{
9+
public class INFPathFinder
10+
{
11+
private string _rootPath;
12+
13+
public INFPathFinder(string rootDir)
14+
{
15+
_rootPath = rootDir;
16+
17+
var nvdmiFiles = new DirectoryInfo(_rootPath).GetFiles("nvdmi.inf", SearchOption.AllDirectories);
18+
19+
if (nvdmiFiles != null)
20+
{
21+
nvdmi = nvdmiFiles[0].FullName;
22+
}
23+
}
24+
25+
public string nvdmi { get; set; }
26+
27+
}
28+
}

WPFApp/MainWindow.xaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<Window
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:local="clr-namespace:WPFApp"
7+
xmlns:ViewModel="clr-namespace:WPFApp.ViewModel" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml" x:Class="WPFApp.MainWindow"
8+
mc:Ignorable="d"
9+
Title="NVIDIA INF Modifier" Height="284.157" Width="483.885" Loaded="Window_Loaded">
10+
<Grid>
11+
<StackPanel>
12+
<GroupBox Header="Highlight the NVIDIA GPU" Margin="10,0">
13+
<StackPanel Margin="10,10,10,10" HorizontalAlignment="Stretch">
14+
<DataGrid x:Name="devicesDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" ItemsSource="{Binding Devices}" SelectedItem="{Binding SelectedDevice}" HorizontalAlignment="Stretch" EnableRowVirtualization="True" AutoGenerateColumns="False">
15+
<DataGrid.Columns>
16+
<DataGridTextColumn x:Name="keyColumn" Width="*" IsReadOnly="True" Header="Device Description" Binding="{Binding Key}"/>
17+
<!--DataGridTextColumn x:Name="valueColumn" Width="Auto" IsReadOnly="True" Header="Device Id" Binding="{Binding Value}"/-->
18+
</DataGrid.Columns>
19+
</DataGrid>
20+
</StackPanel>
21+
</GroupBox>
22+
23+
<GroupBox Header="Select the folder where the NVIDIA driver has been extracted" Margin="10,10">
24+
<Grid HorizontalAlignment="Stretch">
25+
<Grid.ColumnDefinitions>
26+
<ColumnDefinition />
27+
<ColumnDefinition Width="85"/>
28+
</Grid.ColumnDefinitions>
29+
<TextBox Grid.Column="0" HorizontalAlignment="Stretch" Text="{Binding FolderPath}"/>
30+
<Button x:Name="BrowseButton" Grid.Column="1" Content="Browse" HorizontalAlignment="Right" Width="80" Height="21" VerticalAlignment="Top" Click="BrowseButton_Click"/>
31+
</Grid>
32+
</GroupBox>
33+
34+
</StackPanel>
35+
<Button x:Name="ModifyButton" Content="Modify INF Files" Click="ModifyButton_Click" VerticalAlignment="Bottom" IsEnabled="{Binding CanModify}" HorizontalAlignment="Right" Margin="0,0,10,10"/>
36+
</Grid>
37+
</Window>

WPFApp/MainWindow.xaml.cs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Windows;
6+
using System.Windows.Controls;
7+
using System.Windows.Data;
8+
using System.Windows.Documents;
9+
using System.Windows.Input;
10+
using System.Windows.Media;
11+
using System.Windows.Media.Imaging;
12+
using System.Windows.Navigation;
13+
using System.Windows.Shapes;
14+
15+
using WPFApp.ViewModel;
16+
17+
namespace WPFApp
18+
{
19+
/// <summary>
20+
/// Interaction logic for MainWindow.xaml
21+
/// </summary>
22+
public partial class MainWindow : Window
23+
{
24+
public MainWindow()
25+
{
26+
InitializeComponent();
27+
}
28+
29+
MainViewModel viewmodel = new MainViewModel();
30+
31+
private void Window_Loaded(object sender, RoutedEventArgs e)
32+
{
33+
this.DataContext = viewmodel;
34+
}
35+
36+
private void BrowseButton_Click(object sender, RoutedEventArgs e)
37+
{
38+
viewmodel.BrowseForFolder();
39+
}
40+
41+
private void ModifyButton_Click(object sender, RoutedEventArgs e)
42+
{
43+
viewmodel.ModifyINFFiles();
44+
}
45+
}
46+
}

0 commit comments

Comments
 (0)