Ecologylab.BigSemantics.MetaMetadataNS.MetaMetadataRepositoryLoader.ReadDirectoryRecursively C# (CSharp) Метод

ReadDirectoryRecursively() публичный статический Метод

public static ReadDirectoryRecursively ( MetaMetadataRepository mainRepo, String path, SimplTypesScope mmdTScope, SimplTypesScope metadataTScope ) : Task
mainRepo MetaMetadataRepository
path String
mmdTScope Simpl.Serialization.SimplTypesScope
metadataTScope Simpl.Serialization.SimplTypesScope
Результат Task
        public static async Task<MetaMetadataRepository> ReadDirectoryRecursively(MetaMetadataRepository mainRepo, String path, SimplTypesScope mmdTScope, SimplTypesScope metadataTScope)
        {
            Stack<string> stack = new Stack<string>();
            stack.Push(path);
            while(stack.Count > 0)
            {
                string dir = stack.Pop();
                Debug.WriteLine("Looking in : " + dir);
                //String[] files = Directory.GetFiles(dir, "*.xml");
                string[] files = await FundamentalPlatformSpecifics.Get().GetFilesFromDirectory(dir, ".xml");
                foreach (string file in files)
                {
                    MetaMetadataRepository thatRepo = await ReadRepository(file, mmdTScope, metadataTScope, mainRepo);
                    // if (thatRepo != null)
                    //    mainRepo.IntegrateRepository(thatRepo);

                    //string[] directories = Directory.GetDirectories(dir);
                    //                                           string[] directories = await FundamentalPlatformSpecifics.Get().GetDirectoriesFromDirectory(dir);
                    //                                           foreach (
                    //                                                    string innerDir in directories.Where(
                    //                                                                                          innerDir =>
                    //                                                                                            !innerDir.Contains(".svn")))
                    //                                                                                    stack.Push(innerDir);
                    //                                                                            });
                }
                
            }

            return mainRepo;
        }

Usage Example

Пример #1
0
        public async void LoadRepositoryAsync()
        {
            META_METADATA_REPOSITORY = new MetaMetadataRepository
            {
                RepositoryByName = new Dictionary <string, MetaMetadata>(),
                PackageMmdScopes = new Dictionary <string, MmdScope>()
            };

            _metaMetadataRepository = META_METADATA_REPOSITORY;

            SetDefaultMetaMetadatas();

            MetaMetadataRepository mainRepo = await MetaMetadataRepositoryLoader.ReadDirectoryRecursively(
                META_METADATA_REPOSITORY,
                MetametadataRepositoryDirFile as string,
                MetaMetadataTranslationScope.Get(),
                _metadataTranslationScope
                );



            BindAndCallback(mainRepo);
        }