예제 #1
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="src"></param>
 public BlueprintMarketGroup(BlueprintMarketGroup parent, SerializableBlueprintGroup src)
     : base(parent, src)
 {
     m_subCategories = new BlueprintMarketGroupCollection(this, src.SubGroups);
     m_blueprints = new BlueprintCollection(this, src.Blueprints);
 }
예제 #2
0
 /// <summary>
 /// Deserialization constructor
 /// </summary>
 /// <param name="parent">The Market Group this Market Group is contained within</param>
 /// <param name="src">Source Blueprint Group</param>
 public MarketGroup(MarketGroup parent, SerializableBlueprintGroup src)
     :this (src)
 {
     m_parent = parent;
 }
예제 #3
0
        /// <summary>
        /// Generate the skills datafile.
        /// </summary>
        private static void GenerateBlueprints()
        {
            Console.WriteLine();
            Console.Write(@"Generated blueprints datafile... ");

            s_counter = 0;
            s_percentOld = 0;
            s_text = String.Empty;
            s_startTime = DateTime.Now;

            // Configure blueprints with Null market group
            ConfigureNullMarketBlueprint();

            var groups = new Dictionary<int, SerializableBlueprintGroup>();

            // Export blueprint groups
            foreach (InvMarketGroup marketGroup in s_marketGroups.Concat(s_injectedMarketGroups))
            {
                var group = new SerializableBlueprintGroup
                                {
                                    ID = marketGroup.ID,
                                    Name = marketGroup.Name,
                                };

                groups[marketGroup.ID] = group;

                // Add the items in this group
                var blueprints = new List<SerializableBlueprint>();
                foreach (InvType item in s_types.Where(x => x.MarketGroupID == marketGroup.ID
                                       && s_groups[x.GroupID].CategoryID == DBConstants.BlueprintCategoryID
                                       && s_groups[x.GroupID].Published))
                {
                    CreateBlueprint(item, blueprints);
                }

                // Store the items
                group.Blueprints = blueprints.OrderBy(x => x.Name).ToArray();
            }

            // Create the parent-children groups relations
            foreach (SerializableBlueprintGroup group in groups.Values)
            {
                IEnumerable<SerializableBlueprintGroup> children = s_marketGroups.Concat(
                    s_injectedMarketGroups).Where(x => x.ParentID == group.ID).Select(x => groups[x.ID]);

                group.SubGroups = children.OrderBy(x => x.Name).ToArray();
            }

            // Sort groups
            IOrderedEnumerable<SerializableBlueprintGroup> blueprintGroups = s_marketGroups.Concat(
                s_injectedMarketGroups).Where(x => x.ParentID == DBConstants.BlueprintsGroupID)
                .Select(x => groups[x.ID]).OrderBy(x => x.Name);

            s_endTime = DateTime.Now;
            Console.WriteLine(String.Format(" in {0}", s_endTime.Subtract(s_startTime)).TrimEnd('0'));

            // Serialize
            var datafile = new BlueprintsDatafile();
            datafile.Groups = blueprintGroups.ToArray();
            Util.SerializeXML(datafile, DatafileConstants.BlueprintsDatafile);
        }
예제 #4
0
 /// <summary>
 /// Deserialization constructor for root category only
 /// </summary>
 /// <param name="src"></param>
 public MarketGroup(SerializableBlueprintGroup src)
 {
     m_id = src.ID;
     m_name = src.Name;
 }