Ztring Language_Others_Run () { ZtringListListF Dest; Dest.Load(L"../Source/Ressource/Language.csv"); Run_File(Dest, L"ca"); Run_File(Dest, L"cs"); Run_File(Dest, L"de"); Run_File(Dest, L"en"); Run_File(Dest, L"es"); Run_File(Dest, L"fr"); Run_File(Dest, L"gl"); Run_File(Dest, L"gr"); Run_File(Dest, L"hu"); Run_File(Dest, L"it"); Run_File(Dest, L"ja"); Run_File(Dest, L"ko"); Run_File(Dest, L"lt"); Run_File(Dest, L"nl"); Run_File(Dest, L"pl"); Run_File(Dest, L"pt"); Run_File(Dest, L"ro"); Run_File(Dest, L"ru"); Run_File(Dest, L"sv"); Run_File(Dest, L"tr"); Run_File(Dest, L"zh-TW"); Run_File(Dest, L"zh-CN"); Dest.Save(); return L"OK"; }
void Run_File(ZtringListListF &Dest, Ztring Language) { //Open Orig ZtringListListF Origin; if (Origin.Load(Ztring(L"../Source/Resource/Plugin/Language/")+Language+L".csv")==Error) return; //Find position in Destination int Lang=0; for (int LangPos=1; LangPos<50; LangPos++) if (Lang==0 && (Dest(L" Language_ISO639", LangPos)==Language || Dest(L" Language_ISO639", LangPos).size()==0)) Lang=LangPos; //Delete BOM characters if present Origin(0, 0)=L" Author_Email"; //Complete for (size_t Pos=0; Pos<Origin.size(); Pos++) { int Dest_Pos=Dest.Find(Origin(Pos, 0), 0, 0, L"==", Ztring_CaseSensitive); if (Dest_Pos==-1) { Dest.push_back(Origin.Read(Pos, 0)); //Append to end of file Dest_Pos=Dest.Find(Origin(Pos, 0), 0, 0, L"==", Ztring_CaseSensitive); } Dest(Dest_Pos, Lang)=Origin(Pos, 1); } }
Ztring Language_All_Run () { ZtringListListF Origin; Origin.Load(L"../Source/Resource/Language.csv"); for (int Lang=1; Lang<50; Lang++) { Ztring Name=Origin.Read(L" Language_ISO639", Lang); if (Name.size()>0) { ZtringListListF Dest; int Automatic=0; //count of words in file int Automatic_Language=0; //count of words in file without Language names for (size_t Pos=0; Pos<Origin.size(); Pos++) { Dest(Pos, 0)=Origin(Pos, 0); Dest(Pos, 1)=Origin(Pos, Lang); if (Dest(Pos, 1).size()>0) Automatic++; if (Dest(Pos, 1).size()>0 || Dest(Pos, 0).find(__T("Language_"))==0 || Dest(Pos, 0).find(__T("Genre_"))==0 || Dest(Pos, 0).find(__T("OpenCandy_"))==0) Automatic_Language++; } Dest((L"ZZ_Automatic_Percent"), 1).From_Number(Automatic*100/Origin.size()); Dest((L"ZZ_AutomaticLanguage_Percent"), 1).From_Number(Automatic_Language*100/Origin.size()); Dest.Save(Ztring(L"../Source/Resource/Plugin/Language/")+Name+L".csv"); } } return L"OK"; }
//--------------------------------------------------------------------------- int TPreferences_LanguageF::Run(const Ztring &Name) { ZtringListListF Default; Default.Load(Prefs->BaseFolder+Prefs->FolderNames[Prefs_Language]+_T("\\")+Prefs->DefaultNames[Prefs_Language]+_T(".csv")); EditedLanguage.Load(Prefs->BaseFolder+Prefs->FolderNames[Prefs_Language]+_T("\\")+Name+_T(".csv")); Grille->RowCount=Default.size()+1; Grille->Cells[0][0]="Program name"; Grille->Cells[1][0]="Default translation"; Grille->Cells[2][0]="Your translation"; for (size_t Pos=0; Pos<Default.size(); Pos++) { Grille->Cells[0][Pos+1]=Default(Pos, 0).c_str(); Grille->Cells[1][Pos+1]=Default(Pos, 1).c_str(); Grille->Cells[2][Pos+1]=EditedLanguage(Default(Pos, 0), 1).c_str(); } return ShowModal(); }
//--------------------------------------------------------------------------- // Open an item ZenLib::Ztring Enums_Create_Item(const Ztring &Directory, const Ztring &Name, Ztring &Contents) { Contents.clear(); Ztring Result; //Load header Ztring Partial; Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.2.txt", Partial); if (!Result.empty()) return Result; Partial.FindAndReplace(L"%Name%", Ztring(Name).MakeLowerCase()); Contents+=Partial; //Load line template Ztring Line; Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.5.txt", Line); if (!Result.empty()) return Result; //Read input file ZtringListListF ZLL; ZLL.Load(Ztring(L"../Source/Resource/Text/")+Directory+L"/"+Name+L".csv"); for (size_t Pos=0; Pos<ZLL.size(); Pos++) { Ztring Line_Temp=Line; Line_Temp.FindAndReplace(L"%Name%", Name); Ztring &ToAdd=ZLL(Pos, 0); ToAdd.FindAndReplace(__T("/"), __T("_"), 0, Ztring_Recursive); //C++ does not accept "/" in names ToAdd.FindAndReplace(__T("("), __T("_")); //C++ does not accept "(" in names ToAdd.FindAndReplace(__T(")"), __T("_")); //C++ does not accept ")" in names ToAdd.FindAndReplace(__T("*"), __T("_")); //C++ does not accept "*" in names ToAdd.FindAndReplace(__T("-"), __T("_")); //C++ does not accept "-" in names Line_Temp.FindAndReplace(L"%Line%", ToAdd); Contents+=Line_Temp; } //Load footer template Result=Enums_Create_Load(L"../Source/Resource/Text/Enums_.8.txt", Partial); if (!Result.empty()) return Result; Contents+=Partial; return L""; }
//--------------------------------------------------------------------------- int Preferences::RefreshFilesList(Prefs_t KindOfList) { //Default available? if (!File::Exists(BaseFolder+FolderNames[KindOfList]+_T("\\")+DefaultNames[KindOfList]+_T(".csv"))) Create(KindOfList, DefaultNames[KindOfList]); //Listing FilesList[KindOfList]=Dir::GetAllFileNames(BaseFolder+FolderNames[KindOfList]+_T("\\")+_T("*.csv")); if (KindOfList==Prefs_Language) { //Special case : Languages, should show the name of language in the local version FilesList[Prefs_Language_List].clear(); for (size_t Pos=0; Pos<FilesList[KindOfList].size(); Pos++) { ZtringListListF Lang; Lang.Load(FilesList[KindOfList][Pos]); Ztring Local=Lang(_T(" Language_Name")); if (Local.size()==0) Local=FilesList[KindOfList][Pos].SubString(BaseFolder+FolderNames[KindOfList]+_T("\\"), _T(".csv")); if (Local.find(_T("(Chris)"))==Ztring::npos) //quick method for no more showing Chris translation (deprecated) FilesList[Prefs_Language_List].push_back(Local); else { //quick method for no more showing Chris translation (deprecated) FilesList[KindOfList].erase(FilesList[KindOfList].begin()+Pos); Pos--; } } } //Only name for (size_t Pos=0; Pos<FilesList[KindOfList].size(); Pos++) FilesList[KindOfList][Pos]=FilesList[KindOfList][Pos].SubString(BaseFolder+FolderNames[KindOfList]+_T("\\"), _T(".csv")); return 1; }
void RegressionTest_Basic(Ztring Files, Ztring DataBaseDirectory, int32u Scenario) { /* //One per one ZtringList List=Dir::GetAllFileNames(Files); for (size_t Pos=0; Pos<List.size(); Pos++) { std::cout<<List[Pos].To_Local()<<endl; MediaInfoDLL_Load(); MediaInfoList* MIL=new MediaInfoList; MIL->Open(List[Pos]); delete MIL; MediaInfoDLL_UnLoad(); File::Move(L"C:\\Temp\\Debug_MemoryLeak.txt", L"C:\\Temp\\"+ZenLib::FileName(List[Pos]).Name_Get()+L"."+ZenLib::FileName(List[Pos]).Extension_Get()+L"."+Ztring::ToZtring(Pos)+L".txt"); } */ /* Old ZtringListListF* Ref=new ZtringListListF[Stream_Max]; for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) if (File::Exists(DataBaseDirectory+__T("\\Basic\\Ref\\")+Ztring::ToZtring(StreamKind)+__T(".csv"))) Ref[StreamKind].Load(DataBaseDirectory+__T("\\Basic\\Ref\\")+Ztring::ToZtring(StreamKind)+__T(".csv")); ZtringListListF* New=new ZtringListListF[Stream_Max]; MediaInfoList MIL; struct UserHandle_struct UserHandle; //Times wostringstream Event_CallBackFunction_Text; Event_CallBackFunction_Text<<__T("CallBack=memory://")<<(MediaInfo_int64u)Basic_Event_CallBackFunction<<__T(";UserHandler=memory://")<<(MediaInfo_int64u)&UserHandle; MIL.Option(__T("File_Event_CallBackFunction"), Event_CallBackFunction_Text.str()); if (!Dir::Exists(DataBaseDirectory+__T("\\Basic\\Diff"))) Dir::Create(DataBaseDirectory+__T("\\Basic\\Diff")); File::Delete(DataBaseDirectory+__T("\\Basic\\Diff\\Times.csv")); UserHandle.Time_File.Open(DataBaseDirectory+__T("\\Basic\\Diff\\Times.csv"), File::Access_Write_Append); cout<<" Analyzing"<<endl; MIL.Open(Files); cout<<" Retrieving new data"<<endl; for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) { for (size_t FilePos=0; FilePos<MIL.Count_Get(); FilePos++) if (MIL.Count_Get(FilePos, (stream_t)StreamKind)) { New[StreamKind].push_back(ZtringList()); New[StreamKind].at(New[StreamKind].size()-1).push_back(Ztring()); //CompleteFileName for (size_t LinePos=0; LinePos<MIL.Count_Get(FilePos, (stream_t)StreamKind, 0); LinePos++) New[StreamKind].at(New[StreamKind].size()-1).push_back(MIL.Get(FilePos, (stream_t)StreamKind, 0, LinePos, Info_Name)); break; } } for (size_t FilePos=0; FilePos<MIL.Count_Get(); FilePos++) for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) for (size_t StreamPos=0; StreamPos<MIL.Count_Get(FilePos, (stream_t)StreamKind); StreamPos++) { New[StreamKind].push_back(ZtringList()); New[StreamKind].at(New[StreamKind].size()-1).push_back(MIL.Get(FilePos, Stream_General, 0, __T("CompleteName"))); for (size_t LinePos=0; LinePos<MIL.Count_Get(FilePos, (stream_t)StreamKind, StreamPos); LinePos++) New[StreamKind].at(New[StreamKind].size()-1).push_back(MIL.Get(FilePos, (stream_t)StreamKind, StreamPos, LinePos)); } for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) { if (!Dir::Exists(DataBaseDirectory+__T("\\Basic\\New"))) Dir::Create(DataBaseDirectory+__T("\\Basic\\New")); New[StreamKind].Save(DataBaseDirectory+__T("\\Basic\\New\\")+Ztring::ToZtring(StreamKind)+__T(".csv")); } cout<<" Diff"<<endl; ZtringListListF* Diff=new ZtringListListF[Stream_Max]; for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) { size_t Ref_Pos=1; size_t New_Pos=1; while (Ref_Pos<Ref[StreamKind].size() && New_Pos<New[StreamKind].size()) { if (New[StreamKind](New_Pos, 0)!=Ref[StreamKind](Ref_Pos, 0)) { size_t Ref_PosNext=Ref_Pos; while (Ref_PosNext<Ref[StreamKind].size() && New[StreamKind](New_Pos, 0)!=Ref[StreamKind](Ref_PosNext, 0)) Ref_PosNext++; if (Ref_PosNext==Ref[StreamKind].size()) //Ref file not found { Diff[StreamKind].push_back(New[StreamKind](New_Pos)); New_Pos++; } else { for (; Ref_Pos<Ref_PosNext; Ref_Pos++) Diff[StreamKind].push_back(Ref[StreamKind](Ref_Pos)); } } else { bool IsDiff=false; size_t LinePos_Max=max(New[StreamKind](New_Pos).size(), Ref[StreamKind](Ref_Pos).size()); for (size_t LinePos=1; LinePos<LinePos_Max; LinePos++) if (New[StreamKind](New_Pos, LinePos)!=Ref[StreamKind](Ref_Pos, LinePos)) { if (!IsDiff) { Diff[StreamKind].push_back(ZtringList()); Diff[StreamKind](Diff[StreamKind].size()-1, 0)=New[StreamKind](New_Pos, 0); IsDiff=true; } Diff[StreamKind](Diff[StreamKind].size()-1, LinePos)=New[StreamKind](New_Pos, LinePos)+__T(" --- ")+Ref[StreamKind](Ref_Pos, LinePos); } Ref_Pos++; New_Pos++; } } for (; Ref_Pos<Ref[StreamKind].size(); Ref_Pos++) { Diff[StreamKind].push_back(ZtringList()); Diff[StreamKind](Diff[StreamKind].size()-1, 0)=Ref[StreamKind](Ref_Pos, 0); for (size_t LinePos=1; LinePos<Ref[StreamKind][Ref_Pos].size(); LinePos++) if (!Ref[StreamKind](Ref_Pos, LinePos).empty()) Diff[StreamKind](Diff[StreamKind].size()-1, LinePos)=__T(" --- ")+Ref[StreamKind](Ref_Pos, LinePos); } for (; New_Pos<New[StreamKind].size(); New_Pos++) { Diff[StreamKind].push_back(ZtringList()); Diff[StreamKind](Diff[StreamKind].size()-1, 0)=New[StreamKind](New_Pos, 0); for (size_t LinePos=1; LinePos<New[StreamKind][New_Pos].size(); LinePos++) if (!New[StreamKind](New_Pos, LinePos).empty()) Diff[StreamKind](Diff[StreamKind].size()-1, LinePos)=New[StreamKind](New_Pos, LinePos)+__T(" --- "); } } for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) { if (!Diff[StreamKind].empty()) { Diff[StreamKind].insert(Diff[StreamKind].begin(), New[StreamKind](0)); if (!Dir::Exists(DataBaseDirectory+__T("\\Basic\\Diff"))) Dir::Create(DataBaseDirectory+__T("\\Basic\\Diff")); Diff[StreamKind].Save(DataBaseDirectory+__T("\\Basic\\Diff\\")+Ztring::ToZtring(StreamKind)+__T(".csv")); } } */ MediaInfoList MIL; struct UserHandle_struct UserHandle; //Times wostringstream Event_CallBackFunction_Text; Event_CallBackFunction_Text<<__T("CallBack=memory://")<<(MediaInfo_int64u)Basic_Event_CallBackFunction<<__T(";UserHandler=memory://")<<(MediaInfo_int64u)&UserHandle; MIL.Option(__T("File_Event_CallBackFunction"), Event_CallBackFunction_Text.str()); if (!Dir::Exists(DataBaseDirectory+__T("\\Basic\\Diff"))) Dir::Create(DataBaseDirectory+__T("\\Basic\\Diff")); File::Delete(DataBaseDirectory+__T("\\Basic\\Diff\\Times.csv")); UserHandle.Time_File.Open(DataBaseDirectory+__T("\\Basic\\Diff\\Times.csv"), File::Access_Write_Append); cout<<" Analyzing"<<endl; MIL.Open(Files); for (size_t StreamKind=0; StreamKind<Stream_Max; StreamKind++) { ZtringListListF New; ZtringListListF Ref; ZtringListListF Diff; cout<<" Retrieving ref data"<<endl; if (File::Exists(DataBaseDirectory+__T("\\Basic\\Ref\\")+Ztring::ToZtring(StreamKind)+__T(".csv"))) Ref.Load(DataBaseDirectory+__T("\\Basic\\Ref\\")+Ztring::ToZtring(StreamKind)+__T(".csv")); cout<<" Retrieving new data"<<endl; for (size_t FilePos=0; FilePos<MIL.Count_Get(); FilePos++) if (MIL.Count_Get(FilePos, (stream_t)StreamKind)) { New.push_back(ZtringList()); New.at(New.size()-1).push_back(Ztring()); //CompleteFileName for (size_t LinePos=0; LinePos<MIL.Count_Get(FilePos, (stream_t)StreamKind, 0); LinePos++) New.at(New.size()-1).push_back(MIL.Get(FilePos, (stream_t)StreamKind, 0, LinePos, Info_Name)); break; } for (size_t FilePos=0; FilePos<MIL.Count_Get(); FilePos++) for (size_t StreamPos=0; StreamPos<MIL.Count_Get(FilePos, (stream_t)StreamKind); StreamPos++) { New.push_back(ZtringList()); New.at(New.size()-1).push_back(MIL.Get(FilePos, Stream_General, 0, __T("CompleteName"))); for (size_t LinePos=0; LinePos<MIL.Count_Get(FilePos, (stream_t)StreamKind, StreamPos); LinePos++) New.at(New.size()-1).push_back(MIL.Get(FilePos, (stream_t)StreamKind, StreamPos, LinePos)); } if (!Dir::Exists(DataBaseDirectory+__T("\\Basic\\New"))) Dir::Create(DataBaseDirectory+__T("\\Basic\\New")); New.Save(DataBaseDirectory+__T("\\Basic\\New\\")+Ztring::ToZtring(StreamKind)+__T(".csv")); cout<<" Diff"<<endl; size_t Ref_Pos=1; size_t New_Pos=1; while (Ref_Pos<Ref.size() && New_Pos<New.size()) { if (New(New_Pos, 0)!=Ref(Ref_Pos, 0)) { size_t Ref_PosNext=Ref_Pos; while (Ref_PosNext<Ref.size() && New(New_Pos, 0)!=Ref(Ref_PosNext, 0)) Ref_PosNext++; if (Ref_PosNext==Ref.size()) //Ref file not found { Diff.push_back(New(New_Pos)); New_Pos++; } else { for (; Ref_Pos<Ref_PosNext; Ref_Pos++) Diff.push_back(Ref(Ref_Pos)); } } else { bool IsDiff=false; size_t LinePos_Max=max(New(New_Pos).size(), Ref(Ref_Pos).size()); for (size_t LinePos=1; LinePos<LinePos_Max; LinePos++) if (New(New_Pos, LinePos)!=Ref(Ref_Pos, LinePos)) { if (!IsDiff) { Diff.push_back(ZtringList()); Diff(Diff.size()-1, 0)=New(New_Pos, 0); IsDiff=true; } Diff(Diff.size()-1, LinePos)=New(New_Pos, LinePos)+__T(" --- ")+Ref(Ref_Pos, LinePos); } Ref_Pos++; New_Pos++; } } for (; Ref_Pos<Ref.size(); Ref_Pos++) { Diff.push_back(ZtringList()); Diff(Diff.size()-1, 0)=Ref(Ref_Pos, 0); for (size_t LinePos=1; LinePos<Ref[Ref_Pos].size(); LinePos++) if (!Ref(Ref_Pos, LinePos).empty()) Diff(Diff.size()-1, LinePos)=__T(" --- ")+Ref(Ref_Pos, LinePos); } for (; New_Pos<New.size(); New_Pos++) { Diff.push_back(ZtringList()); Diff(Diff.size()-1, 0)=New(New_Pos, 0); for (size_t LinePos=1; LinePos<New[New_Pos].size(); LinePos++) if (!New(New_Pos, LinePos).empty()) Diff(Diff.size()-1, LinePos)=New(New_Pos, LinePos)+__T(" --- "); } if (!Diff.empty()) { Diff.insert(Diff.begin(), New(0)); if (!Dir::Exists(DataBaseDirectory+__T("\\Basic\\Diff"))) Dir::Create(DataBaseDirectory+__T("\\Basic\\Diff")); Diff.Save(DataBaseDirectory+__T("\\Basic\\Diff\\")+Ztring::ToZtring(StreamKind)+__T(".csv")); } } }
void TExportF::Export_Run() { //Create text for the file Ztring Text; Ztring Append_Separator=__T("\r\n"); if (Export->ActivePage==Export_CSV) { //Full information bool MediaInfo_Complete; if (CSV_Advanced->Checked) MediaInfo_Complete=true; else MediaInfo_Complete=false; //General ZtringListListF CSV; ZtringListList Parameters; Parameters.Write(MediaInfo::Option_Static(__T("Info_Parameters_CSV"))); int Pos_Start=1; int Pos_End=Parameters.Find(__T("Video"))-1; int CSV_Pos=0; for (int I1=0; I1<Pos_End-Pos_Start; I1++) if (MediaInfo_Complete || ToExport->Get(0, Stream_General, 0, I1, Info_Options)[InfoOption_ShowInInform]==__T('Y')) { CSV(0, CSV_Pos)=Ztring(__T("General "))+Parameters(Pos_Start+I1, 0); for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) CSV(1+FilePos, CSV_Pos)=ToExport->Get(FilePos, Stream_General, 0, I1); CSV_Pos++; } //Video Pos_Start=Pos_End+2; Pos_End=Parameters.Find(__T("Audio"))-1; for (int I1=0; I1<Pos_End-Pos_Start; I1++) { for (int Count=0; Count<CSV_Stream_Video->ItemIndex; Count++) if (MediaInfo_Complete || ToExport->Get(0, Stream_Video, 0, I1, Info_Options)[InfoOption_ShowInInform]==__T('Y')) { CSV(0, CSV_Pos)=Ztring(__T("Video "))+Ztring::ToZtring(Count)+__T(" ")+Parameters(Pos_Start+I1, 0); for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) CSV(1+FilePos, CSV_Pos)=ToExport->Get(FilePos, Stream_Video, 0, I1); CSV_Pos++; } } //Audio Pos_Start=Pos_End+2; Pos_End=Parameters.Find(__T("Text"))-1; for (int Count=0; Count<CSV_Stream_Audio->ItemIndex; Count++) { for (int I1=0; I1<Pos_End-Pos_Start; I1++) if (MediaInfo_Complete || ToExport->Get(0, Stream_Audio, 0, I1, Info_Options)[InfoOption_ShowInInform]==__T('Y')) { CSV(0, CSV_Pos)=Ztring(__T("Audio "))+Ztring::ToZtring(Count)+__T(" ")+Parameters(Pos_Start+I1, 0); for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) CSV(1+FilePos, CSV_Pos)=ToExport->Get(FilePos, Stream_Audio, Count, I1); CSV_Pos++; } } //Text Pos_Start=Pos_End+2; Pos_End=Parameters.Find(__T("Chapters"))-1; for (int Count=0; Count<CSV_Stream_Text->ItemIndex; Count++) { for (int I1=0; I1<Pos_End-Pos_Start; I1++) if (MediaInfo_Complete || ToExport->Get(0, Stream_Text, 0, I1, Info_Options)[InfoOption_ShowInInform]==__T('Y')) { CSV(0, CSV_Pos)=Ztring(__T("Text "))+Ztring::ToZtring(Count)+__T(" ")+Parameters(Pos_Start+I1, 0); for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) CSV(1+FilePos, CSV_Pos)=ToExport->Get(FilePos, Stream_Text, Count, I1); CSV_Pos++; } } //Chapters Pos_Start=Pos_End+2; Pos_End=Parameters.size()-1; for (int Count=0; Count<CSV_Stream_Other->ItemIndex; Count++) { for (int I1=0; I1<Pos_End-Pos_Start; I1++) if (MediaInfo_Complete || ToExport->Get(0, Stream_Other, 0, I1, Info_Options)[InfoOption_ShowInInform]==__T('Y')) { CSV(0, CSV_Pos)=Ztring(__T("Chapters "))+Ztring::ToZtring(Count)+__T(" ")+Parameters(Pos_Start+I1, 0); for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) CSV(1+FilePos, CSV_Pos)=ToExport->Get(FilePos, Stream_Other, Count, I1); CSV_Pos++; } } //Separators Ztring Separator_Col=ZEN_UNICODE(CSV_Separator_Col->Text); if (Separator_Col==__T("(Tab)")) Separator_Col=__T("\t"); Ztring Separator_Line=ZEN_UNICODE(CSV_Separator_Line->Text); if (Separator_Line==__T("(Default)")) #ifdef WIN32 Separator_Line=__T("\r\n"); #else #error #endif //WIN32 Separator_Line.FindAndReplace(__T("\\r"), __T("\r")); Separator_Line.FindAndReplace(__T("\\n"), __T("\n")); Append_Separator=Separator_Line.c_str(); Ztring Quote=ZEN_UNICODE(CSV_Quote->Text); CSV.Separator_Set(0, Separator_Line); CSV.Separator_Set(1, Separator_Col); CSV.Quote_Set(Quote); if (File_Append->Checked) CSV.Delete(0); Text=CSV.Read().c_str(); } else if (Export->ActivePage==Export_Sheet) { ZtringListListF SheetF; //Configure for (size_t Pos=0; Pos<Prefs->Details[Prefs_Sheet].size(); Pos++) { Ztring Z1=__T("Column"); Z1+=Ztring::ToZtring(Pos); //Searching kind of stream stream_t S; ZenLib::Char C=__T('G'); if (Prefs->Details[Prefs_Sheet].Find(Z1)==(size_t)-1) break; C=Prefs->Details[Prefs_Sheet](Z1, 1)[0]; switch (C) { case __T('G'): S=Stream_General; break; case __T('V'): S=Stream_Video; break; case __T('A'): S=Stream_Audio; break; case __T('T'): S=Stream_Text; break; case __T('C'): S=Stream_Other; break; default: S=Stream_General; } SheetF(0, Pos)=ToExport->Get(0, S, Prefs->Details[Prefs_Sheet](Z1, 2).To_int32u(), Prefs->Details[Prefs_Sheet](Z1, 3), Info_Name_Text); if (C!=__T('G')) SheetF(0, Pos)=Prefs->Details[Prefs_Sheet](Z1, 1)+Prefs->Details[Prefs_Sheet](Z1, 2)+__T(" ")+SheetF(0, Pos); } //Show all available files for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) for (size_t Pos=0; Pos<Prefs->Details[Prefs_Sheet].size(); Pos++) { Ztring Z1=__T("Column"); Z1+=Ztring::ToZtring(Pos); //Searching Stream kind stream_t S; ZenLib::Char C=__T('G'); if (Prefs->Details[Prefs_Sheet].Find(Z1)==(size_t)-1) break; C=Prefs->Details[Prefs_Sheet](Z1, 1)[0]; switch (C) { case __T('G'): S=Stream_General; break; case __T('V'): S=Stream_Video; break; case __T('A'): S=Stream_Audio; break; case __T('T'): S=Stream_Text; break; case __T('C'): S=Stream_Other; break; default: S=Stream_General; } //Showing SheetF(1+FilePos, Pos)=ToExport->Get(FilePos, S, Prefs->Details[Prefs_Sheet](Z1, 2).To_int32u(), Prefs->Details[Prefs_Sheet](Z1, 3)); } //Separators Ztring Separator_Col=ZEN_UNICODE(Sheet_Separator_Col->Text); if (Separator_Col==__T("(Tab)")) Separator_Col=__T("\t"); Ztring Separator_Line=ZEN_UNICODE(Sheet_Separator_Line->Text); if (Separator_Line==__T("(Default)")) #ifdef WIN32 Separator_Line=__T("\r\n"); #else #error #endif //WIN32 if (Separator_Line==__T("\\r\\n")) Separator_Line=__T("\r\n"); if (Separator_Line==__T("\\r")) Separator_Line=__T("\r"); if (Separator_Line==__T("\\n")) Separator_Line=__T("\n"); Ztring Quote=ZEN_UNICODE(Sheet_Quote->Text); Append_Separator=Separator_Line.c_str(); SheetF.Separator_Set(0, Separator_Line); SheetF.Separator_Set(1, Separator_Col); SheetF.Quote_Set(Quote); if (File_Append->Checked) SheetF.Delete(0); Text=SheetF.Read().c_str(); } else if (Export->ActivePage==Export_Text) { ToExport->Option_Static(__T("Inform")); Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_HTML) { ToExport->Option_Static(__T("Inform"), __T("HTML")); Text=ToExport->Inform().c_str(); Append_Separator=__T("<hr>\r\n"); } else if (Export->ActivePage==Export_XML) { ToExport->Option_Static(__T("Inform"), __T("XML")); if (Export_XML_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".mediainfo.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_MPEG7) { ToExport->Option_Static(__T("Inform"), __T("MPEG-7")); if (Export_MPEG7_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".mpeg7.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_PBCore) { ToExport->Option_Static(__T("Inform"), __T("PBCore_1.2")); if (Export_PBCore_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".PBCore.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_PBCore2) { ToExport->Option_Static(__T("Inform"), __T("PBCore_2.0")); if (Export_PBCore2_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".PBCore2.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_EBUCore_1_5) { ToExport->Option_Static(__T("Inform"), __T("EBUCore_1.5")); if (Export_EBUCore_1_5_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".EBUCore.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_EBUCore_1_6) { ToExport->Option_Static(__T("Inform"), __T("EBUCore_1.6")); if (Export_EBUCore_1_6_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".EBUCore.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_FIMS_1_1) { ToExport->Option_Static(__T("Inform"), __T("FIMS_1.1")); if (Export_FIMS_1_1_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".FIMS.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_FIMS_1_2) { ToExport->Option_Static(__T("Inform"), __T("FIMS_1.2")); if (Export_FIMS_1_2_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".FIMS.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_FIMS_1_3) { ToExport->Option_Static(__T("Inform"), __T("FIMS_1.3")); if (Export_FIMS_1_3_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".FIMS.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_reVTMD) { ToExport->Option_Static(__T("Inform"), __T("reVTMD")); if (Export_reVTMD_SideCar->Checked) { for (size_t Pos=0; Pos<ToExport->Count_Get(); Pos++) { Text=ToExport->Inform(Pos).c_str(); File F; F.Create(Ztring(ToExport->Get(Pos, Stream_General, 0, __T("CompleteName")).c_str())+__T(".reVTMD.xml")); F.Write(Text); } return; } Text=ToExport->Inform().c_str(); } else if (Export->ActivePage==Export_Custom) { ToExport->Option_Static(__T("Inform"), Prefs->Details[Prefs_Custom].Read()); if (Custom_One->State==cbChecked) { for (int FilePos=0; FilePos<ToExport->Count_Get(); FilePos++) { Ztring Z1=ToExport->Inform(FilePos).c_str(); //Put begin and end of file Z1=Prefs->Details[Prefs_Custom](Stream_Max+2, 1)+Z1; //Begin Z1+=Prefs->Details[Prefs_Custom](Stream_Max+4, 1); //End Z1.FindAndReplace(__T("\\r\\n"),__T( "\r\n"), 0, Ztring_Recursive); Text=Z1.c_str();;//Write file File F; FileName FN=ZEN_UNICODE(Name->Text); FN.Name_Set(FN.Name_Get()+Ztring::ToZtring(FilePos).c_str()); F.Open(FN, File::Access_Write); F.Write(Text); } return; //No need to save the file, already done } else Text=ToExport->Inform().c_str(); } //Writing file File F; if (File_Append->Checked) { F.Open(ZEN_UNICODE(Name->Text), File::Access_Write_Append); F.Write(Append_Separator); } else F.Create(ZEN_UNICODE(Name->Text)); F.Write(Text); }