예제 #1
0
//---------------------------------------------------------------------------
// Sauvegarde CFG
bool ZtringListListF::CFG_Sauvegarder ()
{
    File F;
    if (!F.Create(Name, true))
        return Error;

    Ztring ToWrite;
    Ztring Propriete, Valeur, Commentaire;

    ;
    for (size_t Pos=0; Pos<size(); Pos++)
    {
        Propriete=Read(Pos, 0);
        Valeur=Read(Pos, 1);
        Commentaire=Read(Pos, 2);
        if (Propriete!=Ztring())
        {
            ToWrite+=Propriete+__T(" = ");
            if (Valeur!=Ztring())
                ToWrite+=Valeur+__T(" ");
        }
        if (Commentaire!=Ztring())
            ToWrite+=__T("; ")+Commentaire;
        ToWrite+=EOL;
    }
    F.Write(ToWrite);

    return true;
}
예제 #2
0
//---------------------------------------------------------------------------
// Sauvegarde CSV
bool ZtringListListF::CSV_Sauvegarder ()
{
    //Sauvegarde
    File F;
    if (!F.Create(Name, true))
        return Error;

    if (Separator[0]==__T("(Default)"))
        Separator[0]=EOL;

    F.Write(Read());

    return true;
}
예제 #3
0
//---------------------------------------------------------------------------
// Write a file
ZenLib::Ztring Enums_Create_Save(Ztring FileName, Ztring &Contents)
{
    File F;
    if (F.Create(FileName.c_str(), true)==false)
    {
        Ztring ToReturn=L"Problems to create ";
        ToReturn+=FileName;
        ToReturn+=L"\r\n";
        return ToReturn;
    }

    std::string S1=Contents.To_UTF8();
    size_t Size=F.Write((const int8u*)S1.c_str(), S1.size());
    Contents.From_Number(Size);
    Contents+=L" bytes written";
    return L"";
}
예제 #4
0
파일: json.cpp 프로젝트: Jesna/jucpp
	config_struct* getConfigObject(LPCWSTR name,config_struct* obj = 0){
		static ObjectList<config_struct>* dbList = 0;
		LocalCriticalSection lcs(_configCs);
		if(dbList==0){
			dbList = new (mallocGlobalStaticMem(sizeof(ObjectList<config_struct>))) ObjectList<config_struct>;
		}

		if(obj!=NULL){
			obj->icount--;
			if(obj->icount==0){
				dbList->Delete(obj);
			}
			return 0;
		}
		String fn,title;
		if(WcsLength(name)==0){
			fn = App::GetAppDirectory();
			title = App::GetAppName();
			FPLinkPath(fn,title);
			FPLinkExt(fn,L"json");
		}else{
			fn = name;
		}

		config_struct* rs = 0;
		for(uint i=0;i<dbList->Count();i++){
			rs = &(*dbList)[i];
			if(FPIsSame(fn,rs->FileName)){
				rs->icount++;
				return rs;
			}
		}
		rs = new config_struct;
		rs->icount = 1;
		if(1!=GetFileType(fn)){
			File f;
			f.Create(fn);
		}
		if(!rs->Tree.LoadFromFile(fn)){
			CONASSERT(L"config file is not a valid json format");
		}
		rs->FileName = fn;
		dbList->AddIn(rs);
		return rs;
	}
예제 #5
0
bool UpdateExistingShortName(char *Name,wchar *NameW)
{
  FindData fd;
  if (!FindFile::FastFind(Name,NameW,&fd))
    return(false);
  if (*fd.Name==0 || *fd.ShortName==0)
    return(false);
  if (stricomp(PointToName(fd.Name),fd.ShortName)==0 ||
      stricomp(PointToName(Name),fd.ShortName)!=0)
    return(false);

  char NewName[NM];
  for (int I=0;I<10000;I+=123)
  {
    strncpyz(NewName,Name,ASIZE(NewName));
    sprintf(PointToName(NewName),"rtmp%d",I);
    if (!FileExist(NewName))
      break;
  }
  if (FileExist(NewName))
    return(false);
  char FullName[NM];
  strncpyz(FullName,Name,ASIZE(FullName));
  strcpy(PointToName(FullName),PointToName(fd.Name));
  if (!MoveFile(FullName,NewName))
    return(false);
  File KeepShortFile;
  bool Created=false;
  if (!FileExist(Name))
    Created=KeepShortFile.Create(Name);
  MoveFile(NewName,FullName);
  if (Created)
  {
    KeepShortFile.Close();
    KeepShortFile.Delete();
  }
  return(true);
}
예제 #6
0
// If we find a file, which short name is equal to 'Name', we try to change
// its short name, while preserving the long name. It helps when unpacking
// an archived file, which long name is equal to short name of already
// existing file. Otherwise we would overwrite the already existing file,
// even though its long name does not match the name of unpacking file.
bool UpdateExistingShortName(const wchar *Name)
{
  wchar LongPathName[NM];
  DWORD Res=GetLongPathName(Name,LongPathName,ASIZE(LongPathName));
  if (Res==0 || Res>=ASIZE(LongPathName))
    return false;
  wchar ShortPathName[NM];
  Res=GetShortPathName(Name,ShortPathName,ASIZE(ShortPathName));
  if (Res==0 || Res>=ASIZE(ShortPathName))
    return false;
  wchar *LongName=PointToName(LongPathName);
  wchar *ShortName=PointToName(ShortPathName);

  // We continue only if file has a short name, which does not match its
  // long name, and this short name is equal to name of file which we need
  // to create.
  if (*ShortName==0 || wcsicomp(LongName,ShortName)==0 ||
      wcsicomp(PointToName(Name),ShortName)!=0)
    return false;

  // Generate the temporary new name for existing file.
  wchar NewName[NM];
  *NewName=0;
  for (int I=0;I<10000 && *NewName==0;I+=123)
  {
    // Here we copy the path part of file to create. We'll make the temporary
    // file in the same folder.
    wcsncpyz(NewName,Name,ASIZE(NewName));

    // Here we set the random name part.
    swprintf(PointToName(NewName),ASIZE(NewName),L"rtmp%d",I);
    
    // If such file is already exist, try next random name.
    if (FileExist(NewName))
      *NewName=0;
  }

  // If we could not generate the name not used by any other file, we return.
  if (*NewName==0)
    return false;
  
  // FastFind returns the name without path, but we need the fully qualified
  // name for renaming, so we use the path from file to create and long name
  // from existing file.
  wchar FullName[NM];
  wcsncpyz(FullName,Name,ASIZE(FullName));
  SetName(FullName,LongName,ASIZE(FullName));
  
  // Rename the existing file to randomly generated name. Normally it changes
  // the short name too.
  if (!MoveFile(FullName,NewName))
    return false;

  // Now we need to create the temporary empty file with same name as
  // short name of our already existing file. We do it to occupy its previous
  // short name and not allow to use it again when renaming the file back to
  // its original long name.
  File KeepShortFile;
  bool Created=false;
  if (!FileExist(Name))
    Created=KeepShortFile.Create(Name,FMF_WRITE|FMF_SHAREREAD);

  // Now we rename the existing file from temporary name to original long name.
  // Since its previous short name is occupied by another file, it should
  // get another short name.
  MoveFile(NewName,FullName);

  if (Created)
  {
    // Delete the temporary zero length file occupying the short name,
    KeepShortFile.Close();
    KeepShortFile.Delete();
  }
  // We successfully changed the short name. Maybe sometimes we'll simplify
  // this function by use of SetFileShortName Windows API call.
  // But SetFileShortName is not available in older Windows.
  return true;
}
예제 #7
0
// If we find a file, which short name is equal to 'Name', we try to change
// its short name, while preserving the long name. It helps when unpacking
// an archived file, which long name is equal to short name of already
// existing file. Otherwise we would overwrite the already existing file,
// even though its long name does not match the name of unpacking file.
bool UpdateExistingShortName(wchar *Name)
{
  // 'Name' is the name of file which we want to create. Let's check
  // if file with such name is exist. If it does not, we return.
  FindData fd;
  if (!FindFile::FastFind(NULL,Name,&fd))
    return(false);

  // We continue only if file has a short name, which does not match its
  // long name, and this short name is equal to name of file which we need
  // to create.
  if (*fd.ShortName==0 || wcsicomp(PointToName(fd.NameW),fd.ShortName)==0 ||
      wcsicomp(PointToName(Name),fd.ShortName)!=0)
    return(false);

  // Generate the temporary new name for existing file.
  wchar NewName[NM];
  *NewName=0;
  for (int I=0;I<10000 && *NewName==0;I+=123)
  {
    // Here we copy the path part of file to create. We'll make the temporary
    // file in the same folder.
    wcsncpyz(NewName,Name,ASIZE(NewName));

    // Here we set the random name part.
    sprintfw(PointToName(NewName),ASIZE(NewName),L"rtmp%d",I);
    
    // If such file is already exist, try next random name.
    if (FileExist(NULL,NewName))
      *NewName=0;
  }

  // If we could not generate the name not used by any other file, we return.
  if (*NewName==0)
    return(false);
  
  // FastFind returns the name without path, but we need the fully qualified
  // name for renaming, so we use the path from file to create and long name
  // from existing file.
  wchar FullName[NM];
  wcsncpyz(FullName,Name,ASIZE(FullName));
  wcscpy(PointToName(FullName),PointToName(fd.NameW));
  
  // Rename the existing file to randomly generated name. Normally it changes
  // the short name too.
  if (!MoveFileW(FullName,NewName))
    return(false);

  // Now we need to create the temporary empty file with same name as
  // short name of our already existing file. We do it to occupy its previous
  // short name and not allow to use it again when renaming the file back to
  // its original long name.
  File KeepShortFile;
  bool Created=false;
  if (!FileExist(NULL,Name))
    Created=KeepShortFile.Create(NULL,Name);

  // Now we rename the existing file from temporary name to original long name.
  // Since its previous short name is occupied by another file, it should
  // get another short name.
  MoveFileW(NewName,FullName);

  if (Created)
  {
    // Delete the temporary zero length file occupying the short name,
    KeepShortFile.Close();
    KeepShortFile.Delete();
  }
  // We successfully changed the short name. Maybe sometimes we'll simplify
  // this function by use of SetFileShortName Windows API call.
  // But SetFileShortName is not available in older Windows.
  return(true);
}
예제 #8
0
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);
}