Inheritance: IDisposable, IImageFinder
コード例 #1
0
ファイル: CLI.cs プロジェクト: WeeWorld/Swiffotron
        /// <summary>
        /// App entry point
        /// </summary>
        /// <param name="args">Command line arguments</param>
        public static void Main(string[] args)
        {
            try
            {
                string config;
                string explode;

                string job = ParseArguments(args, out config, out explode);
                if (job == null && explode == null)
                {
                    PrintUsage();
                    Environment.Exit(-1);
                }

                if (explode != null)
                {
                    FileInfo swfFile = new FileInfo(explode);
                    using (FileStream swfIn = new FileStream(explode, FileMode.Open, FileAccess.Read))
                    {
                        ABCCatcher catcher = new ABCCatcher();
                        SWFReader reader = new SWFReader(swfIn, new SWFReaderOptions(), null, catcher);
                        reader.ReadSWF(new SWFContext(explode));
                        catcher.SaveAll(explode, swfFile.DirectoryName);
                    }
                }

                Swiffotron swiffotron;
                if (config == null)
                {
                    swiffotron = new Swiffotron(null);
                }
                else
                {
                    using (FileStream cfs = new FileStream(config, FileMode.Open, FileAccess.Read))
                    {
                        swiffotron = new Swiffotron(cfs);
                    }
                }

                if (job != null)
                {
                    using (FileStream jobfs = new FileStream(job, FileMode.Open, FileAccess.Read))
                    {
                        swiffotron.Process(jobfs);
                    }
                }
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.ToString());
            }
        }
コード例 #2
0
ファイル: SWFDebugDump.cs プロジェクト: WeeWorld/Swiffotron
        public void Run(string[] files)
        {
            try
            {
                foreach (string swfFile in files)
                {
                    if (!File.Exists(swfFile))
                    {
                        Console.WriteLine("Not found: " + swfFile);
                        return;
                    }
                }

                foreach (string swfFile in files)
                {
                    StringBuilder binDump = new StringBuilder();
                    StringBuilder modelDump = new StringBuilder();

                    SWF swf = null;
                    using (FileStream fs = new FileStream(swfFile, FileMode.Open, FileAccess.Read))
                    {
                        swf = new SWFReader(fs, null, binDump, this).ReadSWF(new SWFContext(swfFile));
                        swf.ToStringModelView(0, modelDump);
                    }

                    using (FileStream binOut = new FileStream(swfFile + ".SWFDUMP.bin.txt", FileMode.Create))
                    {
                        byte[] ascii = new ASCIIEncoding().GetBytes(binDump.ToString());
                        binOut.Write(ascii, 0, ascii.Length);
                    }

                    using (FileStream modelOut = new FileStream(swfFile + ".SWFDUMP.model.txt", FileMode.Create))
                    {
                        byte[] ascii = new ASCIIEncoding().GetBytes(modelDump.ToString());
                        modelOut.Write(ascii, 0, ascii.Length);
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #3
0
ファイル: Swiffotron.cs プロジェクト: WeeWorld/Swiffotron
        /// <summary>
        /// Load a SWF from a store path.
        /// </summary>
        /// <param name="path">A store path from the job XML</param>
        /// <returns>A parsed SWF object.</returns>
        private SWF SwfFromStore(string path)
        {
            using (Stream s = stores.Open(this.Context, path))
            {
                string name = null;
                name = new Uri(path).AbsolutePath.Substring(1);

#if DEBUG

                if (this.readLogHandler != null)
                {
                    StringBuilder sb = new StringBuilder();

                    SWF swf = new SWFReader(
                            s,
                            new SWFReaderOptions() { StrictTagLength = true },
                            sb,
                            this.abcInterceptor)
                        .ReadSWF(new SWFContext(name));

                    this.readLogHandler.OnSwiffotronReadSWF(name, swf, sb.ToString());
                    return swf;
                }

                return new SWFReader(
                        s,
                        new SWFReaderOptions() { StrictTagLength = true },
                        null,
                        this.abcInterceptor)
                    .ReadSWF(new SWFContext(name));
#else
                return new SWFReader(s, new SWFReaderOptions() { StrictTagLength = true }, null, null).ReadSWF(new SWFContext(name));
#endif
            }
        }
コード例 #4
0
ファイル: SWF2HTMLTest.cs プロジェクト: WeeWorld/Swiffotron
 private void TestSWF(string name)
 {
     using (SWFReader swfIn = new SWFReader(ResourceAsStream(name), new SWFModeller.IO.SWFReaderOptions(), null, null))
     {
         SWF swf = swfIn.ReadSWF(new SWFContext(name));
         ConvertSWF(name, swf);
     }
 }