Exemplo n.º 1
0
void Dialog::ReadRC(RCFile &rcFile)
{
    if (extended)
    {
        italics = 256;
    }
    resInfo.SetFlags(resInfo.GetFlags() | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile,false);
    pos.x = rcFile.GetNumber();
    rcFile.SkipComma();
    pos.y = rcFile.GetNumber();
    rcFile.SkipComma();
    size.x = rcFile.GetNumber();
    rcFile.SkipComma();
    size.y = rcFile.GetNumber();
    rcFile.SkipComma();
    rcFile.NeedEol();
    ReadSettings(rcFile);
    rcFile.NeedBegin();
    while (Control::ValidType(rcFile))
    {	
        Control *c = new Control;
        controls.push_back(c);
        c->ReadRC(rcFile, extended);
    }
    rcFile.NeedEnd();
}
Exemplo n.º 2
0
void Accelerators::ReadRC(RCFile &rcFile)
{
    resInfo.SetFlags( (resInfo.GetFlags() &~ResourceInfo::Discardable) | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile, true);
    rcFile.NeedBegin();
    while (rcFile.IsString() || rcFile.IsNumber())
    {
        //int done;
        Key key;
        key.ReadRC(rcFile);
        keys.push_back(key);
    }
    rcFile.NeedEnd();
}
Exemplo n.º 3
0
void ResourceData::ReadRC(RCFile &rcFile)
{
    if (rcFile.IsKeyword())
    {
        int maxLen = 1024;
        data = new unsigned char [maxLen];
        rcFile.NeedBegin();
        while (rcFile.IsNumber())
        {
            if (len == maxLen)
            {
                maxLen += 1024;
                unsigned char *hold = data;
                data = new unsigned char [maxLen];
                memcpy(data, hold, maxLen - 1024);
                delete [] hold;
            }
            data[len++] = rcFile.GetNumber() & 0xff;
            rcFile.SkipComma();
        }
        rcFile.NeedEnd();
    }
    else
    {
        std::string name = rcFile.GetFileName();
        std::fstream in(name.c_str(), std::ios::in | std::ios::binary);
        if (!in.fail())
        {
            in.seekg(0, std::ios::end);
            len = in.tellg();
            in.seekg(0, std::ios::beg);
            data = new unsigned char[len];
            in.read((char *)data, len);
        }
        else
            throw new std::runtime_error(std::string("Could not open file '") + name + "'");
    }
}