コード例 #1
0
        public static string GetGameInfo(OBJConfig objConfig, RomDesc currentRom, CListBox romList)
        {
            // Rom Info
            var ranking = currentRom.PlayedTimeNow != TimeSpan.Zero ? currentRom.PlayedTimeNow.TotalSeconds / romList.MaxPlayedTimeNow.TotalSeconds : 0.0;
            var stars   = 0;

            if (ranking > 0.0)
            {
                stars = (int)Math.Round(ranking * 5, 0);
            }
            var perc = ranking > 0 ? Math.Round(ranking * 100, 0) : 0.0;
            var str  = "Ranking§" + perc + "%";

            if (stars > 0)
            {
                str += " (" + "".PadRight(stars, '*') + ")";
            }
            str += "\nPlayed§" + currentRom.PlayedCount + (currentRom.PlayedCount == 1 ? " time" : " times");
            str += "\nLast played§" + TimePassedBy(currentRom.TimeStamp);
            str += "\nTotal time§" + TimeSpent(currentRom.PlayedTime);
            var usage = romList.TotalPlayedTime.TotalSeconds > 0 ? Math.Round((currentRom.PlayedTime.TotalSeconds * 100) / romList.TotalPlayedTime.TotalSeconds, 0) : 0.0;

            str += "\nOn overall time§" + usage + "%";

            if (objConfig.current_platform == "all_emu")
            {
                str += "\n\nPlatform§" + currentRom.FeelInfo.PlatformDesc;
                str += "\nEmulator§" + currentRom.FeelInfo.EmulatorDesc;
            }

            return(str);
        }
コード例 #2
0
        public static RomDesc RemoveGameFromList(OBJConfig objConfig, CListBox romList, RomDesc rom)
        {
            var currentRom = romList.RemoveGame(rom);

            SaveRomList(objConfig, romList);
            return(currentRom);
        }
コード例 #3
0
 public static bool AddGameToList(OBJConfig objConfig, CListBox romList, RomDesc rom)
 {
     if (romList.AddGame(rom))
     {
         SaveRomList(objConfig, romList);
         return(true);
     }
     return(false);
 }
コード例 #4
0
        public static void SaveRomList(OBJConfig objConfig, CListBox romList)
        {
            var fileName = new StringBuilder(Application.StartupPath)
                           .Append(Path.DirectorySeparatorChar).Append("data").Append(Path.DirectorySeparatorChar);

            if (objConfig.current_platform != "all_emu")
            {
                fileName.Append(objConfig.current_gamelist);
            }
            else
            {
                fileName.Append(objConfig.current_platform);
            }
            fileName.Append(".lst");
            var file = File.CreateText(fileName.ToString());

            foreach (var rom in romList.List)
            {
                if (objConfig.current_platform != "all_emu")
                {
                    file.WriteLine(rom.Key);
                    file.WriteLine(rom.Description);
                    file.WriteLine(rom.Year);
                    file.WriteLine(rom.Manufacturer);
                    file.WriteLine(rom.CloneOf);
                    file.WriteLine(rom.Bios);
                    file.WriteLine(rom.ExtraData);
                    file.WriteLine(rom.ScreenOrientation);
                    file.WriteLine(rom.InputControl);
                    file.WriteLine(rom.Status);
                    file.WriteLine(rom.Color);
                    file.WriteLine(rom.Sound);
                    file.WriteLine(rom.Category);
                }
                else
                {
                    var outputLineSB = new StringBuilder(rom.Key).Append("|");
                    outputLineSB.Append(rom.Description).Append("|");
                    outputLineSB.Append(rom.Year).Append("|");
                    outputLineSB.Append(rom.Manufacturer).Append("|");
                    outputLineSB.Append(rom.CloneOf).Append("|");
                    outputLineSB.Append(rom.Bios).Append("|");
                    outputLineSB.Append(rom.ExtraData).Append("|");
                    outputLineSB.Append(rom.ScreenOrientation).Append("|");
                    outputLineSB.Append(rom.InputControl).Append("|");
                    outputLineSB.Append(rom.Status).Append("|");
                    outputLineSB.Append(rom.Color).Append("|");
                    outputLineSB.Append(rom.Sound).Append("|");
                    outputLineSB.Append(rom.Category).Append("|");
                    outputLineSB.Append(rom.FeelInfo.ToString());
                    file.WriteLine(outputLineSB.ToString());
                }
            }
            file.Close();
        }