static void Main(string[] args) { args = new string[] { @"c:\t\" }; if (args.Length < 1) { MessageBox.Show(Properties.Resources.NO_ARGUMENTS, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } string dir = args[0]; if (!System.IO.Directory.Exists(dir)) { MessageBox.Show(string.Format(Properties.Resources.FOLDER_NOT_EXIST, dir), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } FormMain f = new FormMain(); AmbLib.SetFontAll(f); f.dir_ = dir; if (DialogResult.OK != f.ShowDialog()) { return; } }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FormMain form = new FormMain(args); AmbLib.SetFontAll(form); Application.Run(form); }
static void Main(String[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Application.Run(new FormMain()); if (args.Length < 1) { MessageBox.Show(Properties.Resources.NO_ARGUMENTS, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } //string theFileName = @"C:\Documents and Settings\tt\My Documents\Productivity Distribution, Firm Heterogeneity, and Agglomeration.pdf"; string theFileName = args[0]; if (!System.IO.File.Exists(theFileName)) { MessageBox.Show(string.Format(Properties.Resources.FILE_NOT_EXIST, theFileName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } System.IO.FileInfo fi = new System.IO.FileInfo(theFileName); DateTime oldCreationTime = fi.CreationTime; DateTime oldLATime = fi.LastAccessTime; DateTime oldLWTime = fi.LastWriteTime; try { FormMain fm = new FormMain(fi); AmbLib.SetFontAll(fm); fm.Text = Application.ProductName; fm.txtFileName.Text = theFileName; fm.dtpLWTime.Tag = oldLWTime; fm.dtpLWTime.Value = oldLWTime; fm.ShowDialog(); } catch (Exception e) { MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } }
static void Main(string[] args) { Ambiesoft.CppUtils.AmbSetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // args = new string[]{@"c:\t\"}; //if (args.Length < 1) //{ // MessageBox.Show(Properties.Resources.NO_ARGUMENTS, // Application.ProductName, // MessageBoxButtons.OK, // MessageBoxIcon.Asterisk); // return; //} string initialFile = null; if (args.Length > 0) { initialFile = args[0]; //if (!System.IO.Directory.Exists(dir)) //{ // MessageBox.Show(string.Format(Properties.Resources.FOLDER_NOT_EXIST, dir), // Application.ProductName, // MessageBoxButtons.OK, // MessageBoxIcon.Asterisk); // return; //} } FormMain f = new FormMain(initialFile); AmbLib.SetFontAll(f); if (DialogResult.OK != f.ShowDialog()) { return; } }
static int Main(string[] args) { if (!AmbLib.IsNet45OrNewer()) { MessageBox.Show(Properties.Resources.DOTNET_45_REQUIRED, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); return(1); } Ambiesoft.CppUtils.AmbSetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FormMain form = new FormMain(args); AmbLib.SetFontAll(form); Application.Run(form); return(0); }
static void Main(string[] args) { if (args.Length < 1) { StringBuilder sb = new StringBuilder(); sb.Append(Properties.Resources.NO_ARGUMENTS); sb.AppendLine(); sb.AppendLine(); sb.AppendLine(Properties.Resources.HELP); MessageBox.Show( sb.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } if (args.Length > 1) { StringBuilder sbNotFounds = new StringBuilder(); for (int i = 0; i < args.Length; ++i) { try { if (File.Exists(args[i]) || Directory.Exists(args[i])) { System.Diagnostics.Process.Start(Application.ExecutablePath, "\"" + args[i] + "\""); } else { sbNotFounds.AppendLine(args[i]); } } catch (System.Exception e) { MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (sbNotFounds.Length != 0) { MessageBox.Show(Properties.Resources.FOLLOWING_DOESNOT_EXIST + "\r\n\r\n" + sbNotFounds.ToString(), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } return; } string theFileName = args[0]; // theFileName = @"C:\Documents and Settings\tt\My Documents\Productivity Distribution, Firm Heterogeneity, and Agglomeration.pdf"; if (!File.Exists(theFileName) && !Directory.Exists(theFileName)) { MessageBox.Show(string.Format(Properties.Resources.FILE_NOT_FOUND, theFileName), Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } System.IO.FileInfo fi = new System.IO.FileInfo(theFileName.Trim()); string oldname = fi.Name; string oldext = fi.Extension; string newName = fi.Name; if (!string.IsNullOrEmpty(oldext)) { newName = newName.Replace(oldext, ""); } do { try { FormMain fm = new FormMain(); AmbLib.SetFontAll(fm); fm.textName.Text = newName; fm.textName.Tag = theFileName; if (DialogResult.OK != fm.ShowDialog()) { return; } newName = fm.textName.Text; if (!RenameIt(fi, newName, oldname, oldext)) { continue; } break; } catch (Exception e) { MessageBox.Show(e.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } while (true); }
static void Main(String[] args) { Ambiesoft.CppUtils.AmbSetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Application.Run(new FormMain()); if (args.Length < 1) { CppUtils.Alert(Properties.Resources.NO_ARGUMENTS); return; } //string theFileName = @"C:\Documents and Settings\tt\My Documents\Productivity Distribution, Firm Heterogeneity, and Agglomeration.pdf"; string theFileName = args[0]; if (!System.IO.File.Exists(theFileName)) //&& !System.IO.Directory.Exists(theFileName)) { CppUtils.Alert(string.Format(Properties.Resources.FILE_NOT_EXIST, theFileName)); return; } System.IO.FileInfo fi = new System.IO.FileInfo(theFileName); DateTime oldCRTime = fi.CreationTime; DateTime oldLWTime = fi.LastWriteTime; DateTime oldLATime = fi.LastAccessTime; try { FormMain fm = new FormMain(); AmbLib.SetFontAll(fm); fm.Text = Application.ProductName; fm.txtFileName.Text = theFileName; fm.dtpCRTime.Tag = oldCRTime; fm.dtpCRTime.Value = oldCRTime; fm.dtpLWTime.Tag = oldLWTime; fm.dtpLWTime.Value = oldLWTime; fm.dtpLATime.Tag = oldLATime; fm.dtpLATime.Value = oldLATime; if (DialogResult.OK == fm.ShowDialog()) { if (fm.dtCRResult != null) { fi.CreationTime = fm.dtCRResult; } if (fm.dtLWResult != null) { fi.LastWriteTime = fm.dtLWResult; } if (fm.dtLAResult != null) { fi.LastAccessTime = fm.dtLAResult; } } } catch (Exception e) { CppUtils.Alert(e); } }
static void Main(string[] argsOriginal) { Ambiesoft.CppUtils.AmbSetProcessDPIAware(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (argsOriginal.Length < 1) { StringBuilder sb = new StringBuilder(); sb.Append(Properties.Resources.NO_ARGUMENTS); sb.AppendLine(); sb.AppendLine(); sb.AppendLine(Properties.Resources.HELP); CppUtils.Alert(sb.ToString()); return; } List <string> args = new List <string>(); foreach (string arg in argsOriginal) { if (arg == "-h" || arg == "/h" || arg == "--help") { StringBuilder sb = new StringBuilder(); sb.AppendLine(Properties.Resources.HELP); CppUtils.Alert(sb.ToString()); return; } else if (arg == "/run") { run_ = true; continue; } args.Add(arg); } if (args.Count > 1) { StringBuilder sbNotFounds = new StringBuilder(); for (int i = 0; i < args.Count; ++i) { try { if (File.Exists(args[i]) || Directory.Exists(args[i])) { System.Diagnostics.Process.Start( Application.ExecutablePath, (run_ ? "/run ": "") + "\"" + args[i] + "\""); } else { sbNotFounds.AppendLine(args[i]); } } catch (System.Exception e) { CppUtils.Fatal(e.Message); } } if (sbNotFounds.Length != 0) { CppUtils.Alert(Properties.Resources.FOLLOWING_DOESNOT_EXIST + "\r\n\r\n" + sbNotFounds.ToString()); } return; } string theFileName = args[0].Trim(); // theFileName = @"C:\Documents and Settings\tt\My Documents\Productivity Distribution, Firm Heterogeneity, and Agglomeration.pdf"; if (!File.Exists(theFileName) && !Directory.Exists(theFileName)) { CppUtils.Alert(string.Format(Properties.Resources.FILE_NOT_FOUND, theFileName)); return; } //System.IO.FileInfo fi = new System.IO.FileInfo(theFileName.Trim()); //string olddir = fi.Directory.FullName; //string oldname = fi.Name; //string oldext = fi.Extension; bool bIsFolder = Directory.Exists(theFileName); string newName = bIsFolder ? Path.GetFileName(theFileName) : Path.GetFileNameWithoutExtension(theFileName); //if (!string.IsNullOrEmpty(oldext)) //{ // newName = newName.Replace(oldext, ""); //} do { try { FormMain fm = new FormMain(); AmbLib.SetFontAll(fm); fm.txtName.Text = newName; fm.txtName.Tag = theFileName; if (DialogResult.OK != fm.ShowDialog()) { return; } //newName = fm.txtName.Text; //if (!RenameIt(olddir, newName, oldname, oldext)) // continue; break; } catch (Exception e) { CppUtils.Alert(e.Message); } } while (true); }