Пример #1
0
        public List <StandardisedLoadoutEntry> Load(string loadoutXmlPath)
        {
            if (String.IsNullOrWhiteSpace(loadoutXmlPath))
            {
                return(new List <StandardisedLoadoutEntry>());
            }

            var windowsPath = loadoutXmlPath.Replace("/", "\\");

            Console.WriteLine(windowsPath);

            var loadoutParser  = new DefaultLoadoutParser();
            var defaultLoadout = loadoutParser.Parse(Path.Combine(DataRoot, "Data", windowsPath));

            return(BuildStandardLoadout(defaultLoadout?.Items));
        }
Пример #2
0
        public string Load(string loadoutXmlPath)
        {
            Directory.CreateDirectory(Path.Combine(OutputFolder, "loadouts"));

            if (String.IsNullOrWhiteSpace(loadoutXmlPath))
            {
                return("");
            }

            var windowsPath = loadoutXmlPath.Replace("/", "\\");

            Console.WriteLine(windowsPath);

            var loadoutParser  = new DefaultLoadoutParser();
            var defaultLoadout = loadoutParser.Parse(Path.Combine(DataRoot, "Data", windowsPath));

            var jsonFilename = Path.Combine(OutputFolder, "loadouts", $"{Path.GetFileNameWithoutExtension(loadoutXmlPath)}.json");
            var json         = JsonConvert.SerializeObject(defaultLoadout);

            File.WriteAllText(jsonFilename, json);

            return(Path.GetRelativePath(OutputFolder, jsonFilename).Replace("\\", "/"));
        }