Example #1
0
        public void ParsePlugin(string fileName)
        {
            List <mValue> list     = new List <mValue>();
            XmlDocument   document = new XmlDocument();

            document.Load(fileName);
            XmlElement documentElement = document.DocumentElement;

            TagClass   = documentElement.Attributes["class"].Value;
            HeaderSize = int.Parse(documentElement.Attributes["headersize"].Value);
            Revisions  = new List <mRevision>();
            ValueList  = new List <mValue>();
            for (int i = 0; i < documentElement.ChildNodes.Count; i++)
            {
                if (documentElement.ChildNodes[i].Name != "revision")
                {
                    mValue item = ReadNode(documentElement.ChildNodes[i]);
                    if (item.Attributes != mValue.ObjectAttributes.None)
                    {
                        ValueList.Add(item);
                    }
                }
                else
                {
                    mRevision revision = new mRevision {
                        Author      = documentElement.ChildNodes[i].Attributes["author"].Value,
                        Version     = float.Parse(documentElement.ChildNodes[i].Attributes["version"].Value),
                        Description = documentElement.ChildNodes[i].InnerText
                    };
                    Revisions.Add(revision);
                }
            }
        }
Example #2
0
        public void ParsePlugin(string fileName)
        {
            //Initialize our Value List.
            List <mValue> valueList = new List <mValue>();

            //Initialize our XmlDocument for parsing
            XmlDocument xmlDoc = new XmlDocument();

            //Load our plugin
            xmlDoc.Load(fileName);

            //Get the root to read the header information from
            XmlElement root = xmlDoc.DocumentElement;

            //Parse our basic information. Plugin Class first.
            TagClass = root.Attributes["class"].Value;
            //Now we parse the author.
            Author = root.Attributes["author"].Value;
            //Then we parse the version of the plugin.
            Version = float.Parse(root.Attributes["version"].Value);
            //Parse the headersize, which will indicate how big the Tag is without any reflexives.
            HeaderSize = int.Parse(root.Attributes["headersize"].Value);

            //Initialize our revision list incase there are revisions.
            Revisions = new List <mRevision>();
            //Initialize our value list.
            ValueList = new List <mValue>();
            //Loop through all the nodes
            for (int i = 0; i < root.ChildNodes.Count; i++)
            {
                //If the name isnt revision...
                if (root.ChildNodes[i].Name != "revision")
                {
                    //Then get the returned value.
                    mValue returnedVal = ReadNode(root.ChildNodes[i]);
                    //And if it isn't an unknown value
                    if (returnedVal.Attributes != mValue.ObjectAttributes.None)
                    {
                        //Then add it to the list.
                        ValueList.Add(returnedVal);
                    }
                }
                else
                {
                    //Otherwise...
                    //Initialize a new instance of our revision.
                    mRevision revision = new mRevision();
                    //Set the author for this revision.
                    revision.Author = root.ChildNodes[i].Attributes["author"].Value;
                    //Set the version for this revision.
                    revision.Version = float.Parse(root.ChildNodes[i].Attributes["version"].Value);
                    //Set the description for this revision.
                    revision.Description = root.ChildNodes[i].InnerText;
                    //Add the revision to the Revisions list.
                    Revisions.Add(revision);
                }
            }
        }
        public void GeneratePlugins(string outputFolder, bool remapMetaHeaders)
        {
            if (remapMetaHeaders)
            {
                GetMetaHeaderDataBlocksMapped(true, true, true);
            }
            List <string> list = new List <string>();

            for (int i = 0; i < MetaHeader_Data_Blocks.Count; i++)
            {
                if (!list.Contains(MetaHeader_Data_Blocks[i].Tag_Class))
                {
                    list.Add(MetaHeader_Data_Blocks[i].Tag_Class);
                }
            }
            foreach (string str in list)
            {
                XmlParser parser = new XmlParser();
                mRevision item   = new mRevision {
                    Author      = "DarkShallFall",
                    Version     = 0.1f,
                    Description = "Mapped plugin structure a new."
                };
                parser.Revisions.Add(item);
                parser.TagClass = str;
                List <PluginDataBlock> pDBList = new List <PluginDataBlock>();
                foreach (MetaHeader_DataBlock block in MetaHeader_Data_Blocks)
                {
                    if (block.Tag_Class == str)
                    {
                        pDBList.Add(block);
                    }
                }
                parser.HeaderSize = FindMostLikelySizeForChunk(pDBList);
                try
                {
                    MapPluginWithPDBList(parser.ValueList, pDBList, parser.HeaderSize, 0);
                    parser.WritePlugin(outputFolder + @"\" + str.Replace('<', '_').Replace('>', '_').Replace(" ", "") + ".asc");
                }
                catch
                {
                }
            }
        }
Example #4
0
        /// <summary>
        /// This void will generate plugins to a given path.
        /// </summary>
        public void GeneratePlugins(string outputFolder, bool remapMetaHeaders)
        {
            //If we are to remap the meta headers
            if (remapMetaHeaders)
            {
                //Map our structures out.
                GetMetaHeaderDataBlocksMapped(true, true);
            }

            //Initialize our temporary done list
            List <string> doneTagClasses = new List <string>();

            //Loop through every tag
            for (int i = 0; i < MetaHeader_Data_Blocks.Count; i++)
            {
                //If we don't got this tagclass.
                if (!doneTagClasses.Contains(MetaHeader_Data_Blocks[i].Tag_Class))
                {
                    //Add it to our list
                    doneTagClasses.Add(MetaHeader_Data_Blocks[i].Tag_Class);
                }
            }

            //Loop for each tagclass in our tag hierarchy
            foreach (string T_C in doneTagClasses)
            {
                //Initialize our new XmlParser
                XmlParser xmlP = new XmlParser();

                //Let's create our revision
                mRevision mRev = new mRevision();
                mRev.Author      = "-DeToX-";
                mRev.Version     = 0.1f;
                mRev.Description = "Mapped plugin structure a new.";

                //Add it
                xmlP.Revisions.Add(mRev);

                //Set our author.
                xmlP.Author   = "-DeToX-";
                xmlP.Version  = 0.1f;
                xmlP.TagClass = T_C;

                //Create our MetaHeader_DataBlock list
                List <PluginDataBlock> PDBList = new List <PluginDataBlock>();

                //Loop for each tag of this class
                foreach (MetaHeader_DataBlock db in MetaHeader_Data_Blocks)
                {
                    //If it's the class we're looking for
                    if (db.Tag_Class == T_C)
                    {
                        //Add it to our list
                        PDBList.Add(db);
                    }
                }

                //Set our header size
                xmlP.HeaderSize = FindMostLikelySizeForChunk(PDBList);

                //Map our plugin with our PDBList
                MapPluginWithPDBList(xmlP.ValueList, PDBList, xmlP.HeaderSize, 0);

                //Write our plugin
                xmlP.WritePlugin(outputFolder + "\\" + T_C.Replace('<', '_').Replace('>', '_').Replace(" ", "") + ".alt");
            }
        }