Exemplo n.º 1
0
 /// <summary>
 /// Creates a new <see cref="PoEBuild"/> instance from the given <see cref="XmlBuild"/> instance.
 /// Will return null if null is given.
 /// </summary>
 protected static PoEBuild ConvertFromXmlBuild(XmlBuild build)
 {
     if (build == null)
     {
         return(null);
     }
     return(new PoEBuild(build.Bandits, build.CustomGroups, build.CheckedNodeIds, build.CrossedNodeIds,
                         build.AdditionalData)
     {
         AccountName = build.AccountName,
         CharacterName = build.CharacterName,
         ItemData = build.ItemData,
         LastUpdated = build.LastUpdated,
         League = build.League,
         Level = build.Level,
         Name = build.Name,
         Note = build.Note,
         TreeUrl = build.TreeUrl
     });
 }
        private static void SerializeBuild(string path, PoEBuild build)
        {
            var xmlBuild = new XmlBuild
            {
                AccountName    = build.AccountName,
                AdditionalData = build.AdditionalData.ToString(),
                Bandits        = build.Bandits,
                CharacterName  = build.CharacterName,
                CheckedNodeIds = build.CheckedNodeIds.ToList(),
                CrossedNodeIds = build.CrossedNodeIds.ToList(),
                CustomGroups   = build.CustomGroups.ToList(),
                ItemData       = build.ItemData,
                LastUpdated    = build.LastUpdated,
                League         = build.League,
                Level          = build.Level,
                Name           = build.Name,
                Note           = build.Note,
                TreeUrl        = build.TreeUrl,
                Version        = BuildVersion.ToString()
            };

            SerializationUtils.XmlSerialize(xmlBuild, path + BuildFileExtension);
            build.KeepChanges();
        }
 /// <summary>
 /// Creates a new <see cref="PoEBuild"/> instance from the given <see cref="XmlBuild"/> instance.
 /// Will return null if null is given.
 /// </summary>
 protected static PoEBuild ConvertFromXmlBuild(XmlBuild build)
 {
     if (build == null)
         return null;
     return new PoEBuild(build.Bandits, build.CustomGroups, build.CheckedNodeIds, build.CrossedNodeIds,
         build.AdditionalData)
     {
         AccountName = build.AccountName,
         CharacterName = build.CharacterName,
         ItemData = build.ItemData,
         LastUpdated = build.LastUpdated,
         League = build.League,
         Level = build.Level,
         Name = build.Name,
         Note = build.Note,
         TreeUrl = build.TreeUrl
     };
 }