/// <summary>
        /// Look up function pointers in the dlls
        /// </summary>
        void connectFunctionPointers()
        {
            m64pCoreStartup                 = (CoreStartup)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreStartup"), typeof(CoreStartup));
            m64pCoreShutdown                = (CoreShutdown)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreShutdown"), typeof(CoreShutdown));
            m64pCoreDoCommandByteArray      = (CoreDoCommandByteArray)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandByteArray));
            m64pCoreDoCommandPtr            = (CoreDoCommandPtr)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandPtr));
            m64pCoreDoCommandRefInt         = (CoreDoCommandRefInt)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandRefInt));
            m64pCoreDoCommandFrameCallback  = (CoreDoCommandFrameCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandFrameCallback));
            m64pCoreDoCommandVICallback     = (CoreDoCommandVICallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandVICallback));
            m64pCoreDoCommandRenderCallback = (CoreDoCommandRenderCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandRenderCallback));
            m64pCoreAttachPlugin            = (CoreAttachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreAttachPlugin"), typeof(CoreAttachPlugin));
            m64pCoreDetachPlugin            = (CoreDetachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDetachPlugin"), typeof(CoreDetachPlugin));
            m64pConfigOpenSection           = (ConfigOpenSection)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigOpenSection"), typeof(ConfigOpenSection));
            m64pConfigSetParameter          = (ConfigSetParameter)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigSetParameter"), typeof(ConfigSetParameter));
            m64pCoreSaveState               = (savestates_save_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_save_bkm"), typeof(savestates_save_bkm));
            m64pCoreLoadState               = (savestates_load_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_load_bkm"), typeof(savestates_load_bkm));
            m64pDebugMemGetPointer          = (DebugMemGetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "DebugMemGetPointer"), typeof(DebugMemGetPointer));
            m64pMemGetSize   = (MemGetSize)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "MemGetSize"), typeof(MemGetSize));
            m64pinit_saveram = (init_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "init_saveram"), typeof(init_saveram));
            m64psave_saveram = (save_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "save_saveram"), typeof(save_saveram));
            m64pload_saveram = (load_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "load_saveram"), typeof(load_saveram));

            m64pSetReadCallback  = (SetReadCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetReadCallback"), typeof(SetReadCallback));
            m64pSetWriteCallback = (SetWriteCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetWriteCallback"), typeof(SetWriteCallback));

            m64pGetRegisters = (GetRegisters)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "GetRegisters"), typeof(GetRegisters));

            m64p_read_memory_8  = (biz_read_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_read_memory"), typeof(biz_read_memory));
            m64p_write_memory_8 = (biz_write_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_write_memory"), typeof(biz_write_memory));

            m64p_decode_op = (biz_r4300_decode_op)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_r4300_decode_op"), typeof(biz_r4300_decode_op));
        }
        public static void Init()
        {
            SharpSnippetCompilerManager manager = new SharpSnippetCompilerManager();
            Assembly exe = manager.GetType().Assembly;

            string rootPath        = Path.GetDirectoryName(exe.Location);
            string configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "SharpSnippetCompiler");
            string dataDirectory   = Path.Combine(rootPath, "data");

            CoreStartup startup = new CoreStartup("SharpSnippetCompiler");

            startup.ConfigDirectory = configDirectory;
            startup.DataDirectory   = dataDirectory;
            startup.PropertiesName  = "SharpSnippetCompiler";

            startup.StartCoreServices();

            ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe));

            StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());

            string addInFolder = Path.Combine(rootPath, "AddIns");

            startup.AddAddInsFromDirectory(addInFolder);
            startup.RunInitialization();
        }
示例#3
0
        static void Main()
        {
            LoggingService.Info("Starting App...");
            Assembly exe = typeof(Program).Assembly;

            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            CoreStartup c = new CoreStartup("Frame.Core");

            c.ConfigDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".michael-zhang", "Frame.Core") + Path.DirectorySeparatorChar;
            LoggingService.Info("Starting core services...");
            c.StartCoreServices();
            ResourceService.RegisterNeutralStrings(new ResourceManager("StartUp.Properties.SDRes", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("StartUp.Properties.SDRes", exe));

            AddInTree.Doozers.Add("Pad", new Frame.Core.Pad.PadDoozer());
            AddInTree.Doozers.Add("DisplayBinding", new Frame.Core.ViewContent.DisplayBindingDoozer());

            LoggingService.Debug("Looking for Addins...");
            c.AddAddInsFromDirectory(FileUtility.ApplicationRootPath);
            //c.ConfigureExternalAddIns(...);
            LoggingService.Debug("Loading AddinTre...");
            c.RunInitialization();

            LoggingService.Debug("Initializing workbench...");
            WorkbenchSingleton.InitializeWorkbench();
            LoggingService.Debug("Starting workbench...");
            Form f = (Form)WorkbenchSingleton.Workbench;

            Application.Run(f);

            PropertyService.Save();
            LoggingService.Info("Leaving app");
        }
示例#4
0
        internal static void StartCoreServices()
        {
            frmSplashScreen.PrintStatus("Starting core services...");

            Assembly exe = PragmaSQLApp.ApplicationProxy;

            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            Core = new CoreStartup("PragmaSQL");

            // Specify the name of the application settings file (.xml is automatically appended)
            Core.PropertiesName = "AppProperties";

            // Initializes the Core services (ResourceService, PropertyService, etc.)
            Core.StartCoreServices();

            PragmaSQLApp.RegisterApplicationResources();

            //ResourceService.RegisterNeutralStrings(new ResourceManager("PragmaSQL.StringResources", exe));
            //ResourceService.RegisterNeutralImages(new ResourceManager("PragmaSQL.ImageResources", exe));

            // Registeres the default (English) strings and images. They are compiled as
            // Localized strings are automatically picked up when they are put into the
            // "data/resources" directory.
        }
示例#5
0
        public static void Init()
        {
            var      manager = new SharpSnippetCompilerManager();
            Assembly exe     = manager.GetType().Assembly;

            string rootPath        = Path.GetDirectoryName(exe.Location);
            string configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                                  "SharpSnippetCompiler");
            string dataDirectory = Path.Combine(rootPath, "data");

            var container = new SharpDevelopServiceContainer(ServiceSingleton.FallbackServiceProvider);

            ServiceSingleton.ServiceProvider = container;

            var startup = new CoreStartup("SharpSnippetCompiler");

            startup.ConfigDirectory         = configDirectory;
            startup.DataDirectory           = dataDirectory;
            startup.PropertiesName          = "SharpSnippetCompiler";
            FileUtility.ApplicationRootPath = "SharpSnippetCompiler";
            startup.StartCoreServices();

            SD.ResourceService.RegisterNeutralStrings(new ResourceManager("ICSharpCode.SharpSnippetCompiler.Core.Resources.StringResources", exe));
            SD.ResourceService.RegisterNeutralImages(new ResourceManager("ICSharpCode.SharpSnippetCompiler.Core.Resources.BitmapResources", exe));

            CommandWrapper.LinkCommandCreator = (link => new LinkCommand(link));
            CommandWrapper.RegisterConditionRequerySuggestedHandler   = (eh => CommandManager.RequerySuggested += eh);
            CommandWrapper.UnregisterConditionRequerySuggestedHandler = (eh => CommandManager.RequerySuggested -= eh);
            StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());

            string addInFolder = Path.Combine(rootPath, "AddIns");

            startup.AddAddInsFromDirectory(addInFolder);
            startup.RunInitialization();
        }
示例#6
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Add
            if (args != null && args.Length > 0 && !string.IsNullOrEmpty(args[0]))
            {
                Config.SetConfigPath(args[0]);
            }
            bool flag = false;

            using (new Mutex(true, SystemInfo.Instance.SystemFullName, out flag))
            {
                if (flag)
                {
                    try
                    {
                        FormLogin dialog = new FormLogin();
                        if (dialog.ShowDialog() == DialogResult.OK)
                        {
                            Assembly assembly = typeof(StartUp).Assembly;
                            FileUtility.ApplicationRootPath  = Path.GetDirectoryName(assembly.Location);
                            FileUtility.LocalUserAppDataPath = System.Windows.Forms.Application.LocalUserAppDataPath;
                            ResourceService.RegisterNeutralImages(new ResourceManager("DFStartUp.Resource", assembly));
                            CoreStartup coreStartup = new CoreStartup("DIFGIS");
                            coreStartup.PropertiesName = "BuilderConfig";
                            coreStartup.StartCoreServices();
                            coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "..\\AddIns"));
                            coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
                            coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"), Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
                            coreStartup.RunInitialization();
                        }
                        else
                        {
                            System.Environment.Exit(0);
                        }
                    }
                    catch (XmlException ex)
                    {
                        MessageBox.Show("读取XML文件错误 :" + Environment.NewLine + ex.Message);
                        LoggingService.Error(ex.Message + "\r\n" + ex.StackTrace);
                        Thread.Sleep(0x3e8);
                        Environment.Exit(1);
                    }
                    catch (Exception ex)
                    {
                        LoggingService.Fatal(ex.Message + "\r\n" + ex.StackTrace);
                        Thread.Sleep(0x3e8);
                        Environment.Exit(1);
                    }
                }
                else
                {
                    MessageBox.Show(SystemInfo.Instance.SystemFullName + "已经在运行中!");
                    Thread.Sleep(0x3e8);
                    Environment.Exit(1);
                }
            }
        }
示例#7
0
        /// <summary>
        /// Initializes different services used by the app.
        /// </summary>
        /// <param name="extraHostConfiguration">Add specific configurations for app initialization.</param>
        protected void InitializeServices(Action <IHostBuilder> extraHostConfiguration = null)
        {
            var coreStartup = new CoreStartup();

            coreStartup.PreInitialize();
            coreStartup.Initialize(extraHostConfiguration);

            _coreStartup = coreStartup;

            ConfigureSecurityProtocol();
        }
示例#8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            CoreStartup.ConfigureLogging(env, loggerFactory, Configuration);

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseCors("CorsPolicy");
            }

            app.UseMvc();
        }
示例#9
0
        static void Main()
        {
            LoggingService.Info("Starting App...");
            Assembly exe = typeof(Program).Assembly;

            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            CoreStartup c = new CoreStartup("MapToolkit");

            c.ConfigDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "UserConfig") + Path.DirectorySeparatorChar;
            LoggingService.Info("Starting core services...");
            c.StartCoreServices();
            ResourceService.RegisterNeutralStrings(new ResourceManager("MapToolkit.Properties.SatRes", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("MapToolkit.Properties.SatRes", exe));

            AddInTree.Doozers.Add("Pad", new SharpAppCore.Pad.PadDoozer());
            AddInTree.Doozers.Add("DisplayBinding", new SharpAppCore.ViewContent.DisplayBindingDoozer());

            //初始化卫星和区域
            //SatGui.Services.SatService.SatInit();
            //SatGui.Services.AreaService.AreaInit();

            LoggingService.Debug("Looking for Addins...");
            c.AddAddInsFromDirectory(FileUtility.ApplicationRootPath);
            //c.ConfigureExternalAddIns(...);
            LoggingService.Debug("Loading AddinTre...");
            c.RunInitialization();

            LoggingService.Debug("Initializing workbench...");
            WorkbenchSingleton.InitializeWorkbench();

            //载入地图
            //SatGui.Services.MapService.MapInit();
            LoggingService.Debug("Starting workbench...");
            Form f = (Form)WorkbenchSingleton.Workbench;

            Application.Run(f);

            PropertyService.Save();
            //SatGui.Services.SatService.SaveStatus();
            //SatGui.Services.AreaService.SaveStatus();
            LoggingService.Info("Leaving app");
        }
示例#10
0
        /// <summary>
        /// Look up function pointers in the dlls
        /// </summary>
        private void connectFunctionPointers()
        {
            T GetCoreDelegate <T>(string proc) where T : Delegate => (T)Marshal.GetDelegateForFunctionPointer(Library.GetProcAddrOrThrow(proc), typeof(T));

            m64pCoreStartup                 = GetCoreDelegate <CoreStartup>("CoreStartup");
            m64pCoreShutdown                = GetCoreDelegate <CoreShutdown>("CoreShutdown");
            m64pCoreDoCommandByteArray      = GetCoreDelegate <CoreDoCommandByteArray>("CoreDoCommand");
            m64pCoreDoCommandPtr            = GetCoreDelegate <CoreDoCommandPtr>("CoreDoCommand");
            m64pCoreDoCommandRefInt         = GetCoreDelegate <CoreDoCommandRefInt>("CoreDoCommand");
            m64pCoreDoCommandFrameCallback  = GetCoreDelegate <CoreDoCommandFrameCallback>("CoreDoCommand");
            m64pCoreDoCommandVICallback     = GetCoreDelegate <CoreDoCommandVICallback>("CoreDoCommand");
            m64pCoreDoCommandRenderCallback = GetCoreDelegate <CoreDoCommandRenderCallback>("CoreDoCommand");
            m64pCoreAttachPlugin            = GetCoreDelegate <CoreAttachPlugin>("CoreAttachPlugin");
            m64pCoreDetachPlugin            = GetCoreDelegate <CoreDetachPlugin>("CoreDetachPlugin");
            m64pConfigOpenSection           = GetCoreDelegate <ConfigOpenSection>("ConfigOpenSection");
            m64pConfigSetParameter          = GetCoreDelegate <ConfigSetParameter>("ConfigSetParameter");
            m64pConfigSetParameterStr       = GetCoreDelegate <ConfigSetParameterStr>("ConfigSetParameter");
            m64pCoreSaveState               = GetCoreDelegate <savestates_save_bkm>("savestates_save_bkm");
            m64pCoreLoadState               = GetCoreDelegate <savestates_load_bkm>("savestates_load_bkm");
            m64pDebugMemGetPointer          = GetCoreDelegate <DebugMemGetPointer>("DebugMemGetPointer");
            m64pDebugSetCallbacks           = GetCoreDelegate <DebugSetCallbacks>("DebugSetCallbacks");
            m64pDebugBreakpointLookup       = GetCoreDelegate <DebugBreakpointLookup>("DebugBreakpointLookup");
            m64pDebugBreakpointCommand      = GetCoreDelegate <DebugBreakpointCommand>("DebugBreakpointCommand");
            m64pDebugGetState               = GetCoreDelegate <DebugGetState>("DebugGetState");
            m64pDebugSetRunState            = GetCoreDelegate <DebugSetRunState>("DebugSetRunState");
            m64pDebugStep    = GetCoreDelegate <DebugStep>("DebugStep");
            m64pMemGetSize   = GetCoreDelegate <MemGetSize>("MemGetSize");
            m64pinit_saveram = GetCoreDelegate <init_saveram>("init_saveram");
            m64psave_saveram = GetCoreDelegate <save_saveram>("save_saveram");
            m64pload_saveram = GetCoreDelegate <load_saveram>("load_saveram");

            m64pSetTraceCallback = GetCoreDelegate <SetTraceCallback>("SetTraceCallback");

            m64pGetRegisters = GetCoreDelegate <GetRegisters>("GetRegisters");

            m64p_read_memory_8  = GetCoreDelegate <biz_read_memory>("biz_read_memory");
            m64p_write_memory_8 = GetCoreDelegate <biz_write_memory>("biz_write_memory");

            m64p_decode_op = GetCoreDelegate <biz_r4300_decode_op>("biz_r4300_decode_op");
        }
示例#11
0
        public FormMain()
        {
            InitializeComponent();

            DockContainer          = new DockContainer();
            DockContainer.MainForm = this;
            DockContainer.Dock     = DockStyle.Fill;

            this.toolStripContainer1.ContentPanel.Controls.Add(this.DockContainer);

            DockContainer.ShowDocumentIcon = true;

            DockContainer.DocumentStyle = DocumentStyles.DockingWindow;

            DockContainer.ActiveDocumentChanged += new EventHandler(_DockContainer_ActiveDocumentChanged);

            DockContainer.ActiveContentChanged += new EventHandler(_DockContainer_ActiveContentChanged);

            DockContainer.ContextMenu = new ContextMenu();

            Assembly exe = this.GetType().Assembly;

            ResourceService.RegisterNeutralStrings(new ResourceManager("PAT.Main.Properties.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("PAT.Main.Properties.BitmapResources", exe));

            WorkbenchSingleton.DockContainer = DockContainer;
            WorkbenchSingleton.InitializeWorkbench();

            CoreStartup startup = new CoreStartup(Common.Ultility.Ultility.APPLICATION_NAME);

            startup.ConfigDirectory = Common.Ultility.Ultility.APPLICATION_PATH;
            startup.DataDirectory   = Common.Ultility.Ultility.APPLICATION_PATH;

            startup.StartCoreServices();
            startup.RunInitialization();

            ((ToolStripProfessionalRenderer)StandardToolBar.Renderer).ColorTable.UseSystemColors = true;

            Output_Window           = new OutputDockingWindow();
            Output_Window.Icon      = Common.Ultility.Ultility.GetIcon("Output");
            Output_Window.Disposed += new EventHandler(output_Window_Disposed);

            ErrorListWindow                       = new ErrorListWindow();
            ErrorListWindow.Icon                  = Common.Ultility.Ultility.GetIcon("ErrorList");
            ErrorListWindow.Disposed             += new EventHandler(ErrorListWindow_Disposed);
            ErrorListWindow.ListView.DoubleClick += new EventHandler(ErrorListView_DoubleClick);


            this.toolStripContainer1.TopToolStripPanel.Controls.Clear();
            this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.FunctionalToolBar);
            this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.StandardToolBar);
            this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.MenuStrip);

            StandardToolBar.Location   = new Point(3, 24);
            FunctionalToolBar.Location = new Point(3, 49);
            FunctionalToolBar.Size     = new Size(409, 25);
            MenuStrip.Dock             = DockStyle.Top;
            MenuStrip.Location         = new Point(0, 0);

            CheckForItemState();

            CurrentModule = new ModuleFacade();
            Language      = HighlightingManager.Manager.AddHighlightingStrategy(Path.Combine(Application.StartupPath, "Syntax.xshd"));
            OpenFilter    = Language.Name + " (*" + Language.ExtensionString + ")|*" + Language.ExtensionString;

            CurrentModule.ShowModel += new ShowModelHandler(ShowModel);
            CurrentModule.ExampleMenualToolbarInitialize(this.MenuButton_Examples);
            CurrentModule.ReadConfiguration();

            //Common.Ultility.Ultility.ModuleFolderNames.Add(moduleFolderName);
            Common.Ultility.Ultility.ModuleNames      = new List <string>();
            Common.Ultility.Ultility.ModuleDictionary = new Dictionary <string, ModuleFacadeBase>();

            Common.Ultility.Ultility.ModuleNames.Add(Language.Name);
            Common.Ultility.Ultility.ModuleDictionary.Add(Language.Name, CurrentModule);
            Common.Ultility.Ultility.Images.ImageList.Images.Add(Language.Name, CurrentModule.ModuleIcon);

            this.FunctionalToolBar.SuspendLayout();
            CurrentModule.ToolbarInitialize(this.FunctionalToolBar, Toolbar_Button_Click);
            this.FunctionalToolBar.ResumeLayout();
        }
示例#12
0
 public void Configure(IWebJobsBuilder builder)
 {
     CoreStartup.Configure(builder.Services);
 }
示例#13
0
        public void InitMESCore(SolarViewerHost.CallbackHelper callback, StartupSettings properties)
        {
            //初始化ILoggingService接口
            FanHai.Gui.Core.Services.ServiceManager.LoggingService = new log4netLoggingService();
            //初始化IMessageService接口
            FanHai.Gui.Core.Services.ServiceManager.MessageService = WinFormsMessageService.Instance;
            //记录字符串信息
            LoggingService.Info("Init FanHai Framework Core...");
            this.callback = callback;

            CoreStartup startup = new CoreStartup(properties.ApplicationName);

            if (properties.UseSolarViewerFrameworkErrorHandler)
            {
                this.useSolarViewerFrameworkErrorHandler = true;
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            //设定启动路径
            startup.ConfigDirectory = properties.ConfigDirectory;
            //设定数据路径
            startup.DataDirectory = properties.DataDirectory;
            if (properties.PropertiesName != null)
            {
                //把StarupSettings类中PropertiesName属性传递给CoreStartup
                startup.PropertiesName = properties.PropertiesName;
            }
            //ParserService.DomPersistencePath = properties.DomPersistencePath;
            // disable RTL: translations for the RTL languages are inactive
            RightToLeftConverter.RightToLeftLanguages = new string[0];
            //设定App启动路径
            if (properties.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
            }
            startup.StartCoreServices();

            Assembly exe = Assembly.Load(properties.ResourceAssemblyName);

            ResourceService.RegisterNeutralStrings(new ResourceManager("FanHai.Gui.Framework.StartUp.Resources.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("FanHai.Gui.Framework.StartUp.Resources.BitmapResources", exe));

            LoggingService.Info("Looking for AddIns...");
            foreach (string file in properties.addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in properties.addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (properties.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
            }
            if (properties.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
            }

            LoggingService.Info("Loading AddInTree...");
            startup.RunInitialization();

            LoggingService.Info("Init FanHai Framework Core finished");
        }
示例#14
0
        public void InitSharpDevelopCore(SharpDevelopHost.CallbackHelper callback, StartupSettings properties)
        {
            LoggingService.Info("InitSharpDevelop...");
            this.callback = callback;
            CoreStartup startup = new CoreStartup(properties.ApplicationName);

            if (properties.UseSharpDevelopErrorHandler)
            {
                this.useSharpDevelopErrorHandler = true;
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            startup.ConfigDirectory = properties.ConfigDirectory;
            startup.DataDirectory   = properties.DataDirectory;
            if (properties.PropertiesName != null)
            {
                startup.PropertiesName = properties.PropertiesName;
            }

            // disable RTL: translations for the RTL languages are inactive
            RightToLeftConverter.RightToLeftLanguages = new string[0];

            if (properties.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
            }

            startup.StartCoreServices();
            Assembly exe = Assembly.Load(properties.ResourceAssemblyName);

            ResourceService.RegisterNeutralStrings(new ResourceManager("Resources.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("Resources.BitmapResources", exe));

            MenuCommand.LinkCommandCreator = delegate(string link) { return(new LinkCommand(link)); };
            StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());

            LoggingService.Info("Looking for AddIns...");
            foreach (string file in properties.addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in properties.addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (properties.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
            }
            if (properties.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
            }

            LoggingService.Info("Loading AddInTree...");
            startup.RunInitialization();

            // Register events to marshal back
            Project.ProjectService.StartBuild     += delegate { this.callback.StartBuild(); };
            Project.ProjectService.EndBuild       += delegate { this.callback.EndBuild(); };
            Project.ProjectService.SolutionLoaded += delegate { this.callback.SolutionLoaded(); };
            Project.ProjectService.SolutionClosed += delegate { this.callback.SolutionClosed(); };
            Project.ProjectService.SolutionConfigurationChanged += delegate { this.callback.SolutionConfigurationChanged(); };
            FileUtility.FileLoaded += delegate(object sender, FileNameEventArgs e) { this.callback.FileLoaded(e.FileName); };
            FileUtility.FileSaved  += delegate(object sender, FileNameEventArgs e) { this.callback.FileSaved(e.FileName); };

            LoggingService.Info("InitSharpDevelop finished");
        }
示例#15
0
		/// <summary>
		/// Look up function pointers in the dlls
		/// </summary>
		void connectFunctionPointers()
		{
			m64pCoreStartup = (CoreStartup)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreStartup"), typeof(CoreStartup));
			m64pCoreShutdown = (CoreShutdown)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreShutdown"), typeof(CoreShutdown));
			m64pCoreDoCommandByteArray = (CoreDoCommandByteArray)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandByteArray));
			m64pCoreDoCommandPtr = (CoreDoCommandPtr)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandPtr));
			m64pCoreDoCommandRefInt = (CoreDoCommandRefInt)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandRefInt));
			m64pCoreDoCommandFrameCallback = (CoreDoCommandFrameCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandFrameCallback));
			m64pCoreDoCommandVICallback = (CoreDoCommandVICallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandVICallback));
			m64pCoreDoCommandRenderCallback = (CoreDoCommandRenderCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDoCommand"), typeof(CoreDoCommandRenderCallback));
			m64pCoreAttachPlugin = (CoreAttachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreAttachPlugin"), typeof(CoreAttachPlugin));
			m64pCoreDetachPlugin = (CoreDetachPlugin)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "CoreDetachPlugin"), typeof(CoreDetachPlugin));
			m64pConfigOpenSection = (ConfigOpenSection)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigOpenSection"), typeof(ConfigOpenSection));
			m64pConfigSetParameter = (ConfigSetParameter)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "ConfigSetParameter"), typeof(ConfigSetParameter));
			m64pCoreSaveState = (savestates_save_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_save_bkm"), typeof(savestates_save_bkm));
			m64pCoreLoadState = (savestates_load_bkm)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "savestates_load_bkm"), typeof(savestates_load_bkm));
			m64pDebugMemGetPointer = (DebugMemGetPointer)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "DebugMemGetPointer"), typeof(DebugMemGetPointer));
			m64pMemGetSize = (MemGetSize)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "MemGetSize"), typeof(MemGetSize));
			m64pinit_saveram = (init_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "init_saveram"), typeof(init_saveram));
			m64psave_saveram = (save_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "save_saveram"), typeof(save_saveram));
			m64pload_saveram = (load_saveram)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "load_saveram"), typeof(load_saveram));

			m64pSetReadCallback = (SetReadCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetReadCallback"), typeof(SetReadCallback));
			m64pSetWriteCallback = (SetWriteCallback)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "SetWriteCallback"), typeof(SetWriteCallback));

			m64pGetRegisters = (GetRegisters)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "GetRegisters"), typeof(GetRegisters));

			m64p_read_memory_8 = (biz_read_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_read_memory"), typeof(biz_read_memory));
			m64p_write_memory_8 = (biz_write_memory)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_write_memory"), typeof(biz_write_memory));

			m64p_decode_op = (biz_r4300_decode_op)Marshal.GetDelegateForFunctionPointer(GetProcAddress(CoreDll, "biz_r4300_decode_op"), typeof(biz_r4300_decode_op));
		}
示例#16
0
 static void Main(string[] args)
 {
     CoreStartup.Startup();
 }
示例#17
0
        /// <summary>
        /// Initializes the application.
        /// </summary>
        /// <param name="startupSettings">The settings used for startup of the application.</param>
        public static void InitializeApplication(StartupSettings startupSettings)
        {
            // Initialize the most important services:
            var container = new AltaxoServiceContainer();

            container.AddFallbackProvider(Current.FallbackServiceProvider);
            container.AddService(typeof(IMessageService), new Altaxo.Main.Services.MessageServiceImpl());
            //			container.AddService(typeof(ILoggingService), new log4netLoggingService());
            Current.Services = container;

            Current.Log.Info("Initialize application...");
            var startup = new CoreStartup(startupSettings.ApplicationName);

            if (startupSettings.UseExceptionBoxForErrorHandler)
            {
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            string configDirectory = startupSettings.ConfigDirectory;
            string dataDirectory   = startupSettings.DataDirectory;
            string propertiesName;

            if (startupSettings.PropertiesName != null)
            {
                propertiesName = startupSettings.PropertiesName;
            }
            else
            {
                propertiesName = startupSettings.ApplicationName + "Properties";
            }

            if (startupSettings.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = startupSettings.ApplicationRootPath;
            }

            if (configDirectory == null)
            {
                configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                               startupSettings.ApplicationName);
            }

            var propertyService = new Altaxo.Main.Services.PropertyService(
                DirectoryName.Create(configDirectory),
                DirectoryName.Create(dataDirectory ?? Path.Combine(FileUtility.ApplicationRootPath, "data")),
                propertiesName);

            startup.StartCoreServices(propertyService, startupSettings);

            var exe = Assembly.Load(startupSettings.ResourceAssemblyName);

            Current.ResourceService.RegisterNeutralStrings(new ResourceManager("Altaxo.Resources.StringResources", exe));
            Current.ResourceService.RegisterNeutralImages(new ResourceManager("Altaxo.Resources.BitmapResources", exe));
            Current.ResourceService.RegisterNeutralStrings(new ResourceManager("Altaxo.Resources.AltaxoString", exe));
            Current.ResourceService.RegisterNeutralImages(new ResourceManager("Altaxo.Resources.AltaxoBitmap", exe));

            CommandWrapper.LinkCommandCreator      = (link => new LinkCommand(link));                                  // creation of command for opening web sites
            CommandWrapper.WellKnownCommandCreator = MenuService.GetKnownCommand;                                      // creation of all other commands
            CommandWrapper.RegisterConditionRequerySuggestedHandler   = (eh => CommandManager.RequerySuggested += eh); // CommandWrapper has to know how to subscribe to the RequerySuggested event of the command manager
            CommandWrapper.UnregisterConditionRequerySuggestedHandler = (eh => CommandManager.RequerySuggested -= eh); // CommandWrapper must know how to unsubscribe to the RequerySuggested event of the command manager

            Current.Log.Info("Looking for AddIns...");
            foreach (string file in startupSettings._addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in startupSettings._addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (startupSettings.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(configDirectory, "AddIns.xml"));
            }
            if (startupSettings.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(configDirectory, "AddInInstallTemp"),
                                            Path.Combine(configDirectory, "AddIns"));
            }

            Current.Log.Info("Loading AddInTree...");
            startup.RunInitialization();

            Current.Log.Info("Init application finished");
        }
示例#18
0
		public static void Main(string[] args)
		{
			// The LoggingService is a small wrapper around log4net.
			// Our application contains a .config file telling log4net to write
			// to System.Diagnostics.Trace.
			LoggingService.Info("Application start");
			
			// Get a reference to the entry assembly (Startup.exe)
			Assembly exe = typeof(Start).Assembly;
			
			// Set the root path of our application. ICSharpCode.Core looks for some other
			// paths relative to the application root:
			// "data/resources" for language resources, "data/options" for default options
			FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);
		    //ResourceHelper.GenerateResources(FileUtility.ApplicationRootPath + "\\Resources");
			LoggingService.Info("Starting core services...");
			
			// CoreStartup is a helper class making starting the Core easier.
			// The parameter is used as the application name, e.g. for the default title of
			// MessageService.ShowMessage() calls.
            CoreStartup coreStartup = new CoreStartup("SharpWorkbench");
			// It is also used as default storage location for the application settings:
			// "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory
			
			// Specify the name of the application settings file (.xml is automatically appended)
			coreStartup.PropertiesName = "AppProperties";
			
			// Initializes the Core services (ResourceService, PropertyService, etc.)
			coreStartup.StartCoreServices();
			
			// Registeres the default (English) strings and images. They are compiled as
			// "EmbeddedResource" into Startup.exe.
			// Localized strings are automatically picked up when they are put into the
			// "data/resources" directory.
			ResourceService.RegisterNeutralStrings(new ResourceManager("Startup.StringResources", exe));
			ResourceService.RegisterNeutralImages(new ResourceManager("Startup.ImageResources", exe));
            //ResourceService.RegisterNeutralImages(new ResourceManager("app", exe));

            AddInTree.Doozers.Add("Pad", new SharpWorkbench.Core.Pad.PadDoozer());
            AddInTree.Doozers.Add("DisplayBinding", new SharpWorkbench.Core.ViewContent.DisplayBindingDoozer());
			
			LoggingService.Info("Looking for AddIns...");
			// Searches for ".addin" files in the application directory.
			//coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns"));
            coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, ""));
			
			// Searches for a "AddIns.xml" in the user profile that specifies the names of the
			// add-ins that were deactivated by the user, and adds "external" AddIns.
			coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
			
			// Searches for add-ins installed by the user into his profile directory. This also
			// performs the job of installing, uninstalling or upgrading add-ins if the user
			// requested it the last time this application was running.
			coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
			                                Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
			
			LoggingService.Info("Loading AddInTree...");
			// Now finally initialize the application. This parses the ".addin" files and
			// creates the AddIn tree. It also automatically runs the commands in
			// "/Workspace/Autostart"
			coreStartup.RunInitialization();
			
			LoggingService.Info("Initializing Workbench...");
			// Workbench is our class from the base project, this method creates an instance
			// of the main form.

            WorkbenchSingleton.InitializeWorkbench();
            LoggingService.Debug("Starting workbench...");
            
			try {
				LoggingService.Info("Running application...");
				// Workbench.Instance is the instance of the main form, run the message loop.
                Application.Run((Form)WorkbenchSingleton.Workbench);
			} finally {
				try {
					// Save changed properties
					PropertyService.Save();
				} catch (Exception ex) {
					MessageService.ShowError(ex, "Error storing properties");
				}
			}
			
			LoggingService.Info("Application shutdown");
		}
示例#19
0
        public static void Main(string[] args)
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <UIElementAdapterFactoryCatalog>().As <IUIElementAdapterFactoryCatalog>().SingleInstance();
            var container = builder.Build();

            IoC.GetInstance = (t, p) => container.Resolve(t);

            Application.ThreadException += Application_ThreadException;
            AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;

            SkinManager.EnableFormSkins();
            BonusSkins.Register();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CriteriaOperator.RegisterCustomFunction(new IsDuringDaysFunction());
            CriteriaOperator.RegisterCustomFunction(new IsEarlierNextWeekFunction());
            CriteriaOperator.RegisterCustomFunction(new IsLastMonthFunction());
            CriteriaOperator.RegisterCustomFunction(new IsPriorDaysFunction());

            DevExpress.Utils.AppearanceObject.DefaultFont = System.Drawing.SystemFonts.DefaultFont;

            // The LoggingService is a small wrapper around log4net.
            // Our application contains a .config file telling log4net to write
            // to System.Diagnostics.Trace.
            ICSharpCode.Core.Services.ServiceManager.Instance = new Katrin.AppFramework.WinForms.Services.ServiceManager();
            LoggingService.Info("Application start");

            // Get a reference to the entry assembly (Startup.exe)
            Assembly exe = typeof(Program).Assembly;

            // Set the root path of our application. ICSharpCode.Core looks for some other
            // paths relative to the application root:
            // "data/resources" for language resources, "data/options" for default options
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            LoggingService.Info("Starting core services...");

            // CoreStartup is a helper class making starting the Core easier.
            // The parameter is used as the application name, e.g. for the default title of
            // MessageService.ShowMessage() calls.
            CoreStartup coreStartup = new CoreStartup("Katrin");

            // It is also used as default storage location for the application settings:
            // "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory

            // Specify the name of the application settings file (.xml is automatically appended)
            coreStartup.PropertiesName = "AppProperties";

            // Initializes the Core services (ResourceService, PropertyService, etc.)
            coreStartup.StartCoreServices();

            // Registeres the default (English) strings and images. They are compiled as
            // "EmbeddedResource" into Startup.exe.
            // Localized strings are automatically picked up when they are put into the
            // "data/resources" directory.
            ResourceService.RegisterNeutralStrings(new ResourceManager("Katrin.Shell.Resources.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("Katrin.Shell.Resources.ImageResources", exe));

            System.Threading.Thread.CurrentThread.CurrentCulture = CultureManager.CurrentCulture;
            ResourceService.Language = CultureManager.CurrentCulture.Name;

            LoggingService.Info("Looking for AddIns...");
            // Searches for ".addin" files in the application directory.
            coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns"));

            // Searches for a "AddIns.xml" in the user profile that specifies the names of the
            // add-ins that were deactivated by the user, and adds "external" AddIns.
            coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));

            // Searches for add-ins installed by the user into his profile directory. This also
            // performs the job of installing, uninstalling or upgrading add-ins if the user
            // requested it the last time this application was running.
            coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));

            LoggingService.Info("Loading AddInTree...");
            // Now finally initialize the application. This parses the ".addin" files and
            // creates the AddIn tree. It also automatically runs the commands in
            // "/Workspace/Autostart"
            coreStartup.RunInitialization();

            LoggingService.Info("Initializing Workbench...");
            // Workbench is our class from the base project, this method creates an instance
            // of the main form.
            LoginForm loginForm = new LoginForm();

            loginForm.ShowDialog();

            try
            {
                LoggingService.Info("Running application...");
                // Workbench.Instance is the instance of the main form, run the message loop.
                if (SecurityContext.IsLogon)
                {
                    var catalog = IoC.Get <IUIElementAdapterFactoryCatalog>();
                    catalog.RegisterFactory(new XtraNavBarUIAdapterFactory());
                    catalog.RegisterFactory(new XtraBarUIAdapterFactory());
                    catalog.RegisterFactory(new RibbonUIAdapterFactory());
                    catalog.RegisterFactory(new NavigatorCustomButtonUIAdapterFactory());
                    catalog.RegisterFactory(new EditorButtonCollectionUIAdapterFactory());

                    ODataObjectSpace.Initialize();
                    MetadataRepository.Initialize();

                    MainForm mainForm = new MainForm();
                    mainForm.FormClosed += mainForm_FormClosed;
                    mainForm.Show();

                    Application.Run();
                }
            }
            catch (Exception ex)
            {
                MessageService.ShowException(ex, ex.Message);
            }
            finally
            {
                LoadingFormManager.EndLoading();
                try
                {
                    // Save changed properties
                    PropertyService.Save();
                }
                catch (Exception ex)
                {
                    MessageService.ShowException(ex, ex.Message);
                }
            }

            LoggingService.Info("Application shutdown");
        }
示例#20
0
        public void InitSharpDevelopCore(SharpDevelopHost.CallbackHelper callback, StartupSettings properties)
        {
            // Initialize the most important services:
            var container = new SharpDevelopServiceContainer();

            container.AddFallbackProvider(ServiceSingleton.FallbackServiceProvider);
            container.AddService(typeof(IMessageService), new SDMessageService());
            container.AddService(typeof(ILoggingService), new log4netLoggingService());
            ServiceSingleton.ServiceProvider = container;

            LoggingService.Info("InitSharpDevelop...");
            this.callback = callback;
            CoreStartup startup = new CoreStartup(properties.ApplicationName);

            if (properties.UseSharpDevelopErrorHandler)
            {
                this.useSharpDevelopErrorHandler = true;
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            string configDirectory = properties.ConfigDirectory;
            string dataDirectory   = properties.DataDirectory;
            string propertiesName;

            if (properties.PropertiesName != null)
            {
                propertiesName = properties.PropertiesName;
            }
            else
            {
                propertiesName = properties.ApplicationName + "Properties";
            }

            if (properties.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
            }

            if (configDirectory == null)
            {
                configDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                               properties.ApplicationName);
            }
            var propertyService = new PropertyService(
                DirectoryName.Create(configDirectory),
                DirectoryName.Create(dataDirectory ?? Path.Combine(FileUtility.ApplicationRootPath, "data")),
                propertiesName);

            startup.StartCoreServices(propertyService);
            Assembly exe = Assembly.Load(properties.ResourceAssemblyName);

            SD.ResourceService.RegisterNeutralStrings(new ResourceManager("ICSharpCode.SharpDevelop.Resources.StringResources", exe));
            SD.ResourceService.RegisterNeutralImages(new ResourceManager("ICSharpCode.SharpDevelop.Resources.BitmapResources", exe));

            CommandWrapper.LinkCommandCreator      = (link => new LinkCommand(link));
            CommandWrapper.WellKnownCommandCreator = Core.Presentation.MenuService.GetKnownCommand;
            CommandWrapper.RegisterConditionRequerySuggestedHandler   = (eh => CommandManager.RequerySuggested += eh);
            CommandWrapper.UnregisterConditionRequerySuggestedHandler = (eh => CommandManager.RequerySuggested -= eh);
            StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());

            LoggingService.Info("Looking for AddIns...");
            foreach (string file in properties.addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in properties.addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (properties.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(configDirectory, "AddIns.xml"));
            }
            if (properties.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(configDirectory, "AddInInstallTemp"),
                                            Path.Combine(configDirectory, "AddIns"));
            }

            LoggingService.Info("Loading AddInTree...");
            startup.RunInitialization();

            ((AssemblyParserService)SD.AssemblyParserService).DomPersistencePath = properties.DomPersistencePath;

            // Register events to marshal back
            Project.ProjectService.BuildStarted   += delegate { this.callback.StartBuild(); };
            Project.ProjectService.BuildFinished  += delegate { this.callback.EndBuild(); };
            Project.ProjectService.SolutionLoaded += delegate { this.callback.SolutionLoaded(); };
            Project.ProjectService.SolutionClosed += delegate { this.callback.SolutionClosed(); };
            FileUtility.FileLoaded += delegate(object sender, FileNameEventArgs e) { this.callback.FileLoaded(e.FileName); };
            FileUtility.FileSaved  += delegate(object sender, FileNameEventArgs e) { this.callback.FileSaved(e.FileName); };

            LoggingService.Info("InitSharpDevelop finished");
        }
示例#21
0
        public void InitSharpDevelopCore(StartUpHost.CallbackHelper callback, StartupSettings properties)
        {
            // creating the service manager initializes the logging service etc.
            ICSharpCode.Core.Services.ServiceManager.Instance = new FWServiceManager();

            LoggingService.Info("InitFrameWork...");
            this.callback = callback;
            CoreStartup startup = new CoreStartup(properties.ApplicationName);

            if (properties.UseSharpDevelopErrorHandler)
            {
                this.useSharpDevelopErrorHandler = true;
                ExceptionBox.RegisterExceptionBoxForUnhandledExceptions();
            }
            startup.ConfigDirectory = properties.ConfigDirectory;
            startup.DataDirectory   = properties.DataDirectory;
            if (properties.PropertiesName != null)
            {
                startup.PropertiesName = properties.PropertiesName;
            }
            //AssemblyParserService.DomPersistencePath = properties.DomPersistencePath;//by hanz

            if (properties.ApplicationRootPath != null)
            {
                FileUtility.ApplicationRootPath = properties.ApplicationRootPath;
            }

            startup.StartCoreServices();
            Assembly exe = Assembly.Load(properties.ResourceAssemblyName);

            ResourceService.RegisterNeutralStrings(new ResourceManager("StartUp.Resources.StringResources", exe));
            ResourceService.RegisterNeutralImages(new ResourceManager("StartUp.Resources.BitmapResources", exe));

            MenuCommand.LinkCommandCreator  = delegate(string link) { return(new LinkCommand(link)); };
            MenuCommand.KnownCommandCreator = CreateICommandForWPFCommand;
            ICSharpCode.Core.Presentation.MenuService.LinkCommandCreator = MenuCommand.LinkCommandCreator;
            //StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());//by hanz

            LoggingService.Info("Looking for AddIns...");
            foreach (string file in properties.addInFiles)
            {
                startup.AddAddInFile(file);
            }
            foreach (string dir in properties.addInDirectories)
            {
                startup.AddAddInsFromDirectory(dir);
            }

            if (properties.AllowAddInConfigurationAndExternalAddIns)
            {
                startup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));
            }
            if (properties.AllowUserAddIns)
            {
                startup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));
            }

            LoggingService.Info("Loading AddInTree...");
            startup.RunInitialization();

            LoggingService.Info("InitFrameWork finished");
        }
示例#22
0
        static void Main()
        {
            if (appMutex.WaitOne(TimeSpan.Zero, true))
            {
                //Yes, we know that FDO providers like King.Oracle/MySQL/PostgreSQL require
                //additional dlls. No need to spam this error at the user everytime they launch
                SetErrorMode(SEM_FAILCRITICALERRORS);

                //Blah blah blah. I don't care that your FDO provider does not implement reference counting correctly
                //especially when you throw this as I'm exiting!
                _set_purecall_handler(IDontCare);

                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(true);
                Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

                // The LoggingService is a small wrapper around log4net.
                // Our application contains a .config file telling log4net to write
                // to System.Diagnostics.Trace.
                LoggingService.Info("Application start");

                AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);

                // Get a reference to the entry assembly (Startup.exe)
                Assembly exe = typeof(Program).Assembly;

                // Set the root path of our application. ICSharpCode.Core looks for some other
                // paths relative to the application root:
                // "data/resources" for language resources, "data/options" for default options
                FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

                LoggingService.Info("Starting core services...");

#if X64
                string title = "FDO Toolbox (x64)";
#else
                string title = "FDO Toolbox (x86)";
#endif
                // CoreStartup is a helper class making starting the Core easier.
                // The parameter is used as the application name, e.g. for the default title of
                // MessageService.ShowMessage() calls.

                CoreStartup coreStartup = new CoreStartup(title);

                // It is also used as default storage location for the application settings:
                // "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory

                var asmName = Assembly.GetExecutingAssembly().GetName();
                coreStartup.ConfigDirectory = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                    string.Format("{0} {1}.{2}.{3}",
                                  title,
                                  asmName.Version.Major,
                                  asmName.Version.Minor,
                                  asmName.Version.Build));


                // Specify the name of the application settings file (.xml is automatically appended)
                coreStartup.PropertiesName = "AppProperties";

                // Initializes the Core services (ResourceService, PropertyService, etc.)
                coreStartup.StartCoreServices();

                LoggingService.Info("Looking for AddIns...");
                // Searches for ".addin" files in the application directory.
                coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns"));

                // Searches for a "AddIns.xml" in the user profile that specifies the names of the
                // add-ins that were deactivated by the user, and adds "external" AddIns.
                coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml"));

                // Searches for add-ins installed by the user into his profile directory. This also
                // performs the job of installing, uninstalling or upgrading add-ins if the user
                // requested it the last time this application was running.
                coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"),
                                                Path.Combine(PropertyService.ConfigDirectory, "AddIns"));

                LoggingService.Info("Checking FDO");
                // Set FDO path
                string fdoPath = Preferences.FdoPath;
                bool   abort   = false;
                if (!FdoAssemblyResolver.IsValidFdoPath(fdoPath))
                {
                    fdoPath             = Path.Combine(FileUtility.ApplicationRootPath, "FDO");
                    Preferences.FdoPath = fdoPath;

                    while (!FdoAssemblyResolver.IsValidFdoPath(fdoPath) && !abort)
                    {
                        FolderBrowserDialog fb = new FolderBrowserDialog();
                        fb.Description = "Select the directory that contains the FDO binaries";
                        if (fb.ShowDialog() == DialogResult.Cancel)
                        {
                            abort = true;
                        }
                        else
                        {
                            fdoPath             = fb.SelectedPath;
                            Preferences.FdoPath = fdoPath;
                        }
                    }
                }

                if (abort)
                {
                    return;
                }

                AddInAssemblyResolver.RegisterLibraries(
                    fdoPath,
                    "OSGeo.FDO.dll",
                    "OSGeo.FDO.Common.dll",
                    "OSGeo.FDO.Geometry.dll",
                    "OSGeo.FDO.Spatial.dll",
                    "OSGeo.FDO.Providers.MySQL.Overrides.dll",
                    "OSGeo.FDO.Providers.ODBC.Overrides.dll",
                    "OSGeo.FDO.Providers.Rdbms.dll",
                    "OSGeo.FDO.Providers.Rdbms.Overrides.dll",
                    "OSGeo.FDO.Providers.SHP.Overrides.dll",
                    "OSGeo.FDO.Providers.SQLServerSpatial.Overrides.dll",
                    "OSGeo.FDO.Providers.WMS.Overrides.dll");

                LoggingService.Info("FDO path set to: " + fdoPath);

                LoggingService.Info("Loading AddInTree...");
                // Now finally initialize the application. This parses the ".addin" files and
                // creates the AddIn tree. It also automatically runs the commands in
                // "/Workspace/Autostart"
                coreStartup.RunInitialization();

                LoggingService.Info("Initializing Workbench...");
                // Workbench is our class from the base project, this method creates an instance
                // of the main form.
                log4net.Config.XmlConfigurator.Configure();
                Workbench.InitializeWorkbench(title);

                try
                {
                    LoggingService.Info("Running application...");
                    // Workbench.Instance is the instance of the main form, run the message loop.
                    Application.Run(Workbench.Instance);
                }
                finally
                {
                    try
                    {
                        // Save changed properties
                        PropertyService.Save();
                    }
                    catch (Exception ex)
                    {
                        MessageService.ShowError(ex, "Error storing properties");
                    }
                }
                LoggingService.Info("Application shutdown");
                appMutex.ReleaseMutex();
            }
            else
            {
                //Send our message to make the workbench be the topmost form
                NativeMethods.PostMessage(
                    (IntPtr)NativeMethods.HWND_BROADCAST,
                    NativeMethods.WM_SHOWME,
                    IntPtr.Zero,
                    IntPtr.Zero);
            }
        }
示例#23
0
 static void Main(string[] args)
 {
     CoreStartup.Startup(GameGloba.Start);
 }
示例#24
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(true);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            string lang = PreferredSiteList.InitCulture();

            //var btw = BroadcastTextWriter.Instance;

            // Logging service by default uses System.Diagnostics.Debug. Re-route this
            // to our writer
            //var wfmsg = WinFormsMessageService.Instance;
            //ServiceManager.LoggingService = new TextWriterLoggingService(btw);
            //ServiceManager.MessageService = wfmsg;

            ServiceManager.Instance = new MaestroServiceManager();
            LoggingService.Info("Application start"); //NOXLATE

            // Setup Platform.ini if required
            if (!Platform.IsRunningOnMono)
            {
                if (!File.Exists("Platform.ini") && File.Exists("LocalConfigure.exe")) //NOXLATE
                {
                    var proc = new ProcessStartInfo("LocalConfigure.exe");
                    if (Environment.OSVersion.Version.Major >= 6)
                    {
                        proc.Verb = "runas"; //NOXLATE
                    }
                    var p = Process.Start(proc);
                    p.WaitForExit();
                }
            }

            if (Platform.IsRunningOnMono)
            {
                LoggingService.Info(Strings.Warn_Mono);
            }

            //Init our default set of resource validators
            ResourceValidatorLoader.LoadStockValidators();

            AppDomain.CurrentDomain.AssemblyLoad       += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            // Get a reference to the entry assembly (Startup.exe)
            Assembly exe = typeof(Program).Assembly;

            // Set the root path of our application. ICSharpCode.Core looks for some other
            // paths relative to the application root:
            // "data/resources" for language resources, "data/options" for default options
            FileUtility.ApplicationRootPath = Path.GetDirectoryName(exe.Location);

            LoggingService.Info("Starting core services..."); //NOXLATE

            // CoreStartup is a helper class making starting the Core easier.
            // The parameter is used as the application name, e.g. for the default title of
            // MessageService.ShowMessage() calls.
            CoreStartup coreStartup = new CoreStartup("MapGuide Maestro"); //NOXLATE

            // It is also used as default storage location for the application settings:
            // "%Application Data%\%Application Name%", but you can override that by setting c.ConfigDirectory

            // #1955: Each version of Maestro from here on in will store their user data under
            // %APPDATA%\Maestro-x.y
            coreStartup.ConfigDirectory = MaestroPaths.BasePath;

            // Specify the name of the application settings file (.xml is automatically appended)
            coreStartup.PropertiesName = "AppProperties"; //NOXLATE

            // Initializes the Core services (ResourceService, PropertyService, etc.)
            coreStartup.StartCoreServices();

            LoggingService.Info("Looking for AddIns...");                                                //NOXLATE
            // Searches for ".addin" files in the application directory.
            coreStartup.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns")); //NOXLATE

            // Searches for a "AddIns.xml" in the user profile that specifies the names of the
            // add-ins that were deactivated by the user, and adds "external" AddIns.
            coreStartup.ConfigureExternalAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml")); //NOXLATE

            // Searches for add-ins installed by the user into his profile directory. This also
            // performs the job of installing, uninstalling or upgrading add-ins if the user
            // requested it the last time this application was running.
            coreStartup.ConfigureUserAddIns(Path.Combine(PropertyService.ConfigDirectory, "AddInInstallTemp"), //NOXLATE
                                            Path.Combine(PropertyService.ConfigDirectory, "AddIns"));          //NOXLATE

            ResourceService.Language = lang;
            LoggingService.Info("Loading AddInTree..."); //NOXLATE
            // Now finally initialize the application. This parses the ".addin" files and
            // creates the AddIn tree. It also automatically runs the commands in
            // "/Workspace/Autostart"
            coreStartup.RunInitialization();

            LoggingService.Info("Initializing Workbench..."); //NOXLATE
            // Workbench is our class from the base project, this method creates an instance
            // of the main form.
            ServiceRegistry.Initialize(() =>
            {
                //DIRTY DIRTY HACK: I'm getting tired of Mono workarounds. But background resource
                //preview preparation has a chance of clogging up if the main window is initially maximized
                Workbench.InitializeWorkbench(new WorkbenchInitializer(!Platform.IsRunningOnMono));
                try
                {
                    LoggingService.Info("Running application..."); //NOXLATE
                    // Workbench.Instance is the instance of the main form, run the message loop.
                    Application.Run(Workbench.Instance);
                }
                finally
                {
                    try
                    {
                        // Save changed properties
                        PropertyService.Save();
                    }
                    catch (Exception ex)
                    {
                        ErrorDialog.Show(Strings.Error_StoreProperties, ex.ToString());
                    }
                }
                LoggingService.Info("Application shutdown"); //NOXLATE
            });
        }