public void Dispose()
 {
     ApplicationMacros.Clear();
     GlobalMacros.Clear();
     AutomationSequences.Clear();
     ((IDisposable)WebClient).Dispose();
 }
        private bool ResetApplicationMacros(AutomationSequence sequence)
        {
            Logging.Debug(Logfiles.AutomationRunner, LogOptions.ClassName, "Resetting application macros");

            //check that required automation settings are set for being able to reset macaros
            if (string.IsNullOrEmpty(AutomationRunnerSettings.WoTClientInstallLocation))
            {
                Logging.Error("WoTClientInstallLocation is not set in settings tab!");
                return(false);
            }
            if (!File.Exists(AutomationRunnerSettings.WoTClientInstallLocation))
            {
                Logging.Error("WoTClientInstallLocation file does not exist!");
                return(false);
            }

            DatabasePackage   package           = sequence.Package;
            SelectablePackage selectablePackage = package as SelectablePackage;

            ApplicationMacros.Clear();
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "date", Value = DateTime.UtcNow.ToString("yyyy-MM-dd"), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "category.name", Value = (selectablePackage != null) ? selectablePackage.ParentCategory.Name : "null", MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "name", Value = (selectablePackage != null) ? selectablePackage.NameFormatted : "null", MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "packageName", Value = package.PackageName, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "packageUID", Value = package.UID, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "zipfile", Value = package.ZipFile, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "level", Value = (selectablePackage != null) ? selectablePackage.Level.ToString() : "null", MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "patchGroup", Value = package.PatchGroup.ToString(), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "installGroup", Value = package.InstallGroupWithOffset.ToString(), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "clientVersion", Value = WoTClientVersion, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "onlineFolderVersion", Value = WoTModpackOnlineFolderVersion, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "author", Value = package.Author, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "version", Value = package.Version, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "applicationPath", Value = ApplicationConstants.ApplicationStartupPath, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "relhaxTemp", Value = ApplicationConstants.RelhaxTempFolderPath, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "workDirectory", Value = string.Format("{0}\\{1}", ApplicationConstants.RelhaxTempFolderPath, package.PackageName), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "automationRepoRoot", Value = AutomationRepoPathEscaped, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "clientPath", Value = Path.GetDirectoryName(AutomationRunnerSettings.WoTClientInstallLocation)
            });
            return(true);
        }
Example #3
0
        public void ResetApplicationMacros(AutomationSequence sequence)
        {
            Logging.Debug(Logfiles.AutomationRunner, LogOptions.ClassName, "Resetting application macros");
            DatabasePackage   package           = sequence.Package;
            SelectablePackage selectablePackage = package as SelectablePackage;

            ApplicationMacros.Clear();
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "date", Value = DateTime.UtcNow.ToString("yyyy-MM-dd"), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "category.name", Value = (selectablePackage != null)? selectablePackage.ParentCategory.Name : "null", MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "name", Value = (selectablePackage != null)? selectablePackage.NameFormatted : "null", MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "packageName", Value = package.PackageName, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "zipfile", Value = package.ZipFile, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "level", Value = (selectablePackage != null)? selectablePackage.Level.ToString() : "null", MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "patchGroup", Value = package.PatchGroup.ToString(), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "installGroup", Value = package.InstallGroupWithOffset.ToString(), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "clientVersion", Value = WoTClientVersion, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "onlineFolderVersion", Value = WoTModpackOnlineFolderVersion, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "author", Value = package.Author, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "version", Value = package.Version, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "applicationPath", Value = ApplicationConstants.ApplicationStartupPath, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "relhaxTemp", Value = ApplicationConstants.RelhaxTempFolderPath, MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "workDirectory", Value = string.Format("{0}\\{1}", ApplicationConstants.RelhaxTempFolderPath, package.PackageName), MacroType = MacroType.ApplicationDefined
            });
            ApplicationMacros.Add(new AutomationMacro()
            {
                Name = "automationRepoRoot", Value = AutomationXmlRepoFilebaseEscaped, MacroType = MacroType.ApplicationDefined
            });
        }