Esempio n. 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);
            }
        }
Esempio n. 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);
        }
Esempio n. 3
0
        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;
                }
            }
        }
Esempio n. 4
0
 public void ReplaceFormControls(string name, VbaFolder source)
 {
     _so.FileCopy(source.FindFrxPath(name), FindFrxPath(name), true);
 }
Esempio n. 5
0
 internal ModuleLocator(VbaFolder parent)
 {
     _parent = parent;
 }
Esempio n. 6
0
 public void ReplaceFormControls(string name, VbaFolder source)
 {
     _so.FileCopy(FindFrxPath(source.FindModulePath(name, ModuleType.Form)),
                  FindFrxPath(FindModulePath(name, ModuleType.Form)), true);
 }
Esempio n. 7
0
 public ActiveSession(ISession session, ISessionSettings sessionSettings)
 {
     _session         = session;
     _sessionSettings = sessionSettings;
     _vf = new VbaFolder();
 }