[V4Rb 2] File format version

Charles Yeomans yeomans at desuetude.com
Thu Oct 6 18:11:21 CDT 2005


On Oct 6, 2005, at 5:48 PM, Ruslan Zasukhin wrote:

> On 10/7/05 12:38 AM, "Charles Yeomans" <yeomans at desuetude.com> wrote:
>
>>>> I mean the Valentina database file format.  As you know, it changed
>>>> from v1 to v2.  So I should write code like
>>>>
>>>> If Valentina.GetDatabaseVersion((theFile) < &h200 then
>>>> ...
>>>> Else
>>>> Msgbox "This is a v1 file."
>>>> End if
>>>>
>>>> Now suppose that you change the Valentina file format again.  What I
>>>> want is a function that returns &h200 now, and the correct value in
>>>> the
>>>> future.
>>>
>>> Charles,
>>>
>>> You have not read my text deeply:
>>>
>>>     this function EXTRACT version from db file !
>>>
>>> So it will always work correctly for a given file
>>
>>
>> Let's try this again.  I understand what Valentina.GetDatabaseVersion
>> does; it tells me the file format version of the file.  V4Rb expects 
>> to
>> see a certain database file format.  How am I to know what that format
>> is, so that I can compare that to the value returned by
>> Valentina.GetDatabaseVersion?
>>
>> In other words, given the code
>>
>> If Valentina.GetDatabaseVersion((theFile) < &h200 then
>>
>> I want to replace the &h200 on the right-hand side with a Valentina
>> module function that returns the file format version expected by V4Rb.
>
> Okay, now I better see what you want.
>
>     Function instead of numeric value?
>     Function which return CURRENT format which plugin do use ?
>
> if Valentina.GetDatabaseVersion((theFile) < &h200 then
>  ...
> Else
>   Msgbox "This is a v1 file."
> End if
>
> Can you show code of task which you cannot solve now ?
>
>     currentFormatVersion = new function you want()
>
>     foundFormatVersion = Valentina.GetDatabaseVersion((theFile)
>
>     if currentFormatVersion = foundFormatVersion
>
>     else
>
>     end
>
> ?


Right now I can do the following.

if Valentina.GetDatabaseVersion((theFile) < &h200 then
  ...
Else
   Msgbox "This is a v1 file."
End if

If the database file format changes later, I must remember to look for 
the constant &h200 representing the current Valentina file format and 
change it.  If there were a function Valentina.DatabaseVersion() as 
Integer, then I can write

if Valentina.GetDatabaseVersion((theFile) < Valentina.DatabaseVersion() 
then
   Msgbox "I need to update the file format."
End if

and upgrading the plugin does not require changing the code.


--------------
Charles Yeomans



More information about the Valentina mailing list