예제 #1
0
        public static void Create(string targetPath)
        {
            var modName     = Path.GetFileName(targetPath);
            var description = DefaultDescripton;
            var guid1       = Guid.NewGuid().ToString("D");
            var guid2       = Guid.NewGuid().ToString("D");
            var guid3       = Guid.NewGuid().ToString("D");

            var sourcePath = Path.Combine(Program.HomePath, NewModTemplateFolder, ModNamePlaceholder);

            if (Directory.Exists(targetPath))
            {
                throw new Exception($"{modName} already exists");
            }

            DirectoryHelper.CopyDirectory(sourcePath, targetPath);

            DirectoryHelper.ReplaceDirectoryContents(
                targetPath,
                extensions: null,
                StringComparison.OrdinalIgnoreCase,
                SearchOption.AllDirectories,
                rename: true,
                (ModNamePlaceholder, modName),
                (DescriptionPlaceholder, description),
                (Guid1Placeholder, guid1),
                (Guid2Placeholder, guid2),
                (Guid3Placeholder, guid3));
        }
예제 #2
0
        private bool StageModFolder(string folderName)
        {
            var sourcePath = Path.Combine(modInfo.InnerPath, folderName);

            if (Directory.Exists(sourcePath))
            {
                Report.Verbose($"Staging {folderName}");
                var targetPath = Path.Combine(modStagingPath, folderName);
                DirectoryHelper.CopyDirectory(sourcePath, targetPath);
                return(true);
            }
            return(false);
        }
예제 #3
0
        private void RestoreSdkSourceCode()
        {
            Report.Verbose("Restoring SDK source");
            var count = DirectoryHelper.CopyDirectory(edition.SdkOriginalSourceCodePath, edition.SdkSourceCodePath);

            Report.Verbose($"Restored {count} files");
            if (Settings.Default.Highlander)
            {
                var highlanderSourceCodePath = edition.GetHighlanderModSourceCodePath();
                Report.Verbose($"Restoring highlander source from {highlanderSourceCodePath}");
                count = DirectoryHelper.CopyDirectory(highlanderSourceCodePath, edition.SdkSourceCodePath);
                Report.Verbose($"Restored {count} files");
            }
        }
예제 #4
0
 private void DeployMod()
 {
     Report.Verbose("Deploying mod");
     DirectoryHelper.Delete(modInstallPath);
     DirectoryHelper.CopyDirectory(modStagingPath, modInstallPath);
 }
예제 #5
0
 private void CopyModSourceCodeToSdk()
 {
     Report.Verbose("Copying mod source");
     DirectoryHelper.CopyDirectory(modInfo.SourceCodePath, edition.SdkSourceCodePath);
 }