static void Main(string[] args) { CommandLineArguments commandLineArguments = new CommandLineArguments(args); if (!commandLineArguments.ConsoleExit) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); SingleInstanceController controller = new SingleInstanceController(); controller.Run(args); } }
static void Main(string[] args) { try { CommandLineArguments commandLineArguments = new CommandLineArguments(args); //if there is a ConsoleExit we don't continue loading if (!commandLineArguments.ConsoleExit) { //load the settings from the settings.xml file settings = Settings.LoadSettings(); //if WinLess was called with arguments if (commandLineArguments.HasArguments) { //clear loaded directories settings.DirectoryList.ClearDirectories(); //load directories specified in arguments foreach(string directoryPath in commandLineArguments.DirectoryPaths){ Directory directory = settings.DirectoryList.AddDirectory(directoryPath); foreach (File file in directory.Files) { file.Minify = commandLineArguments.Minify; } } settings.SaveSettings(); } settings.DirectoryList.Initialize(); //load the mainform Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new mainForm(commandLineArguments.InitialCompile)); //save settings on exit settings.SaveSettings(); } } //log uncaught expections catch (Exception e) { ExceptionHandler.LogException(e); } }
private void this_StartupNextInstance(object sender, StartupNextInstanceEventArgs eventArgs) { string[] args = new string[eventArgs.CommandLine.Count]; eventArgs.CommandLine.CopyTo(args, 0); CommandLineArguments commandLineArguments = new CommandLineArguments(args); if (!commandLineArguments.ConsoleExit) { mainForm form = (mainForm)this.MainForm; if (commandLineArguments.HasArguments) { form.LoadDirectories(commandLineArguments); } else { form.RestoreFromTray(); } } }
public void LoadDirectories(CommandLineArguments args) { if (args.ClearDirectories) { Program.Settings.DirectoryList.ClearDirectories(); } //load directories specified in arguments foreach (string directoryPath in args.DirectoryPaths) { if(System.IO.Directory.Exists(directoryPath)) { Models.Directory directory = Program.Settings.DirectoryList.AddDirectory(directoryPath); foreach (Models.File file in directory.Files) { file.Minify = args.Minify; if (args.InitialCompile) { file.Compile(); } } } } foldersListBox_DataChanged(); SelectDirectory(); Program.Settings.SaveSettings(); }
private void mainForm_Load(object sender, EventArgs e) { string[] args = Environment.GetCommandLineArgs(); CommandLineArguments commandLineArgs = new CommandLineArguments(args); if (commandLineArgs.HasArguments) { LoadDirectories(commandLineArgs); } }