예제 #1
0
        private void LoadRepository(string directoryName, out IRepository repository, out DirectoryTree <TREInfoFile> directoryTree)
        {
            this.Cursor = Cursors.WaitCursor;
            try
            {
                repository    = null;
                directoryTree = null;

                if (string.IsNullOrEmpty(directoryName))
                {
                    return;
                }

                var localRepository = Wxv.Swg.Common.Repository.Load(directoryName);

                IEnumerable <TREInfoFile> treInfoFiles;
                if (localRepository != null)
                {
                    treInfoFiles = localRepository.Files
                                   .SelectMany(tf => tf.TREFile.InfoFiles, (tf, tfif) => new TREInfoFile(localRepository, tf.FileName, tfif))
                                   .OrderBy(tif => tif.Path)
                                   .ToList();
                }
                else
                {
                    treInfoFiles = new TREInfoFile[] { }
                };

                repository    = localRepository;
                directoryTree = DirectoryTree <TREInfoFile> .Get("", treInfoFiles, tif => tif.Path, "/");
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }