void OnConvert(object sender, EventArgs e) { try { var converter = new Converter(); this.m_destination.Text = converter.Process(null, "MyAdviser", this.m_source.Text); } catch (Exception ex) { this.m_destination.Text = ex.ToString(); } }
static bool TryRunAsConvert(string[] args) { if (args.Length > 3) { return false; } var intputPath = args[0]; var outputPath = Path.ChangeExtension(intputPath, "cs"); var className = (args.Length > 1) ? args[1] : "MyAdviser"; var namespaceName = (args.Length > 2) ? args[2] : "MyNamespace"; var converter = new Converter(); converter.Process(namespaceName, className, intputPath, outputPath); return true; }