Esempio n. 1
0
        private static void SerializeBuild(string path, PoEBuild build)
        {
            var xmlBuild = ToXmlBuild(build);

            XmlSerializationUtils.SerializeToFile(xmlBuild, path + BuildFileExtension);
            build.KeepChanges();
        }
Esempio n. 2
0
        private static void SerializeFolder(string path, BuildFolder folder)
        {
            var xmlFolder = new XmlBuildFolder
            {
                Version    = BuildVersion.ToString(),
                IsExpanded = folder.IsExpanded,
                Builds     = folder.Builds.Select(b => b.Name).ToList()
            };

            Directory.CreateDirectory(path);
            XmlSerializationUtils.SerializeToFile(xmlFolder, Path.Combine(path, BuildFolderFileName));
        }
Esempio n. 3
0
        public async Task UpdateAsync()
        {
            var mods = await LoadMods();

            var uniqueTasks = RelevantWikiClasses.Select(c => LoadAsync(c, mods))
                              .Append(LoadJewelsAsync(mods));
            var results = await Task.WhenAll(uniqueTasks).ConfigureAwait(false);

            var uniqueList = new XmlUniqueList
            {
                Uniques = results.Flatten().ToArray()
            };

            XmlSerializationUtils.SerializeToFile(uniqueList, _savePath);
        }
Esempio n. 4
0
        /// <summary>
        /// Serializes all files except builds to <paramref name="filePath"/>.
        /// </summary>
        public void Serialize(string filePath)
        {
            var stashes = new List <XmlLeagueStash>(_persistentData.LeagueStashes.Select(
                                                        p => new XmlLeagueStash {
                Name = p.Key, Bookmarks = new List <StashBookmark>(p.Value)
            }));
            var xmlPersistentData = new XmlPersistentData
            {
                AppVersion        = SerializationUtils.AssemblyFileVersion,
                CurrentBuildPath  = PathFor(_persistentData.CurrentBuild, false),
                Options           = _persistentData.Options,
                SelectedBuildPath = PathFor(_persistentData.SelectedBuild, false),
                StashBookmarks    = _persistentData.StashBookmarks.ToList(),
                LeagueStashes     = stashes
            };

            XmlSerializationUtils.SerializeToFile(xmlPersistentData, filePath);
            SerializeStash();
        }
Esempio n. 5
0
 protected override Task CompleteSavingAsync()
 {
     XmlSerializationUtils.SerializeToFile(Data, SavePath);
     return(Task.WhenAll());
 }