public void ReplaceTextModule(string name, ModuleType type, VbaFolder source, string fallbackText) { var sourcePath = source.FindModulePath(name, type); var destinationPath = FindModulePath(name, type); if (string.IsNullOrEmpty(destinationPath)) { destinationPath = _so.PathCombine(FolderPath, name + ModuleProcessing.ExtensionFromType(type)); } if (_so.FileExists(sourcePath)) { if (source.ProjectEncoding.Equals(ProjectEncoding)) { _so.FileCopy(sourcePath, destinationPath, true); } else { _so.FileWriteAllText(destinationPath, _so.FileReadAllText(sourcePath, source.ProjectEncoding), ProjectEncoding); } } else { _so.FileWriteAllText(destinationPath, fallbackText, ProjectEncoding); } }
public void AddModule(string name, ModuleType type, VbaFolder source) { var path = _so.PathCombine(FolderPath, name + ModuleProcessing.ExtensionFromType(type)); _so.FileCopy(source.FindModulePath(name, type), path); if (type == ModuleType.Form) { var frxPath = path.Substring(0, path.Length - 4) + ".frx"; _so.FileCopy(source.FindFrxPath(name), frxPath); } ModuleFilePaths.Add(path); }
public string GetModulePath(string name, ModuleType type) => _parent.FindModulePath(name, type);
public void ReplaceFormControls(string name, VbaFolder source) { _so.FileCopy(FindFrxPath(source.FindModulePath(name, ModuleType.Form)), FindFrxPath(FindModulePath(name, ModuleType.Form)), true); }