コード例 #1
0
ファイル: ModCreator.cs プロジェクト: danarcher/XCom2ModTool
        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);
 }