static void Main(string[] args) { InitializeLanguage(); InitializeLibraries(); string fileName = null; int i = 0; string configDir = GeneralUtils.GetConfigDirectory(true); if (configDir == null) { MessageBox.Show(String.Format(Properties.Resources.Program_ErrorCreatingUserDirectory, GeneralUtils.GetConfigDirectory(false)), Properties.Resources.MessageBox_ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); Environment.Exit(1); } for (i = 0; i < args.Length; ++i) { if (args[i].StartsWith("-")) { if (args[i].StartsWith("-ext:")) { CANAPEExtensionManager.LoadExtension(args[i].Substring("-ext:".Length)); } } else { break; } } if (i < args.Length) { fileName = args[i]; } if (Properties.Settings.Default.RunOnce == false) { MessageBox.Show(CANAPE.Properties.Resources.Program_SecurityWarning, CANAPE.Properties.Resources.Program_SecurityWarningCaption, MessageBoxButtons.OK, MessageBoxIcon.Stop); Properties.Settings.Default.RunOnce = true; Program.SaveSettings(); } if (!Debugger.IsAttached) { Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm(fileName)); ScriptUtils.DeleteTempFiles(); }
private static void InitializeLibraries() { RegisterEditor(typeof(Dictionary <string, string>), typeof(NodePropertiesEditor)); RegisterEditor(typeof(ColorValue), typeof(ColorValueEditor)); RegisterEditor(typeof(DataFrameFilterFactory[]), typeof(DataFrameFilterEditor)); RegisterEditor(typeof(byte[]), typeof(ByteArrayEditor)); RegisterEditor(typeof(SslNetworkLayerConfig), typeof(SslConfigEditor)); RegisterEditor(typeof(INetworkLayerFactory[]), typeof(LayersEditor)); RegisterEditor(typeof(SequenceChoice[]), typeof(SequenceChoiceEditor)); // Load default extensions CANAPEExtensionManager.LoadExtension(typeof(ScriptDocument).Assembly); CANAPEExtensionManager.LoadExtension(typeof(HTTPData).Assembly); CANAPEExtensionManager.LoadExtension(typeof(HexEditorControl).Assembly); CANAPEExtensionManager.LoadExtensions(AppDomain.CurrentDomain.BaseDirectory); CANAPEExtensionManager.LoadExtensions(GeneralUtils.GetConfigDirectory()); }