/// <summary> /// /// </summary> /// <param name="strFileName"></param> /// <returns></returns> public VirtualStream OpenFile(string strFileName, FileAccess fileAccess) { if (String.IsNullOrEmpty(strFileName) == true) { throw new Exception("VirtualFileManager.OpenFile(...) - String.IsNullOrEmpty() == true error!"); } for (int iIndex = 0; iIndex < m_PackageArchives.Length; ++iIndex) { IStreamArchive streamArchive = m_PackageArchives[iIndex]; VirtualStream virtualStream = streamArchive.OpenFile(strFileName, fileAccess); if (virtualStream == null) { continue; } else { return(virtualStream); } } return(FileArchive.SingletonInstance.OpenFile(strFileName, fileAccess)); }
/// <summary> /// /// </summary> /// <param name="strFilePath"></param> public void UnRegisterPackage(string strPackageFile) { if (String.IsNullOrEmpty(strPackageFile) == true) { throw new Exception("VirtualFileManager.UnRegisterPackage(...) - String.IsNullOrEmpty() == true error!"); } List <IStreamArchive> streamArchiveList = new List <IStreamArchive>(m_PackageArchives.Length); bool bIsFind = false; for (int iIndex = 0; iIndex < m_PackageArchives.Length; ++iIndex) { IStreamArchive streamArchive = m_PackageArchives[iIndex]; if (streamArchive.PackageName == strPackageFile) { bIsFind = true; streamArchive.ClosePackage(); } else { streamArchiveList.Add(streamArchive); } } if (bIsFind == true) { m_PackageArchives = streamArchiveList.ToArray(); } }
/// <summary> /// /// </summary> /// <param name="strFilePath"></param> public bool RegisterPackage(string strPackageFile) { if (String.IsNullOrEmpty(strPackageFile) == true) { throw new Exception("VirtualFileManager.RegisterPackage(...) - String.IsNullOrEmpty() == true error!"); } for (int iIndex = 0; iIndex < m_StreamArchives.Length; ++iIndex) { IStreamArchive streamArchive = m_StreamArchives[iIndex]; if (streamArchive.OpenPackage(strPackageFile) == false) { continue; } else { streamArchive.ClosePackage(); IStreamArchive streamArchiveNew = streamArchive.CreateInstance(); if (streamArchiveNew == null) { return(false); } if (streamArchiveNew.OpenPackage(strPackageFile) == false) { return(false); } IStreamArchive[] tempStream = new IStreamArchive[m_PackageArchives.Length + 1]; tempStream[0] = streamArchiveNew; for (int iIndex2 = 0; iIndex2 < m_PackageArchives.Length; ++iIndex2) { tempStream[iIndex2 + 1] = m_PackageArchives[iIndex2]; } m_PackageArchives = tempStream; return(true); } } return(false); }
/// <summary> /// /// </summary> /// <param name="streamArchive"></param> public void RegisterStreamArchive(IStreamArchive streamArchive) { if (streamArchive == null) { throw new Exception("VirtualFileManager.RegisterStreamArchive(...) - streamArchive == null error!"); } IStreamArchive[] tempStream = new IStreamArchive[m_StreamArchives.Length + 1]; for (int iIndex = 0; iIndex < m_StreamArchives.Length; ++iIndex) { tempStream[iIndex] = m_StreamArchives[iIndex]; } tempStream[m_StreamArchives.Length] = streamArchive; m_StreamArchives = tempStream; }
/// <summary> /// /// </summary> /// <param name="streamArchive"></param> public void UnRegisterStreamArchive(IStreamArchive streamArchive) { if (streamArchive == null) { throw new Exception("VirtualFileManager.UnRegisterStreamArchive(...) - streamArchive == null error!"); } List <IStreamArchive> streamArchiveList = new List <IStreamArchive>(); foreach (IStreamArchive itemStream in m_StreamArchives) { if (itemStream != streamArchive) { streamArchiveList.Add(itemStream); } } m_StreamArchives = streamArchiveList.ToArray(); }
/// <summary> /// /// </summary> /// <param name="streamArchive"></param> public void UnRegisterStreamArchive( IStreamArchive streamArchive ) { if ( streamArchive == null ) throw new Exception( "VirtualFileManager.UnRegisterStreamArchive(...) - streamArchive == null error!" ); List<IStreamArchive> streamArchiveList = new List<IStreamArchive>(); foreach ( IStreamArchive itemStream in m_StreamArchives ) { if ( itemStream != streamArchive ) streamArchiveList.Add( itemStream ); } m_StreamArchives = streamArchiveList.ToArray(); }
/// <summary> /// /// </summary> /// <param name="streamArchive"></param> public void RegisterStreamArchive( IStreamArchive streamArchive ) { if ( streamArchive == null ) throw new Exception( "VirtualFileManager.RegisterStreamArchive(...) - streamArchive == null error!" ); IStreamArchive[] tempStream = new IStreamArchive[m_StreamArchives.Length + 1]; for ( int iIndex = 0; iIndex < m_StreamArchives.Length; ++iIndex ) tempStream[iIndex] = m_StreamArchives[iIndex]; tempStream[m_StreamArchives.Length] = streamArchive; m_StreamArchives = tempStream; }
/// <summary> /// /// </summary> /// <param name="strFilePath"></param> public bool RegisterPackage( string strPackageFile ) { if ( String.IsNullOrEmpty( strPackageFile ) == true ) throw new Exception( "VirtualFileManager.RegisterPackage(...) - String.IsNullOrEmpty() == true error!" ); for ( int iIndex = 0; iIndex < m_StreamArchives.Length; ++iIndex ) { IStreamArchive streamArchive = m_StreamArchives[iIndex]; if ( streamArchive.OpenPackage( strPackageFile ) == false ) continue; else { streamArchive.ClosePackage(); IStreamArchive streamArchiveNew = streamArchive.CreateInstance(); if ( streamArchiveNew == null ) return false; if ( streamArchiveNew.OpenPackage( strPackageFile ) == false ) return false; IStreamArchive[] tempStream = new IStreamArchive[m_PackageArchives.Length + 1]; tempStream[0] = streamArchiveNew; for ( int iIndex2 = 0; iIndex2 < m_PackageArchives.Length; ++iIndex2 ) tempStream[iIndex2 + 1] = m_PackageArchives[iIndex2]; m_PackageArchives = tempStream; return true; } } return false; }