Пример #1
0
        private static IEnumerable <Section> getSectionsByKey(Resume resume, IEnumerable <RegexItem> sectionRegexItems, string mappingKey)
        {
            List <Section>     sections    = new List <Section>();
            IList <RawSection> rawSections = getRawSections(resume, sectionRegexItems);

            if (rawSections.Count != 0)
            {
                for (int i = 0; i < rawSections.Count; i++)
                {
                    RawSection current = rawSections[i];
                    RawSection next    = (i < (rawSections.Count - 1)) ? rawSections[i + 1] : null;
                    if (current.getString1() == null)
                    {
                        Section section = new Section();
                        section.Type     = "other";
                        section.Content  = current.Content;
                        section.Language = resume.Language;
                        sections.Add(section);
                    }
                    else if ((next != null) && (next.getString1() == null))
                    {
                        Section section = new Section();
                        section.Type     = current.getSectionType();
                        section.Content  = next.Content;
                        section.Language = resume.Language;
                        sections.Add(section);
                        i++;
                    }
                }
            }
            return(sections.Where(t => (t.Type == mappingKey)));
        }
Пример #2
0
 private static CashOperationsSection ParseCashFlowOperationsSection(RawSection section) => new CashOperationsSection(
     section.Name,
     section.Tables.First().Rows.Select(a => ParseCashFlowSummaryRow(a.Fields)).ToArray(),
     section
     .Tables
     .Skip(1)
     .ToDictionary(
         a => a.Columns.Single(),
         a => (IReadOnlyList <CashFlowOperationRow>)a.ChildTables.Single().Rows.Select(a => ParseCashFlowOperationRow(a.Fields)).ToArray()));
Пример #3
0
        private static IList <RawSection> getRawSections(Resume resume, IEnumerable <RegexItem> sectionRegexItems)
        {
            RawSection first = new RawSection();

            first.Content = resume.Content;
            IList <RawSection> rawSections = new List <RawSection>();

            rawSections.Add(first);
            return(parserRawSections(rawSections, sectionRegexItems));
        }
Пример #4
0
 /// <summary>
 /// Gets and returns the raw list for a supplied <see cref="RawSection"/>.
 /// </summary>
 /// <param name="section">The <see cref="RawSection"/> to get a list of raws for.</param>
 /// <returns>A <see cref="RawList"/> containing raws of the given <see cref="RawSection"/>.</returns>
 public RawList this[RawSection section]
 {
     get
     {
         RawList list = null;
         if (!sectionLookup.ContainsKey(section))
         {
             list = new RawList(); lists.Add(list); sectionLookup.Add(section, lists.IndexOf(list));
         }
         else
         {
             list = lists[sectionLookup[section]];
         }
         return(list);
     }
 }
Пример #5
0
        object IHost.Request(IAddOn sender, string request, params object[] args)
        {
            //Prepare
            int        value      = 0;
            RawSection section    = 0;
            StringId   stringId   = StringId.Zero;
            TagId      tagId      = TagId.Null;
            Stream     dataStream = null;
            IndexEntry entry      = null;

            //Handle Request
            switch (request)
            {
            case "Map": return(map);

            case "SelectedEntry": return(selectedEntry);

            case "Xbox": return(DebugXbox);

            case "StringBrowserDialog":
                //Prepare
                if (args.Length > 0 && args[0] is StringId)
                {
                    stringId = (StringId)args[0];
                }

                //Initialize Tag Browser Dialog
                using (StringSelectDialog stringDlg = new StringSelectDialog(map.Strings.ToList()))
                {
                    //Set
                    stringDlg.SelectedString = stringId;

                    //Show
                    if (stringDlg.ShowDialog() == DialogResult.OK)
                    {
                        stringId = stringDlg.SelectedString;
                    }
                }

                //Return
                return(stringId);

            case "TagBrowserDialog":
                //Prepare
                if (args.Length > 0 && args[0] is TagId)
                {
                    tagId = (TagId)args[0];
                }

                //Initialize Tag Browser Dialog
                using (TagBrowserDialog tagDlg = new TagBrowserDialog(map.IndexEntries, map.Name))
                {
                    //Set
                    tagDlg.SelectedID = tagId;

                    //Show
                    if (tagDlg.ShowDialog() == DialogResult.OK)
                    {
                        tagId = tagDlg.SelectedID;
                    }
                }

                //Return
                return(tagId);

            case "SelectEntry":
                //Prepare
                if (args.Length > 0 && args[0] is TagId)
                {
                    tagId = (TagId)args[0];
                }

                //Check ID...
                if (!tagId.IsNull && entries.ContainsKey(tagId))
                {
                    //Select
                    var                wrapper = entries[tagId];
                    string[]           parts = $"{wrapper.Filename}.{wrapper.Root}".Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries);
                    TreeNodeCollection collection = tagTreeView.Nodes; TreeNode node = null;
                    for (int i = 0; i < parts.Length; i++)
                    {
                        //Get Node
                        node = collection[parts[i]];

                        //Check
                        if (node != null)
                        {
                            collection = node.Nodes;
                        }
                    }

                    //Check
                    if (node != null)
                    {
                        //Select and goto
                        tagTreeView.SelectedNode = node;
                        node.EnsureVisible();
                    }
                }
                return(selectedEntry);

            case "RawDataStream":
                //Check Parameters
                if (args.Length > 2 && (args[0] is IndexEntry || args[0] is TagId) && args[1] is RawSection && args[2] is int)
                {
                    //Get Parameters
                    if (args[0] is IndexEntry)
                    {
                        entry = (IndexEntry)args[0];
                    }
                    else
                    {
                        entry = map.IndexEntries[(TagId)args[0]];
                    }
                    section = (RawSection)args[1];
                    value   = (int)args[2];

                    //Check
                    if (entry != null)
                    {
                        switch (value & 0xC0000000 >> 29)
                        {
                        case 0: if (entry.Raws[section].ContainsRawOffset(value))
                            {
                                dataStream = (Stream)entry.Raws[section][value].Clone();
                            }
                            break;

                        case 1: break;

                        case 2: break;

                        case 3: break;
                        }
                    }
                }
                return(dataStream);

            default: return(null);
            }
        }
Пример #6
0
 private static OtherTradesSection ParseOtherTradesSection(RawSection section) => new OtherTradesSection(
     section.Name,
     section.Tables.Single().Rows.Select(a => ParseOtherTradeRow(a.Fields)).ToArray());
Пример #7
0
 private static CodeDefinitionsSection ParseCodeDefinitionsSection(RawSection section) => new CodeDefinitionsSection(
     section.Name,
     section.Tables.Single().Rows.Select(a => ParseCodeDefinitionRow(a.Fields)).ToArray());
Пример #8
0
 private static ExchangeInformationSection ParseExchangeInformation(RawSection section) => new ExchangeInformationSection(
     section.Name,
     section.Tables.Single().Rows.Select(a => ParseExchangeInformationRow(a.Fields)).ToArray());