コード例 #1
0
ファイル: MetaTreeSQL.cs プロジェクト: andreyV512/rag
        public override void Load(ParMainLite _O)
        {
            L.Clear();
            Select S   = new Select(string.Format("select Val from {0} where Unit='{1}'", schema + "." + table_name, Unit));
            string img = null;

            if (S.Read())
            {
                img = S["Val"] as string;
            }
            S.Dispose();
            if (img == null)
            {
                return;
            }
            MemoryStream ms = null;
            StreamReader sr = null;

            try
            {
                byte[] bbb = Encoding.GetEncoding(1251).GetBytes(img);
                ms = new MemoryStream(bbb);
                sr = new StreamReader(ms, Encoding.GetEncoding(1251));
                while (true)
                {
                    string l = sr.ReadLine();
                    if (l == null)
                    {
                        break;
                    }
                    Param p = Param.FromFileString(l);
                    if (p != null)
                    {
                        L.Add(p);
                    }
                }
            }
            catch
            {
                return;
            }
            finally
            {
                if (sr != null)
                {
                    sr.Dispose();
                }
                if (ms != null)
                {
                    ms.Dispose();
                }
            }
            SerialTreeFile serialTree = new SerialTreeFile(L);

            ExecLoad(serialTree, _O, (_O as ParBase).PropertyName);
            serialTree.Dispose();
        }
コード例 #2
0
        public override void Load(ParMainLite _O)
        {
            L.Clear();
            StreamReader sr = null;

            try
            {
                sr = new StreamReader(file_tree, Encoding.GetEncoding(1251));
                while (true)
                {
                    string l = sr.ReadLine();
                    if (l == null)
                    {
                        break;
                    }
                    Param p = Param.FromFileString(l);
                    if (p != null)
                    {
                        L.Add(p);
                    }
                }
            }
            catch
            {
                return;
            }
            finally
            {
                if (sr != null)
                {
                    sr.Dispose();
                }
            }
            SerialTreeFile serialTree = new SerialTreeFile(L);

            ExecLoad(serialTree, _O, (_O as ParBase).PropertyName);
            serialTree.Dispose();
        }