Пример #1
0
        void ModProcess()
        {
            Random rand = new Random(ModLoaderGlobals.RandomizerSeed);

            string path_extr = ConsolePipeline.ExtractedPath + @"BIGFILE\";

            ModCrates.InstallLayerMods(EnabledModCrates, path_extr, 1);

            if ((Option_RandTracks.Enabled || Option_RandTracks101.Enabled) && Directory.Exists(path_extr + @"levels\tracks\island1"))
            {
                List <int> LevelInd  = new List <int>();
                List <int> LevelRand = new List <int>();
                int        maxLevel  = TrackFolderNames.Count;
                if (Option_RandTracks101.Enabled)
                {
                    maxLevel -= 2;
                }

                for (int i = 0; i < maxLevel; i++)
                {
                    Directory.Move(path_extr + @"levels\tracks\" + TrackFolderNames[i], path_extr + @"levels\tracks\level" + i);
                    LevelInd.Add(i);
                }

                while (LevelInd.Count > 0)
                {
                    int r = rand.Next(LevelInd.Count);
                    LevelRand.Add(LevelInd[r]);
                    LevelInd.RemoveAt(r);
                }

                for (int i = 0; i < LevelRand.Count; i++)
                {
                    Directory.Move(path_extr + @"levels\tracks\level" + i, path_extr + @"levels\tracks\" + TrackFolderNames[LevelRand[i]]);
                }
            }

            LNG lng = new LNG(path_extr + @"lang\en.lng");

            string[] lang_lines = File.ReadAllLines(path_extr + @"lang\en.txt", System.Text.Encoding.Default);
            for (int i = 0; i < lang_lines.Length; i++)
            {
                if (lang_lines[i].Contains("LOADING.."))
                {
                    lang_lines[i] = "CML " + ModLoaderGlobals.ProgramVersion + "|" + "SEED: " + ModLoaderGlobals.RandomizerSeed;
                }
            }
            File.WriteAllLines(path_extr + @"lang\en.txt", lang_lines, System.Text.Encoding.Default);
            lng.ConvertTXT(path_extr + @"lang\en.txt");
            File.Delete(path_extr + @"lang\en.txt");

            if (File.Exists(path_extr + @"lang\en2.lng"))
            {
                LNG      lng1        = new LNG(path_extr + @"lang\en2.lng");
                string[] lang_lines1 = File.ReadAllLines(path_extr + @"lang\en2.txt", System.Text.Encoding.Default);
                for (int i = 0; i < lang_lines1.Length; i++)
                {
                    if (lang_lines[i].Contains("LOADING.."))
                    {
                        lang_lines[i] = "CML " + ModLoaderGlobals.ProgramVersion + "|" + "SEED: " + ModLoaderGlobals.RandomizerSeed;
                    }
                }
                File.WriteAllLines(path_extr + @"lang\en2.txt", lang_lines1, System.Text.Encoding.Default);
                lng1.ConvertTXT(path_extr + @"lang\en2.txt");
                File.Delete(path_extr + @"lang\en2.txt");
            }

            EndModProcess();
        }