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

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

?? filesystem.cpp

?? 使用stl技術(shù),(還沒看,是聽說的)
?? 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一区二区三区免费野_久草精品视频
一本大道久久a久久综合婷婷| 国产成人精品免费视频网站| 日本不卡高清视频| 激情都市一区二区| 成人激情动漫在线观看| 91福利在线导航| 日韩一级免费观看| 中文字幕成人在线观看| 一区二区三区欧美久久| 美女国产一区二区三区| 国产成人精品影视| 欧美色综合天天久久综合精品| 69av一区二区三区| 中文字幕av免费专区久久| 亚洲午夜视频在线观看| 国产一区二区精品久久91| 91免费观看视频| 日韩你懂的在线播放| 国产精品国产三级国产普通话三级| 亚洲国产va精品久久久不卡综合| 久久黄色级2电影| eeuss鲁一区二区三区| 91精品国产91久久久久久一区二区 | 极品尤物av久久免费看| 91香蕉视频mp4| 2021中文字幕一区亚洲| 一二三四区精品视频| 国产精品综合av一区二区国产馆| 91国偷自产一区二区三区成为亚洲经典 | 99精品久久只有精品| 日韩一区二区在线看| 亚洲精品成a人| 国产剧情一区在线| 亚洲色图欧洲色图| 久久99国内精品| 欧美性猛片xxxx免费看久爱| 欧美国产综合一区二区| 免费人成网站在线观看欧美高清| 91捆绑美女网站| 国产日韩欧美精品在线| 日本视频一区二区三区| 欧美在线高清视频| 国产欧美日韩在线观看| 免费av网站大全久久| 在线观看免费成人| 国产精品国产三级国产aⅴ无密码| 麻豆成人久久精品二区三区红 | 一区二区三区四区激情| 国产99久久久精品| 精品播放一区二区| 三级久久三级久久久| 欧美艳星brazzers| 亚洲欧美福利一区二区| 成人精品亚洲人成在线| 久久精品一区二区| 黄色日韩三级电影| 欧美一区二区视频免费观看| 亚洲午夜激情网站| 色噜噜久久综合| 亚洲天堂av老司机| 不卡大黄网站免费看| 国产欧美日韩中文久久| 国产美女视频91| 2020国产成人综合网| 久久精品国产77777蜜臀| 欧美一区二区三区在线观看视频 | 成人av在线播放网站| 久久精品一级爱片| 国产精品资源网| 久久久av毛片精品| 国产真实乱偷精品视频免| 精品久久久久一区| 精品一区二区免费在线观看| 91精品国产色综合久久ai换脸| 日日摸夜夜添夜夜添亚洲女人| 欧美午夜精品久久久| 亚洲国产一区二区a毛片| 欧美日韩综合不卡| 午夜视频在线观看一区二区| 欧美男生操女生| 视频一区欧美精品| 欧美大黄免费观看| 狠狠色综合日日| 国产午夜精品美女毛片视频| 国产精品69毛片高清亚洲| 国产丝袜在线精品| 北岛玲一区二区三区四区| 亚洲人123区| 欧美日韩在线播放三区四区| 亚洲国产cao| 日韩女优电影在线观看| 极品少妇xxxx精品少妇偷拍| 国产亚洲欧美中文| 99久精品国产| 亚洲一区免费观看| 欧美一二三四区在线| 精品亚洲免费视频| 国产精品久久夜| 色狠狠色狠狠综合| 日本午夜精品视频在线观看 | 国产麻豆91精品| 国产精品视频九色porn| 一本到三区不卡视频| 亚洲一卡二卡三卡四卡无卡久久| 欧美肥胖老妇做爰| 国产精品中文字幕日韩精品 | 97超碰欧美中文字幕| 亚洲制服丝袜一区| 日韩精品资源二区在线| 国产精品99久久久久久久vr| 亚洲免费观看视频| 欧美一级片在线观看| 国产精品一级在线| 亚洲女性喷水在线观看一区| 欧美精品乱码久久久久久按摩| 久久成人免费电影| 中文字幕日韩一区| 欧美精品久久久久久久多人混战| 精品在线你懂的| 1000部国产精品成人观看| 欧美高清视频不卡网| 国产成人在线视频免费播放| 一区二区三区日韩精品视频| 欧美精品一区二区三区蜜桃| 91热门视频在线观看| 首页亚洲欧美制服丝腿| 中文一区二区完整视频在线观看| 欧美一a一片一级一片| 国产精品一二三| 亚洲成人在线观看视频| 欧美激情在线看| 欧美日韩国产123区| 成人av在线电影| 另类人妖一区二区av| 亚洲精品美国一| 久久夜色精品国产欧美乱极品| 色菇凉天天综合网| 国产精品资源网站| 日韩va欧美va亚洲va久久| 一色桃子久久精品亚洲| 精品福利视频一区二区三区| 欧日韩精品视频| 成人久久久精品乱码一区二区三区| 午夜精品aaa| 亚洲图片另类小说| 久久精子c满五个校花| 欧美一区二区性放荡片| 91国产福利在线| eeuss国产一区二区三区| 国产在线视频一区二区| 视频一区视频二区中文| 亚洲精品成人少妇| 国产精品乱码人人做人人爱| 精品久久99ma| 欧美日韩国产高清一区二区三区 | 在线亚洲免费视频| 成人午夜私人影院| 国内一区二区视频| 日本特黄久久久高潮| 亚洲国产精品久久久久婷婷884| 中文字幕乱码日本亚洲一区二区| 日韩欧美成人一区二区| 欧美日韩在线不卡| 在线精品观看国产| 97国产一区二区| 成人黄色大片在线观看| 国产精品一二三四五| 国产在线精品一区二区| 久久99国内精品| 久久成人羞羞网站| 免费成人在线观看| 日本强好片久久久久久aaa| 亚洲成人动漫在线观看| 亚洲激情综合网| 亚洲欧美日韩人成在线播放| 国产精品网友自拍| 国产精品美女久久久久久久网站| 国产网红主播福利一区二区| 26uuu久久天堂性欧美| 欧美成人a∨高清免费观看| 性做久久久久久免费观看 | 在线免费观看日本一区| 91丨porny丨最新| 99久久er热在这里只有精品15 | 欧美国产在线观看| 国产精品午夜在线观看| 国产精品国产三级国产a| 中文字幕一区二区三区色视频 | 国产精品白丝jk白祙喷水网站| 伦理电影国产精品| 精品一区二区三区在线播放 | 91久久精品网| 在线亚洲人成电影网站色www| 色婷婷av久久久久久久| 欧美少妇xxx| 欧美一区二区三区在线观看| 精品国产乱码久久久久久久久| 精品国产污污免费网站入口 | 国产sm精品调教视频网站| 国产91富婆露脸刺激对白|