void MergeBundleFileNode(TreeNode fileNode, TreeNode[] checkedModNodes, Merge merge, bool isNew) { _outputPath = Path.Combine(Paths.MergedBundleContent, fileNode.Text); if (File.Exists(_outputPath) && !ConfirmOutputOverwrite(_outputPath)) { return; } _vanillaFile = null; var metadata1 = checkedModNodes[0].GetMetadata(); var source1 = MergeSource.FromBundle(new FileInfo(metadata1.FilePath), metadata1.FileHash); for (int i = 1; i < checkedModNodes.Length; ++i) { ++ProgressInfo.CurrentMergeNum; var metadata2 = checkedModNodes[i].GetMetadata(); var source2 = MergeSource.FromBundle(new FileInfo(metadata2.FilePath), metadata2.FileHash); if (!GetUnpackedFiles(fileNode.Text, ref source1, ref source2)) { if (DialogResult.Abort != HandleCanceledMerge(checkedModNodes.Length - i - 1, merge)) { continue; } break; } var mergedFile = MergeText(merge, source1, source2, true); if (mergedFile != null) { source1 = MergeSource.FromFlatFile(mergedFile, null); } else if (DialogResult.Abort == HandleCanceledMerge(checkedModNodes.Length - i - 1, merge)) { break; } } if (merge.BundleName != null && isNew && merge.Mods.Count > 1) { _bundleChanged = true; _pendingBundleMerges.Add(merge); } }
void MergeFlatFileNode(TreeNode fileNode, TreeNode[] checkedModNodes, Merge merge, bool isNew) { var metadata1 = checkedModNodes[0].GetMetadata(); var source1 = MergeSource.FromFlatFile(new FileInfo(metadata1.FilePath), metadata1.FileHash); var relPath = Paths.GetRelativePath( source1.TextFile.FullName, Path.Combine(Paths.ModsDirectory, source1.Name)); _outputPath = Path.Combine(Paths.ModsDirectory, _mergedModName, relPath); if (File.Exists(_outputPath) && !ConfirmOutputOverwrite(_outputPath)) { return; } _vanillaFile = new FileInfo(fileNode.GetMetadata().FilePath); for (int i = 1; i < checkedModNodes.Length; ++i) { ++ProgressInfo.CurrentMergeNum; var metadata2 = checkedModNodes[i].GetMetadata(); var source2 = MergeSource.FromFlatFile(new FileInfo(metadata2.FilePath), metadata2.FileHash); var mergedFile = MergeText(merge, source1, source2, false); if (mergedFile != null) { source1 = MergeSource.FromFlatFile(mergedFile, null); } else if (DialogResult.Abort == HandleCanceledMerge(checkedModNodes.Length - i - 1, merge)) { break; } } if (isNew && merge.Mods.Count > 1) { ProgressInfo.CurrentAction = "Adding script merge to inventory"; _inventory.Merges.Add(merge); } }