public void TC001_TestNetwork()
        {
            string fileContent = File.ReadAllText("settings.json");

            Config.Setup(JsonConvert.DeserializeObject(fileContent), false);
            WindowsNetwork.SetupNetwork();
        }
        protected override IEnumerable <CommandParameters> Execute(IEnumerable <CommandParameters> inParametersList)
        {
            foreach (var inParameters in inParametersList)
            {
                //inParameters = GetCurrentInParameters();
                string uncPath     = inParameters.GetValue <string>("UNCPath");
                string driveLetter = inParameters.GetValue <string>("DriveLetter");
                string userName    = inParameters.GetValue <string>("UserName");
                string password    = inParameters.GetValue <string>("Password");
                var    mode        = inParameters.GetValue <WindowsNetwork.ConnectionModes>("Mode");

                string errorMessage = string.Empty;

                switch (mode)
                {
                case WindowsNetwork.ConnectionModes.Connect:
                    errorMessage = WindowsNetwork.ConnectRemote(uncPath, userName, password, driveLetter);
                    break;

                case WindowsNetwork.ConnectionModes.Disconnect:
                    errorMessage = WindowsNetwork.DisconnectRemote(uncPath);
                    break;
                }

                if (!string.IsNullOrEmpty(errorMessage))
                {
                    throw new Exception(errorMessage);
                }
                var outParameters = this.GetCurrentOutParameters();
                outParameters.AddOrUpdate(new CommandParameter()
                {
                    Name = "Drive", Value = driveLetter
                });
                yield return(outParameters);
            }
        }
Exemple #3
0
 public void SetupNetworking()
 {
     WindowsNetwork.SetupNetwork();
 }