Exemplo n.º 1
0
        public IIDType ReadAsIID(string file, string label)
        {
            string val  = this.Read(file, label);
            HItem  item = new HItem("iid", val);

            return((IIDType)item.Value);
        }
Exemplo n.º 2
0
        public double ReadAsDouble(string file, string label)
        {
            string val  = this.Read(file, label);
            HItem  item = new HItem("double", val);

            return((double)item.Value);
        }
Exemplo n.º 3
0
        public static void Initialize(string path)
        {
            StreamReader sr = new StreamReader(path);

            items = new HItem[labels.Length];

            string line;

            string[] str_mas;
            string[] delims = new string[] { " ", "\t" };

            line = sr.ReadLine();
            int labels_count = 0;

            while (line != null)
            {
                str_mas = line.Split(delims, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < labels.Length; i++)
                {
                    if (str_mas[0] == labels[i])
                    {
                        labels_count++;
                        try
                        {
                            items[i] = new HItem(types[i], str_mas[1]);
                        }
                        catch
                        {
                            error_string += string.Format("Cannot read {0} value.\r\n", labels[i]);
                        }
                        break;
                    }
                }
                line = sr.ReadLine();
            }
            if (labels_count < labels.Length)
            {
                error_string += "Not all keys has been found.\r\n";
            }
        }