Код:
Add(MainForm,6340001,140,126)
{
 Width=606
}
Add(Edit,15128451,259,126)
{
 Left=30
 Top=30
 Width=240
 Text=""
 DataType=4
 link(onChange,12248021:Traffic,[])
}
Add(InlineCode,12248021,329,126)
{
 @Hint=#18:Конвертер Траффика|
 WorkPoints=#24:Traffic=Траффик в байтах|
 EventPoints=#31:Result=Результат преобразования|
 Code=#15:unit HiAsmUnit;|0:|9:interface|0:|21:uses kol,Share,Debug;|0:|4:type|28: THiAsmClass = class(TDebug)|10:   private|0:|9:   public|22:    Result: THI_Event;|51:    procedure Traffic (var Data:TData; Index:Word);|0:|5: end;|0:|14:implementation|0:|0:|48:function BytesToStr(const size: Double): string;|5:const|100:  sizes: array [1..9] of string = (' Yb', ' Zb', ' Eb', ' Pb', ' Tb', ' Gb', ' Mb', ' Kb', ' byte');|3:var|17:  total: integer;|26:  resSize,varSize: Double;|6:begin |25:  total := Length(sizes);|18:  varSize := size;|26:  while varSize >= 1024 do|7:  begin|15:    dec(total);|30:    varSize := varSize / 1024;|6:  end;|40:  resSize := Round(varSize/0.01)*0.01;  |51:  Result := Double2Str(resSize) + sizes[total];    |4:end;|0:|30:procedure THiAsmClass.Traffic;|3:var|12:  d: Double;|5:begin|29:  //d := Round(ToReal(Data));|20:  d := ToReal(Data);|40:  _hi_OnEvent(Result, BytesToStr(d));   |4:end;|1: |4:end.|
 link(Result,6420362:doAdd,[])
}
Add(Memo,6420362,406,126)
{
 Left=325
 Top=25
 Width=240
 Height=195
 AddType=1
}
Add(VBJScript,7456342,329,182)
{
 WorkPoints=#6:doWork|
 EventPoints=#5:onRes|
 Script=#37:Function BytesToStr(size, precision) |27:    Dim sizes, total, rSize|82:    sizes = Array(" YB", " Zb", " Eb", " Pb", " Tb", " Gb", " Mb", " Kb", " byte")|25:    total = Ubound(sizes)|22:    while size >= 1024|23:      total = total-1  |22:      size = size/1024|8:    wend|33:    rSize = round(size,precision)|38:    BytesToStr = rSize & sizes(total) |12:End Function|0:|18:Sub doWork(dt,idx)|28:  sys.onRes BytesToStr(dt,2)|7:End Sub|
}