update sharpcifs
This commit is contained in:
parent
21d2573d05
commit
6c60656dad
|
@ -166,23 +166,38 @@ namespace Emby.Common.Implementations.IO
|
||||||
public void SetHidden(string path, bool isHidden)
|
public void SetHidden(string path, bool isHidden)
|
||||||
{
|
{
|
||||||
var file = CreateSmbFile(path);
|
var file = CreateSmbFile(path);
|
||||||
|
SetHidden(file, isHidden);
|
||||||
var isCurrentlyHidden = file.IsHidden();
|
|
||||||
|
|
||||||
if (isCurrentlyHidden && !isHidden)
|
|
||||||
{
|
|
||||||
file.SetAttributes(file.GetAttributes() & ~SmbFile.AttrReadonly);
|
|
||||||
}
|
|
||||||
else if (!isCurrentlyHidden && isHidden)
|
|
||||||
{
|
|
||||||
file.SetAttributes(file.GetAttributes() | SmbFile.AttrReadonly);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetReadOnly(string path, bool isReadOnly)
|
public void SetReadOnly(string path, bool isReadOnly)
|
||||||
{
|
{
|
||||||
var file = CreateSmbFile(path);
|
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();
|
var isCurrentlyReadOnly = !file.CanWrite();
|
||||||
|
|
||||||
if (isCurrentlyReadOnly && !isReadOnly)
|
if (isCurrentlyReadOnly && !isReadOnly)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user