From 6c60656dade3e986b0320c7885f0e43c67ecc9f2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 12 May 2017 01:00:02 -0400 Subject: [PATCH] update sharpcifs --- .../IO/SharpCifsFileSystem.cs | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs b/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs index 283bcdef0..64cac7623 100644 --- a/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs +++ b/Emby.Common.Implementations/IO/SharpCifsFileSystem.cs @@ -166,23 +166,38 @@ namespace Emby.Common.Implementations.IO public void SetHidden(string path, bool isHidden) { var file = CreateSmbFile(path); - - var isCurrentlyHidden = file.IsHidden(); - - if (isCurrentlyHidden && !isHidden) - { - file.SetAttributes(file.GetAttributes() & ~SmbFile.AttrReadonly); - } - else if (!isCurrentlyHidden && isHidden) - { - file.SetAttributes(file.GetAttributes() | SmbFile.AttrReadonly); - } + SetHidden(file, isHidden); } public void SetReadOnly(string path, bool isReadOnly) { var file = CreateSmbFile(path); + SetReadOnly(file, isReadOnly); + } + public void SetAttributes(string path, bool isHidden, bool isReadOnly) + { + var file = CreateSmbFile(path); + SetHidden(file, isHidden); + SetReadOnly(file, isReadOnly); + } + + private void SetHidden(SmbFile file, bool isHidden) + { + var isCurrentlyHidden = file.IsHidden(); + + if (isCurrentlyHidden && !isHidden) + { + file.SetAttributes(file.GetAttributes() & ~SmbFile.AttrHidden); + } + else if (!isCurrentlyHidden && isHidden) + { + file.SetAttributes(file.GetAttributes() | SmbFile.AttrHidden); + } + } + + private void SetReadOnly(SmbFile file, bool isReadOnly) + { var isCurrentlyReadOnly = !file.CanWrite(); if (isCurrentlyReadOnly && !isReadOnly)