コード例 #1
0
        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);
            }
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: ActiveSession.cs プロジェクト: RayCulp/VCS-VBASync
        private void ApplyPatches(IEnumerable <Patch> patches, VbaFolder source, VbaFolder destination)
        {
            foreach (var patch in patches)
            {
                switch (patch.ChangeType)
                {
                case ChangeType.AddFile:
                    destination.AddModule(patch.ModuleName, patch.ModuleType, source);
                    break;

                case ChangeType.DeleteFile:
                    destination.DeleteModule(patch.ModuleName, patch.ModuleType);
                    break;

                case ChangeType.ChangeFormControls:
                    destination.ReplaceFormControls(patch.ModuleName, source);
                    break;

                default:
                    destination.ReplaceTextModule(patch.ModuleName, patch.ModuleType, source, patch.SideBySideNewText);
                    break;
                }
            }
        }
コード例 #4
0
 public void ReplaceFormControls(string name, VbaFolder source)
 {
     _so.FileCopy(source.FindFrxPath(name), FindFrxPath(name), true);
 }
コード例 #5
0
 internal ModuleLocator(VbaFolder parent)
 {
     _parent = parent;
 }
コード例 #6
0
 public void ReplaceFormControls(string name, VbaFolder source)
 {
     _so.FileCopy(FindFrxPath(source.FindModulePath(name, ModuleType.Form)),
                  FindFrxPath(FindModulePath(name, ModuleType.Form)), true);
 }
コード例 #7
0
 public ActiveSession(ISession session, ISessionSettings sessionSettings)
 {
     _session         = session;
     _sessionSettings = sessionSettings;
     _vf = new VbaFolder();
 }