Exemple #1
0
 private void AddGlobalComponents(XmlSchema schema)
 {
     foreach (XmlSchemaElement el in schema.Elements.Values)
     {
         GlobalElements.Add(el.QualifiedName, el);
     }
     foreach (XmlSchemaAttribute a in schema.Attributes.Values)
     {
         GlobalAttributes.Add(a.QualifiedName, a);
     }
     foreach (XmlSchemaType t in schema.SchemaTypes.Values)
     {
         GlobalTypes.Add(t.QualifiedName, t);
     }
     foreach (XmlSchemaAttributeGroup g in schema.AttributeGroups.Values)
     {
         global_attribute_groups.Add(g.QualifiedName, g);
     }
     foreach (XmlSchemaGroup g in schema.Groups.Values)
     {
         global_groups.Add(g.QualifiedName, g);
     }
     foreach (DictionaryEntry pair in schema.IDCollection)
     {
         global_ids.Add(pair.Key, pair.Value);
     }
     foreach (XmlSchemaIdentityConstraint ic in schema.NamedIdentities.Values)
     {
         global_identity_constraints.Add(ic.QualifiedName, ic);
     }
 }
Exemple #2
0
 private void ClearGlobalComponents()
 {
     GlobalElements.Clear();
     GlobalAttributes.Clear();
     GlobalTypes.Clear();
     global_attribute_groups.Clear();
     global_groups.Clear();
     global_notations.Clear();
     global_ids.Clear();
     global_identity_constraints.Clear();
 }
Exemple #3
0
    void SortBuildings(GlobalAttributes GA)
    {
        List <BaseBuilding> tempList = new List <BaseBuilding>();

        for (int i = 0; i < GA.Buildings.Count; ++i)
        {
            tempList.Add(GA.Buildings.Find(x => x.name == ((Buildings)i).ToString()));
        }
        GA.Buildings.Clear();
        GA.Buildings.AddRange(tempList);
    }
Exemple #4
0
    void SortUnits(GlobalAttributes GA)
    {
        List <BaseUnit> tempList = new List <BaseUnit>();

        for (int i = 0; i < GA.Units.Count; ++i)
        {
            tempList.Add(GA.Units.Find(x => x.name == ((Units)i).ToString()));
        }
        GA.Units.Clear();
        GA.Units.AddRange(tempList);
    }
Exemple #5
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        GlobalAttributes myTarget = (GlobalAttributes)target;

        if (GUILayout.Button("Sort Buildings List"))
        {
            SortBuildings(myTarget);
        }

        if (GUILayout.Button("Sort Units List"))
        {
            SortUnits(myTarget);
        }
    }
Exemple #6
0
        private void SetSMTPParameters(Email email)
        {
            email.Server = GlobalAttributes.Value("SMTPServer");

            int port = 0;

            if (!Int32.TryParse(GlobalAttributes.Value("SMTPPort"), out port))
            {
                port = 0;
            }
            email.Port = port;

            bool useSSL = false;

            if (!bool.TryParse(GlobalAttributes.Value("SMTPUseSSL"), out useSSL))
            {
                useSSL = false;
            }
            email.UseSSL = useSSL;

            email.UserName = GlobalAttributes.Value("SMTPUserName");
            email.Password = GlobalAttributes.Value("SMTPPassword");
        }
Exemple #7
0
 private void Start()
 {
     Global = this;
 }
        public override void Run()
        {
            State = WorkerState.Working;
            parsedSkuExclusions = ParseSkuInclusionAndExclusions(SkuExclusions);
            parsedSkuInclusions = ParseSkuInclusionAndExclusions(SkuInclusions);
            //parsedSkuValueInclusions = ParseSkuValueInclusions(SkuValueInclusions);

            taxonomyAttributesCache = new Dictionary <Guid, List <KeyValuePair <Attribute, SchemaData> > >();
            baseAttributeNames      = new Dictionary <string, string>();
            delimiter = FieldDelimiter.GetValue().ToString();

            //Create new context
            currentDb = new SkuDataDbDataContext();
            var dlo = new DataLoadOptions();

            projectField1Name = AryaTools.Instance.InstanceData.CurrentProject.EntityField1Name ?? string.Empty;
            dlo.LoadWith <TaxonomyInfo>(taxonomyInfo => taxonomyInfo.TaxonomyDatas);
            dlo.LoadWith <EntityInfo>(entityInfo => entityInfo.EntityDatas);
            dlo.LoadWith <SchemaInfo>(schemaInfo => schemaInfo.SchemaDatas);

            dlo.AssociateWith <TaxonomyInfo>(taxonomyInfo => taxonomyInfo.TaxonomyDatas.Where(p => p.Active));
            dlo.AssociateWith <EntityInfo>(entityInfo => entityInfo.EntityDatas.Where(p => p.Active));
            dlo.AssociateWith <SchemaInfo>(schemaInfo => schemaInfo.SchemaDatas.Where(p => p.Active));
            dlo.AssociateWith <TaxonomyInfo>(taxonomyInfo => taxonomyInfo.SkuInfos.Where(p => p.Active));

            currentDb.LoadOptions    = dlo;
            currentDb.CommandTimeout = 2000;

            currentDb.Connection.Open();
            currentDb.Connection.ChangeDatabase(AryaTools.Instance.InstanceData.Dc.Connection.Database);

            InitGlobals(GlobalAttributes.ToList());

            StatusMessage = "Init";

            var fi           = new FileInfo(ExportFileName);
            var baseFileName = fi.FullName.Replace(fi.Extension, string.Empty);

            attributeDataFile = new StreamWriter(baseFileName + "_AttributeData.txt", false, Encoding.UTF8);

            attributeDataFile.Write("ItemId{0}Taxonomy{0}Node Type", delimiter);
            foreach (var attribute in globalAttributeHeaders)
            {
                string attributeHeader = null;
                var    parts           = attribute.Split(':');
                var    noOfHeaders     = 0;
                if (parts.Count() > 1)
                {
                    Int32.TryParse(parts[1].Trim(), out noOfHeaders);
                }
                if (parts.Count() == 2 && noOfHeaders > 0)
                {
                    for (var i = 0; i < noOfHeaders; i++)
                    {
                        if (attributeHeader == null)
                        {
                            attributeHeader += parts[0].Trim() + (i + 1);
                        }
                        else
                        {
                            attributeHeader += "\t" + parts[0].Trim() + (i + 1);
                        }
                    }
                }
                else
                {
                    attributeHeader = attribute;
                }
                attributeDataFile.Write("{0}{1}", delimiter, attributeHeader);
            }

            attributeDataFile.WriteLine("{0}Rank 1{0}Att 1{0}Val 1{0}Uom 1{0}[...]", delimiter);

            CurrentProgress = 0;

            if (SkuCollection != null && SkuCollection.Any())
            {
                var taxonomies =
                    (SkuCollection.Split(2000)
                     .SelectMany(skus => currentDb.Skus.Where(s => skus.Contains(s.ItemID)))
                     .GroupBy(s => s.Taxonomy)).ToList();

                MaximumProgress = taxonomies.Count;

                foreach (var st in taxonomies)
                {
                    WriteSkusToFile(st.Key, st.ToList());
                    CurrentProgress++;
                }
            }
            else
            {
                var allExportTaxonomyIds =
                    Taxonomies.Cast <ExtendedTaxonomyInfo>().Select(p => p.Taxonomy.ID).Distinct().ToList();
                var exportTaxonomies         = currentDb.TaxonomyInfos.Where(p => allExportTaxonomyIds.Contains(p.ID)).ToList();
                var allExportChildTaxonomies = exportTaxonomies.SelectMany(p => p.AllChildren2).Distinct().ToList();

                MaximumProgress = allExportChildTaxonomies.Count;

                foreach (var exportChildTaxonomy in allExportChildTaxonomies)
                {
                    WriteTaxonomyToFile(exportChildTaxonomy);
                    CurrentProgress++;
                }
            }

            attributeDataFile.Close();

            StatusMessage = "Done!";
            State         = WorkerState.Ready;
        }
Exemple #9
0
 public void SetDifficultyHard()
 {
     GlobalAttributes.SetDifficulty(DifHard);
 }
Exemple #10
0
 public void SetDifficultyMedium()
 {
     GlobalAttributes.SetDifficulty(DifMed);
 }
Exemple #11
0
 public void SetDifficultyEasy()
 {
     GlobalAttributes.SetDifficulty(DifEasy);
 }