当前位置: 首页>>代码示例>>C#>>正文


C# ICloudFileSystemEntry类代码示例

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


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


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