• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ XFile类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中XFile的典型用法代码示例。如果您正苦于以下问题:C++ XFile类的具体用法?C++ XFile怎么用?C++ XFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XFile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SaveAs

BOOL ConfigFile::SaveAs(CTSTR lpPath)
{
    XFile newFile;
    
    String tmpPath = lpPath;
    tmpPath.AppendString(TEXT(".tmp"));

    if (newFile.Open(tmpPath, XFILE_WRITE, XFILE_CREATEALWAYS))
    {
        if (newFile.Write("\xEF\xBB\xBF", 3) != 3)
            return FALSE;
        if (!newFile.WriteAsUTF8(lpFileData))
            return FALSE;

        newFile.Close();
        if (!OSRenameFile(tmpPath, lpPath))
            Log(TEXT("ConfigFile::SaveAs: Unable to move new config file %s to %s"), tmpPath.Array(), lpPath);

        strFileName = lpPath;
        return TRUE;
    }

    return FALSE;
}
开发者ID:373137461,项目名称:OBS,代码行数:24,代码来源:ConfigFile.cpp


示例2: ReadFromFile

////////////////////////////////////////////////////
// 从文件中读入数据,获取的数据添加到流的尾部
// 该操作从字节边界开始,将剩余未写位数跳过
// file:文件句柄
XBOOL XStream::ReadFromFile(XFile&file,int nLength)
{
	if(nLength<=0) nLength=BLOCKSIZE;
	//XU8Array data;
	//data.SetSize(nLength);
	FlushWriteBits();
	SetSize(writePos+nLength);
	nLength=file.Read(m_pData+writePos,nLength);
		//::fread(data,1,nLength,file);
	if(nLength>0)
	{
		//Append(data,nLength);
		writePos+=nLength;
	}
	return nLength;
}
开发者ID:hgl888,项目名称:nashtest,代码行数:20,代码来源:XStream.cpp


示例3: LoadText

XBOOL XFile::LoadText(XPCTSTR strFile, XString8 &strTxt)
{
	XFile file;
	if(!file.Open(strFile,XFile::XREAD)) return XFALSE;
	int l=file.GetLength();
	if(l<=0) {file.Close();return XFALSE;}
	strTxt.SetSize(l+1,XFALSE);
	file.Read(strTxt.GetData(),l);
	file.Close();
	return XTRUE;
}
开发者ID:hgl888,项目名称:nashtest,代码行数:11,代码来源:XFile.cpp


示例4: LoadFile

BOOL ConfigFile::LoadFile(DWORD dwOpenMode)
{
    XFile file;
    if(!file.Open(strFileName, XFILE_READ, dwOpenMode))
    {
        //Log(TEXT("Couldn't load config file: \"%s\""), (TSTR)strFileName);
        return 0;
    }

    if(bOpen)
        Close();

    dwLength = (DWORD)file.GetFileSize();

    if (dwLength >= 3) // remove BOM if present
    {
        char buff[3];
        file.Read(&buff, 3);
        if (memcmp(buff, "\xEF\xBB\xBF", 3))
            file.SetPos(0, XFILE_BEGIN);
        else
            dwLength -= 3;
    }

    LPSTR lpTempFileData = (LPSTR)Allocate(dwLength+5);
    file.Read(&lpTempFileData[2], dwLength);
    lpTempFileData[0] = lpTempFileData[dwLength+2] = 13;
    lpTempFileData[1] = lpTempFileData[dwLength+3] = 10;
    lpTempFileData[dwLength+4] = 0;
    file.Close();

    lpFileData = utf8_createTstr(lpTempFileData);
    dwLength = slen(lpFileData);
    Free(lpTempFileData);

    bOpen = 1;

    return 1;
}
开发者ID:373137461,项目名称:OBS,代码行数:39,代码来源:ConfigFile.cpp


示例5: Load

/*@ XBitmap::LoadBMP(const char* filename)
@group loading a bitmap
@remarks Load a bitmap from a file. This method works faster than Load() but can only load bitmpas in OS2-BMP format
@parameters   char * fileName   filename of the file to load
@exceptions   If the method fails to create a new bitmap an exception of the type XException is thrown.
*/
void XBitmap :: LoadBMP(const char* filename)
{
   if (hbm)
      GpiDeleteBitmap(hbm);
   hbm = 0;

   XFile file;
   PBITMAPFILEHEADER p;
   if (file.Open(filename, XFILE_FAIL_IF_NEW | XFILE_OPEN_EXISTING, XFILE_READONLY, XFILE_SHARE_DENYNONE ) == 0)
   {
      XFileInfo info;
      file.GetFileInfo(&info);
      file.Seek(0, XFILE_BEGIN);
      p = (PBITMAPFILEHEADER) malloc(info.GetFileSize());
      file.Read(p, info.GetFileSize());
      file.Close();
   }
   else
      OOLThrow( "couldnït open file!", -1);

   if (owner )
   {
      hps = WinGetPS(owner->GetHandle());
      hbm = GpiCreateBitmap(hps, (PBITMAPINFOHEADER2) &p->bmp, CBM_INIT, (PBYTE) p + p->offBits, (PBITMAPINFO2) &p->bmp);
      if(hbm == 0)
         OOLThrow("error creating bitmap", 3);
   }
   else
      SetData((BITMAPINFOHEADER2 *) &p->bmp, p->offBits);
   free(p);
   XSize s;
   GetDimensions(&s);
   width = cx = s.GetWidth();
   height = cy = s.GetHeight();

   if (hbm == GPI_ERROR)
   {
      ULONG error = WinGetLastError(XApplication::GetApplication()->GetAnchorBlock());
      OOLThrow("couldnït load bitmap", error);
   }

   return;
}
开发者ID:OS2World,项目名称:LIB-Open_Object_Library,代码行数:49,代码来源:xgraphob.cpp


示例6: double

    ~FLVFileStream()
    {
        UINT64 fileSize = fileOut.GetPos();
        fileOut.Close();

        XFile file;
        if(file.Open(strFile, XFILE_WRITE, XFILE_OPENEXISTING))
        {
            double doubleFileSize = double(fileSize);
            double doubleDuration = double(lastTimeStamp/1000);

            file.SetPos(metaDataPos+0x28, XFILE_BEGIN);
            QWORD outputVal = *reinterpret_cast<QWORD*>(&doubleDuration);
            outputVal = fastHtonll(outputVal);
            file.Write(&outputVal, 8);

            file.SetPos(metaDataPos+0x3B, XFILE_BEGIN);
            outputVal = *reinterpret_cast<QWORD*>(&doubleFileSize);
            outputVal = fastHtonll(outputVal);
            file.Write(&outputVal, 8);

            file.Close();
        }
    }
开发者ID:54UL,项目名称:OBS,代码行数:24,代码来源:FLVFileStream.cpp


示例7: WriteFileItem

void  XConfig::WriteFileItem(XFile &file, int indent, XBaseItem *baseItem)
{
    int j;

    if(baseItem->IsData())
    {
        XDataItem *item = static_cast<XDataItem*>(baseItem);

        String strItem;

        for(j=0; j<indent; j++)
            strItem << TEXT("  ");

        if( item->strName.IsValid()                         && (
            item->strName[0] == ' '                         ||
            item->strName[0] == '\t'                        ||
            item->strName[0] == '{'                         ||
            item->strName[item->strName.Length()-1] == ' '  ||
            item->strName[item->strName.Length()-1] == '\t' ||
            schr(item->strName, '\n')                       ||
            schr(item->strName, '"')                        ||
            schr(item->strName, ':')                        ))
        {
            strItem << ConvertToTextString(item->strName);
        }
        else
            strItem << item->strName;

        strItem << TEXT(" : ");

        if( item->strData.IsValid()                         && (
            item->strData[0] == ' '                         ||
            item->strData[0] == '\t'                        ||
            item->strData[0] == '{'                         ||
            item->strData[item->strData.Length()-1] == ' '  ||
            item->strData[item->strData.Length()-1] == '\t' ||
            schr(item->strData, '\n')                       ||
            schr(item->strData, '"')                        ||
            schr(item->strData, ':')                        ))
        {
            strItem << ConvertToTextString(item->strData);
        }
        else
            strItem << item->strData;

        strItem << TEXT("\r\n");

        file.WriteAsUTF8(strItem);
    }
    else if(baseItem->IsElement())
    {
        XElement *element = static_cast<XElement*>(baseItem);

        String strElement;

        for(j=0; j<indent; j++)
            strElement << TEXT("  ");

        if( element->strName.IsValid()                            && (
            element->strName[0] == ' '                            ||
            element->strName[0] == '\t'                           ||
            element->strName[0] == '{'                            ||
            element->strName[element->strName.Length()-1] == ' '  ||
            element->strName[element->strName.Length()-1] == '\t' ||
            schr(element->strName, '\n')                          ||
            schr(element->strName, '"')                           ||
            schr(element->strName, ':')                           ))
        {
            strElement << ConvertToTextString(element->strName);
        }
        else
            strElement << element->strName;

        strElement << TEXT(" : {\r\n");

        file.WriteAsUTF8(strElement);

        strElement.Clear();

        WriteFileData(file, indent+1, element);

        for(j=0; j<indent; j++)
            strElement << TEXT("  ");
        strElement << TEXT("}\r\n");

        file.WriteAsUTF8(strElement);
    }
}
开发者ID:SeargeDP,项目名称:OBS,代码行数:88,代码来源:XConfig.cpp


示例8: HTTPGetFile

BOOL HTTPGetFile (CTSTR url, CTSTR outputPath, CTSTR extraHeaders, int *responseCode)
{
    HINTERNET hSession = NULL;
    HINTERNET hConnect = NULL;
    HINTERNET hRequest = NULL;
    URL_COMPONENTS  urlComponents;
    BOOL secure = FALSE;
    BOOL ret = FALSE;

    String hostName, path;

    const TCHAR *acceptTypes[] = {
        TEXT("*/*"),
        NULL
    };

    hostName.SetLength(256);
    path.SetLength(1024);

    zero(&urlComponents, sizeof(urlComponents));

    urlComponents.dwStructSize = sizeof(urlComponents);
    
    urlComponents.lpszHostName = hostName;
    urlComponents.dwHostNameLength = hostName.Length();

    urlComponents.lpszUrlPath = path;
    urlComponents.dwUrlPathLength = path.Length();

    WinHttpCrackUrl(url, 0, 0, &urlComponents);

    if (urlComponents.nPort == 443)
        secure = TRUE;

    hSession = WinHttpOpen(OBS_VERSION_STRING, WINHTTP_ACCESS_TYPE_DEFAULT_PROXY, WINHTTP_NO_PROXY_NAME, WINHTTP_NO_PROXY_BYPASS, 0);
    if (!hSession)
        goto failure;

    hConnect = WinHttpConnect(hSession, hostName, secure ? INTERNET_DEFAULT_HTTPS_PORT : INTERNET_DEFAULT_HTTP_PORT, 0);
    if (!hConnect)
        goto failure;

    hRequest = WinHttpOpenRequest(hConnect, TEXT("GET"), path, NULL, WINHTTP_NO_REFERER, acceptTypes, secure ? WINHTTP_FLAG_SECURE|WINHTTP_FLAG_REFRESH : WINHTTP_FLAG_REFRESH);
    if (!hRequest)
        goto failure;

    BOOL bResults = WinHttpSendRequest(hRequest, extraHeaders, extraHeaders ? -1 : 0, WINHTTP_NO_REQUEST_DATA, 0, 0, 0);

    // End the request.
    if (bResults)
        bResults = WinHttpReceiveResponse(hRequest, NULL);
    else
        goto failure;

    TCHAR statusCode[8];
    DWORD statusCodeLen;

    statusCodeLen = sizeof(statusCode);
    if (!WinHttpQueryHeaders (hRequest, WINHTTP_QUERY_STATUS_CODE, WINHTTP_HEADER_NAME_BY_INDEX, &statusCode, &statusCodeLen, WINHTTP_NO_HEADER_INDEX))
        goto failure;

    *responseCode = wcstoul(statusCode, NULL, 10);

    if (bResults && *responseCode == 200)
    {
        BYTE buffer[16384];
        DWORD dwSize, dwOutSize;

        XFile updateFile;

        if (!updateFile.Open(outputPath, XFILE_WRITE, CREATE_ALWAYS))
            goto failure;

        do 
        {
            // Check for available data.
            dwSize = 0;
            if (!WinHttpQueryDataAvailable(hRequest, &dwSize))
                goto failure;

            if (!WinHttpReadData(hRequest, (LPVOID)buffer, dwSize, &dwOutSize))
            {
                goto failure;
            }
            else
            {
                if (!dwOutSize)
                    break;

                if (!updateFile.Write(buffer, dwOutSize))
                    goto failure;
            }
        } while (dwSize > 0);

        updateFile.Close();
    }

    ret = TRUE;

failure:
//.........这里部分代码省略.........
开发者ID:xlambda,项目名称:OBS,代码行数:101,代码来源:HTTPClient.cpp


示例9: output


//.........这里部分代码省略.........
                  //SendMessage(GetDlgItem(hwndProgressDialog, IDC_PROGRESS1), PBM_SETPOS, 70, 0);
                  //ProcessEvents();

                  PushBox(output, DWORD_BE('stsc')); //sample to chunk list
                    output.OutputDword(0); //version and flags (none)
                    output.OutputDword(fastHtonl(videoSampleToChunk.Num()));
                    for(UINT i=0; i<videoSampleToChunk.Num(); i++)
                    {
                        SampleToChunk &stc  = videoSampleToChunk[i];
                        output.OutputDword(fastHtonl(stc.firstChunkID));
                        output.OutputDword(fastHtonl(stc.samplesPerChunk));
                        output.OutputDword(DWORD_BE(1));
                    }
                  PopBox(output); //stsc
                  PushBox(output, DWORD_BE('stsz')); //sample sizes
                    output.OutputDword(0); //version and flags (none)
                    output.OutputDword(0); //block size for all (0 if differing sizes)
                    output.OutputDword(fastHtonl(videoFrames.Num()));
                    for(UINT i=0; i<videoFrames.Num(); i++)
                        output.OutputDword(fastHtonl(videoFrames[i].size));
                  PopBox(output);

                  if(videoChunks.Num() && videoChunks.Last() > 0xFFFFFFFFLL)
                  {
                      PushBox(output, DWORD_BE('co64')); //chunk offsets
                      output.OutputDword(0); //version and flags (none)
                      output.OutputDword(fastHtonl(videoChunks.Num()));
                      for(UINT i=0; i<videoChunks.Num(); i++)
                          output.OutputQword(fastHtonll(videoChunks[i]));
                      PopBox(output); //co64
                  }
                  else
                  {
                      PushBox(output, DWORD_BE('stco')); //chunk offsets
                        output.OutputDword(0); //version and flags (none)
                        output.OutputDword(fastHtonl(videoChunks.Num()));
                        for(UINT i=0; i<videoChunks.Num(); i++)
                            output.OutputDword(fastHtonl((DWORD)videoChunks[i]));
                      PopBox(output); //stco
                  }
                PopBox(output); //stbl
              PopBox(output); //minf
            PopBox(output); //mdia
          PopBox(output); //trak

          //SendMessage(GetDlgItem(hwndProgressDialog, IDC_PROGRESS1), PBM_SETPOS, 80, 0);
          //ProcessEvents();

          //------------------------------------------------------
          // info thingy
          PushBox(output, DWORD_BE('udta'));
            PushBox(output, DWORD_BE('meta'));
              output.OutputDword(0); //version and flags (none)
              PushBox(output, DWORD_BE('hdlr'));
                output.OutputDword(0); //version and flags (none)
                output.OutputDword(0); //quicktime type
                output.OutputDword(DWORD_BE('mdir')); //metadata type
                output.OutputDword(DWORD_BE('appl')); //quicktime manufacturer reserved thingy
                output.OutputDword(0); //quicktime component reserved flag
                output.OutputDword(0); //quicktime component reserved flag mask
                output.OutputByte(0); //null string
              PopBox(output); //hdlr
              PushBox(output, DWORD_BE('ilst'));
                PushBox(output, DWORD_BE('\xa9too'));
                  PushBox(output, DWORD_BE('data'));
                    output.OutputDword(DWORD_BE(1)); //version (1) + flags (0)
                    output.OutputDword(0); //reserved
                    LPSTR lpVersion = OBS_VERSION_STRING_ANSI;
                    output.Serialize(lpVersion, (DWORD)strlen(lpVersion));
                  PopBox(output); //data
                PopBox(output); //@too
              PopBox(output); //ilst
            PopBox(output); //meta
          PopBox(output); //udta

        PopBox(output); //moov

        fileOut.Serialize(endBuffer.Array(), (DWORD)output.GetPos());
        fileOut.Close();

        XFile file;
        if(file.Open(strFile, XFILE_WRITE, XFILE_OPENEXISTING))
        {
#ifdef USE_64BIT_MP4
            file.SetPos((INT64)mdatStart+8, XFILE_BEGIN);

            UINT64 size = fastHtonll(mdatStop-mdatStart);
            file.Write(&size, 8);
#else
            file.SetPos((INT64)mdatStart, XFILE_BEGIN);
            UINT size = fastHtonl((DWORD)(mdatStop-mdatStart));
            file.Write(&size, 4);
#endif
            file.Close();
        }

        App->EnableSceneSwitching(true);

        //DestroyWindow(hwndProgressDialog);
    }
开发者ID:ArtBears,项目名称:OBS,代码行数:101,代码来源:MP4FileStream.cpp


示例10: Close

bool  XConfig::Open(CTSTR lpFile)
{
    if(RootElement)
    {
        if(strFileName.CompareI(lpFile))
            return true;

        Close();
    }

    //-------------------------------------
    XFile file;

    if(!file.Open(lpFile, XFILE_READ, XFILE_OPENALWAYS))
        return false;

    RootElement = new XElement(this, NULL, TEXT("Root"));
    strFileName = lpFile;

    DWORD dwFileSize = (DWORD)file.GetFileSize();

    LPSTR lpFileDataUTF8 = (LPSTR)Allocate(dwFileSize+1);
    zero(lpFileDataUTF8, dwFileSize+1);
    file.Read(lpFileDataUTF8, dwFileSize);

    TSTR lpFileData = utf8_createTstr(lpFileDataUTF8);
    Free(lpFileDataUTF8);

    //-------------------------------------
    // remove comments

    TSTR lpComment, lpEndComment;

    while(lpComment = sstr(lpFileData, TEXT("/*")))
    {
        lpEndComment = sstr(lpFileData, TEXT("*/"));

        assert(lpEndComment);
        assert(lpComment < lpEndComment);

        if(!lpEndComment || (lpComment > lpEndComment))
        {
            file.Close();

            Close(false);
            Free(lpFileData);

            CrashError(TEXT("Error parsing X file '%s'"), strFileName.Array());
        }

        mcpy(lpComment, lpEndComment+3, slen(lpEndComment+3)+1);
    }

    //-------------------------------------

    TSTR lpTemp = lpFileData;

    if(!ReadFileData(RootElement, 0, lpTemp))
    {
        for(DWORD i=0; i<RootElement->SubItems.Num(); i++)
            delete RootElement->SubItems[i];

        CrashError(TEXT("Error parsing X file '%s'"), strFileName.Array());

        Free(lpFileData);
        Close(false);
        file.Close();
    }

    Free(lpFileData);

    file.Close();

    return true;
}
开发者ID:SeargeDP,项目名称:OBS,代码行数:75,代码来源:XConfig.cpp


示例11: OBSExceptionHandler

LONG CALLBACK OBSExceptionHandler (PEXCEPTION_POINTERS exceptionInfo)
{
    HANDLE  hProcess;

    HMODULE hDbgHelp;

    MINIDUMP_EXCEPTION_INFORMATION miniInfo;

    STACKFRAME64        frame = {0};
    CONTEXT             context = *exceptionInfo->ContextRecord;
    SYMBOL_INFO         *symInfo;
    DWORD64             fnOffset;
    TCHAR               logPath[MAX_PATH];

    OSVERSIONINFOEX     osInfo;
    SYSTEMTIME          timeInfo;

    ENUMERATELOADEDMODULES64    fnEnumerateLoadedModules64;
    SYMSETOPTIONS               fnSymSetOptions;
    SYMINITIALIZE               fnSymInitialize;
    STACKWALK64                 fnStackWalk64;
    SYMFUNCTIONTABLEACCESS64    fnSymFunctionTableAccess64;
    SYMGETMODULEBASE64          fnSymGetModuleBase64;
    SYMFROMADDR                 fnSymFromAddr;
    SYMCLEANUP                  fnSymCleanup;
    MINIDUMPWRITEDUMP           fnMiniDumpWriteDump;
    SYMGETMODULEINFO64          fnSymGetModuleInfo64;

    DWORD                       i;
    DWORD64                     InstructionPtr;
    DWORD                       imageType;

    TCHAR                       searchPath[MAX_PATH], *p;

    static BOOL                 inExceptionHandler = FALSE;

    moduleinfo_t                moduleInfo;

    //always break into a debugger if one is present
    if (IsDebuggerPresent ())
        return EXCEPTION_CONTINUE_SEARCH;

    //exception codes < 0x80000000 are typically informative only and not crash worthy
    //0xe06d7363 indicates a c++ exception was thrown, let's just hope it was caught.
    //this is no longer needed since we're an unhandled handler vs a vectored handler
    
    /*if (exceptionInfo->ExceptionRecord->ExceptionCode < 0x80000000 || exceptionInfo->ExceptionRecord->ExceptionCode == 0xe06d7363 ||
        exceptionInfo->ExceptionRecord->ExceptionCode == 0x800706b5)
        return EXCEPTION_CONTINUE_SEARCH;*/

    //uh oh, we're crashing inside ourselves... this is really bad!
    if (inExceptionHandler)
        return EXCEPTION_CONTINUE_SEARCH;

    inExceptionHandler = TRUE;

    //load dbghelp dynamically
    hDbgHelp = LoadLibrary (TEXT("DBGHELP"));

    if (!hDbgHelp)
        return EXCEPTION_CONTINUE_SEARCH;

    fnEnumerateLoadedModules64 = (ENUMERATELOADEDMODULES64)GetProcAddress (hDbgHelp, "EnumerateLoadedModulesW64");
    fnSymSetOptions = (SYMSETOPTIONS)GetProcAddress (hDbgHelp, "SymSetOptions");
    fnSymInitialize = (SYMINITIALIZE)GetProcAddress (hDbgHelp, "SymInitialize");
    fnSymFunctionTableAccess64 = (SYMFUNCTIONTABLEACCESS64)GetProcAddress (hDbgHelp, "SymFunctionTableAccess64");
    fnSymGetModuleBase64 = (SYMGETMODULEBASE64)GetProcAddress (hDbgHelp, "SymGetModuleBase64");
    fnStackWalk64 = (STACKWALK64)GetProcAddress (hDbgHelp, "StackWalk64");
    fnSymFromAddr = (SYMFROMADDR)GetProcAddress (hDbgHelp, "SymFromAddrW");
    fnSymCleanup = (SYMCLEANUP)GetProcAddress (hDbgHelp, "SymCleanup");
    fnSymGetModuleInfo64 = (SYMGETMODULEINFO64)GetProcAddress (hDbgHelp, "SymGetModuleInfo64");
    fnMiniDumpWriteDump = (MINIDUMPWRITEDUMP)GetProcAddress (hDbgHelp, "MiniDumpWriteDump");

    if (!fnEnumerateLoadedModules64 || !fnSymSetOptions || !fnSymInitialize || !fnSymFunctionTableAccess64 ||
        !fnSymGetModuleBase64 || !fnStackWalk64 || !fnSymFromAddr || !fnSymCleanup || !fnSymGetModuleInfo64)
    {
        FreeLibrary (hDbgHelp);
        return EXCEPTION_CONTINUE_SEARCH;
    }

    hProcess = GetCurrentProcess();

    fnSymSetOptions (SYMOPT_UNDNAME | SYMOPT_FAIL_CRITICAL_ERRORS | SYMOPT_LOAD_ANYTHING);

    GetModuleFileName (NULL, searchPath, _countof(searchPath)-1);
    p = srchr (searchPath, '\\');
    if (p)
        *p = 0;

    //create a log file
    GetSystemTime (&timeInfo);
    for (i = 1;;)
    {
        tsprintf_s (logPath, _countof(logPath)-1, TEXT("%s\\crashDumps\\OBSCrashLog%.4d-%.2d-%.2d_%d.txt"), lpAppDataPath, timeInfo.wYear, timeInfo.wMonth, timeInfo.wDay, i);
        if (GetFileAttributes(logPath) == INVALID_FILE_ATTRIBUTES)
            break;
        i++;
    }

    XFile   crashDumpLog;
//.........这里部分代码省略.........
开发者ID:ArtBears,项目名称:OBS,代码行数:101,代码来源:CrashDumpHandler.cpp


示例12: switch

void SdtpCatalogDataProvider::fetch(int type, void *param)
{
    switch(type) {
    case FoldersRecursive:
    {
        XFolder* parent = static_cast<XFolder*>(param);
        Q_CHECK_PTR(parent);

        QUrl url( QString(SDTP_URL_GETALLCATS) );
        createRequest(url, FoldersRecursive, parent);

        break;
    }

    case Folders:
    {
        XFolder* parent = static_cast<XFolder*>(param);
        Q_CHECK_PTR(parent);

        QUrl url( QString(SDTP_URL_GETCATS).arg(parent->id()) );
        createRequest(url, Folders, parent);

        break;
    }

    case Files:
    {
        XFolder* parent = static_cast<XFolder*>(param);
        Q_CHECK_PTR(parent);

        QUrl url( QString(SDTP_URL_GETFILES).arg(parent->id()) );
        createRequest(url, Files, parent);

        break;
    }

    case FileDetails:
    {
        XFile* file = static_cast<XFile*>(param);
        Q_CHECK_PTR(file);

        QUrl url( QString(SDTP_URL_GETDETAILS).arg(file->id()) );
        createRequest(url, FileDetails, file);

        break;
    }

    case Thumbnail:
    {
        XFile* file = static_cast<XFile*>(param);
        Q_CHECK_PTR(file);

        QUrl url( file->thumbLink() );
        createRequest(url, Thumbnail, file);

        break;
    }

    default:
        qDebug("Unknown request type '%d'", static_cast<quint32>(type));
    }

}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:63,代码来源:sdtpcatalogdataprovider.cpp


示例13: assert

void  ConfigFile::SetKey(CTSTR lpSection, CTSTR lpKey, CTSTR newvalue)
{
    assert(lpSection);
    assert(lpKey);
    TSTR lpTemp = lpFileData, lpEnd = &lpFileData[dwLength], lpSectionStart;
    DWORD dwSectionNameSize = slen(lpSection), dwKeyNameSize = slen(lpKey);
    BOOL  bInSection = 0;

    do
    {
        lpTemp = sstr(lpTemp, TEXT("\n["));
        if(!lpTemp)
            break;

        lpTemp += 2;
        if((scmpi_n(lpTemp, lpSection, dwSectionNameSize) == 0) && (lpTemp[dwSectionNameSize] == ']'))
        {
            bInSection = 1;
            lpSectionStart = lpTemp = schr(lpTemp, '\n')+1;
            break;
        }
    }while(lpTemp < lpEnd);

    if(!bInSection)
    {
        lpTemp -= 2;

        XFile file(strFileName, XFILE_WRITE, XFILE_CREATEALWAYS);
        file.Write("\xEF\xBB\xBF", 3);
        file.WriteAsUTF8(&lpFileData[2], dwLength-4);
        file.Write("\r\n[", 3);
        file.WriteAsUTF8(lpSection, dwSectionNameSize);
        file.Write("]\r\n", 3);
        file.WriteAsUTF8(lpKey, dwKeyNameSize);
        file.Write("=", 1);
        file.WriteAsUTF8(newvalue, slen(newvalue));
        file.Write("\r\n", 2);
        file.Close();

        if(LoadFile(XFILE_OPENEXISTING))
            LoadData();
        return;
    }

    do
    {
        if(*lpTemp == '[')
        {
            XFile file(strFileName, XFILE_WRITE, XFILE_CREATEALWAYS);
            file.Write("\xEF\xBB\xBF", 3);
            file.WriteAsUTF8(&lpFileData[2], DWORD(lpSectionStart-lpFileData-2));
            file.WriteAsUTF8(lpKey, dwKeyNameSize);
            file.Write("=", 1);
            file.WriteAsUTF8(newvalue, slen(newvalue));
            file.Write("\r\n", 2);
            file.WriteAsUTF8(lpSectionStart, slen(lpSectionStart)-2);
            file.Close();

            if(LoadFile(XFILE_OPENEXISTING))
                LoadData();
            return;
        }
        else if(*(LPWORD)lpTemp == '//')
        {
            lpTemp = schr(lpTemp, '\n')+1;
            continue;
        }
        else if(bInSection)
        {
            if((scmpi_n(lpTemp, lpKey, dwKeyNameSize) == 0) && (lpTemp[dwKeyNameSize] == '='))
            {
                lpTemp = &lpTemp[dwKeyNameSize+1];

                TSTR lpNextLine = schr(lpTemp, '\r');
                int newlen = slen(newvalue);

                if ((*lpTemp == '\r' && *newvalue == '\0') || (lpNextLine - lpTemp == newlen && !scmp_n(lpTemp, newvalue, newlen)))
                    return;

                String tmpFileName = strFileName;
                tmpFileName += TEXT(".tmp");

                XFile file;
                if (file.Open(tmpFileName, XFILE_WRITE, XFILE_CREATEALWAYS))
                {
                    if (file.Write("\xEF\xBB\xBF", 3) != 3)
                        return;
                    if (!file.WriteAsUTF8(&lpFileData[2], DWORD(lpTemp - lpFileData - 2)))
                        return;
                    if (!file.WriteAsUTF8(newvalue, slen(newvalue)))
                        return;
                    if (!file.WriteAsUTF8(lpNextLine, slen(lpNextLine) - 2))
                        return;

                    file.Close();
                    if (!OSRenameFile(tmpFileName, strFileName))
                        Log(TEXT("ConfigFile::SetKey: Unable to move new config file %s to %s"), tmpFileName.Array(), strFileName.Array());
                }

                if(LoadFile(XFILE_OPENEXISTING))
//.........这里部分代码省略.........
开发者ID:373137461,项目名称:OBS,代码行数:101,代码来源:ConfigFile.cpp


示例14: if

//ugh yet more string parsing, you think you escape it for one minute and then bam!  you discover yet more string parsing code needs to be written
BOOL LocaleStringLookup::LoadStringFile(CTSTR lpFile, bool bClear)
{
    if(bClear)
    {
        cache.Clear();
        delete top;
        top = new StringLookupNode;
    }
    else if(!top)
        top = new StringLookupNode;

    //------------------------

    XFile file;

    if(!file.Open(lpFile, XFILE_READ, XFILE_OPENEXISTING))
        return FALSE;

    String fileString;
    file.ReadFileToString(fileString);
    file.Close();

    if(fileString.IsEmpty())
        return FALSE;

    //------------------------

    fileString.FindReplace(TEXT("\r"), TEXT(" "));

    TSTR lpTemp = fileString.Array()-1;
    TSTR lpNextLine;

    do
    {
        ++lpTemp;
        lpNextLine = schr(lpTemp, '\n');

        while(*lpTemp == ' ' || *lpTemp == L' ' || *lpTemp == '\t')
            ++lpTemp;

        if(!*lpTemp || *lpTemp == '\n') continue;

        if(lpNextLine) *lpNextLine = 0;

        //----------

        TSTR lpValueStart = lpTemp;
        while(*lpValueStart && *lpValueStart != ' ' && *lpValueStart != L' ' && *lpValueStart != '\t')
            ++lpValueStart;

        String lookupVal, strVal;

        TCHAR prevChar = *lpValueStart;
        *lpValueStart = 0;
        lookupVal = lpTemp;
        *lpValueStart = prevChar;

        String value = lpValueStart;
        value.KillSpaces();
        if(value.IsValid() && value[0] == '"')
        {
            value = String::RepresentationToString(value);
            strVal = value;
        }
        else
            strVal = value;

        if(lookupVal.IsValid())
            AddLookupString(lookupVal, strVal);

        //----------

        if(lpNextLine) *lpNextLine = '\n';
    }while(lpTemp = lpNextLine);

    //------------------------

    return TRUE;
}
开发者ID:benneeh,项目名称:wScreenshot,代码行数:80,代码来源:XTLocalization.cpp


示例15: mFiles

//===============================================
// XDisplayGeometry virtual slots...
//-----------------------------------------------
bool XDisplayGeometry::slotRun (int index) {
	// ...
	// this page does not need to offer a dialog because
	// we will call an external program called XFine here
	// ---
	if (index == Geometry) {
		// log(L_INFO,"XDisplayGeometry::call XFine...\n");
		// ...
		// next is calling the external program called xfine
		// the return code of the program which is written to
		// stdout will tell us how to proceed
		// ---
		//  1: xfine was successful, but the user canceled.
		//	2: xfine was successful. The user selected "Save settings"
		// ---
		bool modelineChanged = false;
		// ...
		// get the mFiles pointer wrapper from the Intro
		// object which has read all the data files
		// ---
		QDict<XFile>* mFilePtr = mIntro->getFiles();
		XWrapFile < QDict<XFile> > mFiles (mFilePtr);
		// ...
		// call xfine now and handle the return value...
		// ---
		removeXFineCache();
		XRunXFine xfineThread;
		xfineThread.start();
		mFrame -> disableInteraction();
		while (xfineThread.running()) {
			qApp->processEvents();
			usleep (50000);
		}
		mFrame -> enableInteraction();
		int code = xfineThread.getReturnCode();
		switch (code) {
		case 0:
			log (L_ERROR,
				"XDisplayGeometry::XFine called failed\n"
			);
		break;
		case 1:
			modelineChanged = false;
		break;
		case 2:
			modelineChanged = true;
		break;
		}
		// ...
		// if the xfine call has build the modeline cache
		// holding the modeline changes we had to set the
		// ImportXFineCache variable for all desktops
		// ---
		if (modelineChanged) {
			XData* sys = NULL;
			XFile* map = mFiles["sys_DESKTOP"];
			for (int n=0; n < map->getDeviceCount(); n++) {
			sys = map -> getDevice (n);
			if (! sys) {
				continue;
			}
			sys -> setPair ("ImportXFineCache","yes");
			}
			resetPage (
				PAGE_RELOAD
			);
		}
	}

	#if 0
	if (XTemplate::slotRun (index)) {
	log(L_INFO,"XDisplayGeometry::slotRun() called: %d\n",index);
	// ...
	// this function is called if the geometry page is activated.
	// use this function to init the dialog with the current
	// setup of the geometry
	// ---
	mStatus -> message (mText["RunXGeometry"]);
	}
	#endif

	return (TRUE);
}
开发者ID:BackupTheBerlios,项目名称:sax-svn,代码行数:86,代码来源:geometryhandler.cpp


示例16: kbc


//.........这里部分代码省略.........
      sKBasicPath = sKBasicPath.replace("kbc", "kbide/ide/cache");
    } else {
      sKBasicPath = sKBasicPath.replace("kbc", "ide/cache");
    }
    
    if (sKBasicPath.isEmpty()) return 0;
  }

  // if (checkLicense(acLicense) == false) return 0;


//  checkSerialNo();

	textbuffer *myTextbuffer = new textbuffer(); // needed to truncate big input strings or zero terminate them
 
  cache *my_cache = new cache();
  token *myToken = new token();
	scanner *myScanner = new scanner(myToken, my_cache);

	char *acText;
  bool b = true;

  if (utility::readSourceFile(&acText, cachePath("project.name").ascii(), myTextbuffer)){
    acText = utility::eatUTF16DOM(acText);
    sProjectName = acText;
  }

//  if (b && (b = utility::readSourceFile(&acText, "c:/kbasic16/kbide/ide/cache/C__kbasic16_kbide_examples_kbasic_builtin___class__.kbasic.scanner", myTextbuffer))){}


  { // delete runtime.parser file
    XString m = cachePath("runtime.parser");
    //CONSOLE printError(cachePath("runtime.parser").ascii());
    XFile f(m.ascii());
    if (!f.open(Truncate)){
      CONSOLE printError("Could not create runtime parser file: ");
      CONSOLE printError(m.ascii());
      b = false;
    } else {
      f.close();
    }
  }

  XString m = cachePath("compiler.output");
  finfo.setName(m.ascii());  
  char acInfo[1024];

  //if (utility::my_stricmp(ac, "") == 0)
  if (b){


    {      
      if (!finfo.open(Truncate)){
        CONSOLE printError("Could not write compiler output file:");
        CONSOLE printError(m.ascii());
        b = false;
      } 
    }
    finfo.close();

    XString sFiles = "";

    if (b){ // read compiler.input file
      XString m = cachePath("compiler.input");
      XFile f(m.ascii());
      if (!f.open(ReadOnly)){
开发者ID:DamianSuess,项目名称:kbasic,代码行数:67,代码来源:main.cpp


示例17: AppWarning

void __cdecl AppWarning(const TCHAR *format, ...)
{
    if(!format) return;

    va_list arglist;

    va_start(arglist, format);

    if(bLogStarted)
    {
        OpenLogFile();
        LogFile.WriteStr(TEXT("Warning -- "));

        String strOut = FormattedStringva(format, arglist);
        LogFile.WriteAsUTF8(strOut, strOut.Length());
        LogFile.WriteAsUTF8(TEXT("\r\n"));
        CloseLogFile();
    }

    OSDebugOut(TEXT("Warning -- "));
    OSDebugOutva(format, arglist);
    OSDebugOut(TEXT("\r\n"));

    //------------------------------------------------------
    // NOTE:
    // If you're seeting this, you can safely continue running, but I recommend fixing whatever's causing this warning.
    //
    // The debug output window contains the warning that has occured.
    //------------------------------------------------------

#if defined(_DEBUG) && defined(_WIN32)
    if(bDebugBreak && OSDebuggerPresent())
    {
        ProgramBreak();
    }
#endif
}
开发者ID:AaronMike,项目名称:OBS,代码行数:37,代码来源:XT.cpp


示例18: Display

bool Display(float timeDelta)
{
	if( Device )
	{
		//update audio
		AudioUpdate();

		//keyboard
		if( ::GetAsyncKeyState('W') & 0x8000f)
		{
			TheCamera.walk(40.0f * timeDelta);
			//D3DXMATRIX forwardMovement;
			//D3DXMatrixRotationY(&forwardMovement, avatarYaw);
			//D3DXVECTOR3 v(0,0,forwardSpeed);
			//D3DXVECTOR4 vec4;
			//D3DXVec3Transform(&vec4, &v, &forwardMovement);
			//avatarDirection.x = v.x = vec4.x;
			//avatarDirection.y = v.y = vec4.y;
			//avatarDirection.z = v.z = vec4.z;
			//AvatarPosition.z += v.z;
			//AvatarPosition.x += v.x;
		}
		if( ::GetAsyncKeyState('S') & 0x8000f)
		{
			TheCamera.walk(-40.0f * timeDelta);
			//D3DXMATRIX forwardMovement;
			//D3DXMatrixRotationY(&forwardMovement, avatarYaw);
			//D3DXVECTOR3 v(0,0,-forwardSpeed);
			//D3DXVECTOR4 vec4;
			//D3DXVec3Transform(&vec4, &v, &forwardMovement);
			//avatarDirection.x = v.x = vec4.x;
			//avatarDirection.y = v.y = vec4.y;
			//avatarDirection.z = v.z = vec4.z;
			//AvatarPosition.z += v.z;
			//AvatarPosition.x += v.x;
		}
		if( ::GetAsyncKeyState('A') & 0x8000f)
		{
			TheCamera.yaw(-4.0f * timeDelta);
			//avatarYaw -= rotationSpeed;
		}
		if( ::GetAsyncKeyState('D') & 0x8000f)
		{
			TheCamera.yaw(4.0f * timeDelta);
			//avatarYaw -= rotationSpeed;
		}
		if( ::GetAsyncKeyState('I') & 0x8000f)
		{
			TheCamera.pitch(-4.0f * timeDelta);
		}
		if( ::GetAsyncKeyState('K') & 0x8000f)
		{
			TheCamera.pitch(4.0f * timeDelta);
		}

		D3DXVECTOR3 f = TheCamera.GetPosition();
		if(f.x > 190)
			f.x = 190;
		if(f.x < -190)
			f.x = -190;
		
		if(f.z > 190)
			f.z = 190;
		if(f.z < -190)
			f.z = -190;

		//if(f.y > 390)
		//	f.y = 390;
		//if(f.y < 10)
		//	f.y = 10;
		float height = TheTerrain->getHeight(f.x, f.z);
		f.y = height + 5.0f;


		TheCamera.setPosition(&f);

		//camera stuff
		D3DXMATRIX V, o;
		TheCamera.getViewMatrix(&V);
		Device->SetTransform(D3DTS_VIEW, &V);

		//UpdateCameraThirdPerson();
		//
		// Draw the scene:
		//
		Device->Clear(0, 0, 
			D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER | D3DCLEAR_STENCIL,
			0xff000000, 1.0f, 0L);

		Device->BeginScene();
				
		D3DXMATRIX I;
		D3DXMatrixIdentity(&I);
		if(TheTerrain)
			TheTerrain->draw(&I, false);

		//Device->SetTexture(0, Armor)
D3DXMATRIX i, tripler, grow;

		Collides();
//.........这里部分代码省略.........
开发者ID:Odinra,项目名称:DirectX,代码行数:101,代码来源:Main.cpp


示例19: create

 xf_error_codes create(const char *name, dword flags)
         { xf_error_codes err=xf->create(name,flags|XF_OPEN_READ);
           if (!err) {return begin();}
           errorn=err;
           return err; };
开发者ID:OhGameKillers,项目名称:mythosengine,代码行数:5,代码来源:XFINI.HPP


示例20: Setup

bool Setup()
{
		D3DXVECTOR3 lightDirection(0.0f, 1.0f, 0.0f);

	TheTerrain = new Terrain(Device, "Faces.raw", 734,1024,20,1.0f);
	T 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XHTMLReader类代码示例发布时间:2022-05-31
下一篇:
C++ XFBEncoder类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap