Beispiel #1
0
        //public static GdiForm gf;
        static void Main(string[] args)
        {
            string fileName = "test14.swf";
            if (args.Length > 0)
            {
                fileName = args[0];
            }

            FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fs);

            SwfReader r = new SwfReader(br.ReadBytes((int)fs.Length));
            SwfCompilationUnit scu = new SwfCompilationUnit(r);

            //StringWriter sw = new StringWriter();
            //IndentedTextWriter w = new IndentedTextWriter(sw);
            //scu.Dump(w);
            //Debug.WriteLine(sw.ToString());

            SwfToVex s2v = new SwfToVex();
            VexObject v = s2v.Convert(scu);

            XamlRenderer xr = new WPFRenderer();
            xr.GenerateXaml(v);

            //GdiRenderer gr = new GdiRenderer();
            //List<Bitmap> bmps = gr.GenerateBitmaps(v);
            ////gr.ExportBitmaps(bmps);

            //gf = new GdiForm(bmps);
            //Application.EnableVisualStyles();
            //Application.Run(gf);
        }
Beispiel #2
0
        public static string Convert(
			string fileName, 
			bool isSilverlight,
			out SwfCompilationUnit scu, 
			out VexObject v, 
			out string xamlFileName)
        {
            string result = "Failed to convert.";
            FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fs);

            string name = Path.GetFileNameWithoutExtension(fileName);
            SwfReader r = new SwfReader(br.ReadBytes((int)fs.Length));
            scu = new SwfCompilationUnit(r, name);
            if (scu.IsValid)
            {
                result = "\n\n**** Converting to SwfCompilationUnit ****\n";
            #if DEBUG
                    StringWriter sw = new StringWriter();
                    IndentedTextWriter w = new IndentedTextWriter(sw);
                    scu.Dump(w);
                    Debug.WriteLine(sw.ToString());
            #endif
                result += scu.Log.ToString();

                SwfToVex s2v = new SwfToVex();
                v = s2v.Convert(scu);
                result += "\n\n**** Converting to Vex ****\n";
                result += s2v.Log.ToString();

                XamlRenderer xr;
                if (isSilverlight)
                {
                    xr = new Silverlight10Renderer();
                }
                else
                {
                    xr = new WPFRenderer();
                }
                xr.GenerateXaml(v, out xamlFileName);
                result += "\n\n**** Converting to Xaml ****\n";
                result += xr.Log.ToString();
                result += "\n\nSuccess.";
            }
            else
            {
                result = "Not a valid swf file: " + fileName;
                v = null;
                xamlFileName = "";
            }
            return result;
        }
Beispiel #3
0
        public static string Convert(
			bool isSilverlight,
			SwfCompilationUnit scu,
			VexObject v,
			out string xamlFileName)
        {
            string result = "Failed to convert.";

            SwfToVex s2v = new SwfToVex();
            v = s2v.Convert(scu);
            result = "\n\n**** Converting to Vex ****\n";
            result += s2v.Log.ToString();

            XamlRenderer xr;
            if (isSilverlight)
            {
                xr = new Silverlight10Renderer();
            }
            else
            {
                xr = new WPFRenderer();
            }
            xr.GenerateXaml(v, out xamlFileName);
            result += "\n\n**** Converting to Xaml ****\n";
            result += xr.Log.ToString();
            result += "\n\nSuccess.";

            return result;
        }
Beispiel #4
0
        void tv_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeView tv = (TreeView)sender;
            if (tv.SelectedNode != null)
            {
                if (tv.SelectedNode.Name == "root")
                {
                    partName = "";
                    selectedFileName = uint.MaxValue;
                }
                else
                {
                    uint nm = uint.Parse(tv.SelectedNode.Name);
                    if (selectedFileName != nm)
                    {
                        partName = tv.SelectedNode.Name;
                        selectedFileName = nm;
                        IDefinition def = vexObjects[this.fileIndex].Definitions[selectedFileName];
                        WPFRenderer wpfr = new WPFRenderer();
                        string xamlFileName;
                        wpfr.GenerateXamlPart(vexObjects[this.fileIndex], def, out xamlFileName);

                        Silverlight10Renderer slfr = new Silverlight10Renderer();
                        string slFileName;
                        slfr.GenerateXamlPart(vexObjects[this.fileIndex], def, out slFileName);
                    }
                }
                RefreshContentPane();
            }
        }