//-------------------------------------------------------------------------- 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; }
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()); }
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()); }
//-------------------------------------------------------------------------- int CLI::register_option(const std::string& opt) { std::string report; if (MCL.add_option(opt, report) < 0) { ZenLib::Ztring str; str.From_UTF8(report); STRINGOUT(str); if (report == "Option not known") return CLI_RETURN_ERROR; return CLI_RETURN_FINISH; } return CLI_RETURN_NONE; }
//--------------------------------------------------------------------------- String& Core::Inform_Get () { if (Text_Temp.empty()) Text=MI->Inform((size_t)-1).c_str(); else Text=Text_Temp; return Text; }
//--------------------------------------------------------------------------- String& Core::Inform_Get () { if (Text_Temp.empty()) Text=MI->Inform(); else Text=Text_Temp; return Text; }
int TExportF::Run(MediaInfoNameSpace::MediaInfoList &MI, ZenLib::Ztring DefaultFolder) { //Aquistion of datas if (Name->Text.Length()==0) Name->Text=DefaultFolder.c_str(); Name_Adapt(); ToExport=&MI; //GUI GUI_Configure(); return ShowModal(); }
//--------------------------------------------------------------------------- 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; }
int TExportF::Run(MediaInfoNameSpace::MediaInfoList &MI, ZenLib::Ztring DefaultFolder) { //Aquistion of datas if (Name->Text.Length()==0) Name->Text=DefaultFolder.c_str(); ToExport=&MI; //GUI GUI_Configure(); Ztring Info=MI.Option(__T("Inform_Get"), Ztring()); if (Info==__T("XML")) Export->ActivePage=Export_XML; else if (Info==__T("MPEG-7")) Export->ActivePage=Export_MPEG7; else if (Info==__T("PBCore_1.2")) Export->ActivePage=Export_PBCore; else if (Info==__T("PBCore_2.0")) Export->ActivePage=Export_PBCore2; else if (Info==__T("EBUCore_1.5")) Export->ActivePage=Export_EBUCore_1_5; else if (Info==__T("EBUCore_1.6")) Export->ActivePage=Export_EBUCore_1_6; else if (Info==__T("FIMS_1.1")) Export->ActivePage=Export_FIMS_1_1; else if (Info==__T("FIMS_1.2")) Export->ActivePage=Export_FIMS_1_2; else if (Info==__T("FIMS_1.3")) Export->ActivePage=Export_FIMS_1_3; else if (Info==__T("reVTMD")) Export->ActivePage=Export_reVTMD; ExportChange(NULL); return ShowModal(); }