public void OnLoadAbc(bool lazyInit, SWFContext ctx, string abcName, int doAbcCount, byte[] bytecode)
        {
            string abcDir = TestDir + @"\abc\";

            Directory.CreateDirectory(abcDir);

            string name = ctx.Name + "." + abcName + doAbcCount + abcName + ".abc";

            using (FileStream fs = new FileStream(abcDir + name, FileMode.Create))
            {
                fs.Write(bytecode, 0, bytecode.Length);
            }

            StringBuilder abcReadLog = new StringBuilder();

            AbcCode code = new AbcReader().Read(bytecode, abcReadLog);

            StringBuilder abcd = new StringBuilder();

            code.ToStringModelView(0, abcd);
            byte[] dasmBytes = new ASCIIEncoding().GetBytes(abcd.ToString());

            using (FileStream fs = new FileStream(abcDir + name + ".txt", FileMode.Create))
            {
                fs.Write(dasmBytes, 0, dasmBytes.Length);
            }

            byte[] abcReadLogBytes = new ASCIIEncoding().GetBytes(abcReadLog.ToString());
            using (FileStream fs = new FileStream(abcDir + name + ".abcread.txt", FileMode.Create))
            {
                fs.Write(abcReadLogBytes, 0, abcReadLogBytes.Length);
            }
        }
Example #2
0
        public void OnLoadAbc(bool lazyInit, SWFContext ctx, string abcName, int doAbcCount, byte[] bytecode)
        {
            string abcDir = this.TestDir + @"\abc\";

            Directory.CreateDirectory(abcDir);

            string name = ctx.Name + "." + abcName + doAbcCount + abcName + ".abc";

            using (FileStream fs = new FileStream(abcDir + name, FileMode.Create))
            {
                fs.Write(bytecode, 0, bytecode.Length);
            }

            StringBuilder readLog = new StringBuilder();
            AbcCode       code    = null;

            try
            {
                code = new AbcReader().Read(bytecode, readLog);
            }
            catch (Exception e)
            {
                readLog.Append(e.Message);
                throw;
            }
            finally
            {
                using (FileStream fs = new FileStream(abcDir + name + ".readlog.txt", FileMode.Create))
                {
                    byte[] readLogBytes = new ASCIIEncoding().GetBytes(readLog.ToString());
                    fs.Write(readLogBytes, 0, readLogBytes.Length);
                }
            }

            StringBuilder abcd = new StringBuilder();

            code.ToStringModelView(0, abcd);
            byte[] dasmBytes = new ASCIIEncoding().GetBytes(abcd.ToString());

            using (FileStream fs = new FileStream(abcDir + name + ".txt", FileMode.Create))
            {
                fs.Write(dasmBytes, 0, dasmBytes.Length);
            }
        }