Example #1
0
        public void Files_ContainGrfEntriesWithNames_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var expectedPathAndName = new List <(string, string)>()
            {
                ("data\\0_Tex1.bmp", "0_Tex1.bmp"),
                ("data\\11001.txt", "11001.txt"),
                ("data\\balls.wav", "balls.wav"),
                ("data\\idnum2itemdesctable.txt", "idnum2itemdesctable.txt"),
                ("data\\idnum2itemdisplaynametable.txt", "idnum2itemdisplaynametable.txt"),
                ("data\\loading00.jpg", "loading00.jpg"),
                ("data\\monstertalktable.xml", "monstertalktable.xml"),
                ("data\\resnametable.txt", "resnametable.txt"),
                ("data\\t2_¹è°æ1-1.bmp", "t2_¹è°æ1-1.bmp")
            };
            var grf = Grf.FromFile(inputFile, mode);

            foreach (var(path, name) in expectedPathAndName)
            {
                var entryFound = grf.Find(path, out GrfEntry entry);
                Assert.IsTrue(entryFound);
                Assert.AreEqual(name, entry.Name);
            }
        }
Example #2
0
 private void Load(string grfFilePath, LoadingMode loadingMode)
 {
     _filePath  = grfFilePath;
     Header     = GrfFileReader.ReadHeader(grfFilePath);
     Entries    = GrfFileReader.ReadEntries(grfFilePath, Header, loadingMode);
     EntryNames = Entries.Keys.ToList();
 }
Example #3
0
        public static Grf FromFile(string grfFilePath, LoadingMode loadingMode = LoadingMode.Deferred)
        {
            var grf = new Grf();

            grf.Load(grfFilePath, loadingMode);
            return(grf);
        }
Example #4
0
        /// <summary>
        /// Preload textures into manager
        /// </summary>
        public void PreloadTexture(LoadingMode loadingMode = (MyFakes.LOAD_TEXTURES_IMMEDIATELY ? LoadingMode.Immediate : LoadingMode.LazyBackground))
        {
            if (m_loadedContent || m_diffuseName == null)
            {
                return;
            }

            if (m_hasNormalTexture)
            {
                DiffuseTexture = MyTextureManager.GetTexture <MyTexture2D>(m_diffuseName, CheckTexture, loadingMode);

                if (MyRenderConstants.RenderQualityProfile.UseNormals)
                {
                    NormalTexture = MyTextureManager.GetTexture <MyTexture2D>(m_normalName, CheckTexture, loadingMode);
                }
            }
            else
            {
                DiffuseTexture = MyTextureManager.GetTexture <MyTexture2D>(m_diffuseName, CheckTexture, loadingMode);

                if (MyRenderConstants.RenderQualityProfile.UseNormals)
                {
                    NormalTexture = MyTextureManager.GetTexture <MyTexture2D>(C_FAKE_NORMAL_TEXTURE, CheckTexture, loadingMode);
                }
            }

            m_loadedContent = true;
        }
Example #5
0
        public void load(LoadingMode mode)
        {
            if (Transition.instance.Enabled)
            {
                StartCoroutine(loadWithTransition(mode, Transition.instance.SlideTime));
            }
            else
            {
                switch (mode)
                {
                case LoadingMode.MAIN_MENU:
                    loadMenu(false);
                    break;

                case LoadingMode.LEVEL_SELECT:
                    loadMenu(true);
                    break;

                case LoadingMode.CONTINUE:
                    loadContinue(false);
                    break;

                case LoadingMode.TUTORIAL:
                    loadContinue(true);
                    break;
                }
            }
        }
Example #6
0
        /// <summary>
        /// 화면에 데이터를 로딩한다.
        /// </summary>
        async void LoadFiles()
        {
            Stopwatch st = null;

            if (Debugger.IsAttached)
            {
                st = new Stopwatch();
                st.Start();
            }

            await ThreadPool.RunAsync(async handler =>
            {
                //완료 기표
                loadingModel = LoadingMode.None;
                //재생목록 DB쿼리 (1 ~ 100개, 자막도 로드)
                var miList = new List <MediaInfo>();
                fileDAO.LoadPlayList(miList, 100, 0, true);
                //화면에 반영
                foreach (var mi in miList)
                {
                    await DispatcherHelper.RunAsync(() => { PlaylistSource.Add(mi); });
                }

                await DispatcherHelper.RunAsync(() =>
                {
                    CheckListButtonEnable = miList.Count > 0;
                    ReorderButtonEnable   = miList.Count > 1;
                });
            });

            if (Debugger.IsAttached)
            {
                System.Diagnostics.Debug.WriteLine("재생목록 로드 : " + st.Elapsed);
            }
        }
Example #7
0
        public void Entries_ContainGrfEntriesWithPaths_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var expectedPaths = new List <string>()
            {
                "data\\0_Tex1.bmp",
                "data\\11001.txt",
                "data\\balls.wav",
                "data\\idnum2itemdesctable.txt",
                "data\\idnum2itemdisplaynametable.txt",
                "data\\loading00.jpg",
                "data\\monstertalktable.xml",
                "data\\resnametable.txt",
                "data\\t2_¹è°æ1-1.bmp"
            };
            var grf = Grf.FromFile(inputFile, mode);

            foreach (var path in expectedPaths)
            {
                var entryFound = grf.Find(path, out GrfEntry entry);
                Assert.IsTrue(entryFound);
                Assert.AreEqual(path, entry.Path);
            }
        }
Example #8
0
    public ObjectPool(Func <T> factory, int size, LoadingMode loadingMode = LoadingMode.Eager,
                      AccessMode accessMode = AccessMode.FIFO)
    {
        if (factory == null)
        {
            throw new ArgumentNullException(factoryMessage);
        }

        if (size <= 0)
        {
            throw new ArgumentOutOfRangeException(nameof(size), size, sizeMessage);
        }

        this.factory     = factory;
        this.size        = size;
        this.loadingMode = loadingMode;

        switch (accessMode)
        {
        case AccessMode.FIFO:
            store = new QueueStore(size);
            break;

        case AccessMode.LIFO:
            store = new StackStore(size);
            break;
        }

        if (loadingMode == LoadingMode.Eager)
        {
            PreloadItems();
        }
    }
Example #9
0
 /// <summary>
 /// Загрузка текстуры
 /// </summary>
 /// <param name="file">Имя файла</param>
 /// <param name="loadMode">Режим загрузки</param>
 public Texture(string file, LoadingMode loadMode = LoadingMode.Instant)
 {
     Link           = file;
     WrapHorizontal = WrapMode.Repeat;
     WrapVertical   = WrapMode.Repeat;
     tex            = TextureCache.Get(file, loadMode == LoadingMode.Instant);
     tex.IncrementReference();
 }
Example #10
0
 private void CreateModels()
 {
     loadingModel                = LoadingMode.Caching;
     PlaylistSource              = new ObservableCollection <MediaInfo>();
     MainButtonGroupVisible      = true;
     CheckListButtonGroupVisible = false;
     ReorderButtonGroupVisible   = false;
 }
 private void sessionReset()
 {
     loadingMode          = LoadingMode.Starting;
     isLoadConfirmed      = false;
     isReadyToLoad        = false;
     isReadyForPuzzle     = false;
     slotPanel.PanelState = SlotPanel.SlotPanelState.Closed;
     slotPanel.SelectMode = SlotPanel.SelectorMode.Docked;
 }
Example #12
0
        public void Load_ThrowsDirectoryNotFound_WhenPassingInvalidPath(
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            void throwingMethod()
            {
                Grf.FromFile("some/path/file.grf", mode);
            }

            Assert.Throws <DirectoryNotFoundException>(throwingMethod);
        }
Example #13
0
 private void CreateModels()
 {
     AllVideoSource     = new ObservableCollection <JumpListGroup <MediaInfo> >();
     AllVideoCollection = new CollectionViewSource();
     AllVideoCollection.IsSourceGrouped = true;
     AllVideoCollection.Source          = AllVideoSource;
     loadingMode                 = LoadingMode.Caching;
     ButtonGroupVisible          = true;
     _SearchFolderPathVisibility = Visibility.Collapsed;
 }
Example #14
0
        public bool InternalRefresh(Database database, LoadingMode loadMode, bool clearErrors)
        {
            if (clearErrors)
            {
                ClearLastErrors();
            }

            EnsureExtractedCatalog();

            bool result = Util.StringEqual(this.connectionInfo.ServerName, database.Owner.Name, true) &&
                          Util.StringEqual(this.connectionInfo.DatabaseName, database.Name, true);

            if (!result)
            {
                if (this.IsConnected)
                {
                    this.Disconnect();
                }
                if (this.connectionInfo.ServerName != database.Owner.Name)
                {
                    this.connectionInfo.ServerName = database.Owner.Name;
                }

                if (this.connectionInfo.DatabaseName != database.Name)
                {
                    this.connectionInfo.DatabaseName = database.Name;
                }

                result = InternalReconnect(true, this.connectionInfo);
            }

            if (result)
            {
                EnsureExtractedCatalog();

                List <Schema> schemas = new List <Schema>();
                foreach (var schema in GetFilteredSchemas().Where(item => Util.StringEqual(item.Catalog.Name, database.Name, true)))
                {
                    Schema newSchema = new Schema(schema.Name, database);
                    schemas.Add(newSchema);
                }

                database.Schemas = new SchemaCollection(schemas);

                if (loadMode == LoadingMode.RecursiveAllLevels)
                {
                    foreach (var schema in database.Schemas)
                    {
                        InternalRefresh(schema, loadMode, false);
                    }
                }
            }

            return(result);
        }
        /// <summary>
        /// Preload textures into manager
        /// </summary>
        public void PreloadTexture(LoadingMode loadingMode = LoadingMode.Immediate)
        {
            if (m_loadedContent || m_diffuseName == null)
            {
                return;
            }

            string ext     = Path.GetExtension(m_diffuseName);
            string deMatch = "_de" + ext;
            string meMatch = "_me" + ext;

            string baseName;

            if (m_diffuseName.EndsWith(deMatch))
            {
                baseName = m_diffuseName.Substring(0, m_diffuseName.Length - deMatch.Length);
            }
            else if (m_diffuseName.EndsWith(meMatch))
            {
                baseName = m_diffuseName.Substring(0, m_diffuseName.Length - meMatch.Length);
            }
            else
            {
                baseName = m_diffuseName.Substring(0, m_diffuseName.Length - ext.Length);
            }

            m_diffuseName  = baseName + deMatch;
            DiffuseTexture = MyTextureManager.GetTexture <MyTexture2D>(m_diffuseName, m_contentDir, CheckTexture, loadingMode);
            if (DiffuseTexture == null)
            {
                m_diffuseName  = baseName + ext;
                DiffuseTexture = MyTextureManager.GetTexture <MyTexture2D>(m_diffuseName, m_contentDir, CheckTexture, loadingMode);
            }
            if (DiffuseTexture == null)
            {
                m_diffuseName  = baseName + meMatch;
                DiffuseTexture = MyTextureManager.GetTexture <MyTexture2D>(m_diffuseName, m_contentDir, CheckTexture, loadingMode);
            }


            EnableColorMask = m_diffuseName.EndsWith(meMatch, StringComparison.InvariantCultureIgnoreCase);

            if (DiffuseTexture == null)
            { //we dont want to see just pure black
                DiffuseTexture = MyTextureManager.GetTexture <MyTexture2D>(C_FAKE_DIFFUSE_TEXTURE, m_contentDir, CheckTexture, loadingMode);
            }

            if (MyRenderConstants.RenderQualityProfile.UseNormals)
            {
                string tex = m_hasNormalTexture ? (m_normalName ?? C_FAKE_NORMAL_TEXTURE) : C_FAKE_NORMAL_TEXTURE;
                NormalTexture = MyTextureManager.GetTexture <MyTexture2D>(tex, m_contentDir, CheckTexture, loadingMode);
            }

            m_loadedContent = true;
        }
Example #16
0
        public void EntryCount_ReturnsNine_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var expected = 9;
            var grf      = Grf.FromFile(inputFile, mode);

            var actual = grf.Count;

            Assert.AreEqual(expected, actual);
        }
Example #17
0
        public void Signature_ReturnsMasterOfMagic_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var expected = "Master of Magic";
            var grf      = Grf.FromFile(inputFile, mode);

            var actual = grf.Signature;

            Assert.AreEqual(expected, actual);
        }
Example #18
0
        private void Load(string iniFilePath, string sectionName, LoadingMode loadingMode)
        {
            var dataIni   = new GrfIni(iniFilePath);
            var directory = Path.GetDirectoryName(iniFilePath);
            var grfFiles  = dataIni.Values(sectionName);

            foreach (var grfFile in grfFiles)
            {
                var filePath = Path.Combine(directory, grfFile);
                _grfs.Add(Grf.FromFile(filePath, loadingMode));
            }
        }
Example #19
0
        public bool InternalRefresh(Schema schema, LoadingMode loadMode, bool clearErrors)
        {
            if (clearErrors)
            {
                ClearLastErrors();
            }

            EnsureExtractedCatalog();

            List <Table> tables = new List <Table>();

            global::Xtensive.Sql.Model.Schema ormSchema = extractedCatalog.Schemas[schema.Name];
            foreach (global::Xtensive.Sql.Model.Table table in ormSchema.Tables)
            {
                Table newTable = new Table(table.Name, schema);
                tables.Add(newTable);
            }

            schema.Tables = new TableCollection(tables);

            if (loadMode == LoadingMode.RecursiveAllLevels)
            {
                foreach (var table in schema.Tables)
                {
                    InternalRefresh(table, false);
                }

                // iterate each foreign key if has assigned temporary reference table and if so then try to found real foreign table
                foreach (Table table in schema.Tables)
                {
                    if (table.ForeignKeys != null)
                    {
                        foreach (ForeignKey foreignKey in table.ForeignKeys)
                        {
                            if (foreignKey.ForeignTable is TemporaryReferencedTable)
                            {
                                TemporaryReferencedTable temporaryReferencedTable =
                                    (TemporaryReferencedTable)foreignKey.ForeignTable;

                                var referencedTable = schema.Tables[temporaryReferencedTable.Name];
                                //, temporaryReferencedTable.Schema];
                                foreignKey.ForeignTable = referencedTable;
                            }
                        }
                    }
                }
            }

            //TODO: When supporting views, add loading of views

            return(true);
        }
Example #20
0
        private bool InternalRefresh(Server server, LoadingMode loadMode, bool clearErrors)
        {
            if (clearErrors)
            {
                ClearLastErrors();
            }

            bool result = Util.StringEqual(this.connectionInfo.ServerName, server.Name, true);

            if (!result)
            {
                if (this.IsConnected)
                {
                    this.Disconnect();
                }
                this.connectionInfo.ServerName = server.Name;

                result = InternalReconnect(true, this.connectionInfo);
            }


            if (result)
            {
                EnsureConnected();

                List <Database> databases = new List <Database>();

                string systemEngineProvider = GetSystemEngineProvider();

                var databaseList = DBEngineUtils.GetDatabases(systemEngineProvider, server.Name, this.connectionInfo.UserID, this.connectionInfo.Password);

                foreach (var database in databaseList.OrderBy(s => s))
                {
                    Database db = new Database(database, server);
                    databases.Add(db);
                }

                server.Databases = new DatabaseCollection(databases);

                if (loadMode == LoadingMode.RecursiveAllLevels)
                {
                    EnsureExtractedCatalog();

                    foreach (Database database in server.Databases)
                    {
                        InternalRefresh(database, loadMode, false);
                    }
                }
            }

            return(result);
        }
Example #21
0
        public void UncompressedSize_ReturnsSameSizeAsExtractedData_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var grf = Grf.FromFile(inputFile, mode);

            Assert.IsTrue(grf.Count != 0);
            foreach (var path in grf.EntryNames)
            {
                var entryFound = grf.Find(path, out GrfEntry entry);
                Assert.IsTrue(entryFound);
                Assert.AreEqual(entry.Size, entry.GetUncompressedData().Length);
            }
        }
Example #22
0
        public void GetUncompressedData_DoesntChangeOriginalDataOnUncompressing_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var grf = Grf.FromFile(inputFile, mode);

            Assert.IsTrue(grf.Count != 0);
            foreach (var path in grf.EntryNames)
            {
                var entryFound = grf.Find(path, out GrfEntry entry);
                Assert.IsTrue(entryFound);
                Assert.AreEqual(entry.Size, entry.GetUncompressedData().Length);
                Assert.AreEqual(entry.Size, entry.GetUncompressedData().Length);
            }
        }
Example #23
0
        /// <summary>
        /// Initializes a new instance of the Pool class.
        /// </summary>
        /// <param name="size">Maximum pool size.</param>
        /// <param name="factory">Factory function(creator) for pooled objects.</param>
        /// <param name="loadingMode">Loading mode.</param>
        /// <param name="accessMode">Acess mode</param>
        public Pool(int size, Func <Pool <T>, T> factory = null, LoadingMode loadingMode = LoadingMode.Lazy, AccessMode accessMode = AccessMode.LIFO)
        {
            Exceptions.ThrowIf <ArgumentOutOfRangeException>(size == 0, "Argument 'size' must be greater than zero.");

            this.size        = size;
            this.factory     = factory;
            this.sync        = new Semaphore(size, size);
            this.LoadingMode = loadingMode;

            // Create pool
            switch (accessMode)
            {
            case AccessMode.FIFO:
            {
                this.itemStore = new QueueStore(size);
                break;
            }

            case AccessMode.LIFO:
            {
                this.itemStore = new StackStore(size);
                break;
            }

            case AccessMode.Circular:
            {
                this.itemStore = new CircularStore(size);
                break;
            }
            }

            // Default factory
            if (this.factory == null)
            {
                this.factory = p => (T)Activator.CreateInstance(typeof(T), true);
            }

            // Preaload
            if (loadingMode == LoadingMode.Eager)
            {
                PreloadItems();
            }
        }
Example #24
0
        public ServerCollection GetAllServers(LoadingMode loadingMode)
        {
            ClearLastErrors();
            EnsureConnected();

            ServerCollection servers = null;

            try
            {
                string systemEngineProvider = GetSystemEngineProvider();

                var           dataSources = DBEngineUtils.GetDataSources(systemEngineProvider);
                List <Server> items       = new List <Server>();
                foreach (var item in dataSources.OrderBy(info => info.Host))
                {
                    items.Add(new Server
                    {
                        Name        = item.Host,
                        IsClustered = item.IsClustered,
                        Version     = item.Version
                    });
                }

                items.Insert(0, new Server("localhost"));

                servers = new ServerCollection(items);

                if (loadingMode == LoadingMode.RecursiveAllLevels)
                {
                    foreach (Server server in servers)
                    {
                        InternalRefresh(server, loadingMode, false);
                    }
                }
            }
            catch (Exception e)
            {
                UpdateLastError(e);
            }

            return(servers);
        }
Example #25
0
        private static LoadMethod GetLoadMethod(LoadingMode loadingMode)
        {
            LoadMethod loadMethod;

            switch (loadingMode)
            {
            case LoadingMode.Lazy:
                loadMethod = LoadMethod.Lazy;
                break;

            case LoadingMode.LazyBackground:
                loadMethod = LoadMethod.LazyBackground;
                break;

            default:
                loadMethod = LoadMethod.External;
                break;
            }
            return(loadMethod);
        }
Example #26
0
 public ContextPool(int size, Func <ContextPool <T>, T> factory, LoadingMode loadingMode, AccessMode accessMode)
 {
     if (size <= 0)
     {
         throw new ArgumentOutOfRangeException("size", size,
                                               "Argument 'size' must be greater than zero.");
     }
     if (factory == null)
     {
         throw new ArgumentNullException("factory");
     }
     this.size        = size;
     this.factory     = factory;
     sync             = new Semaphore(size, size);
     this.loadingMode = loadingMode;
     this.itemStore   = CreateItemStore(accessMode, size);
     if (loadingMode == LoadingMode.Eager)
     {
         PreloadItems();
     }
 }
Example #27
0
        public void EntryNames_ReturnsAllFilesFromTestGrf_AfterLoadingAFile(
            [ValueSource("InputFiles")] string inputFile,
            [ValueSource("LoadingModes")] LoadingMode mode)
        {
            var expected = new List <string>()
            {
                "data\\0_Tex1.bmp",
                "data\\11001.txt",
                "data\\balls.wav",
                "data\\idnum2itemdesctable.txt",
                "data\\idnum2itemdisplaynametable.txt",
                "data\\loading00.jpg",
                "data\\monstertalktable.xml",
                "data\\resnametable.txt",
                "data\\t2_¹è°æ1-1.bmp"
            };
            var grf = Grf.FromFile(inputFile, mode);

            var actual = grf.EntryNames;

            Assert.AreEqual(expected, actual);
        }
Example #28
0
    /// <summary>
    /// Load a new scene with adictive scenes
    /// </summary>
    /// <param name="mainScene">
    /// main scene
    /// </param>
    /// <param name="aditiveScene">
    /// adictive scenes over main scene
    /// </param>
    public void GotoScene(LoadingIndication loadingIndication, LoadingMode loadingMode, string mainScene, params string[] adictiveScene)
    {
        m_loadingIndication = loadingIndication;
        CreateLoadingObject();


        m_loadingMode      = loadingMode;
        m_checkSceneLoaded = false;
        m_isLoadingScene   = false;

        //store the params to be used after fade out
        m_mainScene = mainScene;

        m_adictiveScene = (string[])adictiveScene.Clone();
        m_loadStatus    = new AsyncOperation[m_adictiveScene.Length + 1];

        //Change PlayerWeapon and Animations
        //TraceUtil.Log("根据当前游戏场景,改变玩家的技能,武器挂载等在SenceManager GotoSence");
        PlayerManager.Instance.PlayerChangeScene(GameManager.Instance.CurrentState);

        FadeStateChanged();
    }
Example #29
0
        IEnumerator loadWithTransition(LoadingMode mode, float t)
        {
            Transition.instance.TStart(TransitionMode.SLIDE);
            yield return(new WaitForSeconds(t));

            switch (mode)
            {
            case LoadingMode.MAIN_MENU:
                loadMenu(false);
                break;

            case LoadingMode.LEVEL_SELECT:
                loadMenu(true);
                break;

            case LoadingMode.CONTINUE:
                loadContinue(false);
                break;

            case LoadingMode.TUTORIAL:
                loadContinue(true);
                break;
            }
        }
Example #30
0
        async void ReloadAllVideo()
        {
            Stopwatch st     = null;
            var       loader = ResourceLoader.GetForCurrentView();

            //앱바에 시작 상태 통지
            EnableButtons(false);

            if (Debugger.IsAttached)
            {
                st = new Stopwatch();
                st.Start();
            }

            await ThreadPool.RunAsync(async handler =>
            {
                var mfiList = new List <MediaInfo>();
                //재생목록 로드 (이미 추가된 파일인지 표시를 위해)
                playlist = new List <MediaInfo>();
                fileDAO.LoadPlayList(playlist, 100, 0, false);

                //캐시 로딩의 경우 DB로 부터 캐시를 먼저 로드
                if (loadingMode == LoadingMode.Caching)
                {
                    fileDAO.LoadAllVideoList(mfiList, playlist);
                }

                await DispatcherHelper.RunAsync(() =>
                {
                    //목록 초기화
                    AllVideoSource.Clear();
                    //캐시 로드인 경우 로딩 경로를 "캐시에서 로딩" 으로 변경
                    if (loadingMode == LoadingMode.Caching && mfiList.Count > 0)
                    {
                        SearchFolderPath = loader.GetString("Cache");
                    }
                });

                bool isLoaded = false;
                if (loadingMode == LoadingMode.Caching && mfiList.Count > 0)
                {
                    //로딩 표시
                    loadingMode = LoadingMode.None;
                    //캐시 로딩 처리...
                    var jumpGroupList = mfiList.ToAlphaGroups(x => x.Name);
                    foreach (var jumpGroup in jumpGroupList)
                    {
                        await DispatcherHelper.RunAsync(() =>
                        {
                            AllVideoSource.Add(jumpGroup);
                        });
                    }
                    //캐시 로딩 완료 처리
                    isLoaded = true;
                }
                else
                {
                    //로딩 표시
                    loadingMode = LoadingMode.None;

                    List <FolderInfo> folderList = null;
                    InitializeAllVideos(out folderList);

                    //폴더 목록이 비어 있으면 로딩완료 처리
                    isLoaded = folderList.Count == 0;

                    //캐시 로딩이 아닌경우 (디렉토리 풀스캔)
                    //폴더내 파일 로딩 처리
                    if (!isLoaded)
                    {
                        foreach (var fi in folderList)
                        {
                            LoadFilesRecursively(await fi.GetStorageFolder(true), AddAllVideoJumpList);
                        }

                        isLoaded = true;
                    }
                }

                if (isLoaded)
                {
                    //화면 로딩 상태 제거 (캐시로딩 또는 캐시로딩은 아니지만, 로딩할 폴더 목록이 없는 경우)
                    await DispatcherHelper.RunAsync(() =>
                    {
                        //진행바 및 현재 탐색 폴더 표시 삭제
                        SearchFolderPath = string.Empty;
                        //우측 상단 버튼 그룹 제어
                        EnableButtons(true);
                        //시크 데이터 정리
                        //fileDAO.DeleteSeekingData();
                        //재생 목록 정리
                        fileDAO.CleanPlayList();
                    });
                }

                if (Debugger.IsAttached)
                {
                    Debug.WriteLine("전체 비디오 로딩 완료 : " + st.Elapsed);
                }

                //전체 로딩 후 생성 요청...
                MessengerInstance.Send <Message>(new Message("CheckSearchElement", null), MainViewModel.NAME);
            });
        }
Example #31
0
        //  Loads vertex/index buffers and textures, access GPU
        //  Should be called only from Draw method on main thread
        public void LoadInDraw(LoadingMode loadingMode = LoadingMode.Immediate)
        {
            //  If already loaded into GPU
            if (m_loadedContent)
                return;

            //  If this model wasn't loaded through lazy-load then it means we don't need it in this game/sector, and we
            //  don't need to load him into GPU
            if (m_loadedData == false)
                return;

            if (LoadState == Textures.LoadState.Loading)
                return;


            if (loadingMode == LoadingMode.Background)
            {
                //todo
                System.Diagnostics.Debug.Assert(false);
                //MyModels.LoadModelInDrawInBackground(this);
                return;
            }

            if (m_verticesCount == 0)
            {
                LoadState = Textures.LoadState.Error;
                MyRender.Log.WriteLine("ERROR: Attempted to load model " + AssetName + " with zero vertices", LoggingOptions.LOADING_MODELS);
                return;
            }


            Debug.Assert(m_forLoadingTexCoords0 != null && m_meshContainer.Count != 0, "Somebody forget to call LoadData on model before rendering");

            MyRender.GetRenderProfiler().StartProfilingBlock("MyModel::LoadInDraw");


            // Creating
            CreateRenderDataForMesh();
            PreloadTextures(LoadingMode.Immediate);

            m_loadedContent = true;

            //We can do this in render
            UnloadTemporaryData();

            LoadState = Textures.LoadState.Loaded;

            MyRender.GetRenderProfiler().EndProfilingBlock();
        }
Example #32
0
 public void PreloadTextures(LoadingMode loadingMode)
 {
     foreach (MyRenderMesh mesh in GetMeshList())
     {
         mesh.Material.PreloadTexture(loadingMode);
     }
 }
        /// <summary>
        /// Preload textures into manager
        /// </summary>
        public void PreloadTexture(LoadingMode loadingMode = LoadingMode.Immediate)
        {
            if (m_loadedContent || m_diffuseName == null)
            {
                return;
            }

            string ext = Path.GetExtension(m_diffuseName);
            string deMatch = "_de" + ext;
            string meMatch = "_me" + ext;

            string baseName;
            if (m_diffuseName.EndsWith(deMatch))
                baseName = m_diffuseName.Substring(0, m_diffuseName.Length - deMatch.Length);
            else if (m_diffuseName.EndsWith(meMatch))
                baseName = m_diffuseName.Substring(0, m_diffuseName.Length - meMatch.Length);
            else
                baseName = m_diffuseName.Substring(0, m_diffuseName.Length - ext.Length);

            m_diffuseName = baseName + deMatch;
            DiffuseTexture = MyTextureManager.GetTexture<MyTexture2D>(m_diffuseName, m_contentDir, CheckTexture, loadingMode);
            if (DiffuseTexture == null)
            {
                m_diffuseName = baseName + ext;
                DiffuseTexture = MyTextureManager.GetTexture<MyTexture2D>(m_diffuseName, m_contentDir, CheckTexture, loadingMode);
            }
            if (DiffuseTexture == null)
            {
                m_diffuseName = baseName + meMatch;
                DiffuseTexture = MyTextureManager.GetTexture<MyTexture2D>(m_diffuseName, m_contentDir, CheckTexture, loadingMode);
            }


            EnableColorMask = m_diffuseName.EndsWith(meMatch, StringComparison.InvariantCultureIgnoreCase);

            if (DiffuseTexture == null)
            { //we dont want to see just pure black
                DiffuseTexture = MyTextureManager.GetTexture<MyTexture2D>(C_FAKE_DIFFUSE_TEXTURE, m_contentDir, CheckTexture, loadingMode);
            }

            if (MyRenderConstants.RenderQualityProfile.UseNormals)
            {
                string tex = m_hasNormalTexture ? (m_normalName ?? C_FAKE_NORMAL_TEXTURE) : C_FAKE_NORMAL_TEXTURE;
                NormalTexture = MyTextureManager.GetTexture<MyTexture2D>(tex, m_contentDir, CheckTexture, loadingMode);
            }

            m_loadedContent = true;
        }
Example #34
0
        /// <summary>
        /// Preload textures into manager
        /// </summary>
        public void PreloadTexture(LoadingMode loadingMode = (MyFakes.LOAD_TEXTURES_IMMEDIATELY ? LoadingMode.Immediate : LoadingMode.LazyBackground))
        {
            if (m_loadedContent || m_diffuseName == null)
            {
                return;
            }

            if (m_hasNormalTexture)
            {
                DiffuseTexture = MyTextureManager.GetTexture<MyTexture2D>(m_diffuseName, CheckTexture, loadingMode);

                if (MyRenderConstants.RenderQualityProfile.UseNormals)
                    NormalTexture = MyTextureManager.GetTexture<MyTexture2D>(m_normalName, CheckTexture, loadingMode);
            }
            else
            {
                DiffuseTexture = MyTextureManager.GetTexture<MyTexture2D>(m_diffuseName, CheckTexture, loadingMode);

                if (MyRenderConstants.RenderQualityProfile.UseNormals)
                    NormalTexture = MyTextureManager.GetTexture<MyTexture2D>(C_FAKE_NORMAL_TEXTURE, CheckTexture, loadingMode);
            }

            m_loadedContent = true;
        }