Пример #1
0
                async Task <bool> getDataPacks()
                {
                    string dataPath;

                    if (!GameDirSetting.getDataPath(out dataPath))
                    {
                        return(false);
                    }

                    if (!DBTypeMap.Instance.Initialized)
                    {
                        DBTypeMap.Instance.InitializeTypeMap(AppDomain.CurrentDomain.BaseDirectory);
                    }

                    PackFile[] locPackFiles = await Task.WhenAll(GameInfo.locDataPacks.Select
                                                                     (dataPack => {
                        return(Task <PackFile> .Run(() => {
                            return getPackFile(progressUpdater, dataPath, dataPack);
                        }));
                    }));

                    PackFile[] dataPackFiles = await Task <PackFile> .WhenAll(GameInfo.dataPacks.Select
                                                                                  (dataPack => {
                        return(Task <PackFile> .Run(() => {
                            return getPackFile(progressUpdater, dataPath, dataPack);
                        }));
                    }));

                    locDBs = locPackFiles.OfType <PackFile>().Select(PackFile =>
                                                                     PackFile.GetDirByPath(GameInfo.locpath)).OfType <VirtualDirectory>().ToArray();
                    dataDBs = dataPackFiles.OfType <PackFile>().Select(PackFile =>
                                                                       PackFile.GetDirByPath(GameInfo.dbPath)).OfType <VirtualDirectory>().ToArray();
                    return(true);
                }