Esempio n. 1
0
        static bool InitializeApp()
        {
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            //SplashForm splash = null;
            if (!IsMono)
            {
                SplashForm.Start();
            }

            SplashForm.SetProgress("Loading core...", 0);
            //if (splash != null) splash.SetCurWork("Loading core...");
            Core.IsGUI = true;
            Core.Instance.CreateWantedDirs();
            HSplash.AddModuleInfo += SplashForm.AddModuleInfo;
            DeletedFileRegistrer.Initialize();
            Core.ConfigureLogging();
            AsyncTool.MainThread = Thread.CurrentThread;
            //NodeFactory.RegisterRootCreator(RootTreeNode.CreateRoot);
            FileTextProvider.LoadStdTexts();
            LicenseTool.ReloadLicenses();
            UICache.Load();

            PluginTools.AddMasterAssembly(Assembly.GetAssembly(typeof(Program)));
            PluginTools.LoadPlugins(SplashForm.LoadPluginCallback);

            SplashForm.SetProgress(Texts.Get("s_loading_configuration"), 80);
            //AddonLibrary.ReloadLibs();
            GlobalSettings.Initialize();
            InternetSettings.Initialize();
            Texts.Language = GlobalSettings.Pages.General().Language;
            HSettings.CallLoaded();

            if (CheckAutoUpdate.Run(SplashForm.EnsureNoSplash))
            {
                Environment.Exit(0);
                return(true);
            }

            Core.RunAutoInstall();

            Core.CopyDefaultData();

            UsageStats.OnStart();
            Favorites.OnStart();
            //SendUsageForm.UploadIfNeeded(SplashForm.EnsureNoSplash);

            SplashForm.SetProgress(Texts.Get("s_creating_main_window"), 100);

            Logging.Info("Starting DatAdmin GUI");
            return(false);
        }
Esempio n. 2
0
        public static void LoadStdTexts()
        {
            FileTextProvider provider = new FileTextProvider();

            if (Directory.Exists(Core.LangDirectory))
            {
                foreach (string file in Directory.GetFiles(Core.LangDirectory))
                {
                    string ext = Path.GetExtension(file).ToLower();
                    if (ext.StartsWith("."))
                    {
                        ext = ext.Substring(1);
                    }
                    provider.AddFile(file, ext);
                }
            }
            Texts.RegisterTextProvider(provider);
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Core.IsCommandLine = true;
            Core.Instance.CreateWantedDirs();
            Core.ConfigureLogging();

            FileTextProvider.LoadStdTexts();
            LicenseTool.ReloadLicenses();

            PluginTools.AddMasterAssembly(Assembly.GetAssembly(typeof(DaciProgram)));
            PluginTools.LoadPlugins();
            GlobalSettings.Initialize();
            InternetSettings.Initialize();
            HSettings.CallLoaded();

            //Async.MainThread = Thread.CurrentThread;

            try
            {
                if (args.Length == 0)
                {
                    CmdLine.PrintHelp();
                    Environment.Exit(0);
                }
                Logging.Info("Starting DACI - DatAdmin CommandLine interface");
                ICommandLineCommandInstance cmd = CmdLine.LoadCommand(args);
                cmd.RunCommand();
            }
            catch (ExpectedError e)
            {
                Logging.Error(e.Message);
            }
            catch (Exception e)
            {
                Logging.Error("Fatal error:" + e.ToString());
            }
            Logging.QuitAndWait();
            Core.FinalizeApp();
            Environment.Exit(0);
        }
Esempio n. 4
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            SystemLogTool.Info("Initializing DatAdmin Service process...");

            try
            {
                var si = new DatAdminServiceInfo();
                si.Load();
                si.Apply();

                Core.IsCommandLine = true;
                Core.Instance.CreateWantedDirs();
                Core.ConfigureLogging();

                FileTextProvider.LoadStdTexts();
                LicenseTool.ReloadLicenses();

                PluginTools.AddMasterAssembly(Assembly.GetAssembly(typeof(Program)));
                PluginTools.LoadPlugins();
                GlobalSettings.Initialize();
                InternetSettings.Initialize();

                FileTextProvider.LoadStdTexts();
                LicenseTool.ReloadLicenses();
                HSettings.CallLoaded();

                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[]
                {
                    new DatAdminService()
                };
                ServiceBase.Run(ServicesToRun);
            }
            catch (Exception err)
            {
                SystemLogTool.Error("Failed to initialize DatAdmin Service process\n" + err.ToString());
            }
        }