亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? filesystem.cpp

?? 赫赫大名的 OGRE 游戲引擎
?? CPP
字號:
// FileSystem.cpp : Defines the entry point for the DLL application.
//

#include "FileSystem.h"
#include "FileSystemFactory.h"
#include "OgreLogManager.h"
#include "OgreArchiveManager.h"
#include "OgreException.h"
#include "OgreStringVector.h"
#include "OgreRoot.h"



#include <sys/types.h>
#include <sys/stat.h>

#if OGRE_PLATFORM == PLATFORM_LINUX || OGRE_PLATFORM == PLATFORM_APPLE
#   include "SearchOps.h"
#   include <sys/param.h>
#   define MAX_PATH MAXPATHLEN
#endif

#if OGRE_PLATFORM == PLATFORM_WIN32
#   include <windows.h>
#   include <direct.h>
#   include <io.h>
#endif

/*#ifdef _INC_STDIO
#endif*/

namespace Ogre {
    //-----------------------------------------------------------------------
    FileSystemFactory* pFSFactory = NULL;
    //-----------------------------------------------------------------------

    //-----------------------------------------------------------------------
    extern "C" void dllStartPlugin(void)
    {
        SET_TERM_HANDLER;

        pFSFactory = new FileSystemFactory();
        ArchiveManager::getSingleton().addArchiveFactory(pFSFactory);
    }

    //-----------------------------------------------------------------------
    extern "C" void dllStopPlugin(void)
    {
        delete pFSFactory;
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileOpen( const String& strFile, FILE **ppFile ) const
    {
        setPath();

        FILE *pFile;
        pFile = fopen( strFile.c_str(), "r+b" );
        *ppFile = pFile;

        retunset(true);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileRead( const String& strFile, DataChunk **ppChunk ) const
    {
        setPath();

        struct stat tagStat;
        DataChunk *pChunk = *ppChunk;

        int ret = stat( strFile.c_str(), &tagStat );
        assert(ret == 0 && "Problem getting file size" );

        pChunk->allocate( tagStat.st_size );

        FILE* pFile = fopen( strFile.c_str(), "rb" );

        fread( (void*)pChunk->getPtr(), tagStat.st_size, 1, pFile );
        fclose( pFile );

        retunset(true);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileSave( FILE *pFile, const String& strPath, bool bOverwrite /* = false */ )
    {
        setPath();

        FILE *pArchFile = fopen( strPath.c_str(), "r" );
        if( !pArchFile || ( pFile && bOverwrite ) ) {
            if( pArchFile )
                freopen( strPath.c_str(), "wb", pArchFile );
            else
                pArchFile = fopen( strPath.c_str(), "wb" );

            long lPos = ftell( pFile );
            fseek( pFile, 0, SEEK_END );
            long lSize = ftell( pFile );
            fseek( pFile, 0, SEEK_SET );

            unsigned char *szBuffer = new unsigned char[lSize];
            fread( (void*)szBuffer, lSize, 1, pFile );
            fwrite( (const void*)szBuffer, lSize, 1, pArchFile );
            delete[] szBuffer;

            fseek( pFile, lPos, SEEK_SET );
            fclose( pArchFile );

            retunset(true);
        }
        retunset(false);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileWrite( const DataChunk& refChunk, const String& strPath, bool bOverwrite /* = false */ )
    {
        setPath();

        FILE* pFile = fopen( strPath.c_str(), "r" );
        if( !pFile || ( pFile && bOverwrite ) ) {
            if( pFile )
                freopen( strPath.c_str(), "wb", pFile );
            else
                pFile = fopen( strPath.c_str(), "wb" );

            fwrite( (const void*)refChunk.getPtr(), refChunk.getSize(), 1, pFile );
            fclose(pFile);

            retunset(true);
        }

        retunset(false);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileTest( const String& strFile ) const
    {
        setPath();

        char szPath[MAX_PATH+1];
        getcwd( szPath, MAX_PATH);

        struct stat tagStat;
        if(!stat( strFile.c_str(), &tagStat ))
            retunset(true);
        retunset(false);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileCopy( const String& strSrc, const String& strDest, bool bOverwrite )
    {
        setPath();

        FILE* pSrcFile, *pDestFile;
        struct stat tagStat;
        int iCh;

        if( strSrc != strDest )
        {
            pDestFile = fopen(strDest.c_str(), "r" );

            if( pDestFile == NULL )
                pDestFile = fopen( strDest.c_str(), "wb" );
            else if( pDestFile != NULL && bOverwrite == true ) {
                fclose( pDestFile );
                pDestFile = fopen( strDest.c_str(), "wb" );
            }

            if( pDestFile == 0 )
                retunset(false);

            pSrcFile = fopen( strSrc.c_str(), "rb" );
            if( !pSrcFile )
                retunset(false);

            stat( strSrc.c_str(), &tagStat );

            for( long lI=0; lI<tagStat.st_size; lI++ ) {
                iCh = fgetc( pSrcFile );
                fputc( iCh, pDestFile );
            }

            fclose( pDestFile );
            fclose( pSrcFile );

            retunset(true);
        }

        retunset(false);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileMove( const String& strSrc, const String& strDest, bool bOverwrite )
    {
        setPath();

        if( fileCopy( strSrc, strDest, bOverwrite ) ) {
            if( unlink( strSrc.c_str() ) ) {
                retunset(true);
            }
            else {
                retunset(false);
            }
        } else
            retunset(false);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileDele( const String& strFile )
    {
        setPath();

        FILE* pFile = fopen( strFile.c_str(), "r" );

        if( !pFile )
            retunset(false);
        fclose( pFile );

        unlink( strFile.c_str() );

        retunset(true);
    }

    //-----------------------------------------------------------------------
    bool FileSystem::fileInfo( const String& strFile, FileInfo** ppInfo ) const
    {
        setPath();
        FileInfo* pInfo = *ppInfo;;

        struct stat tagStat;
        if( !stat( strFile.c_str(), &tagStat ) ) {
            pInfo = NULL;
            retunset(false);
        }

        pInfo->iCompSize = pInfo->iUncompSize = tagStat.st_size;
        pInfo->iLastMod = tagStat.st_mtime;

        strcpy( pInfo->szFilename, strFile.c_str() );

        retunset(true);
    }

    //-----------------------------------------------------------------------
    void FileSystem::setPath() const
    {
        getcwd( mszTempPath, OGRE_MAX_PATH );
        chdir( mstrBasePath.c_str() );
    }

    //-----------------------------------------------------------------------
    void FileSystem::unsetPath() const
    {
            chdir( mszTempPath );
    }

    //-----------------------------------------------------------------------
    std::vector<String> FileSystem::dirGetFiles( const String& strDir ) const
    {
        std::vector<String> vec;

        setPath();
        if( chdir( strDir.c_str() ) == -1 )
            Except(Exception::ERR_FILE_NOT_FOUND, "Cannot open requested directory", "FileSystem::dirGetFiles");

        long lHandle;
        struct _finddata_t tagData;

        if( ( lHandle = _findfirst( "*.*", &tagData ) ) != -1 ) {
            _findnext( lHandle, &tagData );

            // okay, we skipped . and .., get to the good stuff
            while( _findnext( lHandle, &tagData ) == 0 )
                if( !(tagData.attrib & _A_SUBDIR) ) {
                    String strTemp = tagData.name;
                    vec.push_back( strTemp );
                }

            _findclose(lHandle);
        }

        retunset(vec);
    };

    //-----------------------------------------------------------------------
    std::vector<String> FileSystem::dirGetSubs( const String& strDir ) const
    {
        std::vector<String> vec;

        setPath();
        if( chdir( strDir.c_str() ) == -1 )
            Except(Exception::ERR_FILE_NOT_FOUND, "Cannot open requested directory", "FileSystem::dirGetFiles");

        long lHandle;
        struct _finddata_t tagData;

        if( ( lHandle = _findfirst( "*.*", &tagData ) ) != -1 ) {
            _findnext( lHandle, &tagData );

            // okay, we skipped . and .., get to the good stuff
            while( _findnext( lHandle, &tagData ) == 0 )
                if( tagData.attrib & _A_SUBDIR ) {
                    String strTemp = tagData.name;
                    vec.push_back( strTemp );
                }

            _findclose(lHandle);
        }

        retunset(vec);
    };

    //-----------------------------------------------------------------------
    bool FileSystem::dirDele( const String& strDir, bool bRecursive )
    {
        setPath();
        if( chdir( strDir.c_str() ) == -1 )
            retunset(true);

        recursDeleDir( bRecursive );
        if( rmdir( strDir.c_str() ) == -1 )
            retunset(false);

        retunset(true);
    };

    //-----------------------------------------------------------------------
    bool FileSystem::dirMove( const String& strSrc, const String& strDest, bool bOverwrite )
    {
        return true;
    };

    //-----------------------------------------------------------------------
    bool FileSystem::dirInfo( const String& strDir, FileInfo** ppInfo ) const
    {
        return true;
    };

    //-----------------------------------------------------------------------
    bool FileSystem::dirCopy( const String& strSrc, const String& strDest, bool bOverwrite )
    {
        return true;
    };

    //-----------------------------------------------------------------------
    bool FileSystem::dirTest( const String& strDir ) const
    {
        return true;
    };

    //-----------------------------------------------------------------------
    std::vector<String> FileSystem::getAllNamesLike( const String& strStartPath, const String& strPattern, bool bRecursive /* = true */ )
    {
        std::vector<String> retList;

        long lHandle, res;
        struct _finddata_t tagData;

        setPath();
        chdir(strStartPath.c_str());

        lHandle = _findfirst(("*" + strPattern).c_str(), &tagData);
        res = 0;
        while (lHandle != -1 && res != -1)
        {
            retList.push_back(tagData.name);
            res = _findnext( lHandle, &tagData );
        }
        if(lHandle != -1)
            _findclose(lHandle);

        retunset(retList);
    };

    //-----------------------------------------------------------------------
    void FileSystem::recursDeleDir( bool bRecursive )
    {
        long lHandle;
        struct _finddata_t tagData;

        if( ( lHandle = _findfirst( "*.*", &tagData ) ) != -1 ) {
            _findnext( lHandle, &tagData );

            while( _findnext( lHandle, &tagData ) == 0 )
                if( !( tagData.attrib & _A_SUBDIR ) )
                    unlink( tagData.name );
                else if( bRecursive ) {
                    chdir( tagData.name );
                    recursDeleDir( true );
                    rmdir( tagData.name );
                }
            _findclose(lHandle);
        }

        chdir( ".." );
    }

    //-----------------------------------------------------------------------
    void FileSystem::load() {

        /* SJS: Dropped the 'stat' check
        For starters must check the result from stat - if non-zero the struct is unreliable (garbage)
        After running a number of tests stat never seemed to work for folders anyway, the result was always
        -1 and the S_IFDIR check was purely random. Should work but doesn't?

        struct stat tagStat;
        int statResult;

        stat( mName.c_str(), &tagStat );

        if( !( tagStat.st_mode & S_IFDIR ) )
            throw Exception(Exception::ERR_ITEM_NOT_FOUND, "Cannot find folder " + mName, "FileSystem::load");
        else
            mstrBasePath = mName;
        */

        /* cearny: Simplest solution is always the best. If I can't chdir to the given path, then it musn't
        be a directory */
        char szCurrPath[MAX_PATH];
        getcwd( szCurrPath, MAX_PATH );
        if( chdir( mName.c_str() ) )
            Except( Exception::ERR_ITEM_NOT_FOUND, "Cannot find folder " + mName, "FileSystem::load" );
        chdir( szCurrPath );

        mstrBasePath = mName;

        LogManager::getSingleton().logMessage( "FileSystem Archive Codec for " + mName + " created.");
        mIsLoaded = true;
    };

    //-----------------------------------------------------------------------
    void FileSystem::unload() {
        LogManager::getSingleton().logMessage( "FileSystem Archive Codec for " + mName + " unloaded.");
        delete this;
    };

    //-----------------------------------------------------------------------
    FileSystem::FileSystem() {}

    //-----------------------------------------------------------------------
    FileSystem::FileSystem( const String& name )
    {
        mName = name;
    }

    //-----------------------------------------------------------------------
    FileSystem::~FileSystem() {}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品美女视频| 亚洲欧美日韩成人高清在线一区| 国产成人精品免费| 一区二区欧美国产| 国产亚洲欧洲997久久综合| 欧美日韩一区二区在线观看视频 | 97久久人人超碰| 蜜桃视频免费观看一区| 国产精品高清亚洲| 精品999在线播放| 欧美日韩日日骚| bt欧美亚洲午夜电影天堂| 麻豆国产91在线播放| 亚洲一区影音先锋| 国产精品初高中害羞小美女文| 日韩一区二区三区免费看| 色欧美日韩亚洲| 成人免费电影视频| 极品销魂美女一区二区三区| 亚洲综合一区二区| 中文字幕亚洲视频| 欧美国产97人人爽人人喊| 日韩一级免费观看| 欧美福利电影网| 欧洲激情一区二区| 91视频www| 99久久99久久免费精品蜜臀| 国产在线不卡视频| 精品一区二区免费看| 免费成人你懂的| 日韩1区2区日韩1区2区| 亚洲成a人v欧美综合天堂下载| 综合激情成人伊人| 国产精品高潮久久久久无| 中文一区在线播放| 久久精品日产第一区二区三区高清版 | 成人avav影音| 国产成人免费视频网站| 韩国欧美国产一区| 精品在线亚洲视频| 激情综合色综合久久综合| 青青青爽久久午夜综合久久午夜| 午夜精品国产更新| 日韩精品成人一区二区三区| 三级欧美在线一区| 青草av.久久免费一区| 日韩成人dvd| 久久激情综合网| 国内精品久久久久影院色 | 91福利在线导航| 欧美亚洲国产一区二区三区 | 91在线播放网址| 色噜噜久久综合| 欧美性感一区二区三区| 欧美日韩在线三级| 欧美一区在线视频| 精品1区2区在线观看| 久久久久久久久久久久久夜| 国产欧美视频在线观看| 中文字幕永久在线不卡| 亚洲综合小说图片| 日韩一区精品字幕| 久久99热99| 成人黄色片在线观看| 色综合色狠狠天天综合色| 欧美色成人综合| 精品久久久网站| 日本一区二区动态图| 亚洲免费资源在线播放| 婷婷国产v国产偷v亚洲高清| 精品一区二区三区av| 成人av在线一区二区三区| 色哦色哦哦色天天综合| 欧美剧情电影在线观看完整版免费励志电影 | caoporn国产精品| 欧美亚洲国产bt| 欧美va天堂va视频va在线| 久久久国产精品午夜一区ai换脸| 亚洲色欲色欲www| 丝袜脚交一区二区| 国产.精品.日韩.另类.中文.在线.播放| 白白色 亚洲乱淫| 欧美精品免费视频| 国产婷婷色一区二区三区在线| 中文字幕日韩欧美一区二区三区| 性欧美大战久久久久久久久| 国产剧情在线观看一区二区| 色婷婷国产精品| 26uuu欧美| 亚洲与欧洲av电影| 国产精品综合av一区二区国产馆| 在线观看不卡视频| 国产午夜精品一区二区三区视频| 亚洲在线视频网站| 国产69精品久久99不卡| 欧美精选一区二区| 综合精品久久久| 国内成人自拍视频| 欧美日韩一区中文字幕| 国产精品视频麻豆| 久久97超碰色| 欧美二区在线观看| 亚洲精品亚洲人成人网在线播放| 极品尤物av久久免费看| 欧美三级一区二区| 日韩美女视频一区二区| 国产综合色在线| 3atv一区二区三区| 一区二区日韩av| 波多野结衣91| 国产午夜精品一区二区三区嫩草| 日韩成人免费看| 在线观看国产一区二区| 国产精品伦理在线| 国产乱码字幕精品高清av| 欧美一区二区视频在线观看2022| 亚洲最大成人综合| 91视频国产资源| 国产精品乱码一区二区三区软件 | 日韩亚洲国产中文字幕欧美| 亚洲精品ww久久久久久p站| 国产成人免费视频精品含羞草妖精| 制服丝袜亚洲播放| 亚洲va欧美va天堂v国产综合| 色域天天综合网| 亚洲另类春色校园小说| av亚洲精华国产精华精华 | 亚洲午夜在线视频| 色视频欧美一区二区三区| 中文字幕制服丝袜一区二区三区| 国产成人高清在线| 国产欧美日韩另类一区| 国产乱人伦偷精品视频不卡| 欧美mv和日韩mv的网站| 久久精品国产亚洲aⅴ| 日韩视频免费观看高清完整版在线观看 | 国产成人精品www牛牛影视| 精品国产乱码久久久久久夜甘婷婷 | 国产在线视频不卡二| 日韩欧美久久久| 韩国一区二区视频| 久久九九99视频| 国产一区二三区好的| 国产亚洲综合在线| 成人小视频免费在线观看| 国产精品高潮久久久久无| 成人福利视频在线| 亚洲女同女同女同女同女同69| 色播五月激情综合网| 亚洲愉拍自拍另类高清精品| 欧美巨大另类极品videosbest | 国产欧美一区二区精品秋霞影院| 成人精品在线视频观看| 亚洲人成网站精品片在线观看| 一本大道久久a久久精品综合| 一区二区日韩电影| 555www色欧美视频| 国产一区高清在线| 成人欧美一区二区三区小说 | 欧美一区二区精品| 久久精品国产亚洲高清剧情介绍| 欧美精品一区二区三区蜜桃| 成人av在线网站| 亚洲一区二区av电影| 91精品国产欧美一区二区18| 精品夜夜嗨av一区二区三区| 国产亲近乱来精品视频| 99re6这里只有精品视频在线观看| 亚洲综合成人网| 欧美一级电影网站| 成人黄色a**站在线观看| 亚洲综合成人网| 精品乱人伦一区二区三区| 国产91在线观看| 亚洲一区免费观看| 精品免费国产二区三区 | 国产精品一区二区三区四区| 国产精品高潮呻吟久久| 欧美久久一二三四区| 国产91综合一区在线观看| 亚洲自拍偷拍综合| 欧美精品一区二区三区久久久 | 亚洲精品高清在线| 欧美岛国在线观看| 99精品视频一区二区三区| 免费成人av资源网| 国产精品不卡视频| 欧美肥妇毛茸茸| 97久久人人超碰| 国产在线精品国自产拍免费| 一区二区三区四区视频精品免费 | 亚洲国产高清在线观看视频| 欧美日韩一本到| 成人免费看黄yyy456| 日韩中文字幕1| 中文字幕一区二区三区在线不卡| 日韩一区二区在线看片| 91麻豆成人久久精品二区三区| 久久精品国产一区二区三 | 欧美日韩国产首页|