%--------------------------------------------------REMOTE FILE SEND STUFF----------------------------
%----------Must have varaible --------------
var lock : int := 0
var rou2 : string := ""
%Load Bar
procedure GUIpercent (x1, y1, x2, y2, num : int)
drawfillbox (x1 - 2, y1 - 2, x2 + 2, y2 + 2, grey)
drawbox (x1 - 2, y1 - 2, x2 + 2, y2 + 2, black)
for i : 1 .. round ((x2 - x1) * num / 100) by 10
drawfillbox (x1 + i, y1, x1 + i + 7, y2, blue)
end for
end GUIpercent
%----------------SAFE MODE TRANSFER PROCEDURE-------------
procedure safe
var temp : string
put "Do you want to transfer files in safe or fast mode?"
put "Safe Mode: Less Chance of Data Loss"
put "Fast Mode: More Chance of Data Loss"
put "(S / F)"
get temp
put temp
if length (temp) > 1 then
put "INVALID ENTRY"
delay (1000)
cls
safe
elsif temp not= "s" and temp not= "S" and temp not= "F" and temp not= "f" then
put "INVALID ENTRY"
delay (1000)
cls
safe
elsif temp = "s" or temp = "S" then
lock := 0
else
lock := 1
end if
end safe
%---------------------------------SEND MODULE--------------------------
procedure filesend
var w1 : int
w1 := Window.Open ("title:SEND MODULE,graphics:500;200,nobuttonbar")
%-----------------get file name-----
var file : string
%------------menu choce-----------
var c : int
%----------fILEid----------
var send : int
%----TYPE of OUTPUT/INPUT------
var typ : string := ""
%------------port--------
var p1 : int := 28001
%-----------connection path-------------
var netStream : int
%-----------------net address----------
var net : string
%----------------percent done-------------
var rou : real
var lines, totallines : real := 0
var temp : real := 0
%--------------End percent done---------
safe
cls
%--------------------------GET READY TO SEND----------------
put "Enter file name to send.... " ..
get file
cls
%---------------------SIZE------------------------
put "Please hold... Calculating Size..."
open : send, file, get
loop
exit when eof (send)
get : send, typ : *
totallines := totallines + 1
end loop
close (send)
%---------------------CONTINUE----------------
cls
put "Enter host to send file too... " ..
get net
cls
put "Opening connection...."
netStream := Net.OpenConnection (net, p1)
cls
if netStream <= 0 then
put "Unable to Resolve Host: ", net, " On Port: ", p1
delay (4000)
quit
end if
%----------------------------LOOP SEND--------------------
open : send, file, get
put "Sending file... Press Any Key to Stop"
%---------------------EXCHANGE TOTAL LINES---------------
put : netStream, 00800
put : netStream, totallines
delay (1000)
%------------START SENDING-------------------
if lock = 0 then
put "*SAFE MODE*"
loop
exit when hasch
if eof (send) then
put "Done Sending File..."
exit
end if
get : send, typ : *
put : netStream, typ
delay (1)
end loop
close (send)
else
put "!FAST MODE!"
loop
exit when hasch
if eof (send) then
put "Done Sending File..."
exit
end if
get : send, typ : *
put : netStream, typ
lines := lines + 1
rou := (lines / totallines) * 100
rou := round (rou)
rou2 := realstr (rou, 1)
locate (whatcol, whatrow)
put "Sending File... ", rou, "% done..."
GUIpercent (100, 100, 500, 110, strint (rou2))
end loop
close (send)
end if
%---------------------E N D -------MODULE---------------------------------------------------
put "Have a Nice Day..."
delay (1000)
Window.Close (w1)
end filesend
%-----------------------------------------------GET MODULE--------------------------------
procedure fileget
var w1 : int
w1 := Window.Open ("title:GET MODULE,graphics:500;200,nobuttonbar")
%-----------------get file name-----
var file : string
%------------menu choce-----------
var c : int
%----------fILEid----------
var send : int
%----TYPE of OUTPUT/INPUT------
var typ : string := ""
%------------port--------
var p1 : int := 28001
%-----------connection path-------------
var netStream : int
%-----------------net address----------
var net : string
%----------------percent done-------------
var rou : real
var lines, totallines : real := 0
var temp : real := 0
%--------------End percent done---------
safe
cls
%------------GET READY TO RECIEVE-----------------
put "Enter file name to save as.... " ..
get file
cls
put "Waiting for connection...."
netStream := Net.WaitForConnection (p1, net)
cls
%----------------------------LOOP RECIEVE--------------------
open : send, file, put
cls
put "Receiving file... Press Any Key to Stop"
%---------------------EXCHANGE TOTAL LINES---------------
get : netStream, temp
if temp = 00800 then
get : netStream, temp
totallines := temp
end if
%------------START RECIEVING-------------------
if lock = 0 then
put "*SAFE MODE*"
loop
exit when hasch
if Net.LineAvailable (netStream) then
get : netStream, typ : *
put : send, typ
end if
end loop
close (send)
else
put "!FAST MODE!"
loop
exit when hasch
if Net.LineAvailable (netStream) then
get : netStream, typ : *
put : send, typ
lines := lines + 1
rou := (lines / totallines) * 100
rou := round (rou)
rou2 := realstr (rou, 1)
locate (whatcol, whatrow)
put "Recieving File... ", rou, "% done..."
GUIpercent (100, 100, 500, 110, strint (rou2))
end if
end loop
close (send)
end if
%---------------------E N D -------SUB Program---------------------------------------------------
put "Have a Nice Day..."
delay (1000)
Window.Close (w1)
end fileget
%--------------------------------------------END FILE SEND STUFF---------------------------------------
procedure mfile
var temp : int
put "SEND? 1"
put "RECIEVE? 2"
get temp
if temp = 1 then
filesend
elsif temp = 2 then
fileget
end if
end mfile
mfile
|