donnaken15

program.cs in FastGH3

Dec 27th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 29.16 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Diagnostics;
  4. using System.Windows.Forms;
  5. using Nanook.QueenBee.Parser;
  6. using static IniFile;
  7. using System.Net;
  8. using Ionic.Zip;
  9. using System.Runtime.InteropServices;
  10. using System.Threading;
  11. using FastGH3;
  12.  
  13. namespace FastGH3
  14. {
  15.     class Program
  16.     {
  17.         [DllImport("USER32.DLL")]
  18.         public static extern bool SetForegroundWindow(IntPtr hWnd);
  19.  
  20.         [DllImport("USER32.DLL", CharSet = CharSet.Unicode)]
  21.         public static extern IntPtr FindWindow(string lpClassName,
  22.         string lpWindowName);
  23.  
  24.         [DllImport("user32.dll")]
  25.         static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
  26.  
  27.         private static string currentchart;
  28.         private static string chart;
  29.         private static string guitar_audio;
  30.         private static string rhythm_audio;
  31.         private static string song_audio;
  32.         private static string[] chartiniexpert;
  33.         private static bool vsync;
  34.         private static int maxnotes;
  35.         private static uint pushinteger;
  36.         private static int notecolor;
  37.         private static string[] parameters;
  38.         private static OpenFileDialog openchart = new OpenFileDialog() { AddExtension = true, CheckFileExists = true, CheckPathExists = true, Filter = "All chart types|*.mid;*.chart|FastGH3 Song Package|*.fsp;*.zip|Any type|*.*", RestoreDirectory = true, Title = "Select chart" };
  39.         private static IniFile chartini = new IniFile();
  40.  
  41.         static string Reverse(string s)
  42.         {
  43.             char[] charArray = s.ToCharArray();
  44.             Array.Reverse(charArray);
  45.             return new string(charArray);
  46.         }
  47.  
  48.         static void disallowGameStartup()
  49.         {
  50.             try
  51.             {
  52.                 foreach (Process proc in Process.GetProcessesByName("GH3"))
  53.                 {
  54.                     proc.Kill();
  55.                 }
  56.                 foreach (Process proc2 in Process.GetProcessesByName("DxWnd"))
  57.                 {
  58.                     proc2.Kill();
  59.                 }
  60.             }
  61.             catch (Exception ex)
  62.             {
  63.                 Console.Write("ERROR! :(\n" + ex.Message);
  64.             }
  65.         }
  66.  
  67.         /*static bool IsOneOf<T>(this T value, params T[] items)
  68.         {
  69.             for (int i = 0; i < items.Length; ++i)
  70.             {
  71.                 if (items[i].Equals(value))
  72.                 {
  73.                     return true;
  74.                 }
  75.             }
  76.  
  77.             return false;
  78.         }*/
  79.  
  80.         [STAThread]
  81.         static void Main(string[] args)
  82.         {
  83.             Console.Title = "FastGH3";
  84.             Console.CursorVisible = false;
  85.             Console.WindowWidth = 41;
  86.             Console.WindowHeight = 19;
  87.             Console.BufferWidth = 41;
  88.             Console.BufferHeight = Int16.MaxValue - 1;
  89.             parameters = Environment.GetCommandLineArgs();
  90.             if (args.Length == 0)
  91.             {
  92.                 if (File.Exists(@"C:\Windows\fastgh3\CONFIGS\startupmsg"))
  93.                 {
  94.                     if (File.ReadAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg").ToString() == "on")
  95.                     {
  96.                         Console.CursorVisible = false;
  97.                         Console.WriteLine(@"
  98. FastGH3 is an advanced mod of
  99. Guitar Hero 3 designed to be played
  100. as fast as possible. With this mod, you
  101. can play customs without any technical
  102. setup and even associate chart or mid
  103. files with the game so you can access
  104. your charts quickly.
  105.  
  106. To access settings,
  107. use -settings in parameters.
  108.  
  109. If you want to disable this welcome
  110. message, you can do so by using
  111. these parameters:
  112. -startupmsg off
  113.  
  114. Press any key to load a chart.");
  115.                         Console.ReadKey();
  116.                     }
  117.                 }
  118.                 else
  119.                 {
  120.                     Directory.CreateDirectory(@"C:\Windows\fastgh3\CONFIGS\");
  121.                     File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on");
  122.                 }
  123.                 if (openchart.ShowDialog() == DialogResult.OK)
  124.                 {
  125.                     Process.Start("C:\\Windows\\FastGH3\\FastGH3.exe", SubstringExtensions.EncloseWithQuoteMarks(openchart.FileName));
  126.                 }
  127.             }
  128.             try
  129.             {
  130.                 if (parameters.Length > 0)
  131.                 {
  132.                     if (parameters[1] == "-startupmsg" && parameters[2] == "off")
  133.                     {
  134.                         File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "off");
  135.                     }
  136.                     if (parameters[1] == "-startupmsg" && parameters[2] == "on")
  137.                     {
  138.                         File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on");
  139.                     }
  140.                     if (parameters[1] == "-settings")
  141.                     {
  142.                         Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
  143.                         settings options = new settings();
  144.                         options.ShowDialog();
  145.                     }
  146.                     if (parameters[1] == "dl" && (parameters[2] != "" || parameters[2] != null))
  147.                     {
  148.                         Console.WriteLine("FastGH3 by donnaken15");
  149.                         Console.WriteLine("Downloading song package...");
  150.                         WebClient fsp = new WebClient();
  151.                         Uri fsplink = new Uri(parameters[2].Replace("fastgh3://", "http://"));
  152.                         try
  153.                         {
  154.                             fsp.DownloadFile(fsplink, "C:\\Windows\\FastGH3\\DATA\\TEMP\\DOWNLOAD.FSP");
  155.                         }
  156.                         catch (Exception ex)
  157.                         {
  158.                             Console.Write("ERROR! :(\n" + ex.Message);
  159.                         }
  160.                         Console.WriteLine("Adding song to game.");
  161.                         using (ZipFile file = ZipFile.Read(@"C:\Windows\FastGH3\DATA\TEMP\DOWNLOAD.FSP"))
  162.                         {
  163.                             file.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
  164.                             foreach (ZipEntry data in file)
  165.                             {
  166.                                 if (data.FileName.Contains(".pak"))
  167.                                 {
  168.                                     data.Extract("C:\\Windows\\FastGH3\\DATA\\SONGS\\");
  169.                                     File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\song_song.pak.xen");
  170.                                     File.Move("C:\\Windows\\FastGH3\\DATA\\SONGS\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\SONGS\\song_song.pak.xen");
  171.                                 }
  172.                                 if (data.FileName.Contains(".fsb"))
  173.                                 {
  174.                                     data.Extract("C:\\Windows\\FastGH3\\DATA\\MUSIC\\");
  175.                                     File.Delete("C:\\Windows\\FastGH3\\DATA\\MUSIC\\song.fsb.xen");
  176.                                     File.Move("C:\\Windows\\FastGH3\\DATA\\MUSIC\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\MUSIC\\song.fsb.xen");
  177.                                 }
  178.                             }
  179.                         }
  180.                         Console.WriteLine("Speeding up.");
  181.                         Process dxwnd = new Process();
  182.                         dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  183.                         dxwnd.StartInfo.Arguments = "/q";
  184.                         dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\";
  185.                         dxwnd.StartInfo.CreateNoWindow = false;
  186.                         dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  187.                         dxwnd.Start();
  188.                         Process gh3 = new Process();
  189.                         if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  190.                         {
  191.                             gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe";
  192.                             gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe";
  193.                         }
  194.                         else
  195.                         {
  196.                             gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe";
  197.                             gh3.StartInfo.Arguments = "";
  198.                         }
  199.                         gh3.Start();
  200.                         gh3.WaitForInputIdle();
  201.                         if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe")
  202.                         {
  203.                             Thread.Sleep(2500);
  204.                             gh3.Kill();
  205.                         }
  206.                     }
  207.                     if (File.Exists(parameters[1]))
  208.                     {
  209.                         Console.WriteLine("FASTGH3 by donnaken15");
  210.                         if (Path.GetFileName(parameters[1]).Contains(".chart") || Path.GetFileName(parameters[1]).Contains(".mid"))
  211.                         {
  212.                             Process chart2mid = new Process();
  213.                             Console.WriteLine("Checking file extension...");
  214.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid");
  215.                             if (Path.GetFileName(parameters[1]).Contains(".chart"))
  216.                             {
  217.                                 Console.WriteLine("Detected chart file. ");
  218.                                 chart2mid.StartInfo.FileName = "C:\\Windows\\FastGH3\\chart2mid.exe";
  219.                                 chart2mid.Start();
  220.                                 chart2mid.WaitForInputIdle();
  221.                                 try
  222.                                 {
  223.                                     File.Move(parameters[0].Replace(".chart", ".mid"), parameters[0].Replace(".chart", ".mid") + ".bak");
  224.                                 }
  225.                                 catch { }
  226.                                 Thread.Sleep(1000);
  227.                                 SetForegroundWindow(chart2mid.MainWindowHandle);
  228.                                 SendKeys.SendWait("{TAB}");
  229.                                 Thread.Sleep(125);
  230.                                 SendKeys.SendWait("{ENTER}");
  231.                                 Thread.Sleep(125);
  232.                                 SendKeys.SendWait(parameters[1].Replace("(", "{(}").Replace(")", "{)}"));
  233.                                 Thread.Sleep(125);
  234.                                 SendKeys.SendWait("{ENTER}");
  235.                                 Thread.Sleep(125);
  236.                                 SendKeys.SendWait("{TAB 3}");
  237.                                 Thread.Sleep(125);
  238.                                 SendKeys.SendWait("{ENTER}");
  239.                                 Thread.Sleep(100);
  240.                                 SendKeys.SendWait("%{F4}");
  241.                                 chart2mid.WaitForInputIdle();
  242.                                 Thread.Sleep(500);
  243.                                 File.Copy(parameters[1].Replace(".chart", ".mid"), "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true);
  244.                                 chart = File.ReadAllText(parameters[1]).Replace("}", "").Replace("{", "");
  245.                                 File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", chart);
  246.                             }
  247.                             else if (Path.GetFileName(parameters[1]).Contains(".mid"))
  248.                             {
  249.                                 Console.WriteLine("Detected midi file.");
  250.                                 File.Copy(parameters[1], "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true);
  251.                             }
  252.                             chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart");
  253.                             Console.WriteLine("\n NOTE/WARNING:");
  254.                             Console.WriteLine(" Don't press anything,");
  255.                             Console.WriteLine(" the chart is processing.");
  256.                             Console.WriteLine(" Currently, the program");
  257.                             Console.WriteLine(" is using an alternative");
  258.                             Console.WriteLine(" method for now until");
  259.                             Console.WriteLine(" FastGH3's own chart");
  260.                             Console.WriteLine(" parser gets fixed.");
  261.                             Thread.Sleep(100);
  262.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\song.fsb.xen");
  263.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\song.dat.xen");
  264.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\SONGS\\song_song.pak.xen");
  265.                             Process sox = new Process();
  266.                             sox.StartInfo.FileName = "C:\\Windows\\FastGH3\\sox.exe";
  267.                             if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg")))
  268.                             {
  269.                                 try
  270.                                 {
  271.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg") + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg";
  272.                                     if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "guitar.ogg")))
  273.                                     {
  274.                                         sox.Start();
  275.                                         sox.StartInfo.Arguments = "−r 44100 −b 16" + Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\guitar.ogg";
  276.                                         if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "rhythm.ogg")))
  277.                                         {
  278.                                             sox.Start();
  279.                                             sox.StartInfo.Arguments = "−r 44100 −b 16" + Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "rhythm.ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\rhythm.ogg";
  280.                                         }
  281.                                     }
  282.                                 }
  283.                                 catch { }
  284.                             }
  285.                             else if (Path.GetFileName(parameters[1]).Contains(".chart"))
  286.                             {
  287.                                 try
  288.                                 {
  289.                                     if (chart.Contains("GuitarStream = \""))
  290.                                     {
  291.                                         try
  292.                                         {
  293.                                             sox.StartInfo.Arguments = SubstringExtensions.EncloseWithQuoteMarks(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), chartini.GetSection("Song").GetKey("GuitarStream").Value.Replace(" \"", "").Replace("\"", ""))) + @" C:\Windows\FastGH3\DATA\MUSIC\audio\guitar.ogg";
  294.                                             sox.Start();
  295.                                         }
  296.                                         catch { }
  297.                                     }
  298.                                     if (chart.Contains("BassStream = \""))
  299.                                     {
  300.                                         try
  301.                                         {
  302.                                             sox.StartInfo.Arguments = SubstringExtensions.EncloseWithQuoteMarks(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), chartini.GetSection("Song").GetKey("BassStream").Value.Replace(" \"", "").Replace("\"", ""))) + @" C:\Windows\FastGH3\DATA\MUSIC\audio\rhythm.ogg";
  303.                                             sox.Start();
  304.                                         }
  305.                                         catch { }
  306.                                     }
  307.                                     sox.StartInfo.Arguments = SubstringExtensions.EncloseWithQuoteMarks(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), chartini.GetSection("Song").GetKey("MusicStream").Value.Replace(" \"", "").Replace("\"", ""))) + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg";
  308.                                 }
  309.                                 catch { }
  310.                             }
  311.                             else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".ogg").Replace(".chart", ".ogg")))
  312.                             {
  313.                                 try
  314.                                 {
  315.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".ogg").Replace(".chart", ".ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg";
  316.                                 }
  317.                                 catch { }
  318.                             }
  319.                             else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".mp3").Replace(".chart", ".mp3")))
  320.                             {
  321.                                 try
  322.                                 {
  323.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".mp3").Replace(".chart", ".mp3").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg";
  324.                                 }
  325.                                 catch { }
  326.                             }
  327.                             else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".wav").Replace(".chart", ".wav")))
  328.                             {
  329.                                 try
  330.                                 {
  331.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".wav").Replace(".chart", ".wav").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg";
  332.                                 }
  333.                                 catch { }
  334.                             }
  335.                             else
  336.                             {
  337.                                 DialogResult audiolost = MessageBox.Show("No audio files can be found?\nDo you want to search for it?", "Broken chart?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
  338.                                 DialogResult playsilent = MessageBox.Show("Want to play without audio?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  339.                                 if (audiolost == DialogResult.Yes)
  340.                                 {
  341.                                     OpenFileDialog searchaudio = new OpenFileDialog() { CheckFileExists = true, CheckPathExists = true, InitialDirectory = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), ""), Filter = "Audio files|*.mp3;*.wav;*.ogg|Any type|*.*" };
  342.                                 }
  343.                                 else if (audiolost == DialogResult.No)
  344.                                 {
  345.                                     if (playsilent == DialogResult.Yes)
  346.                                     {
  347.                                         sox.StartInfo.Arguments = "C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\blank C:\\Windows\\FastGH3\\DATA\\MUSIC\\audio\\song_song.mp3";
  348.                                     }
  349.                                     else if (playsilent == DialogResult.No)
  350.                                     {
  351.                                         Application.Exit();
  352.                                     }
  353.                                 }
  354.                             }
  355.                             sox.Start();
  356.                             sox.WaitForExit();
  357.                             try
  358.                             {
  359.                                 if (Path.GetFileName(parameters[1]).Contains(".chart"))
  360.                                 {
  361.                                     File.Copy(parameters[1].Replace(".chart", ".mid"), "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true);
  362.                                     chart2mid.Kill();
  363.                                 }
  364.                             }
  365.                             catch { }
  366.                             Process songlist_editor = new Process();
  367.                             songlist_editor.StartInfo.FileName = "C:\\Windows\\FastGH3\\DATA\\TEMP\\songlist_editor.exe";
  368.                             songlist_editor.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\DATA\\TEMP\\";
  369.                             songlist_editor.Start();
  370.                             Thread.Sleep(250);
  371.                             SetForegroundWindow(songlist_editor.MainWindowHandle);
  372.                             Thread.Sleep(250);
  373.                             SendKeys.SendWait("%{F}");
  374.                             SendKeys.SendWait("{ENTER}");
  375.                             SendKeys.SendWait("{TAB 3}");
  376.                             SendKeys.SendWait("{BS 32}");
  377.                             SendKeys.SendWait("{DEL 32}");
  378.                             SendKeys.SendWait(@"C:\Windows\FastGH3\DATA\TEMP\");
  379.                             SendKeys.SendWait("{ENTER}");
  380.                             SendKeys.SendWait("{TAB 2}");
  381.                             SendKeys.SendWait("{ENTER}");
  382.                             SendKeys.SendWait("song");
  383.                             SendKeys.SendWait("{TAB}");
  384.                             SendKeys.SendWait("{ENTER}");
  385.                             Thread.Sleep(200);
  386.                             if (chart.Contains("GuitarStream = \""))
  387.                             {
  388.                                 SendKeys.SendWait(@" C:\Windows\FastGH3\DATA\MUSIC\audio\guitar.ogg");
  389.                             }
  390.                             else
  391.                             {
  392.                                 SendKeys.SendWait(" C:\\Windows\\FastGH3\\DATA\\MUSIC\\audio\\song.ogg");
  393.                             }
  394.                             SendKeys.SendWait("{ENTER}");
  395.                             Thread.Sleep(200);
  396.                             SendKeys.SendWait("{TAB 2}");
  397.                             SendKeys.SendWait("{ENTER}");
  398.                             Thread.Sleep(200);
  399.                             try
  400.                             {
  401.                                 if (chart.Contains("BassStream = \""))
  402.                                 {
  403.                                     SendKeys.SendWait(@" C:\Windows\FastGH3\DATA\MUSIC\audio\rhythm.ogg");
  404.                                 }
  405.                                 else
  406.                                 {
  407.                                     SendKeys.SendWait(" C:\\Windows\\FastGH3\\DATA\\MUSIC\\audio\\song.ogg");
  408.                                 }
  409.                             }
  410.                             catch
  411.                             { }
  412.                             SendKeys.SendWait("{ENTER}");
  413.                             Thread.Sleep(200);
  414.                             SendKeys.SendWait("{TAB 2}");
  415.                             SendKeys.SendWait("{ENTER}");
  416.                             Thread.Sleep(200);
  417.                             SendKeys.SendWait(" C:\\Windows\\FastGH3\\DATA\\MUSIC\\audio\\song.ogg");
  418.                             SendKeys.SendWait("{ENTER}");
  419.                             Thread.Sleep(200);
  420.                             SendKeys.SendWait("{TAB 4}");
  421.                             SendKeys.SendWait("{ENTER}");
  422.                             Thread.Sleep(200);
  423.                             SendKeys.SendWait(" C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid");
  424.                             SendKeys.SendWait("{ENTER}");
  425.                             Thread.Sleep(200);
  426.                             SendKeys.SendWait("{TAB}");
  427.                             SendKeys.SendWait("{ENTER}");
  428.                             SendKeys.SendWait("%{F4}");
  429.                             Thread.Sleep(4000);
  430.                             songlist_editor.WaitForExit();
  431.                             File.Delete(@"C:\Windows\fastgh3\DATA\SONGS\song_song.pak.xen");
  432.                             File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\SONGS\song_song.pak.xen", @"C:\Windows\FastGH3\DATA\SONGS\song_song.pak.xen", true);
  433.                             Process dxwnd = new Process();
  434.                             dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  435.                             dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\";
  436.                             dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  437.                             dxwnd.StartInfo.Arguments = "/q";
  438.                             dxwnd.Start();
  439.                             Process gh3 = new Process();
  440.                             if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  441.                             {
  442.                                 gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe";
  443.                                 gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe";
  444.                             }
  445.                             else
  446.                             {
  447.                                 gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe";
  448.                                 gh3.StartInfo.Arguments = "";
  449.                             }
  450.                             gh3.Start();
  451.                             if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe")
  452.                             {
  453.                                 Thread.Sleep(2500);
  454.                                 gh3.Kill();
  455.                             }
  456.                             Thread.Sleep(3000);
  457.                             File.Delete(@"C:\Windows\FastGH3\DATA\MUSIC\song.fsb.xen");
  458.                             File.Delete(@"C:\Windows\FastGH3\DATA\MUSIC\song.dat.xen");
  459.                             File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\MUSIC\song.dat.xen", @"C:\Windows\FastGH3\DATA\MUSIC\song.dat.xen", true);
  460.                             File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\MUSIC\song.fsb.xen", @"C:\Windows\FastGH3\DATA\MUSIC\song.fsb.xen", true);
  461.                         }
  462.                     }
  463.                 }
  464.             }
  465.             catch { }
  466.             GC.Collect();
  467.             try
  468.             {
  469.                 if (File.Exists(parameters[1]) && parameters[1].Contains(".fsp"))
  470.                 {
  471.                     Console.WriteLine("FastGH3 by donnaken15");
  472.                     Console.WriteLine("Downloading song package...");
  473.                     Console.WriteLine("Adding song to game.");
  474.                     using (ZipFile file = ZipFile.Read(parameters[1]))
  475.                     {
  476.                         file.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
  477.                         foreach (ZipEntry data in file)
  478.                         {
  479.                             if (data.FileName.Contains(".pak"))
  480.                             {
  481.                                 data.Extract("C:\\Windows\\FastGH3\\DATA\\SONGS\\");
  482.                                 File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\song_song.pak.xen");
  483.                                 File.Move("C:\\Windows\\FastGH3\\DATA\\SONGS\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\SONGS\\song_song.pak.xen");
  484.                             }
  485.                             if (data.FileName.Contains(".fsb"))
  486.                             {
  487.                                 data.Extract("C:\\Windows\\FastGH3\\DATA\\MUSIC\\");
  488.                                 File.Delete("C:\\Windows\\FastGH3\\DATA\\MUSIC\\song.fsb.xen");
  489.                                 File.Move("C:\\Windows\\FastGH3\\DATA\\MUSIC\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\MUSIC\\song.fsb.xen");
  490.                             }
  491.                         }
  492.                     }
  493.                     Console.WriteLine("Speeding up.");
  494.                     Process dxwnd = new Process();
  495.                     dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  496.                     dxwnd.StartInfo.Arguments = "/q";
  497.                     dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\";
  498.                     dxwnd.StartInfo.CreateNoWindow = false;
  499.                     dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  500.                     dxwnd.Start();
  501.                     Process gh3 = new Process();
  502.                     if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  503.                     {
  504.                         gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe";
  505.                         gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe";
  506.                     }
  507.                     else
  508.                     {
  509.                         gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe";
  510.                         gh3.StartInfo.Arguments = "";
  511.                     }
  512.                     gh3.Start();
  513.                     if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe")
  514.                     {
  515.                         Thread.Sleep(2500);
  516.                         gh3.Kill();
  517.                     }
  518.                 }
  519.             }
  520.             catch { }
  521.         }
  522.     }
  523. }
Advertisement
Add Comment
Please, Sign In to add comment