示例#1
0
        public IEnumerable <MyData> Get(string id, int fromVal, int toVal)
        {
            MetaParser myParser = new MetaParser {
                Source = id, FromValue = fromVal, ToValue = toVal
            };

            myParser.Parse();
            return(myParser.myDataList);
        }
示例#2
0
        /// <summary>
        /// Called by ProcessResponseForXXX in order to create status for Alert returned by server.
        /// </summary>
        /// <param name="alert"></param>
        protected void PrepareStatusForReturnedAlert(SyncMLAlert alert)
        {
            switch (alert.Data.Content)
            {
            case "200":
            case "201":
            case "202":
            case "203":
            case "204":
            case "205":
                SyncMLStatus responseStatus = SyncMLStatus.Create();
                //status.CmdID is not defined here, but only defined right before sending next message
                responseStatus.MsgRef.Content = ServerSyncML.Hdr.MsgID.Content;
                responseStatus.Data.Content   = "200";
                responseStatus.Cmd.Content    = "Alert";
                responseStatus.CmdRef.Content = alert.CmdID.Content;
                responseStatus.TargetRefCollection.Add(SyncMLSimpleElementFactory.Create <SyncMLTargetRef>(Facade.ContactDataSourceAtServer));
                responseStatus.SourceRefCollection.Add(SyncMLSimpleElementFactory.Create <SyncMLSourceRef>(Facade.LocalDataSource.DataSourceName));

                //Get alert anchor next
                SyncMLItem alertItem       = alert.ItemCollection[0]; //assuming there's always one.
                SyncMLMeta alertItemMeta   = alertItem.Meta;          // assuming there's always one.
                MetaParser metaParser      = new MetaParser(alertItemMeta.Xml);
                MetaAnchor alertAnchor     = metaParser.GetMetaAnchor();
                string     alertAnchorNext = alertAnchor.Next.Content;

                SyncMLItem statusItem   = SyncMLItem.Create();
                MetaAnchor statusAnchor = MetaAnchor.Create();
                statusAnchor.Next = SyncMLSimpleElementFactory.Create <MetaNext>(alertAnchorNext);
                statusItem.Data.Xml.Add(statusAnchor.Xml);

                responseStatus.ItemCollection.Add(statusItem);

                Facade.ResponseCommandPool.Add(responseStatus);
                break;

            case "100":
                //Show. The Data element type contains content information that should be processed and displayed through the user agent.
                string serverStatusMessage = alert.ItemCollection[0].Data.Content;
                Facade.DisplayOperationMessage(serverStatusMessage);

                SyncMLStatus statusFor100 = SyncMLStatus.Create();
                statusFor100.MsgRef.Content = ServerSyncML.Hdr.MsgID.Content;
                statusFor100.Data.Content   = "200";
                statusFor100.Cmd.Content    = "Alert";
                statusFor100.CmdRef.Content = alert.CmdID.Content;
                Facade.ResponseCommandPool.Add(statusFor100);

                break;

            default:
                Trace.TraceInformation("Do not know what to do in PrepareStatusForReturnedAlert:");
                Trace.TraceInformation(alert.Xml.ToString());
                break;
            }
        }
示例#3
0
        public void ITC23HardCodeParser()
        {
            // Test hard coded grammar
            // Status is for collection of errors
            ParserStatus status         = new ParserStatus(null);
            Parser       hardcodeParser = MetaParser.GetHardCodeParser(status);
            string       actual         = hardcodeParser.GetGrammar();
            string       expect         = GetExpectHardCodeGrammar();
            string       msg            = Util.CompareTextLines(actual, expect);

            Assert.AreEqual(string.Empty, msg, "Hardcode grammar diff error");
        }
 public async Task <IEnumerable <MetaData> > GetMetaData(string sourcePath, bool recursive, params MetaType[] types)
 {
     try
     {
         MetaParserConfig config = new MetaParserConfig()
         {
             Recursive = recursive, FilterTypes = types
         };
         return(await MetaParser.ParseAsync(sourcePath, config));
     }
     catch (MetaParseException ex)
     {
         throw new MediaQuerierException("Failed to parse meta data", ex);
     }
 }
        public int ParseNonTerminal(string name, bool isExplicit, string expression)
        {
            var parser = new MetaParser();
            var stack  = new Stack <ParseNode>();

            foreach (var token in parser.Parse(expression))
            {
                ParseInternal(stack, token);
            }

            var remain = new List <ParseNode>();

            while (stack.Count > 0)
            {
                remain.Add(stack.Pop());
            }
            ParseGroup(remain, name, true);
            return(0);
        }
示例#6
0
        protected override void HandleServerStatus(SyncMLStatus status)
        {
            string statusCode = status.Data.Content;

            Debug.WriteLine("Status " + statusCode + ": " + GetStatusReport(status));
            switch (status.CmdRef.Content)
            {
            case "0":     //Handle header authentication
                switch (statusCode)
                {
                case "212":
                    Facade.DisplayOperationMessage("Log on to SyncML server successfully.");
                    LoggedOn             = true;
                    AuthenticationStatus = SyncMLAuthenticationStatus.LoggedOn;

                    MetaParser parser2   = new MetaParser(status.Chal.Meta.Xml);
                    MetaType   metaType2 = parser2.GetMetaType();
                    if (metaType2 != null)
                    {
                        if (metaType2.Content == "syncml:auth-basic")
                        {
                            AuthenticationStatus = SyncMLAuthenticationStatus.Base64Chal;
                            Facade.AuthenticationTypeOfNextMessage = SyncMLAuthenticationType.Base64;
                        }
                        else if (metaType2.Content == "syncml:auth-md5")
                        {
                            AuthenticationStatus = SyncMLAuthenticationStatus.MD5Chal;
                            MetaNextNonce nextNonce = parser2.GetMetaNextNonce();
                            Facade.Md5NextNonceFromServer          = Convert.FromBase64String(nextNonce.Content);
                            Facade.AuthenticationTypeOfNextMessage = SyncMLAuthenticationType.MD5;
                        }
                        else
                        {
                            AuthenticationStatus = SyncMLAuthenticationStatus.UnknownChal;
                        }
                    }

                    break;

                case "407":
                case "401":
                    MetaParser parser   = new MetaParser(status.Chal.Meta.Xml);
                    MetaType   metaType = parser.GetMetaType();
                    if (metaType != null)
                    {
                        if (metaType.Content == "syncml:auth-basic")
                        {
                            AuthenticationStatus = SyncMLAuthenticationStatus.Base64Chal;
                        }
                        else if (metaType.Content == "syncml:auth-md5")
                        {
                            AuthenticationStatus = SyncMLAuthenticationStatus.MD5Chal;
                            MetaNextNonce nextNonce = parser.GetMetaNextNonce();
                            Facade.Md5NextNonceFromServer = Convert.FromBase64String(nextNonce.Content);
                        }
                        else
                        {
                            AuthenticationStatus = SyncMLAuthenticationStatus.UnknownChal;
                        }
                    }
                    else
                    {
                        AuthenticationStatus = SyncMLAuthenticationStatus.FailedID;
                    }
                    Facade.DisplayOperationMessage("Authentication rejected. Please check user name and password.");
                    break;

                default:
                    AuthenticationStatus = SyncMLAuthenticationStatus.UnknownStatus;
                    Facade.DisplayOperationMessage("The server sent back unexpected status code: " + statusCode);
                    Facade.SoFarOK = false;
                    break;
                }

                break;

            case "1":     //server status to the sync alert command
                switch (statusCode)
                {
                case "508":
                    Trace.TraceInformation("Server wants slown sync.");
                    //    Facade.ResponseCommandPool.Add(CreateSyncAlert(SyncType.Slow));
                    break;

                case "200":
                    break;

                default:
                    if (statusCode == "404")
                    {
                        Trace.TraceInformation("The server does not have requested data store.");
                        Facade.DisplayOperationMessage("The server does not have requested data store.");
                    }
                    Trace.TraceInformation(String.Format("Sync request is rejected. The server said: {0}", Facade.StatusMessages.GetMessage(statusCode)));
                    Facade.SoFarOK = false;
                    break;
                }
                break;

            case "2":    // Handle response to previous Get
                if (statusCode == "200")
                {
                    Trace.TraceInformation("Received server device information successfully.");
                }
                else
                {
                    Facade.SoFarOK = false;
                }
                break;

            case "3":     // Handle response to previous Put.
                if (statusCode == "200")
                {
                    Trace.TraceInformation("The server received local device information successfully.");
                }
                else
                {
                    Facade.SoFarOK = false;
                }
                break;

            default:
                Trace.TraceInformation("Unexpected CmdRef in Status.");
                Facade.SoFarOK = false;
                break;
            }
        }
示例#7
0
            public void AddMetaParser(MetaParser metaParser)
            {
                Contracts.AssertValue(metaParser);

                _metaParsers.Add(metaParser);
            }
示例#8
0
        public MetaGrid(MetaParser metaParser)
        {
            InitializeComponent();

            #region Structures

            //Loop through all the structures
            for (int i = 0; i < metaParser.Structures.Count; i++)
            {
                //Initialize a new listViewItem
                ListViewItem lvi = new ListViewItem();
                //Assign the name
                lvi.SubItems[0].Text = metaParser.Structures[i].Name;
                //Add the offset
                lvi.SubItems.Add("0x" + metaParser.Structures[i].Offset.ToString("X"));
                //Add the count
                lvi.SubItems.Add("0x" + metaParser.Structures[i].Count.ToString("X"));
                //Add the pointer
                lvi.SubItems.Add("0x" + metaParser.Structures[i].Pointer.ToString());
                //Add the size
                lvi.SubItems.Add("0x" + metaParser.Structures[i].Size.ToString("X"));
                //Add it to the listView
                reflexiveGrid.Items.Add(lvi);
            }

            #endregion

            #region Idents

            //Loop through all the idents
            for (int i = 0; i < metaParser.Idents.Count; i++)
            {
                //Initialize a new listViewItem
                ListViewItem lvi = new ListViewItem();
                //Assign the name
                lvi.SubItems[0].Text = metaParser.Idents[i].Name;
                //Assign the offset
                lvi.SubItems.Add("0x" + metaParser.Idents[i].Offset.ToString("X"));
                //Assign the TagClass
                lvi.SubItems.Add(metaParser.Idents[i].TagClass);
                //Assign the TagName
                lvi.SubItems.Add(metaParser.Idents[i].TagName);
                //Add it to the listView
                identGrid.Items.Add(lvi);
            }

            #endregion

            #region Strings
            //Loop through all the idents
            for (int i = 0; i < metaParser.Strings.Count; i++)
            {
                //Initialize a new listViewItem
                ListViewItem lvi = new ListViewItem();
                //Assign the name
                lvi.SubItems[0].Text = metaParser.Strings[i].Name;
                //Assign the offset
                lvi.SubItems.Add("0x" + metaParser.Strings[i].Offset.ToString("X"));
                //Assign the string index
                lvi.SubItems.Add(metaParser.Strings[i].StringIndex.ToString());
                //Assign the string id
                lvi.SubItems.Add("0x" + metaParser.Strings[i].Identifier.ToString("X"));
                //Assign the string name
                lvi.SubItems.Add(metaParser.Strings[i].StringName);
                //Add it to the listView
                stringGrid.Items.Add(lvi);
            }
            #endregion

            #region Finishing Touches

            //Dock all grids.
            reflexiveGrid.Dock = DockStyle.Fill;
            identGrid.Dock     = DockStyle.Fill;
            stringGrid.Dock    = DockStyle.Fill;

            //Determine the last viewed grid
            switch (AppSettings.Settings.LastGridView)
            {
            case Settings.Settings.LastGridViews.Structure:
            {
                //Select the structure list
                SelectStructureList();
                break;
            }

            case Settings.Settings.LastGridViews.Ident:
            {
                //Select the ident list
                SelectIdentList();
                break;
            }

            case Alteration.Settings.Settings.LastGridViews.Strings:
            {
                //Select the string list
                SelectStringList();
                break;
            }
            }

            //resize columns for all grids
            reflexiveGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            identGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            stringGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            #endregion

            //Assign our instance of the HaloMap class
            Map = metaParser.Map;
        }
        private async Task <CopyItems> ParseItemsAsync(string sourcePath, string destinationPath, ParseSummary summary)
        {
            List <string> ignore = new List <string>();

            if (IgnorePaths != null)
            {
                ignore.AddRange(IgnorePaths);
            }
            if (!sourcePath.DirectoryAreSame(destinationPath))
            {
                ignore.Add(destinationPath);
            }

            IEnumerable <MetaData> data;

            try
            {
                MetaParserConfig config = new MetaParserConfig()
                {
                    Recursive = Recursive, IgnorePaths = ignore
                };
                data = await MetaParser.ParseAsync(sourcePath, config);
            }
            catch (MetaParseException ex)
            {
                throw new MediaOrganizerException("Failed to parse meta data", ex);
            }

            PatternPathParser parser = new PatternPathParser(Locale);

            parser.Preload(data);

            CopyItems items = new CopyItems();

            items.sourcePath      = sourcePath;
            items.destinationPath = destinationPath;

            foreach (MetaData meta in data)
            {
                if (workerAborted)
                {
                    break;
                }

                string path = meta.Path;

                switch (meta.Type)
                {
                case MetaType.Directory:
                    summary.totalDirectories.Add(path);
                    continue;

                case MetaType.File:
                    summary.totalFiles.Add(path);
                    summary.ignored.Add(path);
                    continue;

                default:
                    summary.totalFiles.Add(path);
                    break;
                }

                CopyItem item = ParseItem(parser, destinationPath, meta);
                items.Add(item);
                summary.parsed.Add(path);
            }

            return(items);
        }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="command"></param>
        /// <returns>localId=serverId pair</returns>
        private string ApplyAddOrReplaceCommand(SyncMLUpdateBase command)
        {
            if (command == null)
            {
                return(null);
            }

            bool isBase64     = false;
            bool isAddCommand = false;

            SyncMLMeta commandMeta = command.Meta;
            SyncMLItem commandItem = command.ItemCollection[0]; //assuming there is always one item.

            if (String.IsNullOrEmpty(commandMeta.Content) && (!commandMeta.Xml.HasElements))
            {
                commandMeta = commandItem.Meta;
            }

            MetaParser metaParser = new MetaParser(commandMeta.Xml);
            MetaFormat metaFormat = metaParser.GetMetaFormat();

            if (metaFormat != null)
            {
                isBase64 = metaFormat.Content == "b64";
            }

            MetaType metaType = metaParser.GetMetaType();

            if (metaType == null)
            {
                return(null); //the meta element may be empty, so no need to proceed.
            }

            //    if (contentType == ContactExchangeType.Unknown)
            //todo: add some exception        throw new LocalDataSourceException("expected data is Base64 encoded SIF-C or vCard");

            isAddCommand = command is SyncMLAdd;

            //Assuming there will be only one item.
            string serverId;
            string localId = null;

            serverId = commandItem.Source.LocURI.Content; //id of remote one

            if (!isAddCommand)
            {
                localId = commandItem.Target.LocURI.Content; // entryId of existing contact
            }
            string text = GetTextFromContent(isBase64, metaType.Content, commandItem.Data.Content);

            if (text != null)
            {
                localId = isAddCommand ? sifAgent.AddItem(text) :
                          sifAgent.ReplaceItem(text, localId);

                return(isAddCommand ? localId + "=" + serverId : null);
            }
            else
            {
                return(null);
            }
        }
        }  // using xmlWriter

        /// <summary>
        ///
        /// </summary>
        /// <param name="topElement">the 'Changes' element, to be manipulated</param>
        /// <param name="command"></param>
        private static void WriteAddOrReplaceCommandToXml(XElement topElement, SyncMLUpdateBase command)
        {
            if (command == null)
            {
                return;
            }

            bool isBase64 = false;
            ContactExchangeType contentType = ContactExchangeType.Unknown;
            bool isAddCommand = false;

            string commandTypeStr;

            SyncMLMeta commandMeta = command.Meta;
            SyncMLItem commandItem = command.ItemCollection[0]; //assuming there is always one item.

            if (String.IsNullOrEmpty(commandMeta.Content) && (!commandMeta.Xml.HasElements))
            {
                commandMeta = commandItem.Meta;
            }

            MetaParser metaParser = new MetaParser(commandMeta.Xml);
            MetaFormat metaFormat = metaParser.GetMetaFormat();

            if (metaFormat != null)
            {
                isBase64 = metaFormat.Content == "b64";
            }

            MetaType metaType = metaParser.GetMetaType();

            if (metaType == null)
            {
                return; //the meta element may be empty, so no need to proceed.
            }

            if (metaType.Content == "text/x-s4j-sifc")
            {
                contentType = ContactExchangeType.Sifc;
            }
            else if ((metaType.Content == "text/x-vcard") || (metaType.Content == "text/vcard"))
            {
                contentType = ContactExchangeType.Vcard21;
            }

            if (contentType == ContactExchangeType.Unknown)
            {
                throw new LocalDataSourceException("expected data is Base64 encoded SIF-C or vCard");
            }

            isAddCommand   = command is SyncMLAdd;
            commandTypeStr = isAddCommand ? "New" : "Update";

            //Assuming there will be only one item.
            string id;

            if (isAddCommand)
            {
                id = commandItem.Source.LocURI.Content;
            }
            else
            {
                id = commandItem.Target.LocURI.Content;
            }

            XElement cItem     = new XElement("C", new XAttribute("ID", id));
            XElement changItem = new XElement(commandTypeStr, cItem);

            topElement.Add(changItem);

            switch (contentType)
            {
            case ContactExchangeType.Sifc:     // do not need to check isBase64, because it must be
                cItem.Add(XElement.Parse(Utility.ConvertFromBase64(commandItem.Data.Content)));
                break;

            case ContactExchangeType.Vcard21:
                XElement sifcXml;
                if (isBase64)
                {
                    sifcXml = VCardSIFC.ConvertVCardToSifCXml(VCardReader.ParseText(
                                                                  Utility.ConvertFromBase64(commandItem.Data.Content)));
                }
                else
                {
                    sifcXml = VCardSIFC.ConvertVCardToSifCXml(VCardReader.ParseText(commandItem.Data.Content));
                }

                cItem.Add(sifcXml);
                break;

            default:
                throw new LocalDataSourceException("Can not create stream from command Data.");
            }
        }
示例#12
0
        public void LoadEditor(int tagIndex)
        {
            //Try to..
            try
            {
                //Obtain an instance of the meta editor container.
                MetaEditorContainer existingMetaEditor = (MetaEditorContainer)documentContainer1.ActiveDocument.Controls[0];
            }
            catch
            {
                try
                {
                    MetaGrid MG = (MetaGrid)documentContainer1.ActiveDocument.Controls[0];
                }
                catch
                {
                    //We failed.. its not a meta editor.
                    //Try disposing our current library
                    try
                    {
                        //Dispose our current
                        documentContainer1.ActiveDocument.Controls[0].Dispose();
                    }
                    catch { }
                }
            }

            //If its not null tag Index
            if (tagIndex != -1)
            {
                //Load our Meta Information
                LoadMetaInformation(tagIndex);
                //If we're changing tabs
                if (ChangingTab)
                {
                    //Stop code
                    return;
                }
                Painting = false;
                //Determine the editor to use and load it.

                #region Meta Grid

                if (menuButtonMetaGrid.Checked)
                {
                    //Initialize our metaParser
                    MetaParser metaParser = new MetaParser(Map, tagIndex);

                    //Get our plugin path.
                    string pluginPath = "";

                    //If it's retail halo 3
                    if (Map.Halo_Map_Version == HaloMap.HaloMapVersion.Halo3Retail)
                    {
                        pluginPath = Application.StartupPath + "\\plugins\\halo 3\\" +
                                     Map.IndexItems[tagIndex].Class.Replace(" ", "").Replace("<", "_").Replace(">", "_") +
                                     ".alt";
                    }
                    else if (Map.Halo_Map_Version == HaloMap.HaloMapVersion.Halo3ODST)
                    {
                        pluginPath = Application.StartupPath + "\\plugins\\odst\\" +
                                     Map.IndexItems[tagIndex].Class.Replace(" ", "").Replace("<", "_").Replace(">", "_") +
                                     ".alt";
                    }

                    //Initialize our XmlParser
                    XmlParser xmlparser = new XmlParser();
                    //Parse our xml
                    xmlparser.ParsePlugin(pluginPath);
                    //Parse our meta
                    metaParser.ParseMeta(xmlparser);
                    //Initialize our instance of metaGrid
                    MetaGrid metaGrid = new MetaGrid(metaParser);

                    //Create a new document which we will load in, or grab the selected.
                    DockControl document = GetCurrentSelectedDocument(true);

                    //Clear all controls on this document
                    document.Controls.Clear();

                    //Get our tag last index of name.
                    string[] temporaryString = Map.IndexItems[tagIndex].Name.Split('\\');
                    string   lastIndexName   = temporaryString[temporaryString.Length - 1];

                    //Set our document text.
                    document.Text = lastIndexName + "." + Map.IndexItems[tagIndex].Class;

                    //Set our document tag to our tag Index.
                    document.Tag = tagIndex;

                    //Add the meta editor to the document
                    document.Controls.Add(metaGrid);
                    //Set our metaEditorContainer to dock.
                    metaGrid.Dock = DockStyle.Fill;
                    //Select it as the active document.
                    documentContainer1.ActiveDocument = document;
                }

                #endregion

                #region Meta Editor

                if (menuButtonMetaEditor.Checked)
                {
                    //Create a new document which we will load in.
                    DockControl document = GetCurrentSelectedDocument(true);

                    //Get our tag last index of name.
                    string[] temporaryString = Map.IndexItems[tagIndex].Name.Split('\\');
                    string   lastIndexName   = temporaryString[temporaryString.Length - 1];

                    //Set our document text.
                    document.Text = lastIndexName + "." + Map.IndexItems[tagIndex].Class;

                    //Set our document tag to our tag Index.
                    document.Tag = tagIndex;

                    //Try to...
                    try
                    {
                        //Obtain an instance of the meta editor container.
                        MetaEditorContainer existingMetaEditor = (MetaEditorContainer)document.Controls[0];
                        //Switch our tag in our existing meta editor
                        existingMetaEditor.SwitchToTag(tagIndex);
                    }
                    //If its not an existing editor.
                    catch
                    {
                        //Clear all controls on this document
                        document.Controls.Clear();

                        //Create our instance of the Meta Editor container.
                        MetaEditorContainer metaEditorContainer = new MetaEditorContainer(Map);
                        //Add the meta editor to the document
                        document.Controls.Add(metaEditorContainer);
                        //Set our metaEditorContainer to dock.
                        metaEditorContainer.Dock = DockStyle.Fill;
                        //Select it as the active document.
                        documentContainer1.ActiveDocument = document;
                        //Load the meta Editor controls and values
                        metaEditorContainer.LoadMetaEditor(tagIndex, AppSettings.Settings.ShowInvisibles);
                    }
                }

                #endregion

                #region Bitmap Editor

                //Decide whether to show our menu item.
                menuBitmapEditor.Visible = (Map.IndexItems[tagIndex].Class == "bitm");
                //If our menuBitmapEditor is invisible.
                if (menuBitmapEditor.Visible && menuBitmapEditor.Checked)
                {
                    //Create a new document which we will load in, or grab the selected.
                    DockControl document = GetCurrentSelectedDocument(true);

                    //Clear all controls on this document
                    document.Controls.Clear();

                    //Get our tag last index of name.
                    string[] temporaryString = Map.IndexItems[tagIndex].Name.Split('\\');
                    string   lastIndexName   = temporaryString[temporaryString.Length - 1];

                    //Set our document text.
                    document.Text = lastIndexName + "." + Map.IndexItems[tagIndex].Class;

                    //Set our document tag to our tag Index.
                    document.Tag = tagIndex;

                    //Create our bitmap viewer
                    BitmapViewer bitmap_viewer = new BitmapViewer();


                    //Add the bitmap editor to the document
                    document.Controls.Add(bitmap_viewer);

                    //Load our bitmap stuff..
                    bitmap_viewer.LoadBitmapTag(Map, tagIndex);
                    bitmap_viewer.Dock = DockStyle.Fill;

                    //Select it as the active document.
                    documentContainer1.ActiveDocument = document;
                }

                #endregion

                Painting = true;
            }
        }
示例#13
0
 public TagGridContainer(MetaParser metaParser)
 {
     InitializeComponent();
     SwitchToTag(metaParser);
 }
示例#14
0
        public void SwitchToTag(MetaParser metaParser)
        {
            lstIdentGrid.Items.Clear();
            lstStringIdentifiersGrid.Items.Clear();
            lstStructuresGrid.Items.Clear();
            lstVoidsGrid.Items.Clear();
            int num;

            for (int index = 0; index < metaParser.Structures.Count; ++index)
            {
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.SubItems[0].Text = metaParser.Structures[index].Name;
                ListViewItem.ListViewSubItemCollection subItems1 = listViewItem.SubItems;
                string str1 = "0x";
                num = metaParser.Structures[index].Offset;
                string str2  = num.ToString("X");
                string text1 = str1 + str2;
                subItems1.Add(text1);
                ListViewItem.ListViewSubItemCollection subItems2 = listViewItem.SubItems;
                num = metaParser.Structures[index].Count;
                string text2 = num.ToString();
                subItems2.Add(text2);
                ListViewItem.ListViewSubItemCollection subItems3 = listViewItem.SubItems;
                num = metaParser.Structures[index].Size;
                string text3 = num.ToString();
                subItems3.Add(text3);
                ListViewItem.ListViewSubItemCollection subItems4 = listViewItem.SubItems;
                string str3 = "0x";
                num = metaParser.Structures[index].Pointer;
                string str4  = num.ToString("X");
                string text4 = str3 + str4;
                subItems4.Add(text4);
                lstStructuresGrid.Items.Add(listViewItem);
            }
            for (int index = 0; index < metaParser.Idents.Count; ++index)
            {
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.SubItems[0].Text = metaParser.Idents[index].Name;
                ListViewItem.ListViewSubItemCollection subItems1 = listViewItem.SubItems;
                string str1 = "0x";
                num = metaParser.Idents[index].Offset;
                string str2  = num.ToString("X");
                string text1 = str1 + str2;
                subItems1.Add(text1);
                ListViewItem.ListViewSubItemCollection subItems2 = listViewItem.SubItems;
                string str3 = "0x";
                num = metaParser.Idents[index].ID;
                string str4  = num.ToString("X");
                string text2 = str3 + str4;
                subItems2.Add(text2);
                listViewItem.SubItems.Add(metaParser.Idents[index].TagClass);
                listViewItem.SubItems.Add(metaParser.Idents[index].TagName);
                lstIdentGrid.Items.Add(listViewItem);
            }
            for (int index = 0; index < metaParser.Strings.Count; ++index)
            {
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.SubItems[0].Text = metaParser.Strings[index].Name;
                ListViewItem.ListViewSubItemCollection subItems1 = listViewItem.SubItems;
                string str1 = "0x";
                num = metaParser.Strings[index].Offset;
                string str2  = num.ToString("X");
                string text1 = str1 + str2;
                subItems1.Add(text1);
                ListViewItem.ListViewSubItemCollection subItems2 = listViewItem.SubItems;
                string str3 = "0x";
                num = metaParser.Strings[index].Identifier;
                string str4  = num.ToString("X");
                string text2 = str3 + str4;
                subItems2.Add(text2);
                listViewItem.SubItems.Add(metaParser.Strings[index].StringName);
                lstStringIdentifiersGrid.Items.Add(listViewItem);
            }
            for (int index = 0; index < metaParser.Tag_Data_Blocks.Count; ++index)
            {
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.SubItems[0].Text = metaParser.Tag_Data_Blocks[index].Name;
                ListViewItem.ListViewSubItemCollection subItems1 = listViewItem.SubItems;
                string str1 = "0x";
                num = metaParser.Tag_Data_Blocks[index].Offset;
                string str2  = num.ToString("X");
                string text1 = str1 + str2;
                subItems1.Add(text1);
                ListViewItem.ListViewSubItemCollection subItems2 = listViewItem.SubItems;
                string str3 = "0x";
                num = metaParser.Tag_Data_Blocks[index].Size;
                string str4  = num.ToString("X");
                string text2 = str3 + str4;
                subItems2.Add(text2);
                ListViewItem.ListViewSubItemCollection subItems3 = listViewItem.SubItems;
                string str5 = "0x";
                num = metaParser.Tag_Data_Blocks[index].Pointer;
                string str6  = num.ToString("X");
                string text3 = str5 + str6;
                subItems3.Add(text3);
                lstVoidsGrid.Items.Add(listViewItem);
            }
            switch (AppSettings.Settings.LastGridView)
            {
            case Ascension.Settings.Settings.LastGridViews.Structure:
                SelectGridToShow(structuresAndVoidsToolStripMenuItem);
                break;

            case Ascension.Settings.Settings.LastGridViews.Ident:
                SelectGridToShow(tagReferencesToolStripMenuItem);
                break;

            case Ascension.Settings.Settings.LastGridViews.Strings:
                SelectGridToShow(stringIdentifiersToolStripMenuItem);
                break;

            case Ascension.Settings.Settings.LastGridViews.Voids:
                SelectGridToShow(tagDataVoidsToolStripMenuItem);
                break;

            default:
                SelectGridToShow(structuresAndVoidsToolStripMenuItem);
                break;
            }
            lstStructuresGrid.Dock        = DockStyle.Fill;
            lstIdentGrid.Dock             = DockStyle.Fill;
            lstStringIdentifiersGrid.Dock = DockStyle.Fill;
            lstVoidsGrid.Dock             = DockStyle.Fill;
            lstStructuresGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            lstIdentGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            lstStringIdentifiersGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            lstVoidsGrid.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
            Map = metaParser.Map;
        }