Exemplo n.º 1
0
        bool Initialize()
        {
            if (Configuration != null)
            {
                TheBaseAssets.MySettings = new TheNetCoreSettings(Configuration);
            }
            MyArgList = (Configuration.GetChildren().ToDictionary(x => x.Key, x => x.Value));
            UpdateArgList(MyArgList);
            StartupLog?.Log("Service: Loading C-LabsCryptoLib");
            TheBaseAssets.LoadCrypto("C-LabsCryptoLib.dll", StartupLog, MyArgList.ContainsKey("DontVerifyTrust") && CU.CBool(MyArgList["DontVerifyTrust"]), null, MyArgList.ContainsKey("VerifyTrustPath") && CU.CBool(MyArgList["VerifyTrustPath"]), MyArgList.ContainsKey("DontVerifyIntegrity") && CU.CBool(MyArgList["DontVerifyIntegrity"]));
            if (TheBaseAssets.CryptoLoadMessage != null)
            {
                StartupLog?.Log($"Security initialization failed with {TheBaseAssets.CryptoLoadMessage}. Exiting...");
                return(false);
            }
            StartupLog?.Log("Service: Setting apid");
            if (!TheScopeManager.SetApplicationID(ServiceApplicationID))
            {
                StartupLog?.Log("Application ID Illegal...exiting");
                return(false);
            }
            StartupLog?.Log("Service: Creating service host");

            TheBaseAssets.MyServiceHostInfo = new TheServiceHostInfo(m_hostType)
            {
                CurrentVersion    = CU.GetAssemblyVersion(this),
                DebugLevel        = eDEBUG_LEVELS.OFF,
                UPnPIcon          = "iconTopLogo.png",
                LocalServiceRoute = "LOCALHOST",
            };
            TheBaseAssets.MyServiceHostInfo.TO.HeartBeatRate = 3;
            TheBaseAssets.MyServiceHostInfo.StatusColors     = ";#65bb00;orange";
            TheBaseAssets.MyServiceHostInfo.ApplicationName  = "Factory-Relay";

            UpdateServiceHostInfo(TheBaseAssets.MyServiceHostInfo);

            if (m_hostType == cdeHostType.Application)
            {
                TheBaseAssets.MyServiceHostInfo.AddManifestFiles(new List <string> {
                    TheBaseAssets.MyServiceHostInfo.ISMMainExecutable,
                    "C-DEngine.dll", "C-DMyNMIHtml5.dll"
                });
            }

            StartupLog?.Log("Service: Created service host");
            return(true);
        }