Ejemplo n.º 1
0
 private static void ShareFolder(ILogger logger, DirectoryPath directoryPath, ShareName shareName, string shareDescription)
 {
     logger.LogDebug(string.Format("Starts trying to share {0} as {1}", directoryPath, shareName));
     WindowsShare.MethodStatus methodStatus = WindowsShare.Create(directoryPath.PathString, shareName.ToString(), WindowsShare.ShareType.DiskDrive, null, shareDescription, null);
     if (methodStatus != WindowsShare.MethodStatus.Success)
     {
         throw new ShareException(string.Format("Creating share failed for {0} at {1}. Error {2}.", shareName, directoryPath, methodStatus.ToString()));
     }
     logger.LogInfo(string.Format("Share {0} created for {1}.", shareName, directoryPath));
 }