Пример #1
0
        /// <summary>
        /// Called when [execute].
        /// </summary>
        /// <param name="parameter">The parameter.</param>
        protected override void OnExecute(object parameter)
        {
            var modFolder = this.Options.ModFilesProvider.ModFolder;

            var absoluteSourcePath = Path.Combine(Environment.CurrentDirectory, modFolder.SourcePath);

            // Verify source data
            if (!File.Exists(absoluteSourcePath))
            {
                // Log error
                return;
            }

            var absoluteTargetPath = Path.Combine(this.Options.TargetGame.InstallationPath, modFolder.TargetPath);

            // Overwrite needed?
            if (!File.Exists(absoluteTargetPath))
            {
                // Ask permission for overwrite (or delete whole thing, then recopy?)
            }

            try
            {
                DirectoryCopyHelper.DirectoryCopy(absoluteSourcePath, absoluteTargetPath, true, true);
                // Log success
            }
            catch
            {
                // Log failure
            }
        }
Пример #2
0
        /// <summary>
        /// Installs the converter mod.
        /// </summary>
        private void InstallConverterMod()
        {
            //var modFolder = this.Options.ModFilesProvider.ModFolder;

            var absoluteSourcePath = Path.Combine(Environment.CurrentDirectory, "Mod");

            // Verify source data
            if (!Directory.Exists(absoluteSourcePath))
            {
                // Log error
                this.Log("Could not find mod folder (" + absoluteSourcePath + "), making it somewhat hard to copy said folder to " + this.Options.TargetGame.InstallationPath + "\\mod" + ". This means that the converter mod isn't installed, so you might want to try to do it manually instead.", LogEntrySeverity.Error, LogEntrySource.UI);
                return;
            }

            // Overwrite needed?
            if (!File.Exists(this.Options.TargetGame.InstallationPath + "\\mod"))
            {
                // Ask permission for overwrite (or delete whole thing, then recopy?)
            }

            try
            {
                DirectoryCopyHelper.DirectoryCopy(absoluteSourcePath, this.Options.TargetGame.InstallationPath + "\\mod", true, true);
                this.Log("Converter mod copied successfully from " + absoluteSourcePath + " to " + this.Options.TargetGame.InstallationPath + "\\mod", LogEntrySeverity.Info, LogEntrySource.UI);
            }
            catch (Exception ex)
            {
                this.Log("Converter mod installation failed. Directory could not be copied from " + absoluteSourcePath + " to " + this.Options.TargetGame.InstallationPath + "\\mod" + ". The internal error message was: " + ex.Message, LogEntrySeverity.Error, LogEntrySource.UI);
            }
        }