Exemple #1
0
        private void ParseAddonDataToNewStandard(List <Addon> _addons)
        {
            List <NewAddon>    UpgradedAddonList = new List <NewAddon>();
            List <Addon>       AddonWithSameName = new List <Addon>();
            NewAddonCollection nac    = new NewAddonCollection();
            List <Addon>       addons = _addons;

            foreach (Addon addon in addons)
            {
                NewAddon newAddon = new NewAddon();
                AddonWithSameName            = addons.Where(c => c.Name == addon.Name).ToList();
                newAddon.Details.Name        = addon.Name;
                newAddon.Details.Description = addon.Description;
                newAddon.Details.Expansion   = ParseExpansion(AddonWithSameName);
                newAddon.Details.ImageUrl    = addon.ImageUrl;
                newAddon.Details.Installed   = addon.Installed;
                newAddon.DownloadData        = ParseVersion(AddonWithSameName);
                newAddon.Details.Expansion   = ParseExpansion(newAddon.DownloadData);
                newAddon.Details.Category    = (AddonDetails.Categories)addon.Category;
                UpgradedAddonList.Add(newAddon);
                addons = addons.Except(AddonWithSameName).ToList();
            }
            UpgradedAddonList = UpgradedAddonList.Distinct().ToList();
            foreach (NewAddon a in UpgradedAddonList)
            {
                if (a.Details.Name.StartsWith("project-"))
                {
                    UpgradedAddonList.Remove(a);
                }
            }
            nac.NewAddons = UpgradedAddonList;
            SaveNewStandardAddonsToFile(nac);
        }
Exemple #2
0
        private void SaveNewStandardAddonsToFile(NewAddonCollection newAddonCollection)
        {
            string Data = Newtonsoft.Json.JsonConvert.SerializeObject(newAddonCollection);

            System.IO.File.WriteAllText(@"C:\Users\Kirialaa\Desktop\noweZKategoriami.json", Data);
        }