private static void ReadClientFlags(ClientProfile profile, string home) { string path = Path.Combine(home, "ClientFlags.txt"); if (!File.Exists(path)) { return; } StreamReader sr = null; try { sr = new StreamReader(path); string line = null; while ((line = sr.ReadLine()) != null) { line = line.Trim(); if (line == String.Empty) { continue; } if (line.StartsWith("//")) { continue; } profile.AddFlag(line); } } finally { if (sr != null) { sr.Close(); } } }
public static void Main(string [] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(ThreadException); ClientProfile profile = new ClientProfile(); profile.SetUICultureFromCommandLine(args); Thread.CurrentThread.CurrentUICulture = profile.CurrentUICulture; profile.ClientName = Resources.ClientName; profile.ClientTitle = Resources.ClientTitle; profile.PersistenceKey = "QuickSharp\\QuickSharp"; profile.ClientIcon = Resources.MainFormIcon; profile.CopyrightText = String.Format("{0} {1}\r\n{2}\r\n{3}", Resources.ClientCopyright1, Application.ProductVersion, Resources.ClientCopyright2, Resources.ClientCopyright3); profile.AboutBoxImage = Resources.AboutBackgroundImage; profile.AboutBoxTextColor = Color.Black; profile.PersistenceProvider = Constants.REGISTRY_PERSISTENCE_PROVIDER; profile.CommandLineArgs = args; // Update check profile.UpdateCheckURL = Resources.UpdateCheckURL; profile.UpdateHomeURL = Resources.UpdateHomeURL; profile.UpdateLinkText = Resources.UpdateLinkText; // Set the ClientFlags profile.AddFlag(ClientFlags.ExplorerHideByDefault); profile.AddFlag(ClientFlags.ExplorerStartFromCurrentDirectory); profile.AddFlag(ClientFlags.EditorChangeDirectoryOnSave); profile.AddFlag(ClientFlags.TextEditorClaimUnknownDocument); profile.AddFlag(ClientFlags.CodeAssistObjectBrowserIncludeWorkspace); profile.AddFlag(ClientFlags.CodeAssistObjectBrowserUseMainToolbar); profile.AddFlag(ClientFlags.CodeAssistDotNetAutoPopulateDatabase); profile.AddFlag(ClientFlags.WorkspaceEnableTitleBarUpdate); profile.AddFlag(ClientFlags.WorkspaceEnableShowSource); profile.AddFlag(ClientFlags.SqlEditorEnableXsdExport); profile.AddFlag(ClientFlags.SqlManagerEnableDbmlExtract); ApplicationManager applicationManager = ApplicationManager.GetInstance(); applicationManager.ClientProfile = profile; try { Application.Run(new MainForm()); } catch (Exception ex) { ErrorForm ef = new ErrorForm(ex, false); ef.ShowDialog(); } }