Skip to content

Commit

Permalink
Fix some link handling, add Studio Driver selection
Browse files Browse the repository at this point in the history
  • Loading branch information
XenHat committed Jun 19, 2019
1 parent 4101dc8 commit 111b7ea
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 9 deletions.
30 changes: 27 additions & 3 deletions Src/LinkItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public static List<LinkItem> Find(string file)
RegexOptions.Singleline);
if (m3.Success)
{
Match m4 = Regex.Match(i.Href, "r/nvidia/comments/(.*)/driver_(.*?)_faq(discussion_thread)?", RegexOptions.Singleline);

Match m4 = Regex.Match(i.Href, "r/nvidia/comments/(.*)/(|game_ready_)(|studio_)driver_(.*?)_faq(discussion_thread)?", RegexOptions.Singleline);
if (m4.Success)
{
#if DEBUG
Expand All @@ -72,6 +73,7 @@ public static List<LinkItem> Find(string file)
{
continue;
}
// TODO: use "latest driver" when available: "found: 'latest driver faq/discussion thread'"
#if DEBUG
Console.WriteLine("Found '" + t + "'");
#endif
Expand All @@ -80,15 +82,37 @@ public static List<LinkItem> Find(string file)
//if (t.Contains("Driver") && (t.Contains("Hotfix") || (t.Contains("FAQ/Discussion") && !t.Contains("Latest"))))
if (t.Contains("driver "))
{
// TODO: cut off at first number instead
t = t.Replace(" faq/discussion", "");
#if DEBUG
Console.WriteLine("String Trim=> '" + t + "'");
#endif
t = t.Replace(" thread", "");
#if DEBUG
Console.WriteLine("String Trim=> '" + t + "'");
#endif
t = t.Replace("driver ", "");

#if DEBUG
Console.WriteLine("Found Thread =>'" + t + "'");
Console.WriteLine("String Trim=> '" + t + "'");
#endif
t = t.Replace("&amp; ", "");
#if DEBUG
Console.WriteLine("String Trim=> '" + t + "'");
#endif
t = t.Replace("studio ", "");
#if DEBUG
Console.WriteLine("String Trim=> '" + t + "'");
#endif
t = t.Replace("game ready", "");

i.Href = i.Href.Trim();

// Sometimes Trim fails
t = t.Replace(" ", "");
i.Text = t;
#if DEBUG
Console.WriteLine("Found Thread =>'" + t + "'");
#endif
#if DEBUG
Console.WriteLine("Adding '" + t + "' (" + i.Href + ")");
#endif
Expand Down
3 changes: 3 additions & 0 deletions Src/OptionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ public class OptionContainer
public static Option DeleteDownloaded = new Option("--keep", "-k", false,
"Delete the downloaded driver before exiting the program.");

public static Option Studio = new Option("--studio", "-S", false,
"Use the NVIDIA Studio driver where available. Uses the GameReady driver otherwise.");

public static Option Strip = new Option("--strip", "-x", false,
"Attempt to strip all components deemed useless by this tool's developer(s).");

Expand Down
11 changes: 6 additions & 5 deletions Src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ private static bool DownloadDriver(string url, string version, out string downlo
}
else
{
// http://us.download.nvidia.com/Windows/398.82/398.82-desktop-win10-64bit-international-whql.exe
// http://us.download.nvidia.com/Windows/398.86/398.86-desktop-win10-64bit-international-whql.exe <= invalid
Console.WriteLine("Downloading Driver version " + version
#if DEBUG
+ " from " + url + Environment.NewLine + "to " + newFile
Expand Down Expand Up @@ -507,12 +505,15 @@ private static void MainProgramLoop(string[] args)
//latestDriver = StringToFloat(tempver);
//#if !DEBUG
Console.WriteLine(driverTitles.Last());
//#endif
//#endif

// Build new URL from latest version
// Note: '388.00' becomes '388' somewhere above, need to add '.00' at the end if trying to use that one.
// http://us.download.nvidia.com/Windows/397.93/397.93-desktop-win10-64bit-international-whql.exe
string DownloadURL = String.Format("http://us.download.nvidia.com/Windows/{0}/{0:#.##}-desktop-win10-64bit-international-whql.exe", latestDriver);
// http://us.download.nvidia.com/Windows/398.82/398.82-desktop-win10-64bit-international-whql.exe <= Valid
// http://us.download.nvidia.com/Windows/398.86/398.86-desktop-win10-64bit-international-whql.exe <= invalid
// http://us.download.nvidia.com/Windows/430.86/430.86-desktop-win10-64bit-international-nsd-whql.exe <= Studio Driver
// http://us.download.nvidia.com/Windows/430.86/430.86-desktop-win10-64bit-international-whql.exe <= GameReady Driver
string DownloadURL = String.Format("http://us.download.nvidia.com/Windows/{0}/{0:#.##}-desktop-win10-64bit-international-{1}whql.exe", latestDriver, OptionContainer.Studio ? "-nds":"");
string downloadedFile = "";
bool needsDownload = IsOutOfDate(latestDriver);
if (needsDownload)
Expand Down
2 changes: 1 addition & 1 deletion Src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("0.0.3.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en")]

0 comments on commit 111b7ea

Please sign in to comment.