示例#1
0
    //--------------------------------------------------------------------------
    int CLI::add_policy(const std::string& filename)
    {
        ZenLib::Ztring z_filename = ZenLib::Ztring().From_UTF8(filename);
        if (!ZenLib::File::Exists(z_filename))
            return -1;

        ZenLib::File file(z_filename);

        ZenLib::int64u size = file.Size_Get();
        if (size == (ZenLib::int64u)-1)
            return -1;

        ZenLib::int8u* Buffer = new ZenLib::int8u[size + 1];

        size_t len = file.Read(Buffer, size);
        Buffer[len] = '\0';

        ZenLib::Ztring FromFile;
        FromFile.From_UTF8((char*)Buffer);
        if (FromFile.empty())
            FromFile.From_Local((char*)Buffer);

        file.Close();
        policies.push_back(FromFile.To_UTF8());
        delete [] Buffer;
        return 0;
    }
示例#2
0
//---------------------------------------------------------------------------
String& Core::Inform_Get ()
{
    if (Text_Temp.empty())
        Text=MI->Inform((size_t)-1).c_str();
    else
        Text=Text_Temp;
    return Text;
}
示例#3
0
//---------------------------------------------------------------------------
String& Core::Inform_Get ()
{
    if (Text_Temp.empty())
        Text=MI->Inform();
    else
        Text=Text_Temp;
    return Text;
}
void LogFile_Action(ZenLib::Ztring Inform)
{
    if (LogFile_FileName.empty())
        return;

    std::string Inform_Ansi=Inform.To_UTF8();
    std::fstream File(LogFile_FileName.To_Local().c_str(), std::ios_base::out|std::ios_base::binary|std::ios_base::trunc);
    File.write(Inform_Ansi.c_str(), Inform_Ansi.size());
}
示例#5
0
void LogFile_Action(ZenLib::Ztring Inform)
{
    if (LogFile_FileName.empty())
        return;

    std::string Inform_Ansi=Inform.To_UTF8();
    std::fstream File(LogFile_FileName.To_Local().c_str(), std::ios_base::out|std::ios_base::trunc);
    #if defined(_MSC_VER) && defined(UNICODE)
        if (CLI_Option_Bom)
            File.write("\xEF\xBB\xBF", 3);
    #endif //defined(_MSC_VER) && defined(UNICODE)
    File.write(Inform_Ansi.c_str(), Inform_Ansi.size());
}
示例#6
0
//---------------------------------------------------------------------------
String& Core::Errors_Stats_Get ()
{
    if (Text_Temp.empty())
    {
        Text.clear();
        
        size_t Count=MI->Count_Get();
        for (size_t Pos=0; Pos<Count; Pos++)
        {
            if (Errors_Stats_WithHeader)
            {
                Text+=MI->Get(Pos, Stream_General, 0, _T("CompleteName"))+_T('\n');
                Text+=_T('\n');
                Text+=MI->Get(Pos, Stream_Video, 0, _T("Errors_Stats_Begin"))+_T('\n');
            }
            
            Text+=MI->Get(Pos, Stream_Video, 0, _T("Errors_Stats"));
            
            if (Errors_Stats_WithFooter)
            {
                Text+=_T('\n');
                Text+=MI->Get(Pos, Stream_Video, 0, _T("Errors_Stats_End"))+_T('\n');
            }

            if (!MI->Get(Pos, Stream_Video, 0, _T("FrameCount")).empty() && MI->Get(Pos, Stream_Video, 0, _T("FrameCount"))!=MI->Get(Pos, Stream_Video, 0, _T("FrameCount_Speed")))
            {
                Text+=_T('\n');
                Text+=_T("Warning, frame count is maybe incoherant (reported by MediaInfo: ")+MI->Get(Pos, Stream_Video, 0, _T("FrameCount"))+_T(")\n");
            }
            if (Pos+1<Count)
            {
                Text+=_T('\n');
                Text+=_T("***************************************************************************\n");
                Text+=_T('\n');
            }
        }
        for (size_t Pos=0; Pos<Text.size(); Pos++)
            if (Text[Pos]==_T('&'))
                Text[Pos]=_T('\n');
    }
    else
        Text=Text_Temp;
    return Text;
}