Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dalingrin committed Dec 3, 2015
1 parent d24c3cc commit 1fbd8f3
Show file tree
Hide file tree
Showing 18 changed files with 1,011 additions and 0 deletions.
22 changes: 22 additions & 0 deletions NVIDIA INF Modder.sln
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
7 changes: 7 additions & 0 deletions WPFApp/App.xaml
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>
16 changes: 16 additions & 0 deletions WPFApp/App.xaml.cs
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
{
}
}
64 changes: 64 additions & 0 deletions WPFApp/DeviceIDParser.cs
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);
}
}

}
}
28 changes: 28 additions & 0 deletions WPFApp/INFPathFinder.cs
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; }

}
}
37 changes: 37 additions & 0 deletions WPFApp/MainWindow.xaml
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>
46 changes: 46 additions & 0 deletions WPFApp/MainWindow.xaml.cs
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();
}
}
}
Loading

0 comments on commit 1fbd8f3

Please sign in to comment.