• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ICloudFileSystemEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ICloudFileSystemEntry的典型用法代码示例。如果您正苦于以下问题:C# ICloudFileSystemEntry类的具体用法?C# ICloudFileSystemEntry怎么用?C# ICloudFileSystemEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ICloudFileSystemEntry类属于命名空间,在下文中一共展示了ICloudFileSystemEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: RemoveResource

        public bool RemoveResource(IStorageProviderSession session, ICloudFileSystemEntry resource, RemoveMode mode)
        {
            String url;
            Dictionary<String, String> parameters = null;

            if (mode == RemoveMode.FromParentCollection)
            {
                var pId = (resource.Parent != null ? resource.Parent.Id : GoogleDocsConstants.RootFolderId).ReplaceFirst("_", "%3a");
                url = String.Format("{0}/{1}/contents/{2}", GoogleDocsConstants.GoogleDocsFeedUrl, pId, resource.Id.ReplaceFirst("_", "%3a"));
            }
            else
            {
                url = String.Format(GoogleDocsConstants.GoogleDocsResourceUrlFormat, resource.Id.ReplaceFirst("_", "%3a"));
                parameters = new Dictionary<string, string> {{"delete", "true"}};
            }

            var request = CreateWebRequest(session, url, "DELETE", parameters);
            request.Headers.Add("If-Match", "*");

            try
            {
                var response = (HttpWebResponse)request.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                    return true;
            }
            catch (WebException)
            {
            }

            return false;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:31,代码来源:GoogleDocsStorageProviderService.cs


示例2: GetResourcePath

 public static String GetResourcePath(ICloudFileSystemEntry parent, String nameOrId)
 {
     String path = parent != null ? parent.Id.Trim('/') : String.Empty;
     if (!String.IsNullOrEmpty(nameOrId) && !nameOrId.Equals("/"))
         path = String.Format("{0}/{1}", path, nameOrId.Trim('/'));
     return path.Trim('/');
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:7,代码来源:DropBoxResourceIDHelpers.cs


示例3: DeleteResource

        public override bool DeleteResource(IStorageProviderSession session, ICloudFileSystemEntry entry)
        {
            // get the creds
            ICredentials creds = ((GenericNetworkCredentials) session.SessionToken).GetCredential(null, null);

            // generate the loca path
            String uriPath = GetResourceUrl(session, entry, null);

            // removed the file
            if (entry is ICloudDirectoryEntry)
            {
                // we need an empty directory
                foreach (ICloudFileSystemEntry child in (ICloudDirectoryEntry) entry)
                {
                    DeleteResource(session, child);
                }

                // remove the directory
                return _ftpService.FtpDeleteEmptyDirectory(uriPath, creds);
            }
            else
            {
                // remove the file
                return _ftpService.FtpDeleteFile(uriPath, creds);
            }
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:26,代码来源:FtpStorageProviderService.cs


示例4: RefreshResource

        public override void RefreshResource(IStorageProviderSession session, ICloudFileSystemEntry resource)
        {
            // nothing to do for files
            if (!(resource is ICloudDirectoryEntry))
                return;

            // Refresh schild
            RefreshChildsOfDirectory(session, resource as ICloudDirectoryEntry);
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:9,代码来源:FtpStorageProviderService.cs


示例5: RefreshResource

        public void RefreshResource(IStorageProviderSession session, ICloudFileSystemEntry resource)
        {
            var cached = FsCache.Get(GetSessionKey(session), GetCacheKey(session, null, resource), null) as ICloudDirectoryEntry;

            if (cached == null || cached.HasChildrens == nChildState.HasNotEvaluated)
            {
                _service.RefreshResource(session, resource);
                FsCache.Add(GetSessionKey(session), GetCacheKey(session, null, resource), resource);
            }
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:10,代码来源:CachedServiceWrapper.cs


示例6: GetResourcePath

 public static String GetResourcePath(ICloudFileSystemEntry parent, String nameOrId)
 {
     nameOrId = !String.IsNullOrEmpty(nameOrId) ? nameOrId.Trim('/') : String.Empty;
     var parentId = parent != null ? parent.Id.Trim('/') : String.Empty;
     if (String.IsNullOrEmpty(parentId))
         return nameOrId;
     if (String.IsNullOrEmpty(nameOrId))
         return parentId;
     return parentId + "/" + nameOrId;
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:10,代码来源:DropBoxResourceIDHelpers.cs


示例7: CopyProperties

 public static void CopyProperties(ICloudFileSystemEntry src, ICloudFileSystemEntry dest)
 {
     if (!(dest is BaseFileEntry) || !(src is BaseFileEntry)) return;
     
     var destBase = dest as BaseFileEntry;
     var srcBase = src as BaseFileEntry;
     destBase.Name = srcBase.Name;
     destBase.Id = srcBase.Id;
     destBase.Modified = srcBase.Modified;
     destBase.Length = srcBase.Length;
     destBase[SkyDriveConstants.UploadLocationKey] = srcBase[SkyDriveConstants.UploadLocationKey];
     destBase.ParentID = srcBase.ParentID;
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:13,代码来源:SkyDriveHelpers.cs


示例8: GetResourcePath

        public static String GetResourcePath(ICloudFileSystemEntry entry)
        {
            var current = entry;
            var path = "";

            while (current != null)
            {
                if (current.Name != "/")
                {
                    if (path == String.Empty)
                        path = current.Id;
                    else
                        path = current.Id + "/" + path;
                }
                else
                    path = "/" + path;

                current = current.Parent;
            }

            return path;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:22,代码来源:GenericHelper.cs


示例9: OfGoogleDocsKind

 public static bool OfGoogleDocsKind(ICloudFileSystemEntry entry)
 {
     var kind = entry.GetPropertyValue(GoogleDocsConstants.KindProperty);
     return kind.Equals("document") || kind.Equals("presentation") || kind.Equals("spreadsheet") || kind.Equals("drawing");
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:5,代码来源:GoogleDocsResourceHelper.cs


示例10: IsNoolOrRoot

 public static bool IsNoolOrRoot(ICloudFileSystemEntry dir)
 {
     return dir == null || ((dir is ICloudDirectoryEntry) && dir.Id.Equals(GoogleDocsConstants.RootFolderId));
 }
开发者ID:Inzaghi2012,项目名称:teamlab.v7.5,代码行数:4,代码来源:GoogleDocsResourceHelper.cs


示例11: ToFile

 protected File ToFile(ICloudFileSystemEntry fsEntry)
 {
     return fsEntry == null ? null
                : new File
                      {
                          ID = MakeId(fsEntry),
                          Access = FileShare.None,
                          ContentLength = fsEntry.Length,
                          CreateBy = SharpBoxProviderInfo.Owner,
                          CreateOn = fsEntry.Modified,
                          FileStatus = FileStatus.None,
                          FolderID = MakeId(fsEntry.Parent),
                          ModifiedBy = SharpBoxProviderInfo.Owner,
                          ModifiedOn = fsEntry.Modified,
                          NativeAccessor = fsEntry,
                          ProviderId = SharpBoxProviderInfo.ID,
                          ProviderName = SharpBoxProviderInfo.ProviderName,
                          Title = MakeTitle(fsEntry),
                          RootFolderId = MakeId(RootFolder()),
                          RootFolderType = SharpBoxProviderInfo.RootFolderType,
                          RootFolderCreator = SharpBoxProviderInfo.Owner,
                          Version = 1
                      };
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:24,代码来源:SharpBoxDaoBase.cs


示例12: MakeId

 protected string MakeId(ICloudFileSystemEntry entry)
 {
     var path = string.Empty;
     if (entry != null && !(entry is ErrorDirectoryEntry))
     {
         path = SharpBoxProviderInfo.Storage.GetFileSystemObjectPath(entry);
     }
     return string.Format("{0}{1}", PathPrefix, string.IsNullOrEmpty(path) || path == "/" ? "" : ("-" + path.Replace('/', '|')));
 }
开发者ID:ridhouan,项目名称:teamlab.v6.5,代码行数:9,代码来源:SharpBoxDaoBase.cs


示例13: RenameFileSystemEntry

        /// <summary>
        /// This method renames a given filesystem object (file or folder)
        /// </summary>
        /// <param name="fsentry"></param>
        /// <param name="newName"></param>
        /// <returns></returns>
        public bool RenameFileSystemEntry(ICloudFileSystemEntry fsentry, string newName)
        {
            // save the old name
            String renamedId = fsentry.Id;

            // rename the resource
            if (_Service.RenameResource(_Session, fsentry, newName))
            {
                // get the parent
                BaseDirectoryEntry p = fsentry.Parent as BaseDirectoryEntry;

                // remove the old childname
                p.RemoveChildById(renamedId);

                // readd the child
                p.AddChild(fsentry as BaseFileEntry);

                // go ahead
                return true;
            }
            else
                return false;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:29,代码来源:GenericStorageProvider.cs


示例14: DeleteFileSystemEntry

 /// <summary>
 /// This method removes a given filesystem object from the cloud storage
 /// </summary>
 /// <param name="fsentry"></param>
 /// <returns></returns>
 public bool DeleteFileSystemEntry(ICloudFileSystemEntry fsentry)
 {
     return _Service.DeleteResource(_Session, fsentry);
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:9,代码来源:GenericStorageProvider.cs


示例15: CopyResource

        public override bool CopyResource(IStorageProviderSession session, ICloudFileSystemEntry fsentry, ICloudDirectoryEntry newParent)
        {
            // build the targte url            
            String uriStringTarget = this.GetResourceUrl(session, newParent, null);
            uriStringTarget = PathHelper.Combine(uriStringTarget, fsentry.Name);

            if (!CopyResource(session, fsentry, uriStringTarget))
                return false;

            var newParentObject = newParent as BaseDirectoryEntry;
            if (newParentObject != null)
            {
                newParentObject.AddChild(fsentry as BaseFileEntry);   
            }

            return true;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:17,代码来源:WebDavStorageProviderService.cs


示例16: RenameFileSystemEntry

 public bool RenameFileSystemEntry(ICloudFileSystemEntry fsentry, string newName)
 {
     return _provider.RenameFileSystemEntry(fsentry, newName);
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:4,代码来源:GoogleDriveStorage.cs


示例17: GetFileSystemObjectPath

 public string GetFileSystemObjectPath(ICloudFileSystemEntry fsObject)
 {
     return _provider.GetFileSystemObjectPath(fsObject);
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:4,代码来源:GoogleDriveStorage.cs


示例18: RenameResource

        /// <summary>
        /// Renames a webdave file or folder
        /// </summary>
        /// <param name="session"></param>
        /// <param name="fsentry"></param>
        /// <param name="newName"></param>
        /// <returns></returns>
        public override bool RenameResource(IStorageProviderSession session, ICloudFileSystemEntry fsentry, string newName)
        {
            // build the targte url
            String uriStringTarget = this.GetResourceUrl(session, fsentry.Parent, null);
            uriStringTarget = PathHelper.Combine(uriStringTarget, newName);

            if (MoveResource(session, fsentry, uriStringTarget))
            {
                // rename the fsentry
                BaseFileEntry fentry = fsentry as BaseFileEntry;
                fentry.Name = newName;

                // go ahead
                return true;
            }
            else
                // go ahead
                return false;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:26,代码来源:WebDavStorageProviderService.cs


示例19: CopyFileSystemEntry

 /// <summary>
 /// This method moves a specifc filesystem object from his current location
 /// into a new folder
 /// </summary>
 /// <param name="fsentry"></param>
 /// <param name="newParent"></param>
 /// <returns></returns>
 public bool CopyFileSystemEntry(ICloudFileSystemEntry fsentry, ICloudDirectoryEntry newParent)
 {
     return _Service.CopyResource(_Session, fsentry, newParent);
 }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:11,代码来源:GenericStorageProvider.cs


示例20: CreateDownloadStream

        public override Stream CreateDownloadStream(IStorageProviderSession session, ICloudFileSystemEntry fileSystemEntry)
        {
            // build the url 
            string url = GetResourceUrl(session, fileSystemEntry, null);

            // get the session creds
            ICredentials creds = session.SessionToken as ICredentials;

            // Build the service
            DavService svc = new DavService();

            // create the webrequest
            WebRequest request = svc.CreateWebRequest(url, WebRequestMethodsEx.Http.Get, creds.GetCredential(null, null), false, null);

            // create the response
            WebResponse response = svc.GetWebResponse(request);

            // get the data 
            Stream orgStream = svc.GetResponseStream(response);

            BaseFileEntryDownloadStream dStream = new BaseFileEntryDownloadStream(orgStream, fileSystemEntry);

            // put the disposable on the stack
            dStream._DisposableObjects.Push(response);

            // go ahead
            return dStream;
        }
开发者ID:haoasqui,项目名称:ONLYOFFICE-Server,代码行数:28,代码来源:WebDavStorageProviderService.cs



注:本文中的ICloudFileSystemEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICluster类代码示例发布时间:2022-05-24
下一篇:
C# ICloudBlob类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap