Example #1
0
        private void checkForTemplatesAndProcess(Add add)
        {
            // we aren't interested in templates for NiObjects or ones with TEMPLATE
            // the TEMPLATE ones we will process recursively

            if (add.template.Length != 0 && add.originaltype.CompareTo("Ref") != 0 &&
                add.originaltype.CompareTo("Ptr") != 0 && add.originaltype.CompareTo("TEMPLATE") != 0
                && add.template.CompareTo("TEMPLATE") != 0)
            {
                Compound value;
                // check to see if we have created a new compound already
                if (NifDataHolder.getInstance().compoundlist.TryGetValue(add.type +
                    add.template.Substring(0, 1).ToUpper() + add.template.Substring(1), out value))
                {
                    string type = add.type;
                    add.type = type + add.template.Substring(0, 1).ToUpper() + add.template.Substring(1);
                    add.returntype = type + add.template.Substring(0, 1).ToUpper() + add.template.Substring(1);
                }
                else
                {
                    Compound original = NifDataHolder.getInstance().compoundtemplatelist[add.type]; //, out value);
                    Compound clone = (Compound)original.Clone();
                    clone.name = clone.name + add.template.Substring(0, 1).ToUpper() + add.template.Substring(1);
                    clone.setAddTypesForTemplate(add.template);

                    foreach (Add cloneadd in clone.addlist)
                    {
                        if (cloneadd.template.CompareTo("TEMPLATE") == 0)
                        {
                            // found a template, set the actual template and process
                            cloneadd.template = add.template;
                            checkForTemplatesAndProcess(cloneadd);
                        }
                    }

                    NifDataHolder.getInstance().compoundlist.Add(clone.name, clone);
                    String type = add.type;
                    add.type = type + add.template.Substring(0, 1).ToUpper() + add.template.Substring(1);
                    add.returntype = type + add.template.Substring(0, 1).ToUpper() + add.template.Substring(1);
                }
            }
        }
Example #2
0
        public void AddAdd(string name, string description, string version1, string version2,
            string type, string array1, string array2, string array3, string defaultvalue, string template,
            string userversion, string condition, string versioncondition, string arguement)
        {
            {
                Add add = new Add();
                add.name = name;
                add.nameindex = name;
                add.template = template;
                add.description = description;
                add.array1 = array1;
                add.array2 = array2;
                add.array3 = array3;
                add.version1 = add.versionConvert(version1);
                add.version2 = add.versionConvert(version2);
                add.type = type;
                add.returntype = type;
                add.template = template;
                add.defaultvalue = defaultvalue;
                add.userversion = userversion;
                add.versioncondition = versioncondition;
                add.condition = condition;
                add.arguement = arguement;

                if (array2.Length != 0)
                {
                    foreach (Add compareitem in _addlist)
                    {
                        if (compareitem.name.CompareTo(add.array2) == 0)
                        {
                            if (compareitem.array1.Length != 0)
                            {
                                add.isarray2array = true;
                            }
                        }
                    }
                }
                _addlist.Add(add);
            }
        }