Exemplo n.º 1
0
        public static SprotoMgr Parse(string proto, string filename = "=text")
        {
            SprotoMgr sprotomgr = new SprotoMgr();

            SprotoParser._Parse(sprotomgr, proto, filename);
            sprotomgr.Check();
            return(sprotomgr);
        }
Exemplo n.º 2
0
        private static void _ParseFile(SprotoMgr sprotomgr, string filename)
        {
            FileStream    stream = new FileStream(filename, FileMode.Open, FileAccess.Read);
            StringBuilder sb     = new StringBuilder();

            byte[] buf = new byte[1024];
            int    len = stream.Read(buf, 0, buf.Length);

            while (len > 0)
            {
                sb.Append(Encoding.UTF8.GetString(buf, 0, len));
                len = stream.Read(buf, 0, buf.Length);
            }
            stream.Close();
            string proto = sb.ToString();

            SprotoParser._Parse(sprotomgr, proto, filename);
        }