示例#1
0
文件: Program.cs 项目: yzqlwt/Swf2XNA
        static void Main(string[] args)
        {
            string fileName = "test2";
            //StreamReader sr = new StreamReader(fileName + ".vex", Encoding.ASCII);
            FileStream     fs     = new FileStream(fileName + ".vex", FileMode.Open, FileAccess.Read);
            BufferedStream bs     = new BufferedStream(fs);
            JsonLexer      lx     = new JsonLexer(bs);
            List <Token>   tokens = lx.Lex();

            fs.Close();
            bs.Close();
            // Document doc = JavaScriptConvert.DeserializeObject<Document>(json);
            Debug.WriteLine(tokens);

            //var g = from s in doc.Library.Items
            //        from l in s.Timeline.Layers
            //        select
            //            new
            //            {
            //                Name = s.Timeline.Name,
            //                Frames =
            //                    from f in l.Frames
            //                    where f.StartFrame == f.FrameIndex
            //                    select f
            //            };
            //try
            //{
            //    foreach (var tl in g)
            //    {
            //        foreach (var e in tl.Frames)
            //        {
            //            if (e != null)
            //            {
            //                Debug.WriteLine("tl: " + tl.Name + " \tl:" + e.LayerIndex + " f:" + e.FrameIndex + " \tsf:" + e.StartFrame);
            //            }
            //        }
            //    }
            //}
            //catch(Exception)
            //{
            //}

            //SwfCompilationUnit scu;
            //VexObject v;
            //Debug.WriteLine(Convert(fileName + ".swf", out scu, out v));
            //var tags = from ts in scu.Tags
            //        where ts.TagType == TagType.DefineSprite
            //        select (DefineSpriteTag)ts;

            //foreach (var t in tags)
            //{
            //    Debug.WriteLine(t.SpriteId + " t: " + t.FrameCount);
            //}
        }
示例#2
0
        static void Main(string[] args)
        {
            string fileName = "test2";
            //StreamReader sr = new StreamReader(fileName + ".vex", Encoding.ASCII);
            FileStream fs = new FileStream(fileName + ".vex", FileMode.Open, FileAccess.Read);
            BufferedStream bs = new BufferedStream(fs);
            JsonLexer lx = new JsonLexer(bs);
            List<Token> tokens = lx.Lex();
            fs.Close();
            bs.Close();
               // Document doc = JavaScriptConvert.DeserializeObject<Document>(json);
            Debug.WriteLine(tokens);

            //var g = from s in doc.Library.Items
            //        from l in s.Timeline.Layers
            //        select
            //            new
            //            {
            //                Name = s.Timeline.Name,
            //                Frames =
            //                    from f in l.Frames
            //                    where f.StartFrame == f.FrameIndex
            //                    select f
            //            };
            //try
            //{
            //    foreach (var tl in g)
            //    {
            //        foreach (var e in tl.Frames)
            //        {
            //            if (e != null)
            //            {
            //                Debug.WriteLine("tl: " + tl.Name + " \tl:" + e.LayerIndex + " f:" + e.FrameIndex + " \tsf:" + e.StartFrame);
            //            }
            //        }
            //    }
            //}
            //catch(Exception)
            //{
            //}

            //SwfCompilationUnit scu;
            //VexObject v;
            //Debug.WriteLine(Convert(fileName + ".swf", out scu, out v));
            //var tags = from ts in scu.Tags
            //        where ts.TagType == TagType.DefineSprite
            //        select (DefineSpriteTag)ts;

            //foreach (var t in tags)
            //{
            //    Debug.WriteLine(t.SpriteId + " t: " + t.FrameCount);
            //}
        }