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); }
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); }