//--------------------------------------------------------------------------- // Write void ZtringListList::Write(const Ztring &ToWrite) { clear(); if (!&ToWrite || !ToWrite.size()) return; size_type PosC=0; bool Fini=false; Ztring C1; ZtringList ZL1; ZL1.Separator_Set(0, Separator[1]); ZL1.Quote_Set(Quote); ZL1.Max_Set(0, Max[1]); do { C1=ToWrite.SubString(_T(""), Separator[0], PosC, Ztring_AddLastItem); ZL1.Write(C1); push_back(ZL1); PosC+=C1.size()+Separator[0].size(); if (PosC>=ToWrite.size()) Fini=true; } while (!Fini); }
//--------------------------------------------------------------------------- void File_Celt::Comment() { Element_Name("Comment?"); while (Element_Offset<Element_Size) { Ztring value; int32u size; Get_L4(size, "size"); if (size) Get_Local(size, value, "value"); //Filling if (value.find(__T("CELT "))!=std::string::npos) { Ztring Version=value.SubString(__T("CELT "), __T(" (")); Fill(Stream_Audio, 0, Audio_Encoded_Library, __T("CELT ")+Version); Fill(Stream_Audio, 0, Audio_Encoded_Library_Name, __T("CELT")); Fill(Stream_Audio, 0, Audio_Encoded_Library_Version, Version); } else if (!value.empty()) Fill(Stream_Audio, 0, "Comment", value); } Finish("CELT"); }
//--------------------------------------------------------------------------- void File_Cmml::Configuration() { Element_Name("Configuration"); //Parsing Ztring Data; Get_UTF8(Element_Size, Data, "Data"); FILLING_BEGIN(); Ztring Value; Value=Data.SubString(_T("<head>"), _T("</head>")); if (!Value.empty()) Fill(Stream_Text, 0, Text_Title, Value.SubString(_T("<title>"), _T("</title>"))); if (Data.find(_T("<clip"))!=string::npos) Finish("CMML"); FILLING_END(); }
//--------------------------------------------------------------------------- // Write void ZtringList::Write(const Ztring &ToWrite) { clear(); if (ToWrite.empty()) return; size_type PosC=0; bool Fini=false; Ztring C1; Ztring DelimiterL; Ztring DelimiterR; do { //Searching quotes if (ToWrite[PosC]==Quote[0]) { size_t Pos_End=PosC+1; while (Pos_End<ToWrite.size()) { if (ToWrite[Pos_End]==Quote[0] && Pos_End+1<ToWrite.size() && ToWrite[Pos_End+1]==Quote[0]) Pos_End+=2; //Double quote, skipping else { if (ToWrite[Pos_End]==Quote[0]) break; Pos_End++; } } C1=ToWrite.substr(PosC+Quote.size(), Pos_End-PosC); PosC+=C1.size()+Quote.size(); if (C1.size()>0 && C1[C1.size()-1]==Quote[0]) { C1.resize(C1.size()-1); PosC+=Quote.size(); } } else //Normal { C1=ToWrite.SubString(tstring(), Separator[0], PosC, Ztring_AddLastItem); PosC+=C1.size()+Separator[0].size(); } C1.FindAndReplace(Quote+Quote, Quote, 0, Ztring_Recursive); if (size()<Max[0]) push_back(C1); if (PosC>=ToWrite.size()) Fini=true; } while (!Fini); return; }
//--------------------------------------------------------------------------- // Write void ZtringList::Write(const Ztring &ToWrite) { clear(); if (!&ToWrite || !ToWrite.size()) return; size_type PosC=0; bool Fini=false; Ztring C1; Ztring DelimiterL; Ztring DelimiterR; do { if (ToWrite.size()>PosC && Quote.size()>0 && ToWrite[PosC]==Quote[0] && ToWrite.substr(PosC, Quote.size())==Quote) //Quote found (ToWrite[PosC]==Quote[0] is here for optimization { DelimiterL=Quote; DelimiterR=Quote+Separator[0]; } else { DelimiterL.clear(); DelimiterR=Separator[0]; } C1=ToWrite.SubString(DelimiterL, DelimiterR, PosC, Ztring_AddLastItem); if (DelimiterR.size()>Separator[0].size() && C1.size()==ToWrite.size()-Quote.size()-PosC) //This is the last item of the line, we must suppress the Quote at the end C1.resize(C1.size()-Quote.size()); if (size()<Max[0]) push_back(C1); else { //No more adding is permit, we add to the last element (with the separator) at(size()-1)+=Separator[0]; at(size()-1)+=C1; } PosC+=C1.size()+DelimiterL.size()+DelimiterR.size(); if (PosC>=ToWrite.size()) Fini=true; } while (!Fini); return; }
int Test_Version(char* FileName_, char* Begin, char* End) { wxString FileName=Ztring().From_Local(FileName_).c_str(); //Opening File F.Open(FileName); I=F.Read(C, 1000000); if (!I) { ToShow+=__T("Error opening ")+FileName; return -1; } //Getting information C[I]=0; Z.From_Local(C); Z=Z.SubString(Ztring().From_Local(Begin), Ztring().From_Local(End)); //deleting extra bytes if (Z[Z.size()-1]=='\n') Z.resize(Z.size()-1); if (Z[Z.size()-1]=='\r') Z.resize(Z.size()-1); //Testing validity if (Z.size()!=3 && Z.size()!=7) //non long, no short { ToShow+=__T("Error reading ")+FileName; return -2; } //Reformtation information Z.FindAndReplace(__T(","), __T("."), 0, Ztring_Recursive); if (Z!=Version && Z!=Version_Short) { ToShow+=FileName; ToShow+=__T(" is not good : version is marked "); ToShow+=Z; ToShow+=__T("\r\n"); } return 0; }
//--------------------------------------------------------------------------- void File_ApeTag::Data_Parse() { //If footer if (Element_Code==(int64u)-1) { HeaderFooter(); Finish("ApeTag"); return; } //Parsing Ztring Value; Get_UTF8(Element_Size, Value, "Value"); Element_Info(Value); //Filling transform(Key.begin(), Key.end(), Key.begin(), (int(*)(int))toupper); //(int(*)(int)) is a patch for unix if (Key=="ALBUM") Fill(Stream_General, 0, General_Album, Value); else if (Key=="ARTIST") Fill(Stream_General, 0, General_Performer, Value); else if (Key=="AUTHOR") Fill(Stream_General, 0, General_WrittenBy, Value); else if (Key=="BAND") Fill(Stream_General, 0, General_Performer, Value); else if (Key=="COMMENT") Fill(Stream_General, 0, General_Comment, Value); else if (Key=="COMMENTS") Fill(Stream_General, 0, General_Comment, Value); else if (Key=="COMPOSER") Fill(Stream_General, 0, General_Composer, Value); else if (Key=="CONTENTGROUP") Fill(Stream_General, 0, General_Genre, Value); else if (Key=="COPYRIGHT") Fill(Stream_General, 0, General_Copyright, Value); else if (Key=="DISK") { if (Value.find(_T("/"))!=Error) { Fill(Stream_General, 0, General_Part_Position_Total, Value.SubString(_T("/"), _T(""))); Fill(Stream_General, 0, General_Part_Position, Value.SubString(_T(""), _T("/"))); } else Fill(Stream_General, 0, General_Track_Position, Value); } else if (Key=="ENCODEDBY") Fill(Stream_General, 0, General_EncodedBy, Value); else if (Key=="GENRE") Fill(Stream_General, 0, General_Genre, Value); else if (Key=="ORIGARTIST") Fill(Stream_General, 0, General_Original_Performer, Value); else if (Key=="TITLE") Fill(Stream_General, 0, General_Title, Value); else if (Key=="TRACK") { if (Value.find(_T("/"))!=Error) { Fill(Stream_General, 0, General_Track_Position_Total, Value.SubString(_T("/"), _T(""))); Fill(Stream_General, 0, General_Track_Position, Value.SubString(_T(""), _T("/"))); } else Fill(Stream_General, 0, General_Track_Position, Value); } else if (Key=="UNSYNCEDLYRICS") Fill(Stream_General, 0, General_Lyrics, Value); else if (Key=="WWW") Fill(Stream_General, 0, General_Title_Url, Value); else if (Key=="YEAR") Fill(Stream_General, 0, General_Recorded_Date, Value); else if (Key=="CONTENT GROUP DESCRIPTION") Fill(Stream_General, 0, General_Title, Value); else if (Key=="ORIGINAL ALBUM/MOVIE/SHOW TITLE") Fill(Stream_General, 0, General_Original_Album, Value); else if (Key=="ORIGINAL ARTIST(S)/PERFORMER(S)") Fill(Stream_General, 0, General_Original_Performer, Value); else if (Key=="MP3GAIN_MINMAX") Fill(Stream_Audio, 0, "MP3Gain, Min/Max", Value); else if (Key=="MP3GAIN_UNDO") Fill(Stream_Audio, 0, "MP3Gain, Undo", Value); else if (Key=="REPLAYGAIN_TRACK_GAIN") Fill(Stream_Audio, 0, Audio_ReplayGain_Gain, Value.To_float64(), 2, true); else if (Key=="REPLAYGAIN_TRACK_PEAK") Fill(Stream_Audio, 0, Audio_ReplayGain_Peak, Value.To_float64(), 6, true); else Fill(Stream_General, 0, Key.c_str(), Value); }
Ztring OldFiles_Test () { //Checking version in Info_Version ToShow+=__T("Version checked : "); F.Open(__T("../Source/MediaInfo/MediaInfo_Config.cpp")); I=F.Read(C, 1000000); if (!I) { ToShow+=__T("Error opening ../Source/MediaInfo/MediaInfo_Config.cpp"); return ToShow; } C[I]=0; Z.From_Local(C); Version=Z.SubString(__T("MediaInfoLib - v"), __T("\")")); if (Version.size()!=7) { ToShow+=__T("Error reading ../Source/MediaInfo/MediaInfo.cpp : \"MediaInfoLib - vX.X.X.X - \" not found"); return ToShow; } Version_Short=Version; Version_Short.resize(3); ToShow+=Version+__T("\r\n"); //Checking version in MediaInfo.h if (Test_Version("../Source/MediaInfo/MediaInfo.h", "@version ", "\n")) return ToShow; if (Test_Version("../Source/MediaInfo/MediaInfoList.h", "@version ", "\n")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " FILEVERSION ", "\n")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " PRODUCTVERSION ", "\n")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " VALUE \"FileVersion\", \"", "\"")) return ToShow; if (Test_Version("../Project/MSVC/Dll/MediaInfo.rc", " VALUE \"ProductVersion\", \"", "\"")) return ToShow; if (Test_Version("../History.txt", "Version ", " ")) return ToShow; if (Test_Date(__T("MSVC/Library/MediaInfo.lib"))) return ToShow; if (Test_Date(__T("MSVC/Dll/MediaInfo.dll"))) return ToShow; return ToShow; }