/// ------------------------------------------------------------------------------------ /// <summary> /// Mains the method. /// </summary> /// <param name="args">The args.</param> /// ------------------------------------------------------------------------------------ public void MainMethod(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Trace.WriteLine(DateTime.Now.ToString()); StringBuilder bldr = new StringBuilder(); bldr.Append(DateTime.Now.ToString()); bldr.AppendFormat(": Starting {0} (", AppName); int iArg = 0; foreach (string s in args) { if (iArg > 0) { bldr.Append(", "); } bldr.Append(s); iArg++; } bldr.Append(")"); Trace.WriteLine(bldr.ToString()); bool fFirstTime = false; bool fForce = false; for (int iArgs = 0; iArgs < args.Length; iArgs++) { string arg = args[iArgs]; if (arg == "/first" || arg == "-first") { fFirstTime = true; } else if (arg == "/f" || arg == "-f") { fForce = true; } else if (arg.Length > 0 && arg[0] != '/' && arg[0] != '-') { if (arg != Properties.Settings.Default.FwRoot) { Properties.Settings.Default.FwRoot = arg; } } else { System.Windows.Forms.MessageBox.Show( string.Format("Updates VS addins and templates for use with FieldWorks build process\n" + "\nUsage:\n" + "{0} [options] [FwPath]\n" + "\nOptions:\n" + "-f\tForce check for updates, even if check already happened today", "{0}. (C) 2008 by SIL International", AppName)); Trace.WriteLine(DateTime.Now.ToString() + ": Displayed usage. Exiting"); return; } } if (Properties.Settings.Default.FwRoot.Length == 0) { using (FwPath fwPath = new FwPath()) { if (fwPath.ShowDialog() == DialogResult.OK && fwPath.Path.Length > 0) { Properties.Settings.Default.FwRoot = fwPath.Path; } else { Trace.WriteLine(DateTime.Now.ToString() + ": Can't continue without a FW path"); return; } } } Update(fFirstTime, fForce); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Mains the method. /// </summary> /// <param name="args">The args.</param> /// ------------------------------------------------------------------------------------ public void MainMethod(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Trace.WriteLine(DateTime.Now.ToString()); StringBuilder bldr = new StringBuilder(); bldr.Append(DateTime.Now.ToString()); bldr.AppendFormat(": Starting {0} (", AppName); int iArg = 0; foreach (string s in args) { if (iArg > 0) bldr.Append(", "); bldr.Append(s); iArg++; } bldr.Append(")"); Trace.WriteLine(bldr.ToString()); bool fFirstTime = false; bool fForce = false; for (int iArgs = 0; iArgs < args.Length; iArgs++) { string arg = args[iArgs]; if (arg == "/first" || arg == "-first") fFirstTime = true; else if (arg == "/f" || arg == "-f") fForce = true; else if (arg.Length > 0 && arg[0] != '/' && arg[0] != '-') { if (arg != Properties.Settings.Default.FwRoot) Properties.Settings.Default.FwRoot = arg; } else { System.Windows.Forms.MessageBox.Show( string.Format("Updates VS addins and templates for use with FieldWorks build process\n" + "\nUsage:\n" + "{0} [options] [FwPath]\n" + "\nOptions:\n" + "-f\tForce check for updates, even if check already happened today", "{0}. (C) 2008 by SIL International", AppName)); Trace.WriteLine(DateTime.Now.ToString() + ": Displayed usage. Exiting"); return; } } if (Properties.Settings.Default.FwRoot.Length == 0) { using (FwPath fwPath = new FwPath()) { if (fwPath.ShowDialog() == DialogResult.OK && fwPath.Path.Length > 0) Properties.Settings.Default.FwRoot = fwPath.Path; else { Trace.WriteLine(DateTime.Now.ToString() + ": Can't continue without a FW path"); return; } } } Update(fFirstTime, fForce); }