Exemplo n.º 1
0
        public async Task <bool> DeleteDirectory(string directoryPath)
        {
            await _scriptWrapperBool.Run("Remove-Item", new Dictionary <string, dynamic> {
                { "LiteralPath", directoryPath }, { "Force", null }, { "Recurse", null }
            });

            return(!_scriptWrapperBool.Errors.Any());
        }
Exemplo n.º 2
0
        public async Task <bool> CreateDirectory(string directoryPath)
        {
            await _scriptWrapperDirectory.Run("New-Item", new Dictionary <string, dynamic> {
                { "ItemType", "directory" }, { "Path", directoryPath }
            });

            return(_scriptWrapperDirectory.Results.Any());
        }
Exemplo n.º 3
0
        public async Task <string> GetHashMd5(string kernelPath)
        {
            var parameters = new Dictionary <string, dynamic> {
                { "Filepath", kernelPath }
            };
            await _scriptWrapper.Run(Modules.Functions.GetHashMD5, parameters);

            return(_scriptWrapper.Results.FirstOrDefault());
        }
Exemplo n.º 4
0
        public async Task <bool> SaveToFile(BackupInfo backupInfo)
        {
            var parameters = new Dictionary <string, dynamic>
            {
                { "xml", backupInfo.Serialize().ToString() },
                { "OutputFile", $@"{backupInfo.Webroot}\{Settings.BackupInfoFile}" }
            };

            await _scriptWrapper.Run(Modules.Functions.SaveBackupInfo, parameters);

            return(true);
        }
        public async Task <IEnumerable <KeyValuePair <string, string> > > GetBindings(string siteName)
        {
            await _scriptWrapper.Run(Modules.Functions.GetBindings, new Dictionary <string, dynamic> {
                { "SiteNameOrPath", siteName }
            });

            return(_scriptWrapper.Results);
        }
Exemplo n.º 6
0
        public async Task <string> ReadUrlContent(string url)
        {
            var parameters = new Dictionary <string, dynamic>
            {
                { "Webroot", _profile.Webroot },
                { "RelativeUrl", url }
            };

            await _scriptWrapper.Run(Modules.Functions.ReadUrlContent, parameters);

            return(string.Join("\r\n", _scriptWrapper.Results));
        }
Exemplo n.º 7
0
        private async Task TestRemote(object sender, EventArgs <IRemoteSettings> e)
        {
            var profile = ProfilesService.CreateProfile(e.Value);

            _scriptWrapper = new ScriptWrapper <string>(profile, _view, d => d.ToString());

            await _scriptWrapper.Run("dir");

            if (_scriptWrapper.Results.Any())
            {
                _displayMessage.ShowInfo("Success", "Your connection details are valid.");
            }

            if (_scriptWrapper.Errors.Any() && _scriptWrapper.Errors.First() is RemoteTimeoutException)
            {
                _displayMessage.ShowError("Connection Error", "Falied to connect to remote machine with specified parameters");
            }

            _view.ToggleTestButton(true);
        }
Exemplo n.º 8
0
        public async Task <Dictionary <string, DriveType> > GetDrives()
        {
            await _scriptWrapperDrive.Run(Modules.Functions.GetDrives);

            return(_scriptWrapperDrive.Results.ToDictionary(d => d.Name, d => d.DriveType));
        }
        public async Task <IEnumerable <string> > GetSitecoreSites()
        {
            await _scriptWrapperString.Run(Modules.Functions.GetSitecoreSites);

            return(_scriptWrapperString.Results);
        }