private static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: Xib2Xaml XibFile"); return; } if (args.Length == 3) { XamlXibReader.WIDTH = int.Parse(args[1]); XamlXibReader.HEIGHT = int.Parse(args[2]); } using (var xamlReader = new XamlXibReader(args[0])) using (var xmlWriter = XmlWriter.Create(args[0].Replace(".xib", ".xaml"), new XmlWriterSettings { Indent = true })) using (var xamlWriter = new XamlXmlWriter(xmlWriter, xamlReader.SchemaContext)) { XamlServices.Transform(xamlReader, xamlWriter); } // Create boilerplate code-behind files (.cpp, .h) to accompany the newly created XAML file var className = Path.GetFileNameWithoutExtension(args[0]); GenerateXAMLCodeBehindFromResource(className, PlaceHolderCPPFile, args[0].Replace(".xib", ".xaml.cpp")); GenerateXAMLCodeBehindFromResource(className, PlaceHolderHeaderFile, args[0].Replace(".xib", ".xaml.h")); }
private static void Main(string[] args) { if (args.Length < 1) { Console.WriteLine("Usage: Xib2Xaml XibFile"); return; } if (args.Length == 3) { XamlXibReader.WIDTH = int.Parse(args[1]); XamlXibReader.HEIGHT = int.Parse(args[2]); } using (var xamlReader = new XamlXibReader(args[0])) using (var xmlWriter = XmlWriter.Create(args[0].Replace(".xib", ".xaml"), new XmlWriterSettings {Indent = true})) using (var xamlWriter = new XamlXmlWriter(xmlWriter, xamlReader.SchemaContext)) { XamlServices.Transform(xamlReader, xamlWriter); } // Create boilerplate code-behind files (.cpp, .h) to accompany the newly created XAML file var className = Path.GetFileNameWithoutExtension(args[0]); GenerateXAMLCodeBehindFromResource(className, PlaceHolderCPPFile, args[0].Replace(".xib", ".xaml.cpp")); GenerateXAMLCodeBehindFromResource(className, PlaceHolderHeaderFile, args[0].Replace(".xib", ".xaml.h")); }