Example #1
0
        public override void Open()
        {
            DisplayParse parser = new DisplayParse();

            parser.ParseFile(_Path);
            this.RecordFormats = parser.GetRecordFormats();
            localFields        = new Dictionary <string, View>();

            string indicator;

            foreach (RecordInfo format in RecordFormats.Values)
            {
                if (format.Keywords != null)
                {
                    foreach (string keyword in format.Keywords.Keys)
                    {
                        if (keyword.StartsWith("CF") && keyword.Length == 4)
                        {
                            //Sets the function key up
                            indicator = keyword.Substring(2, 2).TrimStart('0');
                            format.Function[DisplayParse.IntToKey(int.Parse(indicator))] = int.Parse(format.Keywords[keyword]);
                        }
                    }
                }
            }
        }
Example #2
0
        public override void Open()
        {
            DisplayParse parser = new DisplayParse();

            parser.ParseFile(_Path);
            this.RecordFormats = parser.GetRecordFormats();
            localFields        = new Dictionary <string, View>();

            string indicator, currentSubfile;

            foreach (RecordInfo format in RecordFormats.Values)
            {
                if (format.Name == "GLOBAL")
                {
                    continue;
                }
                else
                {
                    foreach (var pair in RecordFormats["GLOBAL"].Keywords)
                    {
                        format.Keywords.Add(pair.Key, pair.Value);
                    }
                }

                currentSubfile = "";

                if (format.Keywords != null)
                {
                    foreach (string keyword in format.Keywords.Keys)
                    {
                        switch (keyword)
                        {
                        case "SFLCTL":
                            if (Subfiles == null)
                            {
                                Subfiles = new Dictionary <string, Subfile>();
                            }

                            currentSubfile = format.Keywords[keyword];
                            Subfiles.Add(
                                currentSubfile,
                                new Subfile()
                            {
                                rows = new List <Row>()
                            }
                                );
                            break;

                        case "SFLPAG":
                            Subfiles[currentSubfile].PerPage = int.Parse(format.Keywords[keyword]);
                            break;

                        case "SFLSIZ":
                            Subfiles[currentSubfile].MaxRows = int.Parse(format.Keywords[keyword]);
                            break;

                        case "PAGEUP":
                        case "ROLLDOWN":
                            format.Function[Key.PageUp] = int.Parse(format.Keywords[keyword]);
                            break;

                        case "PAGEDOWN":
                        case "ROLLUP":
                            format.Function[Key.PageDown] = int.Parse(format.Keywords[keyword]);
                            break;

                        default:
                            if (keyword.StartsWith("CF") && keyword.Length == 4)
                            {
                                //Sets the function key up
                                indicator = keyword.Substring(2, 2).TrimStart('0');
                                format.Function[DisplayParse.IntToKey(int.Parse(indicator))] = int.Parse(format.Keywords[keyword]);
                            }
                            break;
                        }
                    }
                }
            }
        }