Exemple #1
0
 public bool Connect(PSDDevice psdDevice)
 {
     var connected = psdDevice.Connect();
     if (connected)
     {
         Psd = psdDevice;
         Name = Psd.ToString();
         Base = new Base();
     }
     else
         Psd = null;
     return connected;
 }
Exemple #2
0
 public SetPsdResult Connect(PSDDevice psdDevice)
 {
     var connected = psdDevice.Connect();
     if (connected)
     {
         Psd = psdDevice;
         Name = Psd.ToString();
         Base = new Base();
         if (!Psd.Login(LoginPass))
             return SetPsdResult.WrongPassword;
     }
     else
         Psd = null;
     return connected ? SetPsdResult.Connected : SetPsdResult.NotConnected;
 }
        public PSDRepository.SetPsdResult TrySetPsdBase(PSDDevice newDevice)
        {
            /* if (_userPasses == null)
                 return false;*/

            var newPsdBase = new PSDRepository(_userPasses.PsdLoginPass);
            var res = newPsdBase.Connect(newDevice);
            if (res == PSDRepository.SetPsdResult.Connected ||
                res == PSDRepository.SetPsdResult.WrongPassword)
                PsdBase = newPsdBase;
            return res;
        }
Exemple #4
0
        public bool TrySetPsdBase(PSDDevice newDevice)
        {
            if (_userPasses == null)
                return false;

            var newPsdBase = new PSDRepository(_userPasses.PsdLoginPass);
            if (!newPsdBase.Connect(newDevice))
                return false;
            PsdBase = newPsdBase;
            return true;
        }
Exemple #5
0
        private static PSDDevice SelectPsdDevice(PSDDevice[] devices)
        {
            if (_args.UseFirstFoundPsd)
                return devices[0];
            if (devices.Length == 1)
                return devices[0];

            Console.WriteLine("Select psd: ");
            for (int i = 0; i < devices.Length; i++)
            {
                Console.WriteLine("Id: {0}. Device: {1}", i, devices[i]);
            }
            int selected;
            if (!int.TryParse(Console.ReadLine(), out selected) || selected > devices.Length - 1)
            {
                Output("Wrong device id.", OutputType.Error);
                return null;
            }
            return devices[selected];
        }