Beispiel #1
0
        public static void readFolder(string path, Hashtable collection)
        {
            if (Directory.Exists(path))
            {
                string[] files = System.IO.Directory.GetFiles(path, "*.xpo");
                foreach (string file in files)
                {
                    string          name       = file.Substring(path.Length + 1, file.Length - path.Length - 5);
                    XpoReader       SourceFile = new XpoReader(file);
                    string          xpoText    = SourceFile.Text();
                    MatchCollection matches    = Regex.Matches(xpoText,
                                                               @"FIELD[ ][#]([\w]+)[\s\S]*?PROPERTIES([\s\S]*?)ENDPROPERTIES", RegexOptions.Compiled);
                    foreach (Match match in matches)
                    {
                        string fieldName  = match.Groups[1].Value.Trim();
                        string properties = match.Groups[2].Value.Trim();
                        string typename   = SourceFile.GetPropertyValue("ARRAY \r\n", properties);
                        if (typename == String.Empty)
                        {
                            typename = SourceFile.GetPropertyValue("EnumType", properties);
                        }

                        FieldDictionaryBase d = new FieldDictionaryBase();
                        d.TableName = name;
                        d.FieldName = fieldName;
                        d.TypeName  = typename;
                        if (typename == string.Empty)
                        {
                            d.ArraySize = 1;
                        }
                        else
                        {
                            d.ArraySize = XpoRefactor.Dictionary.typeArraySize(typename);
                        }

                        if (!collection.ContainsKey(d.Key))
                        {
                            collection.Add(d.Key, d);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        static private int readArrayLength(string FileName)
        {
            XpoReader SourceFile        = new XpoReader(FileName);
            string    ArraySizeProperty = SourceFile.GetPropertyValue("ArraySize");

            if (ArraySizeProperty != String.Empty)
            {
                return(Int32.Parse(ArraySizeProperty));
            }
            return(1);
        }