コード例 #1
0
        public static void GenerateSpoilerLog(string path)
        {
            if (MusicLookupTable.Count == 0 &&
                SoundLookupTable.Count == 0)
            {
                return;
            }

            using (StreamWriter sw = new StreamWriter(path))
            {
                sw.WriteLine($"Seed,{Properties.Settings.Default.Seed}");
                sw.WriteLine();

                sw.WriteLine($"Area Music,{Properties.Settings.Default.RandomizeAreaMusic}");
                sw.WriteLine($"Battle Music,{Properties.Settings.Default.RandomizeBattleMusic}");
                sw.WriteLine($"Ambient Noise,{Properties.Settings.Default.RandomizeAmbientNoise}");
                sw.WriteLine($"Cutscene Noise,{Properties.Settings.Default.RandomizeCutsceneNoise}");
                sw.WriteLine($"NPC Sounds,{Properties.Settings.Default.RandomizeNpcSounds}");
                sw.WriteLine($"Party Sounds,{Properties.Settings.Default.RandomizePartySounds}");
                sw.WriteLine($"Remove DMCA,{Properties.Settings.Default.RemoveDmcaMusic}");
                sw.WriteLine($"Mix NPC and Party,{Properties.Settings.Default.MixNpcAndPartySounds}");
                sw.WriteLine();

                if (MusicLookupTable.Any())
                {
                    var sortedLookup = MusicLookupTable.OrderBy(kvp => kvp.Key);
                    sw.WriteLine("Music");
                    sw.WriteLine("Original,Randomized");

                    foreach (var kvp in sortedLookup)
                    {
                        sw.WriteLine($"{kvp.Key},{kvp.Value}");
                    }

                    sw.WriteLine();
                }

                if (SoundLookupTable.Any())
                {
                    var sortedLookup = SoundLookupTable.OrderBy(kvp => kvp.Key);
                    sw.WriteLine("Sound");
                    sw.WriteLine("Original,Randomized");

                    foreach (var kvp in sortedLookup)
                    {
                        sw.WriteLine($"{kvp.Key},{kvp.Value}");
                    }

                    sw.WriteLine();
                }
            }
        }
コード例 #2
0
        public static void CreateSpoilerLog(XLWorkbook workbook)
        {
            if (MusicLookupTable.Count == 0 &&
                SoundLookupTable.Count == 0)
            {
                return;
            }
            var ws = workbook.Worksheets.Add("MusicSound");

            int i = 1;

            ws.Cell(i, 1).Value           = "Seed";
            ws.Cell(i, 2).Value           = Properties.Settings.Default.Seed;
            ws.Cell(i, 1).Style.Font.Bold = true;
            i++;

            Version version = typeof(StartForm).Assembly.GetName().Version;

            ws.Cell(i, 1).Value                      = "Version";
            ws.Cell(i, 1).Style.Font.Bold            = true;
            ws.Cell(i, 2).Value                      = $"v{version.Major}.{version.Minor}.{version.Build}";
            ws.Cell(i, 2).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Right;
            i += 2;     // Skip a row.

            // Music and Sound Randomization Settings
            ws.Cell(i, 1).Value = "Music/Sound Type";
            ws.Cell(i, 2).Value = "Rando Level";
            ws.Cell(i, 1).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
            ws.Cell(i, 2).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
            ws.Cell(i, 1).Style.Font.Bold           = true;
            ws.Cell(i, 2).Style.Font.Bold           = true;
            i++;

            var settings = new List <Tuple <string, string> >()
            {
                new Tuple <string, string>("Area Music", Properties.Settings.Default.RandomizeAreaMusic.ToString()),
                new Tuple <string, string>("Battle Music", Properties.Settings.Default.RandomizeBattleMusic.ToString()),
                new Tuple <string, string>("Ambient Noise", Properties.Settings.Default.RandomizeAmbientNoise.ToString()),
                new Tuple <string, string>("Cutscene Noise", Properties.Settings.Default.RandomizeCutsceneNoise.ToString()),
                new Tuple <string, string>("NPC Sounds", Properties.Settings.Default.RandomizeNpcSounds.ToString()),
                new Tuple <string, string>("Party Sounds", Properties.Settings.Default.RandomizePartySounds.ToString()),
                new Tuple <string, string>("Remove DMCA", Properties.Settings.Default.RemoveDmcaMusic.ToString()),
                new Tuple <string, string>("Mix NPC and Party", Properties.Settings.Default.MixNpcAndPartySounds.ToString()),
                new Tuple <string, string>("", ""),  // Skip a row.
            };

            foreach (var setting in settings)
            {
                ws.Cell(i, 1).Value             = setting.Item1;
                ws.Cell(i, 2).Value             = setting.Item2;
                ws.Cell(i, 1).Style.Font.Italic = true;
                i++;
            }

            // Music Shuffle
            if (MusicLookupTable.Any())
            {
                var sortedLookup = MusicLookupTable.OrderBy(kvp => kvp.Key);
                ws.Cell(i, 1).Value                      = "Music";
                ws.Cell(i, 1).Style.Font.Bold            = true;
                ws.Cell(i, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
                ws.Range(i, 1, i, 3).Merge();
                i++;

                ws.Cell(i, 1).Value = "Has Changed";
                ws.Cell(i, 2).Value = "Original";
                ws.Cell(i, 3).Value = "Randomized";
                ws.Cell(i, 1).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
                ws.Cell(i, 2).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
                ws.Cell(i, 3).Style.Border.BottomBorder = XLBorderStyleValues.Thin;
                ws.Cell(i, 1).Style.Font.Bold           = true;
                ws.Cell(i, 2).Style.Font.Bold           = true;
                ws.Cell(i, 3).Style.Font.Bold           = true;
                i++;

                foreach (var kvp in sortedLookup)
                {
                    var hasChanged = kvp.Key != kvp.Value;
                    ws.Cell(i, 1).Value = hasChanged;
                    ws.Cell(i, 2).Value = kvp.Key;
                    ws.Cell(i, 3).Value = kvp.Value;
                    if (hasChanged)
                    {
                        ws.Cell(i, 1).Style.Font.FontColor = XLColor.Green;
                    }
                    else
                    {
                        ws.Cell(i, 1).Style.Font.FontColor = XLColor.Red;
                    }
                    i++;
                }

                i++;    // Skip a row.
            }

            // Sound Shuffle
            if (SoundLookupTable.Any())
            {
                var sortedLookup = SoundLookupTable.OrderBy(kvp => kvp.Key);
                ws.Cell(i, 1).Value                      = "Sound";
                ws.Cell(i, 1).Style.Font.Bold            = true;
                ws.Cell(i, 1).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
                ws.Range(i, 1, i, 3).Merge();
                i++;

                ws.Cell(i, 1).Value           = "Has Changed";
                ws.Cell(i, 2).Value           = "Original";
                ws.Cell(i, 3).Value           = "Randomized";
                ws.Cell(i, 1).Style.Font.Bold = true;
                ws.Cell(i, 2).Style.Font.Bold = true;
                ws.Cell(i, 3).Style.Font.Bold = true;
                i++;

                foreach (var kvp in sortedLookup)
                {
                    var hasChanged = kvp.Key != kvp.Value;
                    ws.Cell(i, 1).Value = hasChanged;
                    ws.Cell(i, 2).Value = kvp.Key;
                    ws.Cell(i, 3).Value = kvp.Value;
                    if (hasChanged)
                    {
                        ws.Cell(i, 1).Style.Font.FontColor = XLColor.Green;
                    }
                    else
                    {
                        ws.Cell(i, 1).Style.Font.FontColor = XLColor.Red;
                    }
                    i++;
                }
            }

            // Resize Columns
            ws.Column(1).AdjustToContents();
            ws.Column(2).AdjustToContents();
            ws.Column(3).AdjustToContents();
        }