Exemplo n.º 1
0
 /// <summary>
 /// Deserialization constructor for root category only.
 /// </summary>
 /// <param name="src">Source Serializable Market Group</param>
 private MarketGroup(SerializableMarketGroup src)
 {
     ID        = src.ID;
     Name      = src.Name;
     SubGroups = new MarketGroupCollection(this, src.SubGroups);
     Items     = new ItemCollection(this, src.Items);
 }
Exemplo n.º 2
0
Arquivo: Items.cs Projeto: rsrg/evemon
        /// <summary>
        /// Creates the market groups.
        /// </summary>
        /// <param name="groups">The groups.</param>
        private static void CreateMarketGroups(IDictionary <int, SerializableMarketGroup> groups)
        {
            foreach (InvMarketGroups marketGroup in Database.InvMarketGroupsTable.Concat(
                         s_injectedMarketGroups))
            {
                var group = new SerializableMarketGroup
                {
                    ID = marketGroup.ID, Name = marketGroup.Name
                };
                groups[marketGroup.ID] = group;

                // Add the items in this group; excluding implants which are added below
                var items = new List <SerializableItem>();
                if (s_invTypesPerMarketGroup.ContainsKey(marketGroup.ID))
                {
                    bool validGroup = marketGroup.ParentID != DBConstants.RootNonMarketGroupID;
                    foreach (var srcItem in s_invTypesPerMarketGroup[marketGroup.ID])
                    {
                        if (!srcItem.Generated && (validGroup || Database.InvGroupsTable[
                                                       srcItem.GroupID].CategoryID != DBConstants.ImplantCategoryID ||
                                                   srcItem.GroupID == DBConstants.CyberLearningImplantsGroupID))
                        {
                            CreateItem(srcItem, items);
                        }
                    }
                }

                // Store the items
                group.Items.AddRange(items.OrderBy(x => x.Name));
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Deserialization constructor for root category only
 /// </summary>
 /// <param name="src">Source Serializable Market Group</param>
 public MarketGroup(SerializableMarketGroup src)
 {
     m_id            = src.ID;
     m_name          = src.Name;
     m_subCategories = new MarketGroupCollection(this, src.SubGroups);
     m_items         = new ItemCollection(this, src.Items);
 }
Exemplo n.º 4
0
        /// <summary>
        /// Sets the item family according to its market group
        /// </summary>
        /// <param name="group"></param>
        /// <param name="itemFamily"></param>
        private static void SetItemFamilyByMarketGroup(SerializableMarketGroup group, ItemFamily itemFamily)
        {
            foreach (SerializableItem item in group.Items)
            {
                item.Family = itemFamily;
            }

            foreach (SerializableMarketGroup childGroup in group.SubGroups)
            {
                SetItemFamilyByMarketGroup(childGroup, itemFamily);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates the market groups.
        /// </summary>
        /// <param name="groups">The groups.</param>
        private static void CreateMarketGroups(IDictionary <int, SerializableMarketGroup> groups)
        {
            foreach (InvMarketGroups marketGroup in Database.InvMarketGroupsTable.Concat(s_injectedMarketGroups))
            {
                SerializableMarketGroup group = new SerializableMarketGroup {
                    ID = marketGroup.ID, Name = marketGroup.Name
                };
                groups[marketGroup.ID] = group;

                // Add the items in this group; excluding the implants we are adding below
                List <SerializableItem> items = new List <SerializableItem>();
                foreach (InvTypes srcItem in Database.InvTypesTable.Where(
                             item => !item.Generated && item.MarketGroupID.GetValueOrDefault() == marketGroup.ID).Where(
                             srcItem => marketGroup.ParentID != DBConstants.RootNonMarketGroupID ||
                             Database.InvGroupsTable[srcItem.GroupID].CategoryID != DBConstants.ImplantCategoryID ||
                             srcItem.GroupID == DBConstants.CyberLearningImplantsGroupID))
                {
                    CreateItem(srcItem, items);
                }

                // Store the items
                group.Items.AddRange(items.OrderBy(x => x.Name));
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Deserialization constructor.
 /// </summary>
 /// <param name="parent">The Market Group this Market Group is contained within</param>
 /// <param name="src">Source Serializable Market Group</param>
 public MarketGroup(MarketGroup parent, SerializableMarketGroup src)
     : this(src)
 {
     ParentGroup = parent;
 }