Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Byteworks (* Bytes & Packets *)
- open Memory
- open Memory.C
- open BModel
- open System
- open System.Text
- let Authorize(user : string, password : string) =
- let mutable bufOut = Array.zeroCreate 44
- let cpy = Hex.decode <| "0xAAAA0A80"
- let user = Encoding.ASCII.GetBytes user
- let pwd = Encoding.ASCII.GetBytes password
- bufOut <++ cpy <| 0 <| cpy.Length
- bufOut <++ [|0x16uy|] <| 24 <| 1
- bufOut <++ user <| 26 <| Math.Min(8, user.Length)
- bufOut <++ pwd <| 34 <| Math.Min(8, pwd.Length)
- new Packet(bufOut ++> 42)
- let SyncTime dt =
- let mutable bufOut = Array.zeroCreate 32
- let dtnows = BitConverter.GetBytes( (seconds dt) )
- let cpy = Hex.decode <| "0xAAAA1380"
- bufOut <++ cpy <| 0 <| cpy.Length
- bufOut <++ [|0x4uy|] <| 24 <| 1
- bufOut <++ (dtnows) <| 26 <| 4
- new Packet(bufOut ++> 30)
- let GetCurrent idDev numInst =
- let mutable bufOut = Array.zeroCreate 32
- let cpy = Hex.decode <| "0xAAAA2080"
- bufOut <++ cpy <| 0 <| cpy.Length
- bufOut <++ [|2uy|] <| 24 <| 1
- bufOut <++ [|idDev|] <| 26 <| 2
- bufOut <++ [|numInst|] <| 28 <| 2
- new Packet(bufOut ++> 30)
- let GetArchivet dev dt1 dt2 numIT numArh numID =
- let mutable bufOut = Array.zeroCreate 44
- let cpy = Hex.decode <| "0xAAAA2180"
- let dt1s = BitConverter.GetBytes( Convert.ToInt32(dt1 : int64) )
- let dt2s = BitConverter.GetBytes( (seconds dt2) )
- bufOut <++ cpy <| 0 <| cpy.Length
- bufOut <++ [|14uy|] <| 24 <| 1
- bufOut <++ [|dev|] <| 26 <| 2
- bufOut <++ dt1s <| 28 <| 4
- bufOut <++ dt2s <| 32 <| 4
- bufOut <++ [|numIT|] <| 36 <| 2
- bufOut <++ [|numArh|] <| 38 <| 2
- bufOut <++ [|numID|] <| 40 <| 2
- new Packet(bufOut ++> 42)
- let GetPropContr n =
- let mutable bufOut = Array.zeroCreate 28
- let hex = Hex.decode <| match n with
- | 1 -> "0xAAAA0480"
- | 2 -> "0xAAAA0580"
- | 3 -> "0xAAAA0680"
- | _ -> "0xAAAA0480"
- bufOut <++ hex <| 0 <| hex.Length
- new Packet(bufOut ++> 26)
- let SetPropContr n bytes hack configuration =
- let (hex, size, fin) = match n with
- | 1 -> Hex.decode "0xAAAA0180", 928, 928
- | 2 -> Hex.decode "0xAAAA0280", 928, 928
- | 3 -> Hex.decode "0xAAAA0380", 232, 318
- | _ -> Hex.decode "0xAAAA0180", 928, 928
- let mutable bufOut = Array.zeroCreate 1024 //(fin + 28)
- let mutable bufX : byte array = Array.zeroCreate 928
- let finbytes = BitConverter.GetBytes(Convert.ToInt16(fin)) // 2 bytes
- bufOut <++ hex <| 0 <| hex.Length
- bufOut <++ finbytes <| 4 <| 2
- bufOut <++ bytes <| 26 <| size
- if n = 3 then
- bufOut <++ hack <| 258 (*26+232*) <| 6
- bufOut <++ configuration <| 264 (*26+238*) <| 80
- new Packet(bufOut ++> (fin + 26))
Add Comment
Please, Sign In to add comment