5 using System
.Reflection
;
12 public static void Main(string[] args
)
16 Console
.WriteLine ("Usage: svg2xaml input.svg [output.xaml].\n");
17 Console
.WriteLine (" If you don't specify an output file, it will be created");
18 Console
.WriteLine (" as 'input.svg.xaml' in the location of the svg file.");
22 string input
= args
[0];
23 if (!File
.Exists (input
))
25 Console
.WriteLine ("Error: file {0} does not exist.");
26 Console
.WriteLine ("This might work better if you try and convert an svg that actually exists.");
30 string output
= input
+ ".xaml";
34 Console
.WriteLine ("Converting file {0} into {1}...", input
, output
);
36 XmlDocument xsltdoc
= new XmlDocument();
39 Stream s
= Assembly
.GetExecutingAssembly().GetManifestResourceStream("svg2xaml.xslt");
42 catch (FileNotFoundException e
)
44 Console
.WriteLine ("Ooops, can't find the transformation stylesheet. That won't work :p");
49 Console
.WriteLine (ex
.Message
);
55 XslTransform t
= new XslTransform();
57 t
.Transform (input
, output
);
61 Console
.WriteLine ("Houston, we have a problem!");
63 Console
.WriteLine (a
.Message
);
64 Console
.WriteLine (a
.StackTrace
);
67 Console
.WriteLine (a
.Message
);
68 a
= ex
.InnerException
;
72 Console
.WriteLine ("Conversion done, file {0} created. Have a nice day :)", output
);