예제 #1
0
        private void UpdateAddinDueDateByNamespace(string licenseNamespace)
        {
            List <string> addinsCode = licenseDAO.getAddinsByNamespace(licenseNamespace);

            licenseDAO.UpdateNamespaceDueDate(licenseNamespace, DateTime.MinValue);

            var setup = new AppDomainSetup();

            setup.ApplicationName = "Dover.ConfigureDomain";
            setup.ApplicationBase = AppDomain.CurrentDomain.BaseDirectory;
            AppDomain configureDomain = AppDomain.CreateDomain("ConfigureDomain", null, setup);

            try
            {
                configureDomain.SetData("assemblyName", "tempDomain");
                IApplication app = (IApplication)configureDomain.CreateInstanceAndUnwrap("Framework",
                                                                                         "Dover.Framework.Application");
                SAPServiceFactory.PrepareForInception(configureDomain);
                LicenseManager licenseManager = app.Resolve <LicenseManager>();
                foreach (var addinCode in addinsCode)
                {
                    DateTime dueDate;
                    if (licenseManager.AddinIsValid(addinCode, out dueDate))
                    {
                        licenseDAO.UpdateAddinDueDate(addinCode, dueDate);
                    }
                }
            }
            finally
            {
                AppDomain.Unload(configureDomain);
            }
        }
예제 #2
0
        void IAddinLoader.StartThis()
        {
            string thisAsmName = (string)AppDomain.CurrentDomain.GetData("assemblyName");

            try
            {
                DateTime dueDate;
                Assembly thisAsm     = AppDomain.CurrentDomain.Load(thisAsmName);
                string   thisAsmCode = GetThisAsmCode(thisAsm);

                if (!licenseManager.AddinIsValid(thisAsmCode, out dueDate))
                {
                    // We shouldn´t be here. bye.
                    throw new Exception(string.Format(Messages.NoLicenseError, thisAsmCode));
                }

                ContainerManager.RegisterAssembly(thisAsm);
                StartMenu(thisAsm);
            }
            catch (Exception e)
            {
                Logger.Error(string.Format(Messages.StartThisError, thisAsmName), e);
                throw e;
            }
        }
예제 #3
0
        private void LoadAddin(AssemblyInformation addin)
        {
            DateTime dueDate;

            if (licenseManager.AddinIsValid(addin.Code, out dueDate))
            {
                string directory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", "addIn", addin.Namespace, addin.Name);
                Directory.CreateDirectory(directory);
                fileUpdate.UpdateAppDataFolder(addin, directory);
                if (!IsInstalled(addin.Code))
                {
                    InstallAddin(addin, directory);
                }
                RegisterAddin(addin);
                ConfigureLog(addin);
            }
            else
            {
                Logger.Error(string.Format(Messages.NoLicenseError, addin.Name));
            }
        }