コード例 #1
0
        private static void GenerateOriginalBioFuels()
        {
            const string fileName = "BioReactor_Values.txt";

            if (File.Exists(OriginalsFolder + fileName))
            {
                return;
            }

            var allBioFuels = ValidBioFuels.charge;

            var bioFuelList = new CustomBioFuelList();

            foreach (TechType bioEnergyKey in allBioFuels.Keys)
            {
                bioFuelList.Add(new CustomBioFuel {
                    ItemID = bioEnergyKey.ToString(), Energy = allBioFuels[bioEnergyKey]
                });
            }

            var printyPrints = new List <string>();

            printyPrints.AddRange(EmUtils.CommentTextLinesCentered(new string[]
            {
                "This file was generated with original BIoFuel energy values in the game",
                "You can copy individual entries from this file to use in your personal overrides",
                "--------------------------------------------------------------------------------",
            }));

            printyPrints.Add(bioFuelList.PrettyPrint());

            File.WriteAllLines(OriginalsFolder + fileName, printyPrints.ToArray());

            Logger.Log($"{fileName} file not found. File generated.");
        }
コード例 #2
0
        private static void GenerateOriginalsFile(TechGroup group, TechCategory category, List <TechType> list, string fileName)
        {
            var printyPrints = new List <string>();

            printyPrints.AddRange(EmUtils.CommentTextLinesCentered(new string[]
            {
                "This file was generated with original recipes in the game",
                "You can copy individual entries from this file to use in your personal overrides",
                "--------------------------------------------------------------------------------",
                $"PdaGroup: {group} - PdaCategory:{category}",
                "--------------------------------------------------------------------------------",
            }));

            var originals = new ModifiedRecipeList();

            foreach (TechType craftable in list)
            {
                originals.Add(new ModifiedRecipe(craftable));
            }

            printyPrints.Add(originals.PrettyPrint());

            File.WriteAllLines(FileLocations.OriginalsFolder + fileName, printyPrints.ToArray(), Encoding.UTF8);

            QuickLogger.Debug($"{fileName} file not found. File generated.");
        }
コード例 #3
0
        private void WriteConfigFile()
        {
            const string horzontalLine =
                "---------------------------------------------------------------------------------------------------";

            string[] descriptionLines = EmUtils.CommentTextLinesCentered(new[]
            {
                ConfigTopLine,
                horzontalLine,
                "Changes to this config file will only take effect next time you boot the game",
                "This config file was built using EasyMarkup",
                horzontalLine,
                "Each entry here corresponds to one of the crafting tabs of the VMod Fabricator",
                "Add or remove modded items from these lists to update or customize the items in the VModFabricator",
                "You must use the modded item's internal 'TechType' name for this",
                horzontalLine,
            });

            string[] writingLines = new string[descriptionLines.Length + 1];

            descriptionLines.CopyTo(writingLines, 0);
            writingLines[descriptionLines.Length] = this.PrettyPrint();

            File.WriteAllLines(ConfigFile, writingLines, Encoding.UTF8);
        }
コード例 #4
0
        public void TestFileNameWithoutExtension()
        {
            var strings = new[] {
                "abc.123",
                "abc.def.hij.k",
                "/some/unix/_/path/abc.def.hij.k",
                @"Z:\some\windows\_\path\abc.def.hij.k",
                @"Z:\s o m e\w i n d o w s\_\p a t h\a b c.d e f.h i j.k",
                @"96587658765*&R8 T^RuyTR876R 87^5r8&^8&^%9^$#&%^$^$#%#^$^*&(07",
                @"96587658765*&R8 T^RuyTR876R/87^5r8&^8&^%9^$#&%^$^$#%#^$^*&(07",
                @"96587658765*&R8 T^RuyTR876R/87^5r8&^8&^%9^$#&%^$^$#%#^$^*&(07/file.txt",
            };

            var expected = new[] {
                "abc",
                "abc",
                @"\some\unix\_\path\abc",
                @"Z:\some\windows\_\path\abc",
                @"Z:\s o m e\w i n d o w s\_\p a t h\a b c",
                @"96587658765*&R8 T^RuyTR876R 87^5r8&^8&^%9^$#&%^$^$#%#^$^*&(07",
                @"96587658765*&R8 T^RuyTR876R\87^5r8&^8&^%9^$#&%^$^$#%#^$^*&(07",
                @"96587658765*&R8 T^RuyTR876R\87^5r8&^8&^%9^$#&%^$^$#%#^$^*&(07\file",
            };

            for (var i = 0; i < strings.Length; ++i)
            {
                var a = strings[i];
                var b = expected[i];
                var c = EmUtils.FileNameWithoutExtension(a);
                Assert.AreEqual(b, c);
            }
        }
コード例 #5
0
        private static void WriteFile <T>(T tabList, string fileName) where T : EmProperty
        {
            string filePath = EquipmentSalvageDirectory + fileName;

            var linesToWrite = new List <string>();

            linesToWrite.AddRange(EmUtils.CommentTextLines(TopLines));
            linesToWrite.Add(EmUtils.CommentText(Line));
            linesToWrite.Add(tabList.PrettyPrint());
            linesToWrite.Add(EmUtils.CommentText(Line));
            linesToWrite.AddRange(EmUtils.CommentTextLines(BottomLines));

            File.WriteAllLines(filePath, linesToWrite);
        }
コード例 #6
0
        private static void GenerateOriginalsFile(string key, List <TechType> list, string fileName)
        {
            var printyPrints = new List <string>();

            printyPrints.AddRange(EmUtils.CommentTextLinesCentered(new string[]
            {
                "This file was generated with original recipes in the game",
                "You can copy individual entries from this file to use in your personal overrides",
                "--------------------------------------------------------------------------------",
            }));

            var originals = new ModifiedRecipeList();

            foreach (TechType craftable in list)
            {
                originals.Add(new ModifiedRecipe(craftable));
            }

            printyPrints.Add(originals.PrettyPrint());

            File.WriteAllLines(OriginalsFolder + fileName, printyPrints.ToArray());

            Logger.Log($"{fileName} file not found. File generated.");
        }
コード例 #7
0
        public void SanitizeTest()
        {
            var result = EmUtils.Sanitize("A//////////B//C//////D/E//////////////F");

            Assert.AreEqual(@"A\B\C\D\E\F", result);
        }