Exemplo n.º 1
0
        public string Mount()
        {
            string res = "";

            try
            {
                NetworkDrive netDrive = new NetworkDrive();
                netDrive.Drive     = Drive.Substring(0, 2);
                netDrive.ShareName = Share;
                if (Username != "")
                {
                    netDrive.MapDrive(Username, Password);
                }
                else
                {
                    netDrive.MapDrive();
                }
            }
            catch (Exception ex)
            {
                res = ex.Message;
                logger.Error(ex, "Unable to mount the network drive");
            }
            return(res);
        }
Exemplo n.º 2
0
 public bool Unmount()
 {
     try
     {
         NetworkDrive netDrive = new NetworkDrive();
         netDrive.Drive = Drive.Substring(0, 2);
         netDrive.UnMapDrive();
         return(true);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "Unable to unmount the network drive");
     }
     return(false);
 }