Exemplo n.º 1
0
 public void Save()
 {
     if (!hasUnsavedChanges)
     {
         return;
     }
     Debug.WriteLine(string.Format("Saving game '{0}' as {1}", Name, Code));
     Name = Regex.Replace(Name, @"'(\d)", @"`$1"); // Apostrophe + any number in game name crashes whole system. What. The. F**k?
     File.WriteAllText(ConfigPath, string.Format(
                           "[Desktop Entry]\n" +
                           "Type=Application\n" +
                           "Exec=/usr/bin/clover-kachikachi /usr/share/games/nes/kachikachi/{0}/{8} {1}\n" +
                           "Path=/var/lib/clover/profiles/0/{0}\n" +
                           "Name={2}\n" +
                           "Icon=/usr/share/games/nes/kachikachi/{0}/{0}.png\n\n" +
                           "[X-CLOVER Game]\n" +
                           "Code={0}\n" +
                           "TestID=777\n" +
                           "ID=0\n" +
                           "Players={3}\n" +
                           "Simultaneous={7}\n" +
                           "ReleaseDate={4}\n" +
                           "SaveCount=0\n" +
                           "SortRawTitle={5}\n" +
                           "SortRawPublisher={6}\n" +
                           "Copyright=hakchi2 ©2017 Alexey 'Cluster' Avdyukhin\n",
                           Code, Args ?? DefaultArgs, Name ?? Code, Players, ReleaseDate ?? DefaultReleaseDate,
                           (Name ?? Code).ToLower(), (Publisher ?? DefaultPublisher).ToUpper(),
                           Simultaneous ? 1 : 0, Path.GetFileName(NesPath)));
     if (!string.IsNullOrEmpty(GameGenie.Trim()))
     {
         File.WriteAllText(GameGeniePath, GameGenie.Trim());
     }
     else if (File.Exists(GameGeniePath))
     {
         File.Delete(GameGeniePath);
     }
     hasUnsavedChanges = false;
 }