Changeset 346 for branches


Ignore:
Timestamp:
Nov 2, 2009, 3:32:44 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

GUI-Tools: EVFSGUI Version 2.0 beta4 level code

Location:
branches/guitools-2.0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/guitools-2.0/evfsgui/changes

    r345 r346  
    33- Debug on/off option is badly implemented (rework required)
    44- Create Icon. stem in order to ease maintainance of icons
     5
     6Version 2.0 beta4 2009-11-03:
     7- Fixed: Do not crash on outdated temporary files
     8- Fixed: Do not crash on unavailable machines
    59
    610Version 2.0 beta3 2009-10-29:
  • branches/guitools-2.0/evfsgui/evfsgui.VRP

    r345 r346  
    88VRXWindow: __VREMainWindow,1,1072,1783,891,3951
    99VRXWindow: __VRESectionListWindow,1,602,11708,11033,3342
    10 VRXWindow: __VREToolsWindow,1,1963,819,6986,1661
     10VRXWindow: __VREToolsWindow,1,1963,819,6992,1665
    1111UserFile: 1
    1212UserWindow: Main,1
  • branches/guitools-2.0/shared/smbtree.vrs

    r345 r346  
    8787                smbtree.!machine = VRMethod( "CN_smbtree", "AddRecord",parent,, machine||'0D0A'x||comment)
    8888                /* We make any machine as sleeping initially */
    89                 ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'Icon',"#61:PMWP.DLL")
     89                ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "Icon","#61:PMWP.DLL")
    9090                ok = VRMethod( "CN_smbtree", "SetRecordAttr", smbtree.!machine, "ReadOnly", 1)
    91                 ok = VRMethod( "CN_smbtree", "SetFieldData", smbtree.!machine, NBFH, machine, CommentFH, Comment, WorkGroupFH, CurWG)
     91                ok = VRMethod( "CN_smbtree", "SetFieldData",  smbtree.!machine, NBFH, machine, CommentFH, Comment, WorkGroupFH, CurWG)
    9292                ok = VRSet( "CN_smbtree", "Painting", 0  )
    9393                if VRGet("CN_smbtree","View") = "Detail" then do
     
    170170    say "_RefreshShares() started"
    171171    RefreshID = RANDOM()
    172     smbshares = TempDir||"smbshares."||machine
    173 
    174     say         'detach 'samba.!smbclientexe' -L "'strip(machine)'" 'UserCred' 'debuglevel' 1>'smbshares' 2>NUL'
    175     address cmd 'detach 'samba.!smbclientexe' -L "'strip(machine)'" 'UserCred' 'debuglevel' 1>'smbshares' 2>NUL'
     172    smbmachine = TempDir||"smbmachine."||machine
     173
     174    say         'detach 'samba.!smbclientexe' -L "'strip(machine)'" 'UserCred' 'debuglevel' 1>'smbmachine' 2>NUL'
     175    address cmd 'detach 'samba.!smbclientexe' -L "'strip(machine)'" 'UserCred' 'debuglevel' 1>'smbmachine' 2>NUL'
    176176
    177177    RefreshMode = "SHARE"
     
    186186    say "_AddSharesDisplay() started"
    187187
    188     ok = SysFileTree(Tempdir||'smbshares.*',smbshare.,'FO')
    189 
    190     if smbshare.0 = 0 then do /* we are done, no more files around, cleanup, disable Timer and exit */
     188    ok = SysFileTree(Tempdir||'smbmachine.*',smbmachine.,'FO')
     189    say ' 'smbmachine.0' file(s) to process.'
     190
     191    if smbmachine.0 = 0 then do /* we are done, no more files around, cleanup, disable Timer and exit */
    191192        RefreshMode = ""
    192193        ok = VRSet("CN_smbtree","Enabled", 1)
     
    202203    if ShowHidden = 'SHOWHIDDEN' | ShowHidden = '' then ShowHidden = 0
    203204
    204     do I = 1 to smbshare.0
    205         stat = stream(smbshare.I,'c','open read')
     205    do I = 1 to smbmachine.0
     206        say ' Going for "'smbmachine.I'"'
     207        stat = stream(smbmachine.I,'c','open read')
    206208        if stat = "READY:" then do /* we found a readable output file */
    207             Machine = VRParseFilename(smbshare.I,'E')
     209            Machine = VRParseFilename(smbmachine.I,'E')
    208210            smbtree.!machine = _GetMachinehandle(Machine)
    209 
    210             line = linein(smbshare.I)
    211             say line
     211            say '  Machine (handle) = "'machine'" ('smbtree.!machine')'
     212
     213            if smbtree.!machine = "" then do /* invalid (old) file */
     214                say "_AddSharesDisplay() exit with Invalid file found (no corresponding machine)"
     215                ok = stream(smbmachine.I,'c','close')
     216                ok = SysFileDelete(smbmachine.I)
     217                iterate
     218            end
     219            line = linein(smbmachine.I)
     220            say '  Answer "'line'"'
    212221            ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'UserData', "SERVER|"||strip(line))
    213222
    214             if left(line, 20) = "session setup failed" then do /* we see an error message */
    215                 say left(line, 20)
    216                 signal sharecleanup
     223            if pos("FAIL", translate(line)) > 0 then do /* we see an error message - the term "FAIL" seems to be common to all */
     224                say '_AddSharesDisplay() exit with "'line'"'
     225                ok = stream(smbmachine.I,'c','close')
     226                ok = SysFileDelete(smbmachine.I)
     227                iterate
    217228            end
    218229
    219230            retries = 0
    220231            do while(left(line,1) <> '09'x)
    221                 line = linein(smbshare.I)
     232                line = linein(smbmachine.I)
    222233                retries = retries + 1
    223                 say 'Retry 'retries
     234                say '  Skip 'retries' "'line'"'
    224235                if retries >=10 then do /* No valid output - error */
    225                     signal sharecleanup
    226                 end
    227             end
     236                    say "_AddSharesDisplay() exit with invalid output error"
     237                    ok = stream(smbmachine.I,'c','close')
     238                    ok = SysFileDelete(smbmachine.I)
     239                    leave
     240                end
     241            end
     242            if retries >=10 then iterate
    228243
    229244            /* Skip header */
    230             line = linein(smbshare.I)
    231             line = linein(smbshare.I)
     245            line = linein(smbmachine.I)
     246            line = linein(smbmachine.I)
    232247
    233248            if left(line,5) = "Error" then ok = VRMethod('CN_smbtree', 'SetRecordAttr', smbtree.!machine, 'UserData', "SERVER|"||strip(line))
     
    254269
    255270                /* get next share */
    256                 line = linein(smbshare.I)
    257             end
    258 sharecleanup:
    259             say "_AddSharesDisplay() cleanup"
    260             ok = stream(smbshare.I,'c','close')
    261             ok = SysFileDelete(smbshare.I)
    262             if ok <> 0 then say 'Failure 'ok' deleting "'smbshare.I'"!'
     271                line = linein(smbmachine.I)
     272            end
     273
     274            say "_AddSharesDisplay() success and cleanup"
     275            ok = stream(smbmachine.I,'c','close')
     276            ok = SysFileDelete(smbmachine.I)
     277            if ok <> 0 then say 'Failure 'ok' deleting "'smbmachine.I'"!'
    263278        end
     279        else say '  Got "'stat'" for "'smbmachine.I'"'
    264280    end
    265281    say "_AddSharesDisplay() loop finished"
     
    270286
    271287_GetMachinehandle: procedure
    272     Machine = arg(1)
     288    Machine = translate(arg(1))
     289
    273290    ok = VRMethod("CN_smbtree", "GetRecordList", "All", rh.)
     291    match = 0
    274292
    275293    do I = 1 to rh.0
    276 
    277         ResName  = VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Caption")
     294        ResName  = translate(VRMethod("CN_smbtree","GetRecordAttr",rh.I,"Caption"))
    278295
    279296        parse var ResName  ResName '0D0A'x .
    280297        ResName = strip(ResName)
    281298
    282         if Machine = ResName then leave /* we got a matching name */
    283     end 
     299        if Machine = ResName then do /* we got a matching name */
     300            match = 1
     301            leave
     302        end
     303    end
     304    if match = 0 then rh.I = "" /* return an empty handle, if there was no match */
    284305return rh.I
Note: See TracChangeset for help on using the changeset viewer.