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

C# Lib.RepoInfo类代码示例

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

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



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

示例1: Fetcher

        /// <summary>
        /// Sets up a fetcher that can get remote CMIS folders.
        /// </summary>
        public Fetcher(RepoInfo repoInfo, IActivityListener activityListener)
        {
            string remote_path = repoInfo.RemotePath.Trim("/".ToCharArray());
            string address = repoInfo.Address.ToString();

            TargetFolder = repoInfo.TargetDirectory;

            RemoteUrl = new Uri(address + remote_path);

            Logger.Info("Fetcher | Cmis Fetcher constructor");
            TargetFolder = repoInfo.TargetDirectory;
            RemoteUrl = repoInfo.Address;

            // Check that the CmisSync root folder exists.
            if (!Directory.Exists(ConfigManager.CurrentConfig.FoldersPath))
            {
                Logger.Fatal(String.Format("Fetcher | ERROR - Cmis Default Folder {0} does not exist", ConfigManager.CurrentConfig.FoldersPath));
                throw new DirectoryNotFoundException("Root folder don't exist !");
            }

            // Check that the folder is writable.
            if (!Utils.HasWritePermissionOnDir(ConfigManager.CurrentConfig.FoldersPath))
            {
                Logger.Fatal(String.Format("Fetcher | ERROR - Cmis Default Folder {0} is not writable", ConfigManager.CurrentConfig.FoldersPath));
                throw new UnauthorizedAccessException("Root folder is not writable!");
            }

            // Check that the folder exists.
            if (Directory.Exists(repoInfo.TargetDirectory))
            {
                Logger.Fatal(String.Format("Fetcher | ERROR - Cmis Repository Folder {0} already exist", repoInfo.TargetDirectory));
                throw new UnauthorizedAccessException("Repository folder already exists!");
            }

            // Create the local folder.
            Directory.CreateDirectory(repoInfo.TargetDirectory);

            // Use this folder configuration.
            this.cmisRepo = new CmisRepo(repoInfo, activityListener);
        }
开发者ID:jmanuelnavarro,项目名称:CmisSync,代码行数:43,代码来源:Fetcher.cs


示例2: CreateFromRemoteFolder

 /// <summary>
 /// Create sync item from the path of a remote folder.
 /// </summary>
 /// <param name="remoteFolderPath">Example: /sites/aproject/adir</param>
 public static SyncItem CreateFromRemoteFolder(string remoteFolderPath, RepoInfo repoInfo, Database.Database database)
 {
     return new RemotePathSyncItem(remoteFolderPath, true, repoInfo, database);
 }
开发者ID:aegif,项目名称:CmisSync,代码行数:8,代码来源:SyncItem.cs


示例3: IsFileWorthSyncing

        /// <summary>
        /// Check whether the file is worth syncing or not.
        /// This optionally excludes blank files or files too large.
        /// </summary>
        private static bool IsFileWorthSyncing(string filepath, RepoInfo repoInfo)
        {
            if (File.Exists(filepath))
            {
                bool allowBlankFiles = true; //TODO: add a preference repoInfo.allowBlankFiles
                bool limitFilesize = false; //TODO: add preference for filesize limiting
                long filesizeLimit = 256 * 1024 * 1024; //TODO: add a preference for filesize limit

                FileInfo fileInfo = new FileInfo(filepath);

                //Check permissions
                if (fileInfo.Attributes.HasFlag(FileAttributes.Hidden))
                {
                    Logger.DebugFormat("Skipping {0}: hidden file", filepath);
                    return false;
                }
                if (fileInfo.Attributes.HasFlag(FileAttributes.System))
                {
                    Logger.DebugFormat("Skipping {0}: system file", filepath);
                    return false;
                }

                //Check filesize
                if (!allowBlankFiles && fileInfo.Length <= 0)
                {
                    Logger.DebugFormat("Skipping {0}: blank file", filepath);
                    return false;
                }
                if (limitFilesize && fileInfo.Length > filesizeLimit)
                {
                    Logger.DebugFormat("Skipping {0}: file too large {1}mb", filepath, fileInfo.Length / (1024f * 1024f));
                    return false;
                }

            }
            else if (Directory.Exists(filepath))
            {
                return IsDirectoryWorthSyncing(filepath, repoInfo);
            }
            return true;
        }
开发者ID:pzsysa,项目名称:CmisSync,代码行数:45,代码来源:Utils.cs


示例4: GetRepoInfo

        /// <summary>
        /// Get all the configured info about a synchronized folder.
        /// </summary>
        public RepoInfo GetRepoInfo(string folderName)
        {
            RepoInfo repoInfo = new RepoInfo(folderName, ConfigPath);

            repoInfo.User = GetFolderAttribute(folderName, "user");
            repoInfo.Password = GetFolderAttribute(folderName, "password");
            repoInfo.Address = GetUrlForFolder(folderName);
            repoInfo.RepoID = GetFolderAttribute(folderName, "repository");
            repoInfo.RemotePath = GetFolderAttribute(folderName, "remoteFolder");
            repoInfo.TargetDirectory = GetFolderAttribute(folderName, "path");
            
            double pollinterval = 0;
            double.TryParse(GetFolderAttribute(folderName, "pollinterval"), out pollinterval);
            if (pollinterval < 1) pollinterval = 5000;
            repoInfo.PollInterval = pollinterval;

            if (String.IsNullOrEmpty(repoInfo.TargetDirectory))
            {
                repoInfo.TargetDirectory = Path.Combine(FoldersPath, folderName);
            }
            LinkedList<string> ignoredFolders = getIgnoredFolders(folderName);
            foreach (string ignoredFolder in ignoredFolders)
            {
                repoInfo.addIgnorePath(ignoredFolder);
            }
            return repoInfo;
        }
开发者ID:jmanuelnavarro,项目名称:CmisSync,代码行数:30,代码来源:Config.cs


示例5: RepoBase

        /// <summary>
        /// Constructor.
        /// </summary>
        public RepoBase(RepoInfo repoInfo, IActivityListener activityListener)
        {
            EventManager = new SyncEventManager();
            EventManager.AddEventHandler(new DebugLoggingHandler());
            EventManager.AddEventHandler(new GenericSyncEventHandler<RepoConfigChangedEvent>(0, RepoInfoChanged));
            Queue = new SyncEventQueue(EventManager);
            RepoInfo = repoInfo;
            LocalPath = repoInfo.TargetDirectory;
            Name = repoInfo.Name;
            RemoteUrl = repoInfo.Address;

            this.activityListener = activityListener;

            if (repoInfo.IsSuspended) Status = SyncStatus.Suspend;

            // Folder lock.
            // Disabled for now. Can be an interesting feature, but should be made opt-in, as
            // most users would be surprised to see this file appear.
            // folderLock = new FolderLock(LocalPath);

            Watcher = new Watcher(LocalPath);
            Watcher.EnableRaisingEvents = true;


            // Main loop syncing every X seconds.
            remote_timer.Elapsed += delegate
            {
                // Synchronize.
                SyncInBackground();
            };
            remote_timer.AutoReset = true;
            Logger.Info("Repo " + repoInfo.Name + " - Set poll interval to " + repoInfo.PollInterval + "ms");
            remote_timer.Interval = repoInfo.PollInterval;

            //Partial sync interval..
            local_timer.Elapsed += delegate
            {
                // Run partial sync.
                SyncInBackground(false);
            };
            local_timer.AutoReset = false;
            local_timer.Interval = delay_interval;
        }
开发者ID:j2m2,项目名称:CmisSync,代码行数:46,代码来源:RepoBase.cs


示例6: AddRepository

 /// <summary>
 /// Initialize (in the GUI and syncing mechanism) an existing CmisSync synchronized folder.
 /// </summary>
 /// <param name="repositoryInfo">Synchronized folder path</param>
 private void AddRepository(RepoInfo repositoryInfo)
 {
     RepoBase repo = null;
     repo = new CmisSync.Lib.Sync.CmisRepo(repositoryInfo, activityListenerAggregator);
     this.repositories.Add(repo);
     repo.Initialize();
 }
开发者ID:emrul,项目名称:CmisSync,代码行数:11,代码来源:ControllerBase.cs


示例7: SyncWhileModifyingFolders

        public void SyncWhileModifyingFolders(string canonical_name, string localPath, string remoteFolderPath,
            string url, string user, string password, string repositoryId)
        {
            // Prepare checkout directory.
            string localDirectory = Path.Combine(CMISSYNCDIR, canonical_name);
            CleanDirectory(localDirectory);
            Console.WriteLine("Synced to clean state.");
            
            // Mock.
            IActivityListener activityListener = new Mock<IActivityListener>().Object;
            // Sync.
            RepoInfo repoInfo = new RepoInfo(
                    canonical_name,
                    CMISSYNCDIR,
                    remoteFolderPath,
                    url,
                    user,
                    password,
                    repositoryId,
                    5000);

            using (CmisRepo cmis = new CmisRepo(repoInfo, activityListener))
            {
                using (CmisRepo.SynchronizedFolder synchronizedFolder = new CmisRepo.SynchronizedFolder(
                    repoInfo,
                    activityListener,
                    cmis))
                {
                    synchronizedFolder.Sync();
                    Console.WriteLine("Synced to clean state.");

                    // Sync a few times in a different thread.
                    bool syncing = true;
                    BackgroundWorker bw = new BackgroundWorker();
                    bw.DoWork += new DoWorkEventHandler(
                        delegate(Object o, DoWorkEventArgs args)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                Console.WriteLine("Sync D" + i.ToString());
                                synchronizedFolder.Sync();
                            }
                        }
                    );
                    bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(
                        delegate(object o, RunWorkerCompletedEventArgs args)
                        {
                            syncing = false;
                        }
                    );
                    bw.RunWorkerAsync();

                    // Keep creating/removing a file as long as sync is going on.
                    while (syncing)
                    {
                        //Console.WriteLine("Create/remove.");
                        LocalFilesystemActivityGenerator.CreateDirectoriesAndFiles(localDirectory);
                        CleanAll(localDirectory);
                    }

                    // Clean.
                    Console.WriteLine("Clean all.");
                    Clean(localDirectory, synchronizedFolder);
                }
            }
        }
开发者ID:jmanuelnavarro,项目名称:CmisSync,代码行数:66,代码来源:CmisSyncTests.cs


示例8: ClientSideBigFileAddition

        public void ClientSideBigFileAddition(string canonical_name, string localPath, string remoteFolderPath,
            string url, string user, string password, string repositoryId)
        {
            // Prepare checkout directory.
            string localDirectory = Path.Combine(CMISSYNCDIR, canonical_name);
            CleanDirectory(localDirectory);
            Console.WriteLine("Synced to clean state.");

            IActivityListener activityListener = new Mock<IActivityListener>().Object;
            RepoInfo repoInfo = new RepoInfo(
                    canonical_name,
                    ".",
                    remoteFolderPath,
                    url,
                    user,
                    password,
                    repositoryId,
                    5000);

            using (CmisRepo cmis = new CmisRepo(repoInfo, activityListener))
            {
                using (CmisRepo.SynchronizedFolder synchronizedFolder = new CmisRepo.SynchronizedFolder(
                    repoInfo,
                    activityListener,
                    cmis))
                {
                    synchronizedFolder.Sync();
                    Console.WriteLine("Synced to clean state.");

                    // Create random big file.
                    LocalFilesystemActivityGenerator.CreateRandomFile(localDirectory, 1000); // 1 MB ... no that big to not load servers too much.

                    // Sync again.
                    synchronizedFolder.Sync();
                    Console.WriteLine("Second sync done.");

                    // Check that file is present server-side.
                    // TODO

                    // Clean.
                    Console.WriteLine("Clean all.");
                    Clean(localDirectory, synchronizedFolder);
                }
            }
        }
开发者ID:jmanuelnavarro,项目名称:CmisSync,代码行数:45,代码来源:CmisSyncTests.cs


示例9: CreateFromRemoteFolderAndLocalName

 /// <summary></summary>
 /// <param name="remoteFolder"></param>
 /// <param name="LocalFileName"></param>
 /// <param name="repoInfo"></param>
 /// <returns></returns>
 public static SyncItem CreateFromRemoteFolderAndLocalName(string remoteFolder, string LocalFileName, RepoInfo repoInfo)
 {
     return new RemotePathSyncItem(remoteFolder, LocalFileName, repoInfo);
 }
开发者ID:emrul,项目名称:CmisSync,代码行数:9,代码来源:SyncItem.cs


示例10: CreateFromLocalFolderAndRemoteName

 /// <summary></summary>
 /// <param name="localFolder"></param>
 /// <param name="remoteFileName"></param>
 /// <param name="repoInfo"></param>
 /// <returns></returns>
 public static SyncItem CreateFromLocalFolderAndRemoteName(string localFolder, string remoteFileName, RepoInfo repoInfo)
 {
     return new LocalPathSyncItem(localFolder, remoteFileName, repoInfo);
 }
开发者ID:emrul,项目名称:CmisSync,代码行数:9,代码来源:SyncItem.cs


示例11: CreateFromRemotePath

 /// <summary></summary>
 /// <param name="path"></param>
 /// <param name="repoInfo"></param>
 /// <returns></returns>
 public static SyncItem CreateFromRemotePath(string path, RepoInfo repoInfo)
 {
     return new RemotePathSyncItem(path, repoInfo);
 }
开发者ID:emrul,项目名称:CmisSync,代码行数:8,代码来源:SyncItem.cs


示例12: RepoBase

        /// <summary>
        /// Constructor.
        /// </summary>
        public RepoBase(RepoInfo repoInfo)
        {
            RepoInfo = repoInfo;
            LocalPath = repoInfo.TargetDirectory;
            Name = repoInfo.Name;
            RemoteUrl = repoInfo.Address;

            Logger.Info("Repo " + repoInfo.Name + " - Set poll interval to " + repoInfo.PollInterval + "ms");
            this.remote_timer.Interval = repoInfo.PollInterval;

            SyncStatusChanged += delegate(SyncStatus status)
            {
                Status = status;
            };

            this.Watcher = new Watcher(LocalPath);

            // Main loop syncing every X seconds.
            this.remote_timer.Elapsed += delegate
            {
                // Synchronize.
                SyncInBackground();
            };
            
            ChangesDetected += delegate { };
        }
开发者ID:prignony,项目名称:CmisSync,代码行数:29,代码来源:RepoBase.cs


示例13: RemotePathSyncItem

        public RemotePathSyncItem(string remoteFolderPath, string remoteDocumentName, string localFilename, bool isFolder, RepoInfo repoInfo, Database.Database database)
        {
            this.isFolder = isFolder;
            this.database = database;
            this.localRoot = repoInfo.TargetDirectory;
            this.remoteRoot = repoInfo.RemotePath;

            this.remoteRelativePath = remoteFolderPath;
            if (remoteRelativePath.StartsWith(this.remoteRoot))
            {
                this.remoteRelativePath = remoteRelativePath.Substring(this.remoteRoot.Length).TrimStart(CmisUtils.CMIS_FILE_SEPARATOR);
            }
            this.localRelativePath = localFilename;
        }
开发者ID:aegif,项目名称:CmisSync,代码行数:14,代码来源:SyncItem.cs


示例14: LocalPathSyncItem

        public LocalPathSyncItem(string localPath, bool isFolder, RepoInfo repoInfo, Database.Database database)
        {
            this.isFolder = isFolder;
            this.database = database;
            this.localRoot = repoInfo.TargetDirectory;
            this.remoteRoot = repoInfo.RemotePath;

            this.localRelativePath = localPath;
            if (localPath.StartsWith(this.localRoot))
            {
                this.localRelativePath = localPath.Substring(localRoot.Length).TrimStart(Path.DirectorySeparatorChar);
            }
        }
开发者ID:aegif,项目名称:CmisSync,代码行数:13,代码来源:SyncItem.cs


示例15: GetRepoInfo

                /// <summary>
                /// Get all the configured info about a synchronized folder.
                /// </summary>
                public RepoInfo GetRepoInfo()
                {
                    RepoInfo repoInfo = new RepoInfo(DisplayName, ConfigManager.CurrentConfig.ConfigPath);
                    repoInfo.User = UserName;
                    repoInfo.Password = new CmisSync.Auth.CmisPassword();
                    repoInfo.Password.ObfuscatedPassword = ObfuscatedPassword;
                    repoInfo.Address = RemoteUrl;
                    repoInfo.RepoID = RepositoryId;
                    repoInfo.RemotePath = RemotePath;
                    repoInfo.TargetDirectory = LocalPath;
                    if (PollInterval < 1) PollInterval = Config.DEFAULT_POLL_INTERVAL;
                    repoInfo.PollInterval = PollInterval;

                    foreach (IgnoredFolder ignoredFolder in IgnoredFolders)
                    {
                        repoInfo.addIgnorePath(ignoredFolder.Path);
                    }
                    return repoInfo;
                }
开发者ID:pzsysa,项目名称:CmisSync,代码行数:22,代码来源:Config.cs


示例16: Sync

        public void Sync(string canonical_name, string localPath, string remoteFolderPath,
            string url, string user, string password, string repositoryId)
        {
            // Prepare checkout directory.
            string localDirectory = Path.Combine(CMISSYNCDIR, canonical_name);
            CleanDirectory(localDirectory);
            Console.WriteLine("Synced to clean state.");

            IActivityListener activityListener = new Mock<IActivityListener>().Object;
            RepoInfo repoInfo = new RepoInfo(
                    canonical_name,
                    CMISSYNCDIR,
                    remoteFolderPath,
                    url,
                    user,
                    password,
                    repositoryId,
                    5000);

            using (CmisRepo cmis = new CmisRepo(repoInfo, activityListener))
            {
                using (CmisRepo.SynchronizedFolder synchronizedFolder = new CmisRepo.SynchronizedFolder(
                    repoInfo,
                    activityListener,
                    cmis))
                {
                    synchronizedFolder.Sync();
                    Console.WriteLine("Synced to clean state.");

                    // Clean.
                    Console.WriteLine("Clean all.");
                    Clean(localDirectory, synchronizedFolder);
                }
            }
        }
开发者ID:jmanuelnavarro,项目名称:CmisSync,代码行数:35,代码来源:CmisSyncTests.cs


示例17: LocalPathSyncItem

        /// <summary></summary>
        /// <param name="localPath"></param>
        /// <param name="repoInfo"></param>
        public LocalPathSyncItem(string localPath, RepoInfo repoInfo)
        {
            this.localRoot = repoInfo.TargetDirectory;
            this.remoteRoot = repoInfo.RemotePath;

            this.localPath = localPath;
            if (localPath.StartsWith(this.localRoot))
            {
                this.localPath = localPath.Substring(localRoot.Length).TrimStart(Path.DirectorySeparatorChar);
            }
            this.remotePath = PathRepresentationConverter.LocalToRemote(this.localPath);
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:15,代码来源:SyncItem.cs


示例18: ClientSideDirectoryAndSmallFilesAddition

        public void ClientSideDirectoryAndSmallFilesAddition(string canonical_name, string localPath, string remoteFolderPath,
            string url, string user, string password, string repositoryId)
        {
            // Prepare checkout directory.
            string localDirectory = Path.Combine(CMISSYNCDIR, canonical_name);
            CleanDirectory(localDirectory);
            Console.WriteLine("Synced to clean state.");

            IActivityListener activityListener = new Mock<IActivityListener>().Object;
            RepoInfo repoInfo = new RepoInfo(
                    canonical_name,
                    CMISSYNCDIR,
                    remoteFolderPath,
                    url,
                    user,
                    password,
                    repositoryId,
                    5000);

            using (CmisRepo cmis = new CmisRepo(repoInfo, activityListener))
            {
                using (CmisRepo.SynchronizedFolder synchronizedFolder = new CmisRepo.SynchronizedFolder(
                    repoInfo,
                    activityListener,
                    cmis))
                {
                    synchronizedFolder.Sync();
                    Console.WriteLine("Synced to clean state.");

                    // Create directory and small files.
                    LocalFilesystemActivityGenerator.CreateDirectoriesAndFiles(localDirectory);

                    // Sync again.
                    synchronizedFolder.Sync();
                    Console.WriteLine("Second sync done.");

                    // Clean.
                    Console.WriteLine("Clean all.");
                    Clean(localDirectory, synchronizedFolder);
                }
            }
        }
开发者ID:jmanuelnavarro,项目名称:CmisSync,代码行数:42,代码来源:CmisSyncTests.cs


示例19: RemotePathSyncItem

        /// <summary></summary>
        /// <param name="remotePath"></param>
        /// <param name="repoInfo"></param>
        public RemotePathSyncItem(string remotePath, RepoInfo repoInfo)
        {
            this.localRoot = repoInfo.TargetDirectory;
            this.remoteRoot = PathRepresentationConverter.LocalToRemote(repoInfo.RemotePath);

            this.remotePath = remotePath;
            if (remotePath.StartsWith(this.remoteRoot))
            {
                this.remotePath = remotePath.Substring(this.remoteRoot.Length).TrimStart(CmisUtils.CMIS_FILE_SEPARATOR);
            }
            this.localPath = PathRepresentationConverter.RemoteToLocal(this.remotePath);
        }
开发者ID:emrul,项目名称:CmisSync,代码行数:15,代码来源:SyncItem.cs


示例20: AddRepository

        /// <summary>
        /// Initialize (in the UI and syncing mechanism) an existing CmisSync synchronized folder.
        /// </summary>
        /// <param name="repositoryInfo">Synchronized folder path</param>
        private void AddRepository(RepoInfo repositoryInfo)
        {
            RepoBase repo = null;
            repo = new CmisSync.Lib.Sync.CmisRepo(repositoryInfo, activityListenerAggregator);

            repo.EventManager.AddEventHandler(
                new GenericSyncEventHandler<FileTransmissionEvent>( 50, delegate(ISyncEvent e){
                this.activitiesManager.AddTransmission(e as FileTransmissionEvent);
                return false;
            }));
            this.repositories.Add(repo);
            repo.Initialize();
        }
开发者ID:pcreignou,项目名称:CmisSync,代码行数:17,代码来源:ControllerBase.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# CmsData.CMSDataContext类代码示例发布时间:2022-05-24
下一篇:
C# Actions.ImageUploadParams类代码示例发布时间: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