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


C# IFolder.GetDescendants方法代码示例

本文整理汇总了C#中IFolder.GetDescendants方法的典型用法代码示例。如果您正苦于以下问题:C# IFolder.GetDescendants方法的具体用法?C# IFolder.GetDescendants怎么用?C# IFolder.GetDescendants使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFolder的用法示例。


在下文中一共展示了IFolder.GetDescendants方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CrawlSync

            /// <summary>
            /// Synchronize by checking all folders/files one-by-one.
            /// This strategy is used if the CMIS server does not support the ChangeLog feature.
            /// 
            /// for all remote folders:
            ///     if exists locally:
            ///       recurse
            ///     else
            ///       if in database:
            ///         delete recursively from server // if BIDIRECTIONAL
            ///       else
            ///         download recursively
            /// for all remote files:
            ///     if exists locally:
            ///       if remote is more recent than local:
            ///         download
            ///       else
            ///         upload                         // if BIDIRECTIONAL
            ///     else:
            ///       if in database:
            ///         delete from server             // if BIDIRECTIONAL
            ///       else
            ///         download
            /// for all local files:
            ///   if not present remotely:
            ///     if in database:
            ///       delete
            ///     else:
            ///       upload                           // if BIDIRECTIONAL
            ///   else:
            ///     if has changed locally:
            ///       upload                           // if BIDIRECTIONAL
            /// for all local folders:
            ///   if not present remotely:
            ///     if in database:
            ///       delete recursively from local
            ///     else:
            ///       upload recursively               // if BIDIRECTIONAL
            /// </summary>
            private void CrawlSync(IFolder remoteFolder, string localFolder)
            {
                SleepWhileSuspended();

                if (IsGetDescendantsSupported)
                {
                    IList<ITree<IFileableCmisObject>> desc;
                    try{
                        desc = remoteFolder.GetDescendants(-1);
                    }catch (DotCMIS.Exceptions.CmisConnectionException ex) {
                        if(ex.InnerException is System.Xml.XmlException)
                        {
                            Logger.Warn(String.Format("CMIS::getDescendants() response could not be parsed: {0}", ex.InnerException.Message ));
                        }
                        throw;
                    }
                    CrawlDescendants(remoteFolder, desc, localFolder);
                }

                // Lists of files/folders, to delete those that have been removed on the server.
                IList<string> remoteFiles = new List<string>();
                IList<string> remoteSubfolders = new List<string>();


                try
                {
                    // Crawl remote children.
                    // Logger.LogInfo("Sync", String.Format("Crawl remote folder {0}", this.remoteFolderPath));
                    CrawlRemote(remoteFolder, localFolder, remoteFiles, remoteSubfolders);

                    // Crawl local files.
                    // Logger.LogInfo("Sync", String.Format("Crawl local files in the local folder {0}", localFolder));
                    CrawlLocalFiles(localFolder, remoteFolder, remoteFiles);

                    // Crawl local folders.
                    // Logger.LogInfo("Sync", String.Format("Crawl local folder {0}", localFolder));
                    CrawlLocalFolders(localFolder, remoteFolder, remoteSubfolders);
                }
                catch (CmisBaseException e)
                {
                    ProcessRecoverableException("Could not crawl folder: " + remoteFolder.Path, e);
                }
            }
开发者ID:rc160106,项目名称:CmisSync,代码行数:82,代码来源:CrawlStrategy.cs


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