|
|
|
@ -166,23 +166,38 @@ namespace Emby.Common.Implementations.IO
|
|
|
|
|
public void SetHidden(string path, bool isHidden)
|
|
|
|
|
{
|
|
|
|
|
var file = CreateSmbFile(path);
|
|
|
|
|
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.AttrReadonly);
|
|
|
|
|
file.SetAttributes(file.GetAttributes() & ~SmbFile.AttrHidden);
|
|
|
|
|
}
|
|
|
|
|
else if (!isCurrentlyHidden && isHidden)
|
|
|
|
|
{
|
|
|
|
|
file.SetAttributes(file.GetAttributes() | SmbFile.AttrReadonly);
|
|
|
|
|
file.SetAttributes(file.GetAttributes() | SmbFile.AttrHidden);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetReadOnly(string path, bool isReadOnly)
|
|
|
|
|
private void SetReadOnly(SmbFile file, bool isReadOnly)
|
|
|
|
|
{
|
|
|
|
|
var file = CreateSmbFile(path);
|
|
|
|
|
|
|
|
|
|
var isCurrentlyReadOnly = !file.CanWrite();
|
|
|
|
|
|
|
|
|
|
if (isCurrentlyReadOnly && !isReadOnly)
|
|
|
|
|