diff --git a/Convert_VFP9_BIN_2_PRG.vbs b/Convert_VFP9_BIN_2_PRG.vbs index 6a6fde3..a93516c 100644 --- a/Convert_VFP9_BIN_2_PRG.vbs +++ b/Convert_VFP9_BIN_2_PRG.vbs @@ -13,14 +13,13 @@ '--------------------------------------------------------------------------------------------------- Const ForReading = 1 Dim WSHShell, FileSystemObject -Dim oVFP9, nExitCode, cEXETool, cCMD, nDebug, cConvertType, aExtensions(8), foxbin2prg_cfg, aFiles(), nFile_Count +Dim oVFP9, nExitCode, cEXETool, cCMD, nDebug, lcExt, foxbin2prg_cfg, aFiles(), nFile_Count Dim i, x, str_cfg, aConf, cErrMsg, cFlagGenerateLog, cFlagDontShowErrMsg, cFlagJustShowCall, cFlagRecompile, cNoTimestamps Set WSHShell = WScript.CreateObject("WScript.Shell") Set FileSystemObject = WScript.CreateObject("Scripting.FileSystemObject") Set oVFP9 = CreateObject("VisualFoxPro.Application.9") foxbin2prg_cfg = Replace(WScript.ScriptFullName, WScript.ScriptName, "foxbin2prg.cfg") nExitCode = 0 -cConvertType = "BIN2PRG" '<<< This is the only difference between the 2 scripts '--------------------------------------------------------------------------------------------------- 'Cumulative Flags: ' 0=OFF @@ -32,54 +31,8 @@ cConvertType = "BIN2PRG" '<<< This is the only difference between the 2 scripts nDebug = 1+0+4+0+16 '--------------------------------------------------------------------------------------------------- -If cConvertType = "BIN2PRG" Then - aExtensions(1) = "PJX" - aExtensions(2) = "VCX" - aExtensions(3) = "SCX" - aExtensions(4) = "FRX" - aExtensions(5) = "LBX" - aExtensions(6) = "DBF" - aExtensions(7) = "DBC" - aExtensions(8) = "MNX" -Else - '-- Extensiones TXT por defecto - aExtensions(1) = "PJ2" - aExtensions(2) = "VC2" - aExtensions(3) = "SC2" - aExtensions(4) = "FR2" - aExtensions(5) = "LB2" - aExtensions(6) = "DB2" - aExtensions(7) = "DC2" - aExtensions(8) = "MN2" - - If FileSystemObject.FileExists( foxbin2prg_cfg ) Then - '-- Existe el archivo de configuración foxbin2prg.cgf - Set objTextFile = FileSystemObject.OpenTextFile( foxbin2prg_cfg, ForReading ) - - Do Until objTextFile.AtEndOfStream - strNextLine = objTextFile.Readline - arrFb2p_CFG = Split(strNextLine , ",") - For i = 0 to Ubound(arrFb2p_CFG) - If Left( arrFb2p_CFG(i), 10 ) = "extension:" Then - aConf = Split( arrFb2p_CFG(i), ":" ) 'Obtengo la separación de "extensión:" y "ext:equiv" - str_cfg = UCase( Trim( aConf(1) ) ) - aConf = Split( str_cfg, "=" ) 'Obtengo la separación de extensión y equivalencia (vc2=vca) - - For x = 1 TO 8 - If aExtensions(x) = aConf(0) Then - aExtensions(x) = UCase( aConf(1) ) - Exit For - End If - Next - Else - 'Wscript.Echo "Saltear: " & arrFb2p_CFG(i) - End If - Next - Loop - End If -End if - If WScript.Arguments.Count = 0 Then + 'SIN PARÁMETROS nExitCode = 1 cErrMsg = "nDebug = " & nDebug If GetBit(nDebug, 1) Then @@ -99,11 +52,14 @@ If WScript.Arguments.Count = 0 Then End If MsgBox cErrMsg, 64, "No parameters - Debug Status" Else + 'CON PARÁMETROS cEXETool = Replace(WScript.ScriptFullName, WScript.ScriptName, "foxbin2prg.exe") nFile_Count = 0 oVFP9.DoCmd( "SET PROCEDURE TO '" & cEXETool & "'" ) oVFP9.DoCmd( "PUBLIC oFoxBin2prg" ) oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" ) + '.o_FoxBin2Prg.EvaluarConfiguracion( tcDontShowProgress, tcDontShowErrors, tcNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels ) + oVFP9.DoCmd( "oFoxBin2prg.EvaluarConfiguracion( '1', '1' )" ) oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" ) For i = 0 To WScript.Arguments.Count-1 @@ -185,14 +141,13 @@ End Sub Private Sub evaluateFile( tcFile ) - For x = 1 TO UBound(aExtensions,1) - If aExtensions(x) = UCase( FileSystemObject.GetExtensionName( tcFile ) ) Then - nFile_Count = nFile_Count + 1 - ReDim Preserve aFiles(nFile_Count) - aFiles(nFile_Count) = tcFile - Exit For - End If - Next + lcExt = UCase( FileSystemObject.GetExtensionName( tcFile ) ) + oVFP9.SetVar "gc_Ext", lcExt + If oVFP9.Eval("oFoxBin2prg.TieneSoporte_Bin2Prg(gc_Ext)") Then + nFile_Count = nFile_Count + 1 + ReDim Preserve aFiles(nFile_Count) + aFiles(nFile_Count) = tcFile + End If End Sub diff --git a/Convert_VFP9_PRG_2_BIN.vbs b/Convert_VFP9_PRG_2_BIN.vbs index cd518eb..907974a 100644 --- a/Convert_VFP9_PRG_2_BIN.vbs +++ b/Convert_VFP9_PRG_2_BIN.vbs @@ -13,14 +13,13 @@ '--------------------------------------------------------------------------------------------------- Const ForReading = 1 Dim WSHShell, FileSystemObject -Dim oVFP9, nExitCode, cEXETool, cCMD, nDebug, cConvertType, aExtensions(8), foxbin2prg_cfg, aFiles(), nFile_Count +Dim oVFP9, nExitCode, cEXETool, cCMD, nDebug, lcExt, foxbin2prg_cfg, aFiles(), nFile_Count Dim i, x, str_cfg, aConf, cErrMsg, cFlagGenerateLog, cFlagDontShowErrMsg, cFlagJustShowCall, cFlagRecompile, cNoTimestamps Set WSHShell = WScript.CreateObject("WScript.Shell") Set FileSystemObject = WScript.CreateObject("Scripting.FileSystemObject") Set oVFP9 = CreateObject("VisualFoxPro.Application.9") foxbin2prg_cfg = Replace(WScript.ScriptFullName, WScript.ScriptName, "foxbin2prg.cfg") nExitCode = 0 -cConvertType = "PRG2BIN" '<<< This is the only difference between the 2 scripts '--------------------------------------------------------------------------------------------------- 'Cumulative Flags: ' 0=OFF @@ -32,54 +31,8 @@ cConvertType = "PRG2BIN" '<<< This is the only difference between the 2 scripts nDebug = 1+0+4+0+16 '--------------------------------------------------------------------------------------------------- -If cConvertType = "BIN2PRG" Then - aExtensions(1) = "PJX" - aExtensions(2) = "VCX" - aExtensions(3) = "SCX" - aExtensions(4) = "FRX" - aExtensions(5) = "LBX" - aExtensions(6) = "DBF" - aExtensions(7) = "DBC" - aExtensions(8) = "MNX" -Else - '-- Extensiones TXT por defecto - aExtensions(1) = "PJ2" - aExtensions(2) = "VC2" - aExtensions(3) = "SC2" - aExtensions(4) = "FR2" - aExtensions(5) = "LB2" - aExtensions(6) = "DB2" - aExtensions(7) = "DC2" - aExtensions(8) = "MN2" - - If FileSystemObject.FileExists( foxbin2prg_cfg ) Then - '-- Existe el archivo de configuración foxbin2prg.cgf - Set objTextFile = FileSystemObject.OpenTextFile( foxbin2prg_cfg, ForReading ) - - Do Until objTextFile.AtEndOfStream - strNextLine = objTextFile.Readline - arrFb2p_CFG = Split(strNextLine , ",") - For i = 0 to Ubound(arrFb2p_CFG) - If Left( arrFb2p_CFG(i), 10 ) = "extension:" Then - aConf = Split( arrFb2p_CFG(i), ":" ) 'Obtengo la separación de "extensión:" y "ext:equiv" - str_cfg = UCase( Trim( aConf(1) ) ) - aConf = Split( str_cfg, "=" ) 'Obtengo la separación de extensión y equivalencia (vc2=vca) - - For x = 1 TO 8 - If aExtensions(x) = aConf(0) Then - aExtensions(x) = UCase( aConf(1) ) - Exit For - End If - Next - Else - 'Wscript.Echo "Saltear: " & arrFb2p_CFG(i) - End If - Next - Loop - End If -End if - If WScript.Arguments.Count = 0 Then + 'SIN PARÁMETROS nExitCode = 1 cErrMsg = "nDebug = " & nDebug If GetBit(nDebug, 1) Then @@ -99,11 +52,14 @@ If WScript.Arguments.Count = 0 Then End If MsgBox cErrMsg, 64, "No parameters - Debug Status" Else + 'CON PARÁMETROS cEXETool = Replace(WScript.ScriptFullName, WScript.ScriptName, "foxbin2prg.exe") nFile_Count = 0 oVFP9.DoCmd( "SET PROCEDURE TO '" & cEXETool & "'" ) oVFP9.DoCmd( "PUBLIC oFoxBin2prg" ) oVFP9.DoCmd( "oFoxBin2prg = CREATEOBJECT('c_foxbin2prg')" ) + '.o_FoxBin2Prg.EvaluarConfiguracion( tcDontShowProgress, tcDontShowErrors, tcNoTimestamps, tcDebug, tcRecompile, tcExtraBackupLevels ) + oVFP9.DoCmd( "oFoxBin2prg.EvaluarConfiguracion( '1', '1' )" ) oVFP9.DoCmd( "oFoxBin2prg.cargar_frm_avance()" ) For i = 0 To WScript.Arguments.Count-1 @@ -185,14 +141,13 @@ End Sub Private Sub evaluateFile( tcFile ) - For x = 1 TO UBound(aExtensions,1) - If aExtensions(x) = UCase( FileSystemObject.GetExtensionName( tcFile ) ) Then - nFile_Count = nFile_Count + 1 - ReDim Preserve aFiles(nFile_Count) - aFiles(nFile_Count) = tcFile - Exit For - End If - Next + lcExt = UCase( FileSystemObject.GetExtensionName( tcFile ) ) + oVFP9.SetVar "gc_Ext", lcExt + If oVFP9.Eval("oFoxBin2prg.TieneSoporte_Prg2Bin(gc_Ext)") Then + nFile_Count = nFile_Count + 1 + ReDim Preserve aFiles(nFile_Count) + aFiles(nFile_Count) = tcFile + End If End Sub diff --git a/foxbin2prg.cfg b/foxbin2prg.cfg index 5e8f5a3..9436874 100644 --- a/foxbin2prg.cfg +++ b/foxbin2prg.cfg @@ -58,6 +58,7 @@ * EN: Uncomment to activate the new value, comment to deactivate and use the default * ES: Descomente para activar el nuevo valor, comente para desactivarlo y usar el predeterminado +* 0=No support, 1=Generate TXT only (Diff), 2=Generate TXT and BIN (Merge) *--------------------------------------------------------------------------------------------------- *PJX_Conversion_Support: 2 *VCX_Conversion_Support: 2 diff --git a/foxbin2prg.pj2 b/foxbin2prg.pj2 index 5901394..ea33e3f 100644 --- a/foxbin2prg.pj2 +++ b/foxbin2prg.pj2 @@ -26,7 +26,7 @@ _LegalTrademark = "Open Source" _ProductName = " FOXBIN2PRG" _MajorVer = "1" _MinorVer = "19" -_Revision = " 282" +_Revision = " 286" _LanguageID = "1034" _AutoIncrement = "1" * @@ -50,8 +50,8 @@ MODIFY PROJECT 'foxbin2prg.pjx' NOWAIT NOSHOW NOPROJECTHOOK loProject = _VFP.Projects('foxbin2prg.pjx') WITH loProject.FILES - .ADD('config\config.fpw') && *< FileMetadata: Type="T" Cpid="1252" Timestamp="1132857145" ID="1131721714" ObjRev="0" /> - .ADD('foxbin2prg.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="1147207961" ID="1130644423" ObjRev="544" /> + .ADD('config\config.fpw') && *< FileMetadata: Type="T" Cpid="1252" Timestamp="0" ID="0" ObjRev="0" /> + .ADD('foxbin2prg.prg') && *< FileMetadata: Type="P" Cpid="1252" Timestamp="0" ID="0" ObjRev="544" /> * .ITEM('__newproject.f2b').Remove() diff --git a/foxbin2prg.pjt b/foxbin2prg.pjt index ee1f00b..6dfc31d 100644 Binary files a/foxbin2prg.pjt and b/foxbin2prg.pjt differ diff --git a/foxbin2prg.pjx b/foxbin2prg.pjx index f1d8fe4..0a99a17 100644 Binary files a/foxbin2prg.pjx and b/foxbin2prg.pjx differ diff --git a/foxbin2prg.prg b/foxbin2prg.prg index 93f80a1..c0a0253 100644 --- a/foxbin2prg.prg +++ b/foxbin2prg.prg @@ -74,6 +74,8 @@ * 09/02/2014 FDBOZZO v1.19.10 Parametrización soporte de tipo de conversión por archivo / ClearUniqueID * 13/02/2014 FDBOZZO v1.19.11 Optimizaciones WITH/ENDWITH (16%+velocidad) / Arreglo bug #IF anidados * 21/02/2014 FDBOZZO v1.19.12 Centralizar ZOrder controles en metadata de cabecera de clase para minimizar diferencias / También mover UniqueIDs y Timestamps a metadata +* 26/02/2014 FDBOZZO v1.19.13 Arreglo bug TimeStamp en archivo cfg / ExtraBackupLevels se puede desactivar / Optimizaciones / Casos FoxUnit +* 01/03/2014 FDBOZZO v1.19.14 Arreglo bug regresion cuando no se define ExtraBackupLevels no hace backups / Optimización carga cfg en batch * * *--------------------------------------------------------------------------------------------------- @@ -91,6 +93,7 @@ * 01/01/2014 Fidel Charny REPORTE BUG mnx v1.16: El menú no siempre respeta la posición original LOCATION y a veces se genera mal el MNX (se arregla en v1.17) * 05/01/2014 Fidel Charny REPORTE BUG mnx v1.17: Se genera cláusula "DO" o llamada Command cuando no Procedure ni Command que llamar // Diferencia de Case en NAME (se arregla en v1.18) * 20/02/2014 Ryan Harris PROPUESTA DE MEJORA v1.19.11: Centralizar los ZOrder de los controles en metadata de cabecera de la clase para minimizar diferencias +* 27/02/2014 BUG REGRESION v1.19.13: Si no se define ExtraBackupLevels no se generan backups (solucionado en v1.19.14) * * *--------------------------------------------------------------------------------------------------- @@ -411,6 +414,8 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM + [] ; + [] ; + [] ; + + [] ; + + [] ; + [] ; + [] ; + [] @@ -795,7 +800,8 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM .l_Recompile = (EMPTY(tcRecompile) OR TRANSFORM(tcRecompile) == '1' OR DIRECTORY(tcRecompile)) .l_NoTimestamps = NOT (TRANSFORM(tcNoTimestamps) == '0') .l_Debug = (TRANSFORM(tcDebug)=='1') - .n_ExtraBackupLevels = INT(VAL(TRANSFORM(tcExtraBackupLevels))) + tcExtraBackupLevels = EVL( tcExtraBackupLevels, TRANSFORM( .n_ExtraBackupLevels ) ) + .n_ExtraBackupLevels = INT( VAL( TRANSFORM(tcExtraBackupLevels) ) ) .writeLog( '---' ) .writeLog( '> l_ShowProgress: ' + TRANSFORM(.l_ShowProgress) ) @@ -813,13 +819,49 @@ DEFINE CLASS c_foxbin2prg AS CUSTOM ENDPROC + PROCEDURE TieneSoporte_Bin2Prg + LPARAMETERS tcExt + LOCAL llTieneSoporte + WITH THIS AS c_foxbin2prg OF 'FOXBIN2PRG.PRG' + llTieneSoporte = ICASE( tcExt == 'PJX', .PJX_Conversion_Support >= 1 ; + , tcExt == 'VCX', .VCX_Conversion_Support >= 1 ; + , tcExt == 'SCX', .SCX_Conversion_Support >= 1 ; + , tcExt == 'FRX', .FRX_Conversion_Support >= 1 ; + , tcExt == 'LBX', .LBX_Conversion_Support >= 1 ; + , tcExt == 'MNX', .MNX_Conversion_Support >= 1 ; + , tcExt == 'DBF', .DBF_Conversion_Support >= 1 ; + , tcExt == 'DBC', .DBC_Conversion_Support >= 1 ; + , .F. ) + ENDWITH && THIS + RETURN llTieneSoporte + ENDPROC + + + PROCEDURE TieneSoporte_Prg2Bin + LPARAMETERS tcExt + LOCAL llTieneSoporte + WITH THIS AS c_foxbin2prg OF 'FOXBIN2PRG.PRG' + llTieneSoporte = ICASE( tcExt == .c_PJ2, .PJX_Conversion_Support >= 2 ; + , tcExt == .c_VC2, .VCX_Conversion_Support >= 2 ; + , tcExt == .c_SC2, .SCX_Conversion_Support >= 2 ; + , tcExt == .c_FR2, .FRX_Conversion_Support >= 2 ; + , tcExt == .c_LB2, .LBX_Conversion_Support >= 2 ; + , tcExt == .c_MN2, .MNX_Conversion_Support >= 2 ; + , tcExt == .c_DB2, .DBF_Conversion_Support >= 2 ; + , tcExt == .c_DC2, .DBC_Conversion_Support >= 2 ; + , .F. ) + ENDWITH && THIS + RETURN llTieneSoporte + ENDPROC + + PROCEDURE ejecutar *-------------------------------------------------------------------------------------------------------------- * PARÁMETROS: (!=Obligatorio | ?=Opcional) (@=Pasar por referencia | v=Pasar por valor) (IN/OUT) * tc_InputFile (!v IN ) Nombre del archivo de entrada * tcType (?v IN ) NO DISPONIBLE. Se mantiene por compatibilidad con SourceSafe * tcTextName (?v IN ) NO DISPONIBLE. Se mantiene por compatibilidad con SourceSafe - * tlGenText (?v IN ) NO DISPONIBLE. Se mantiene por compatibilidad con SourceSafe + * tlGenText (?v IN ) NO DISPONIBLE. Se mantiene por compatibilidad con SourceSafe * tcDontShowErrors (?v IN ) '1' para no mostrar mensajes de error (MESSAGEBOX) * tcDebug (?v IN ) '1' para habilitar modo debug (SOLO DESARROLLO) * tcDontShowProgress (?v IN ) '1' para inhabilitar la barra de progreso @@ -2230,11 +2272,11 @@ DEFINE CLASS c_conversor_base AS SESSION * tcPropName (!v IN ) Nombre de la propiedad *-------------------------------------------------------------------------------------------------------------- LPARAMETERS tcOperation, tcPropName - LOCAL lcPropName, lnPropType + LOCAL lcPropName lcPropName = tcPropName tcOperation = UPPER(EVL(tcOperation,'')) - lnPropType = 0 && System property + *-- Por defecto son todas System Properties DO CASE CASE tcOperation == 'GETNAME' lcPropName = SUBSTR(tcPropName,5) @@ -2486,11 +2528,9 @@ DEFINE CLASS c_conversor_base AS SESSION lcPropName = 'A595' + lcPropName CASE lcPropName == '_memberdata' lcPropName = 'A995' + lcPropName - CASE lcPropName == 'Name' - lnPropType = 1 && System "Name" property + CASE lcPropName == 'Name' && System "Name" property lcPropName = 'A999' + lcPropName - OTHERWISE - lnPropType = 2 && User property + OTHERWISE && User Property lcPropName = 'A998' + lcPropName ENDCASE @@ -9375,7 +9415,7 @@ DEFINE CLASS c_conversor_pjm_a_prg AS c_conversor_bin_a_prg FOR I = 1 TO ALINES( laLines, STREXTRACT( lcStrPJM, '[ProjectFiles]', '[EOF]' ), 4 ) ALINES( laProps, laLines(I) + ',', 1, ',' ) loReg = CREATEOBJECT("EMPTY") - ADDPROPERTY( loReg, 'ID', VAL( laProps(1) ) ) + ADDPROPERTY( loReg, 'ID', IIF( toFoxBin2Prg.l_ClearUniqueID, 0, VAL( laProps(1) ) ) ) ADDPROPERTY( loReg, 'TYPE', laProps(2) ) ADDPROPERTY( loReg, 'NAME', laProps(3) ) ADDPROPERTY( loReg, 'EXCLUDE', EVALUATE( laProps(4) ) )