コード例 #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());
        }
コード例 #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());
        }
コード例 #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());
        }
コード例 #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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
ファイル: RequestHelper.cs プロジェクト: ampach/Sifon
        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));
        }
コード例 #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);
        }
コード例 #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));
        }
コード例 #9
0
        public async Task <IEnumerable <string> > GetSitecoreSites()
        {
            await _scriptWrapperString.Run(Modules.Functions.GetSitecoreSites);

            return(_scriptWrapperString.Results);
        }