Skip to content

Commit

Permalink
DAV:SharedLink extended property
Browse files Browse the repository at this point in the history
  • Loading branch information
yar229 committed Dec 11, 2016
1 parent cdaa955 commit 6889ee9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
21 changes: 21 additions & 0 deletions WebDavMailRuCloudStore/DavCustomProperty/DavSharedLink.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using NWebDav.Server;
using NWebDav.Server.Props;
using NWebDav.Server.Stores;
using System.Xml.Linq;

namespace YaR.WebDavMailRu.CloudStore.DavCustomProperty
{
public class DavSharedLink<TEntry> : DavString<TEntry> where TEntry : IStoreItem
{
public static readonly XName PropertyName = WebDavNamespaces.DavNs + "SharedLink";

public override XName Name
{
get
{
return DavSharedLink<TEntry>.PropertyName;
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using NWebDav.Server.Props;
using NWebDav.Server.Stores;
using WebDavMailRuCloudStore;
using YaR.WebDavMailRu.CloudStore.DavCustomProperty;

namespace YaR.WebDavMailRu.CloudStore.Mailru.StoreBase
{
Expand Down Expand Up @@ -167,6 +168,11 @@ public MailruStoreCollection(ILockingManager lockingManager, Folder directoryInf
collection.DirectoryInfo.Attributes = value;
return DavStatusCode.Ok;
}
},
new DavSharedLink<MailruStoreCollection>
{
Getter = (context, item) => item.DirectoryInfo.PublicLink,
Setter = (context, item, value) => DavStatusCode.Ok
}
});

Expand Down
11 changes: 11 additions & 0 deletions WebDavMailRuCloudStore/Mailru/StoreBase/MailruStoreItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using System.Xml.Linq;
using NWebDav.Server;
using NWebDav.Server.Helpers;
using NWebDav.Server.Http;
Expand All @@ -11,6 +12,7 @@
using NWebDav.Server.Props;
using NWebDav.Server.Stores;
using WebDavMailRuCloudStore;
using YaR.WebDavMailRu.CloudStore.DavCustomProperty;

namespace YaR.WebDavMailRu.CloudStore.Mailru.StoreBase
{
Expand Down Expand Up @@ -122,9 +124,18 @@ public MailruStoreItem(ILockingManager lockingManager, MailRuCloudApi.File fileI
{
Getter = (context, item) => FileAttributes.Normal, //item._fileInfo.Attributes,
Setter = (context, item, value) => DavStatusCode.Ok
},
new DavSharedLink<MailruStoreItem>
{
Getter = (context, item) => item._fileInfo.PublicLink,
Setter = (context, item, value) => DavStatusCode.Ok
}
});





public bool IsWritable { get; }
public string Name => _fileInfo.Name;
public string UniqueKey => _fileInfo.FullPath;
Expand Down
1 change: 1 addition & 0 deletions WebDavMailRuCloudStore/WebDavMailRuCloudStore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Cloud.cs" />
<Compile Include="DavCustomProperty\DavSharedLink.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Mailru\StoreBase\MailruStore.cs" />
<Compile Include="Mailru\StoreBase\MailruStoreCollection.cs" />
Expand Down

0 comments on commit 6889ee9

Please sign in to comment.