Advertisement
donnaken15

FastGH3 1.0 Code (10/5/17)

Oct 8th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 56.53 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.         public static void MergeNotes(QbItemInteger array)
  68.         {
  69.             #region ENTIRE CODE FOR NOTE MERGING
  70.             // THIS TOOK SO LONG TO MAKE!!! D:<
  71.             try
  72.             {
  73.                 for (int i = 0; i < array.Values.Length; i += 3)
  74.                 {
  75.                     #region Merge 2 Notes
  76.                     if (array.Values[i] == array.Values[i + 3] && array.Values[i + 6] != array.Values[i] && i < array.Length - 6)
  77.                     {
  78.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2)
  79.                         {
  80.                             array.Values[i + 2] = 3;
  81.                             array.Values[i + 3] = -1000;
  82.                             array.Values[i + 4] = 0;
  83.                             array.Values[i + 5] = 0;
  84.                         }
  85.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4)
  86.                         {
  87.                             array.Values[i + 2] = 5;
  88.                             array.Values[i + 3] = -1000;
  89.                             array.Values[i + 4] = 0;
  90.                             array.Values[i + 5] = 0;
  91.                         }
  92.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 8)
  93.                         {
  94.                             array.Values[i + 2] = 9;
  95.                             array.Values[i + 3] = -1000;
  96.                             array.Values[i + 4] = 0;
  97.                             array.Values[i + 5] = 0;
  98.                         }
  99.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 16)
  100.                         {
  101.                             array.Values[i + 2] = 17;
  102.                             array.Values[i + 3] = -1000;
  103.                             array.Values[i + 4] = 0;
  104.                             array.Values[i + 5] = 0;
  105.                         }
  106.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4)
  107.                         {
  108.                             array.Values[i + 2] = 6;
  109.                             array.Values[i + 3] = -1000;
  110.                             array.Values[i + 4] = 0;
  111.                             array.Values[i + 5] = 0;
  112.                         }
  113.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 8)
  114.                         {
  115.                             array.Values[i + 2] = 10;
  116.                             array.Values[i + 3] = -1000;
  117.                             array.Values[i + 4] = 0;
  118.                             array.Values[i + 5] = 0;
  119.                         }
  120.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 16)
  121.                         {
  122.                             array.Values[i + 2] = 18;
  123.                             array.Values[i + 3] = -1000;
  124.                             array.Values[i + 4] = 0;
  125.                             array.Values[i + 5] = 0;
  126.                         }
  127.                         if (array.Values[i + 2] == 4 && array.Values[i + 5] == 8)
  128.                         {
  129.                             array.Values[i + 2] = 12;
  130.                             array.Values[i + 3] = -1000;
  131.                             array.Values[i + 4] = 0;
  132.                             array.Values[i + 5] = 0;
  133.                         }
  134.                         if (array.Values[i + 2] == 4 && array.Values[i + 5] == 16)
  135.                         {
  136.                             array.Values[i + 2] = 20;
  137.                             array.Values[i + 3] = -1000;
  138.                             array.Values[i + 4] = 0;
  139.                             array.Values[i + 5] = 0;
  140.                         }
  141.                         if (array.Values[i + 2] == 8 && array.Values[i + 5] == 16)
  142.                         {
  143.                             array.Values[i + 2] = 24;
  144.                             array.Values[i + 3] = -1000;
  145.                             array.Values[i + 4] = 0;
  146.                             array.Values[i + 5] = 0;
  147.                         }
  148.                     }
  149.                     #endregion
  150.                     #region Merge 3 Notes
  151.                     if (array.Values[i] == array.Values[i + 3] && array.Values[i + 3] == array.Values[i + 6] && array.Values[i + 6] == array.Values[i] && array.Values[i + 9] != array.Values[i] && i < array.Length - 9)
  152.                     {
  153.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4)
  154.                         {
  155.                             array.Values[i + 2] = 7;
  156.                             array.Values[i + 3] = -1000;
  157.                             array.Values[i + 4] = 0;
  158.                             array.Values[i + 5] = 0;
  159.                             array.Values[i + 6] = -1000;
  160.                             array.Values[i + 7] = 0;
  161.                             array.Values[i + 8] = 0;
  162.                         }
  163.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 8)
  164.                         {
  165.                             array.Values[i + 2] = 11;
  166.                             array.Values[i + 3] = -1000;
  167.                             array.Values[i + 4] = 0;
  168.                             array.Values[i + 5] = 0;
  169.                             array.Values[i + 6] = -1000;
  170.                             array.Values[i + 7] = 0;
  171.                             array.Values[i + 8] = 0;
  172.                         }
  173.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8)
  174.                         {
  175.                             array.Values[i + 2] = 13;
  176.                             array.Values[i + 3] = -1000;
  177.                             array.Values[i + 4] = 0;
  178.                             array.Values[i + 5] = 0;
  179.                             array.Values[i + 6] = -1000;
  180.                             array.Values[i + 7] = 0;
  181.                             array.Values[i + 8] = 0;
  182.                         }
  183.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8)
  184.                         {
  185.                             array.Values[i + 2] = 14;
  186.                             array.Values[i + 3] = -1000;
  187.                             array.Values[i + 4] = 0;
  188.                             array.Values[i + 5] = 0;
  189.                             array.Values[i + 6] = -1000;
  190.                             array.Values[i + 7] = 0;
  191.                             array.Values[i + 8] = 0;
  192.                         }
  193.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 16)
  194.                         {
  195.                             array.Values[i + 2] = 19;
  196.                             array.Values[i + 3] = -1000;
  197.                             array.Values[i + 4] = 0;
  198.                             array.Values[i + 5] = 0;
  199.                             array.Values[i + 6] = -1000;
  200.                             array.Values[i + 7] = 0;
  201.                             array.Values[i + 8] = 0;
  202.                         }
  203.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4 && array.Values[i + 8] == 16)
  204.                         {
  205.                             array.Values[i + 2] = 21;
  206.                             array.Values[i + 3] = -1000;
  207.                             array.Values[i + 4] = 0;
  208.                             array.Values[i + 5] = 0;
  209.                             array.Values[i + 6] = -1000;
  210.                             array.Values[i + 7] = 0;
  211.                             array.Values[i + 8] = 0;
  212.                         }
  213.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4 && array.Values[i + 8] == 16)
  214.                         {
  215.                             array.Values[i + 2] = 22;
  216.                             array.Values[i + 3] = -1000;
  217.                             array.Values[i + 4] = 0;
  218.                             array.Values[i + 5] = 0;
  219.                             array.Values[i + 6] = -1000;
  220.                             array.Values[i + 7] = 0;
  221.                             array.Values[i + 8] = 0;
  222.                         }
  223.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 8 && array.Values[i + 8] == 16)
  224.                         {
  225.                             array.Values[i + 2] = 25;
  226.                             array.Values[i + 3] = -1000;
  227.                             array.Values[i + 4] = 0;
  228.                             array.Values[i + 5] = 0;
  229.                             array.Values[i + 6] = -1000;
  230.                             array.Values[i + 7] = 0;
  231.                             array.Values[i + 8] = 0;
  232.                         }
  233.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 8 && array.Values[i + 8] == 16)
  234.                         {
  235.                             array.Values[i + 2] = 26;
  236.                             array.Values[i + 3] = -1000;
  237.                             array.Values[i + 4] = 0;
  238.                             array.Values[i + 5] = 0;
  239.                             array.Values[i + 6] = -1000;
  240.                             array.Values[i + 7] = 0;
  241.                             array.Values[i + 8] = 0;
  242.                         }
  243.                         if (array.Values[i + 2] == 4 && array.Values[i + 5] == 8 && array.Values[i + 8] == 16)
  244.                         {
  245.                             array.Values[i + 2] = 28;
  246.                             array.Values[i + 3] = -1000;
  247.                             array.Values[i + 4] = 0;
  248.                             array.Values[i + 5] = 0;
  249.                             array.Values[i + 6] = -1000;
  250.                             array.Values[i + 7] = 0;
  251.                             array.Values[i + 8] = 0;
  252.                         }
  253.                     }
  254.                     #endregion
  255.                     #region Merge 4 Notes
  256.                     if (array.Values[i] == array.Values[i + 3] && array.Values[i + 3] == array.Values[i + 6] && array.Values[i + 6] == array.Values[i] && array.Values[i + 9] == array.Values[i] && array.Values[i + 12] != array.Values[i] && i < array.Length - 12)
  257.                     {
  258.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4 && array.Values[i + 11] == 8)
  259.                         {
  260.                             array.Values[i + 2] = 15;
  261.                             array.Values[i + 3] = -1000;
  262.                             array.Values[i + 4] = 0;
  263.                             array.Values[i + 5] = 0;
  264.                             array.Values[i + 6] = -1000;
  265.                             array.Values[i + 7] = 0;
  266.                             array.Values[i + 8] = 0;
  267.                             array.Values[i + 9] = -1000;
  268.                             array.Values[i + 10] = 0;
  269.                             array.Values[i + 11] = 0;
  270.                         }
  271.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4 && array.Values[i + 11] == 16)
  272.                         {
  273.                             array.Values[i + 2] = 23; array.Values[i + 3] = -1000;
  274.                             array.Values[i + 4] = 0;
  275.                             array.Values[i + 5] = 0;
  276.                             array.Values[i + 6] = -1000;
  277.                             array.Values[i + 7] = 0;
  278.                             array.Values[i + 8] = 0;
  279.                             array.Values[i + 9] = -1000;
  280.                             array.Values[i + 10] = 0;
  281.                             array.Values[i + 11] = 0;
  282.                         }
  283.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 8 && array.Values[i + 11] == 16)
  284.                         {
  285.                             array.Values[i + 2] = 27; array.Values[i + 3] = -1000;
  286.                             array.Values[i + 4] = 0;
  287.                             array.Values[i + 5] = 0;
  288.                             array.Values[i + 6] = -1000;
  289.                             array.Values[i + 7] = 0;
  290.                             array.Values[i + 8] = 0;
  291.                             array.Values[i + 9] = -1000;
  292.                             array.Values[i + 10] = 0;
  293.                             array.Values[i + 11] = 0;
  294.                         }
  295.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8 && array.Values[i + 11] == 16)
  296.                         {
  297.                             array.Values[i + 2] = 29; array.Values[i + 3] = -1000;
  298.                             array.Values[i + 4] = 0;
  299.                             array.Values[i + 5] = 0;
  300.                             array.Values[i + 6] = -1000;
  301.                             array.Values[i + 7] = 0;
  302.                             array.Values[i + 8] = 0;
  303.                             array.Values[i + 9] = -1000;
  304.                             array.Values[i + 10] = 0;
  305.                             array.Values[i + 11] = 0;
  306.                         }
  307.                         if (array.Values[i + 2] == 2 && array.Values[i + 5] == 4 && array.Values[i + 8] == 8 && array.Values[i + 11] == 16)
  308.                         {
  309.                             array.Values[i + 2] = 30; array.Values[i + 3] = -1000;
  310.                             array.Values[i + 4] = 0;
  311.                             array.Values[i + 5] = 0;
  312.                             array.Values[i + 6] = -1000;
  313.                             array.Values[i + 7] = 0;
  314.                             array.Values[i + 8] = 0;
  315.                             array.Values[i + 9] = -1000;
  316.                             array.Values[i + 10] = 0;
  317.                             array.Values[i + 11] = 0;
  318.                         }
  319.                     }
  320.                     #endregion
  321.                     #region Merge 5 Notes
  322.                     if (array.Values[i] == array.Values[i + 3] && array.Values[i + 3] == array.Values[i + 6] && array.Values[i + 6] == array.Values[i] && array.Values[i + 9] == array.Values[i] && array.Values[i + 12] == array.Values[i] && i < array.Length - 15)
  323.                     {
  324.                         if (array.Values[i + 2] == 1 && array.Values[i + 5] == 2 && array.Values[i + 8] == 4 && array.Values[i + 11] == 8 && array.Values[i + 14] == 16)
  325.                         {
  326.                             array.Values[i + 2] = 31;
  327.                             array.Values[i + 3] = -1000;
  328.                             array.Values[i + 4] = 0;
  329.                             array.Values[i + 5] = 0;
  330.                             array.Values[i + 6] = -1000;
  331.                             array.Values[i + 7] = 0;
  332.                             array.Values[i + 8] = 0;
  333.                             array.Values[i + 9] = -1000;
  334.                             array.Values[i + 10] = 0;
  335.                             array.Values[i + 11] = 0;
  336.                             array.Values[i + 12] = -1000;
  337.                             array.Values[i + 13] = 0;
  338.                             array.Values[i + 14] = 0;
  339.                         }
  340.                     }
  341.                     #endregion
  342.                     #region Print note info for debugging
  343.                     Console.Write("\r\nTime: " + array.Values[i] + " Length: " + array.Values[i + 1] + "\tFrets: " + array.Values[i + 2] + "(" + Reverse(Convert.ToString(array.Values[i + 2], 2)) + ")");
  344.                     #endregion
  345.                 }
  346.             }
  347.             catch { }
  348.             #endregion
  349.         }
  350.  
  351.         [STAThread]
  352.         static void Main(string[] args)
  353.         {
  354.             Console.Title = "FastGH3";
  355.             Console.CursorVisible = false;
  356.             Console.WindowWidth = 41;
  357.             Console.WindowHeight = 19;
  358.             Console.BufferWidth = 41;
  359.             Console.BufferHeight = short.MaxValue - 1;
  360.             parameters = Environment.GetCommandLineArgs();
  361.             if (args.Length == 0)
  362.             {
  363.                 if (File.Exists(@"C:\Windows\fastgh3\CONFIGS\startupmsg"))
  364.                 {
  365.                     if (File.ReadAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg").ToString() == "on")
  366.                     {
  367.                         Console.CursorVisible = false;
  368.                         Console.WriteLine(@"
  369. FastGH3 is an advanced mod of
  370. Guitar Hero 3 designed to be played
  371. as fast as possible. With this mod, you
  372. can play customs without any technical
  373. setup and even associate chart or mid
  374. files with the game so you can access
  375. your charts quickly.
  376.  
  377. To access settings,
  378. use -settings in parameters.
  379.  
  380. If you want to disable this welcome
  381. message, you can do so by using
  382. these parameters:
  383. -startupmsg off
  384.  
  385. Press any key to load a chart.");
  386.                         Console.ReadKey();
  387.                     }
  388.                 }
  389.                 else
  390.                 {
  391.                     Directory.CreateDirectory(@"C:\Windows\fastgh3\CONFIGS\");
  392.                     File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on");
  393.                 }
  394.                 if (openchart.ShowDialog() == DialogResult.OK)
  395.                 {
  396.                     Process.Start("C:\\Windows\\FastGH3\\FastGH3.exe", SubstringExtensions.EncloseWithQuoteMarks(openchart.FileName));
  397.                 }
  398.             }
  399.             try
  400.             {
  401.                 if (parameters.Length > 0)
  402.                 {
  403.                     if (parameters[1] == "-startupmsg" && parameters[2] == "off")
  404.                     {
  405.                         File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "off");
  406.                     }
  407.                     if (parameters[1] == "-startupmsg" && parameters[2] == "on")
  408.                     {
  409.                         File.WriteAllText(@"C:\Windows\fastgh3\CONFIGS\startupmsg", "on");
  410.                     }
  411.                     if (parameters[1] == "-settings")
  412.                     {
  413.                         Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;
  414.                         new settings().ShowDialog();
  415.                     }
  416.                     if (parameters[1] == "dl" && (parameters[2] != "" || parameters[2] != null))
  417.                     {
  418.                         Console.WriteLine("FastGH3 by donnaken15");
  419.                         Console.WriteLine("Downloading song package...");
  420.                         WebClient fsp = new WebClient();
  421.                         Uri fsplink = new Uri(parameters[2].Replace("fastgh3://", "http://"));
  422.                         try
  423.                         {
  424.                             fsp.DownloadFile(fsplink, "C:\\Windows\\FastGH3\\DATA\\TEMP\\DOWNLOAD.FSP");
  425.                         }
  426.                         catch (Exception ex)
  427.                         {
  428.                             Console.Write("ERROR! :(\n" + ex.Message);
  429.                         }
  430.                         Console.WriteLine("Adding song to game.");
  431.                         using (ZipFile file = ZipFile.Read(@"C:\Windows\FastGH3\DATA\TEMP\DOWNLOAD.FSP"))
  432.                         {
  433.                             file.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
  434.                             foreach (ZipEntry data in file)
  435.                             {
  436.                                 if (data.FileName.Contains(".pak"))
  437.                                 {
  438.                                     data.Extract("C:\\Windows\\FastGH3\\DATA\\SONGS\\");
  439.                                     File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen");
  440.                                     File.Move("C:\\Windows\\FastGH3\\DATA\\SONGS\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen");
  441.                                 }
  442.                                 if (data.FileName.Contains(".fsb"))
  443.                                 {
  444.                                     data.Extract("C:\\Windows\\FastGH3\\DATA\\MUSIC\\");
  445.                                     File.Delete("C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen");
  446.                                     File.Move("C:\\Windows\\FastGH3\\DATA\\MUSIC\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen");
  447.                                 }
  448.                             }
  449.                         }
  450.                         Console.WriteLine("Speeding up.");
  451.                         Process dxwnd = new Process();
  452.                         dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  453.                         dxwnd.StartInfo.Arguments = "/q";
  454.                         dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\";
  455.                         dxwnd.StartInfo.CreateNoWindow = false;
  456.                         dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  457.                         dxwnd.Start();
  458.                         Process gh3 = new Process();
  459.                         if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  460.                         {
  461.                             gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe";
  462.                             gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe";
  463.                         }
  464.                         else
  465.                         {
  466.                             gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe";
  467.                             gh3.StartInfo.Arguments = "";
  468.                         }
  469.                         gh3.Start();
  470.                         gh3.WaitForInputIdle();
  471.                         if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe")
  472.                         {
  473.                             Thread.Sleep(2500);
  474.                             gh3.Kill();
  475.                         }
  476.                     }
  477.                     if (File.Exists(parameters[1]))
  478.                     {
  479.                         Console.WriteLine("FASTGH3 by donnaken15");
  480.                         if (Path.GetFileName(parameters[1]).Contains(".chart") || Path.GetFileName(parameters[1]).Contains(".mid"))
  481.                         {
  482.                             Process chart2mid = new Process();
  483.                             Console.WriteLine("Checking file extension...");
  484.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid");
  485.                             if (Path.GetFileName(parameters[1]).Contains(".chart"))
  486.                             {
  487.                                 Console.WriteLine("Detected chart file. ");
  488.                                 File.Copy(parameters[1], "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", true);
  489.                             }
  490.                             else if (Path.GetFileName(parameters[1]).Contains(".mid"))
  491.                             {
  492.                                 Console.WriteLine("Detected midi file.");
  493.                                 File.Copy(parameters[1], "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true);
  494.                             }
  495.                             try
  496.                             {
  497.                                 File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe");
  498.                             }
  499.                             catch { }
  500.                             chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart");
  501.                             Thread.Sleep(100);
  502.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\fastgh3.fsb.xen");
  503.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\fastgh3.dat.xen");
  504.                             File.Delete("C:\\Windows\\FastGH3\\DATA\\TEMP\\SONGS\\fastgh3_song.pak.xen");
  505.                             Process sox = new Process();
  506.                             sox.StartInfo.FileName = "C:\\Windows\\FastGH3\\sox.exe";
  507.                             if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg")))
  508.                             {
  509.                                 try
  510.                                 {
  511.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg") + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k";
  512.                                     if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "guitar.ogg")))
  513.                                     {
  514.                                         sox.Start();
  515.                                         sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "song.ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\guitar.ogg rate 44.1k";
  516.                                         if (File.Exists(Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "rhythm.ogg")))
  517.                                         {
  518.                                             sox.Start();
  519.                                             sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(Path.GetFileName(parameters[1]), "rhythm.ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\rhythm.ogg rate 44.1k";
  520.                                         }
  521.                                     }
  522.                                 }
  523.                                 catch { }
  524.                             }
  525.                             else if (Path.GetFileName(parameters[1]).Contains(".chart"))
  526.                             {
  527.                                 try
  528.                                 {
  529.                                     if (chart.Contains("GuitarStream = \""))
  530.                                     {
  531.                                         try
  532.                                         {
  533.                                             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 rate 44.1k";
  534.                                             sox.Start();
  535.                                         }
  536.                                         catch { }
  537.                                     }
  538.                                     if (chart.Contains("BassStream = \""))
  539.                                     {
  540.                                         try
  541.                                         {
  542.                                             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 rate 44.1k";
  543.                                             sox.Start();
  544.                                         }
  545.                                         catch { }
  546.                                     }
  547.                                     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 rate 44.1k";
  548.                                 }
  549.                                 catch { }
  550.                             }
  551.                             else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".ogg").Replace(".chart", ".ogg")))
  552.                             {
  553.                                 try
  554.                                 {
  555.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".ogg").Replace(".chart", ".ogg").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k";
  556.                                 }
  557.                                 catch { }
  558.                             }
  559.                             else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".mp3").Replace(".chart", ".mp3")))
  560.                             {
  561.                                 try
  562.                                 {
  563.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".mp3").Replace(".chart", ".mp3").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k";
  564.                                 }
  565.                                 catch { }
  566.                             }
  567.                             else if (File.Exists(Path.GetFullPath(parameters[1]).Replace(".mid", ".wav").Replace(".chart", ".wav")))
  568.                             {
  569.                                 try
  570.                                 {
  571.                                     sox.StartInfo.Arguments = Path.GetFullPath(parameters[1]).Replace(".mid", ".wav").Replace(".chart", ".wav").EncloseWithQuoteMarks() + @" C:\Windows\FastGH3\DATA\MUSIC\audio\song.ogg rate 44.1k";
  572.                                 }
  573.                                 catch { }
  574.                             }
  575.                             else
  576.                             {
  577.                                 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);
  578.                                 DialogResult playsilent = MessageBox.Show("Want to play without audio?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
  579.                                 if (audiolost == DialogResult.Yes)
  580.                                 {
  581.                                     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|*.*" };
  582.                                 }
  583.                                 else if (audiolost == DialogResult.No)
  584.                                 {
  585.                                     if (playsilent == DialogResult.Yes)
  586.                                     {
  587.                                         sox.StartInfo.Arguments = "C:\\Windows\\FastGH3\\DATA\\TEMP\\MUSIC\\blank.ogg C:\\Windows\\FastGH3\\DATA\\MUSIC\\audio\\song.ogg  rate 44.1k";
  588.                                     }
  589.                                     else if (playsilent == DialogResult.No)
  590.                                     {
  591.                                         Application.Exit();
  592.                                     }
  593.                                 }
  594.                             }
  595.                             sox.Start();
  596.                             try
  597.                             {
  598.                                 if (Path.GetFileName(parameters[1]).Contains(".chart"))
  599.                                 {
  600.                                     File.Copy(parameters[1].Replace(".chart", ".mid"), "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true);
  601.                                     chart2mid.Kill();
  602.                                 }
  603.                             }
  604.                             catch { }
  605.                             try
  606.                             {
  607.                                 File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe");
  608.                             }
  609.                             catch { }
  610.                             File.Copy(parameters[1].Replace(".chart", ".mid"), "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.mid", true);
  611.                             Console.ReadKey();
  612.                             Console.WriteLine("Reading chart file.");
  613.                             Console.ReadKey();
  614.                             chart = File.ReadAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart").Replace("}", "").Replace("{", "");
  615.                             Console.ReadKey();
  616.                             File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart", chart);
  617.                             Console.ReadKey();
  618.                             if (chart.Contains("= S "))
  619.                             {
  620.                                 Process.Start("C:\\Windows\\FastGH3\\sed.exe", "sed - i '/ = S /d' C:\\Windows\\fastgh3\\DATA\\SONGS\\song.chart");
  621.                                 Process.Start("C:\\Windows\\FastGH3\\sed.exe", "sed - i '/ = TS /d' C:\\Windows\\fastgh3\\DATA\\SONGS\\song.chart");
  622.                             }
  623.                             Console.ReadKey();
  624.                             chartini.Load("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.chart");
  625.                             Console.ReadKey();
  626.                             string[] chartinieasy = chart.After("[EasySingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
  627.                             string[] chartinimedium = chart.After("[MediumSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
  628.                             string[] chartinihard = chart.After("[HardSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
  629.                             chartiniexpert = chart.After("[ExpertSingle]").Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
  630.                             disallowGameStartup();
  631.                             Console.ReadKey();
  632.                             Console.WriteLine("Generating QB template.");
  633.                             Console.ReadKey();
  634.                             File.Delete("C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb");
  635.                             Console.ReadKey();
  636.                             File.Copy("C:\\Windows\\fastgh3\\DATA\\SONGS\\.qb", "C:\\Windows\\fastgh3\\DATA\\SONGS\\song.qb", true);
  637.                             Console.ReadKey();
  638.                             File.SetAttributes("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", FileAttributes.Normal);
  639.                             Console.ReadKey();
  640.                             disallowGameStartup();
  641.                             Console.ReadKey();
  642.                             Console.WriteLine("Opening song pak.");
  643.                             Console.ReadKey();
  644.                             File.Copy("C:\\Windows\\FastGH3\\DATA\\SONGS\\.pak","C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen",true);
  645.                             PakFormat pakformat = new PakFormat("C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen", "", "", PakFormatType.PC);
  646.                             Console.ReadKey();
  647.                             PakEditor buildsong = new PakEditor(pakformat, false);
  648.                             Console.ReadKey();
  649.                             Console.WriteLine("Compiling chart.");
  650.                             Console.ReadKey();
  651.                             QbFile songdata = new QbFile("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb", pakformat);
  652.                             Console.ReadKey();
  653.                             QbItemBase array_easy = new QbItemArray(songdata);
  654.                             QbItemBase array_medium = new QbItemArray(songdata);
  655.                             QbItemBase array_hard = new QbItemArray(songdata);
  656.                             QbItemBase array_expert = new QbItemArray(songdata);
  657.                             Console.ReadKey();
  658.                             array_easy.Create(QbItemType.SectionArray);
  659.                             array_medium.Create(QbItemType.SectionArray);
  660.                             array_hard.Create(QbItemType.SectionArray);
  661.                             array_expert.Create(QbItemType.SectionArray);
  662.                             Console.ReadKey();
  663.                             QbItemInteger notes_easy = new QbItemInteger(songdata);
  664.                             QbItemInteger notes_medium = new QbItemInteger(songdata);
  665.                             QbItemInteger notes_hard = new QbItemInteger(songdata);
  666.                             QbItemInteger notes_expert = new QbItemInteger(songdata);
  667.                             Console.ReadKey();
  668.                             if (chartinieasy.Length > 0)
  669.                             { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartinieasy.Length).ToString()); }
  670.                             else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); }
  671.                             notes_easy.Create(QbItemType.ArrayInteger);
  672.                             if (chartinimedium.Length > 0)
  673.                             { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartinimedium.Length).ToString()); }
  674.                             else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); }
  675.                             notes_medium.Create(QbItemType.ArrayInteger);
  676.                             if (chartinihard.Length > 0)
  677.                             { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartinihard.Length).ToString()); }
  678.                             else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); }
  679.                             notes_hard.Create(QbItemType.ArrayInteger);
  680.                             if (chartiniexpert.Length > 0)
  681.                             { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", (3 * chartiniexpert.Length).ToString()); }
  682.                             else { File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3"); }
  683.                             notes_expert.Create(QbItemType.ArrayInteger);
  684.                             array_easy.ItemQbKey = QbKey.Create("E9BB103D");
  685.                             array_medium.ItemQbKey = QbKey.Create("DE2FC9CC");
  686.                             array_hard.ItemQbKey = QbKey.Create("61CC9578");
  687.                             array_expert.ItemQbKey = QbKey.Create("57471F39");
  688.                             Console.ReadKey();
  689.                             #region Import expert notes
  690.                             pushinteger = 0;
  691.                             foreach (string note in chartiniexpert)
  692.                             {
  693.                                 int.TryParse(note.Before(" = N"), out notes_expert.Values[pushinteger]);
  694.                                 notes_expert.Values[pushinteger] = Convert.ToInt32(notes_expert.Values[pushinteger] * 2.604166666666667);
  695.                                 int.TryParse(note.After(" = N ").Before(" "), out notecolor);
  696.                                 if (notes_expert.Values[pushinteger + 1] == 0)
  697.                                 {
  698.                                     notes_expert.Values[pushinteger + 1] = 1;
  699.                                 }
  700.                                 else
  701.                                 {
  702.                                     int.TryParse(note.After(" = N " + notecolor.ToString() + ' '), out notes_expert.Values[pushinteger + 1]);
  703.                                     notes_expert.Values[pushinteger + 1] = Convert.ToInt32(notes_expert.Values[pushinteger + 1] * 2.604166666666667);
  704.                                 }
  705.                                 switch (notecolor)
  706.                                 {
  707.                                     case 0:
  708.                                         notes_expert.Values[pushinteger + 2] = 1;
  709.                                         break;
  710.                                     case 1:
  711.                                         notes_expert.Values[pushinteger + 2] = 2;
  712.                                         break;
  713.                                     case 2:
  714.                                         notes_expert.Values[pushinteger + 2] = 4;
  715.                                         break;
  716.                                     case 3:
  717.                                         notes_expert.Values[pushinteger + 2] = 8;
  718.                                         break;
  719.                                     case 4:
  720.                                         notes_expert.Values[pushinteger + 2] = 16;
  721.                                         break;
  722.                                 }
  723.                                 pushinteger += 3;
  724.                             }
  725.                             #endregion
  726.                             MergeNotes(notes_easy);
  727.                             MergeNotes(notes_medium);
  728.                             MergeNotes(notes_hard);
  729.                             MergeNotes(notes_expert);
  730.                             songdata.AddItem(array_easy);
  731.                             songdata.AddItem(array_medium);
  732.                             songdata.AddItem(array_hard);
  733.                             songdata.AddItem(array_expert);
  734.                             array_easy.AddItem(notes_easy);
  735.                             array_medium.AddItem(notes_medium);
  736.                             array_hard.AddItem(notes_hard);
  737.                             array_expert.AddItem(notes_expert);
  738.                             Console.ReadKey();
  739.                             string qbkey = "";
  740.                             for (int i = 0; i < 20; i++)
  741.                             {
  742.                                 QbItemBase disposable = new QbItemArray(songdata);
  743.                                 disposable.Create(QbItemType.SectionArray);
  744.                                 switch (i)
  745.                                 {
  746.                                     case 0: qbkey = "9C876792"; break;
  747.                                     case 1: qbkey = "4FE36D34"; break;
  748.                                     case 2: qbkey = "74F79A34"; break;
  749.                                     case 3: qbkey = "608DEDC6"; break;
  750.                                     case 4: qbkey = "BA97A161"; break;
  751.                                     case 5: qbkey = "4575E6F0"; break;
  752.                                     case 6: qbkey = "E57786DA"; break;
  753.                                     case 7: qbkey = "CB0D41E7"; break;
  754.                                     default: qbkey = "ABCDEF00"; break;
  755.                                 }
  756.                                 disposable.ItemQbKey = QbKey.Create(qbkey);
  757.                                 QbItemBase disposable2 = new QbItemArray(songdata);
  758.                                 QbItemInteger disposable3 = new QbItemInteger(songdata);
  759.                                 songdata.AddItem(disposable);
  760.                                 /*if (i < 8 && i > 11)
  761.                                 {
  762.                                     disposable2.Create(QbItemType.ArrayArray);
  763.                                     disposable.AddItem(disposable2);
  764.                                 }
  765.                                 if (i > 7 && i < 12)
  766.                                 {
  767.                                     File.WriteAllText("C:\\Windows\\FastGH3\\DATA\\SONGS\\maxarraysize", "3");
  768.                                     disposable3.Create(QbItemType.ArrayInteger);
  769.                                     disposable3.Values[0] = 0;
  770.                                     disposable3.Values[1] = 0;
  771.                                     disposable3.Values[2] = 0;
  772.                                     disposable.AddItem(disposable3);
  773.                                 }*/
  774.                             }
  775.                             Console.ReadKey();
  776.                             songdata.AlignPointers();
  777.                             Console.ReadKey();
  778.                             songdata.Write("C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb");
  779.                             Console.ReadKey();
  780.                             Console.WriteLine("Compiling pak.");
  781.                             Console.ReadKey();
  782.                             buildsong.ReplaceFile("E15310CD", "C:\\Windows\\FastGH3\\DATA\\SONGS\\song.qb");
  783.                             Console.ReadKey();
  784.                             Console.WriteLine("Encoding song.");
  785.                             Console.ReadKey();
  786.                             disallowGameStartup();
  787.                             Console.WriteLine("Speeding up.");
  788.                             try
  789.                             {
  790.                                 var olddxwnd = Process.GetProcessesByName("dxwnd")[0];
  791.                                 olddxwnd.Kill();
  792.                             }
  793.                             catch { }
  794.                             Process dxwnd = new Process();
  795.                             dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  796.                             dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\";
  797.                             dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  798.                             dxwnd.StartInfo.Arguments = "/q";
  799.                             if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  800.                             {
  801.                                 dxwnd.Start();
  802.                             }
  803.                             Process gh3 = new Process();
  804.                             gh3.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\";
  805.                             if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  806.                             {
  807.                                 gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe";
  808.                                 gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe";
  809.                             }
  810.                             else
  811.                             {
  812.                                 gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  813.                                 gh3.StartInfo.Arguments = "/q /r:0";
  814.                                 gh3.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED";
  815.                                 gh3.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  816.                             }
  817.                             if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\maxnotes_auto") == "true")
  818.                             {
  819.                                 try
  820.                                 {
  821.                                     if (chartini.GetSection("EasySingle").Keys.Count > chartini.GetSection("MediumSingle").Keys.Count)
  822.                                     {
  823.                                         if (chartini.GetSection("EasySingle").Keys.Count > chartini.GetSection("HardSingle").Keys.Count)
  824.                                         {
  825.                                             if (chartini.GetSection("EasySingle").Keys.Count > chartini.GetSection("ExpertSingle").Keys.Count)
  826.                                             {
  827.                                                 maxnotes = chartini.GetSection("EasySingle").Keys.Count;
  828.                                             }
  829.                                         }
  830.                                     }
  831.                                 }
  832.                                 catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; }
  833.                                 try
  834.                                 {
  835.                                     if (chartini.GetSection("MediumSingle").Keys.Count > chartini.GetSection("EasySingle").Keys.Count)
  836.                                     {
  837.                                         if (chartini.GetSection("MediumSingle").Keys.Count > chartini.GetSection("HardSingle").Keys.Count)
  838.                                         {
  839.                                             if (chartini.GetSection("MediumSingle").Keys.Count > chartini.GetSection("ExpertSingle").Keys.Count)
  840.                                             {
  841.                                                 maxnotes = chartini.GetSection("MediumSingle").Keys.Count;
  842.                                             }
  843.                                         }
  844.                                     }
  845.                                 }
  846.                                 catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; }
  847.                                 try
  848.                                 {
  849.                                     if (chartini.GetSection("HardSingle").Keys.Count > chartini.GetSection("EasySingle").Keys.Count)
  850.                                     {
  851.                                         if (chartini.GetSection("HardSingle").Keys.Count > chartini.GetSection("MediumSingle").Keys.Count)
  852.                                         {
  853.                                             if (chartini.GetSection("HardSingle").Keys.Count > chartini.GetSection("ExpertSingle").Keys.Count)
  854.                                             {
  855.                                                 maxnotes = chartini.GetSection("HardSingle").Keys.Count;
  856.                                             }
  857.                                         }
  858.                                     }
  859.                                 }
  860.                                 catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; }
  861.                                 try
  862.                                 {
  863.                                     if (chartini.GetSection("ExpertSingle").Keys.Count > chartini.GetSection("EasySingle").Keys.Count)
  864.                                     {
  865.                                         if (chartini.GetSection("ExpertSingle").Keys.Count > chartini.GetSection("MediumSingle").Keys.Count)
  866.                                         {
  867.                                             if (chartini.GetSection("ExpertSingle").Keys.Count > chartini.GetSection("HardSingle").Keys.Count)
  868.                                             {
  869.                                                 maxnotes = chartini.GetSection("ExpertSingle").Keys.Count;
  870.                                             }
  871.                                         }
  872.                                     }
  873.                                 }
  874.                                 catch { maxnotes = chartini.GetSection("ExpertSingle").Keys.Count; }
  875.                                 if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\maxnotes_auto") == "true")
  876.                                 {
  877.                                     File.WriteAllText("C:\\Windows\\FastGH3\\CONFIGS\\maxnotes", maxnotes.ToString());
  878.                                 }
  879.                             }
  880.                             //File.Delete(@"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.fsb.xen");
  881.                             //File.Delete(@"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.dat.xen");
  882.                             //File.Delete(@"C:\Windows\fastgh3\DATA\SONGS\fastgh3_song.pak.xen");
  883.                             //File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\MUSIC\fastgh3.dat.xen", @"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.dat.xen", true);
  884.                             //File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\MUSIC\fastgh3.fsb.xen", @"C:\Windows\FastGH3\DATA\MUSIC\fastgh3.fsb.xen", true);
  885.                             //File.Copy(@"C:\Windows\fastgh3\DATA\TEMP\SONGS\fastgh3_song.pak.xen", @"C:\Windows\FastGH3\DATA\SONGS\fastgh3_song.pak.xen", true);
  886.                             gh3.Start();
  887.                             Thread.Sleep(2500);
  888.                             if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe")
  889.                             {
  890.                                 gh3.Kill();
  891.                             }
  892.                             try
  893.                             {
  894.                                 File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe");
  895.                             }
  896.                             catch { }
  897.                         }
  898.                     }
  899.                 }
  900.             }
  901.             catch { }
  902.             GC.Collect();
  903.             try
  904.             {
  905.                 if (File.Exists(parameters[1]) && parameters[1].Contains(".fsp"))
  906.                 {
  907.                     Console.WriteLine("FastGH3 by donnaken15");
  908.                     Console.WriteLine("Adding song to game.");
  909.                     using (ZipFile file = ZipFile.Read(parameters[1]))
  910.                     {
  911.                         file.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently;
  912.                         foreach (ZipEntry data in file)
  913.                         {
  914.                             if (data.FileName.Contains(".pak"))
  915.                             {
  916.                                 data.Extract("C:\\Windows\\FastGH3\\DATA\\SONGS\\");
  917.                                 File.Delete("C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen");
  918.                                 File.Move("C:\\Windows\\FastGH3\\DATA\\SONGS\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\SONGS\\fastgh3_song.pak.xen");
  919.                             }
  920.                             if (data.FileName.Contains(".fsb"))
  921.                             {
  922.                                 data.Extract("C:\\Windows\\FastGH3\\DATA\\MUSIC\\");
  923.                                 File.Delete("C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen");
  924.                                 File.Move("C:\\Windows\\FastGH3\\DATA\\MUSIC\\" + data.FileName, "C:\\Windows\\FastGH3\\DATA\\MUSIC\\fastgh3.fsb.xen");
  925.                             }
  926.                         }
  927.                     }
  928.                     try
  929.                     {
  930.                         File.Move("C:\\Windows\\FastGH3\\FastGH3.exe.bak", "C:\\Windows\\FastGH3\\FastGH3.exe");
  931.                     }
  932.                     catch { }
  933.                     Console.WriteLine("Speeding up.");
  934.                     Process dxwnd = new Process();
  935.                     dxwnd.StartInfo.FileName = "C:\\Windows\\FastGH3\\WINDOWED\\dxwnd.exe";
  936.                     dxwnd.StartInfo.Arguments = "/q";
  937.                     dxwnd.StartInfo.WorkingDirectory = "C:\\Windows\\FastGH3\\WINDOWED\\";
  938.                     dxwnd.StartInfo.CreateNoWindow = false;
  939.                     dxwnd.StartInfo.WindowStyle = ProcessWindowStyle.Minimized;
  940.                     dxwnd.Start();
  941.                     Process gh3 = new Process();
  942.                     if (File.ReadAllText("C:\\Windows\\FastGH3\\CONFIGS\\vsync") == "True")
  943.                     {
  944.                         gh3.StartInfo.FileName = "C:\\Program Files\\3da\\3DAnalyze.exe";
  945.                         gh3.StartInfo.Arguments = "/EXE=C:\\Windows\\FastGH3\\gh3.exe";
  946.                     }
  947.                     else
  948.                     {
  949.                         gh3.StartInfo.FileName = "C:\\Windows\\FastGH3\\gh3.exe";
  950.                         gh3.StartInfo.Arguments = "";
  951.                     }
  952.                     gh3.Start();
  953.                     if (gh3.StartInfo.FileName == "C:\\Program Files\\3da\\3DAnalyze.exe")
  954.                     {
  955.                         Thread.Sleep(2500);
  956.                         gh3.Kill();
  957.                     }
  958.                 }
  959.             }
  960.             catch { }
  961.         }
  962.     }
  963. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement