Exemplo n.º 1
0
        public static DataSet[] CreateStructs(string file, Boolean qualified = false)
        {
            List <DataSet> Structures = new List <DataSet>();

            DataSet        currentStruct = null;
            List <DataSet> subfields     = null;

            DisplayParse parser = new DisplayParse();

            parser.ParseFile(Path.Combine(Environment.CurrentDirectory, "objects", file + ".dspf"));

            foreach (RecordInfo format in parser.GetRecordFormats().Values)
            {
                currentStruct            = new DataSet(format.Name);
                currentStruct._Type      = Types.Structure;
                currentStruct._Qualified = qualified;

                subfields = new List <DataSet>();
                foreach (FieldInfo field in format.Fields)
                {
                    if (field.fieldType != FieldInfo.FieldType.Const)
                    {
                        subfields.Add(field.dataType);
                    }
                }

                currentStruct._Subfields = subfields;
                Structures.Add(currentStruct);
            }

            return(Structures.ToArray());
        }
Exemplo n.º 2
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]);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
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;
                        }
                    }
                }
            }
        }