| 38 |
|
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); |
| 39 |
|
procedure FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); |
| 40 |
|
|
| 41 |
< |
function GetValue(datatype: Word; offset: LongWord): String; |
| 41 |
> |
function GetValue(datatype: Word; offset: Integer): String; |
| 42 |
|
procedure ClearValues; |
| 43 |
|
procedure WriteValues; |
| 44 |
< |
procedure SetNewValue(datatype: Word; offset: LongWord; Value: String); |
| 44 |
> |
procedure SetNewValue(datatype: Word; offset: Integer; Value: String); |
| 45 |
|
|
| 46 |
|
procedure value_viewerDblClick(Sender: TObject); |
| 47 |
|
procedure value_viewer_context_copyClick(Sender: TObject); |
| 53 |
|
procedure hexSelectionChanged(Sender: TObject); |
| 54 |
|
procedure hexChange(Sender: TObject); |
| 55 |
|
private |
| 56 |
< |
ConID, fileid, datoffset: Integer; |
| 56 |
> |
fileid, datoffset: Integer; |
| 57 |
|
public |
| 58 |
|
end; |
| 59 |
|
|
| 100 |
|
|
| 101 |
|
procedure TForm_RawEdit.LoadRaw(raw_info: TRawDataInfo); |
| 102 |
|
var |
| 103 |
< |
i: LongWord; |
| 104 |
< |
mem: TMemoryStream; |
| 103 |
> |
i: Integer; |
| 104 |
|
begin |
| 105 |
|
if hex.Modified then |
| 106 |
|
begin |
| 109 |
|
Exit; |
| 110 |
|
end; |
| 111 |
|
end; |
| 112 |
< |
if list_offset.Count = 0 then |
| 112 |
> |
for i := 0 to filelist.Count - 1 do |
| 113 |
|
begin |
| 114 |
< |
for i := 0 to filelist.Count - 1 do |
| 114 |
> |
if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then |
| 115 |
|
begin |
| 116 |
< |
if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then |
| 117 |
< |
begin |
| 118 |
< |
filelist.ItemIndex := i; |
| 120 |
< |
listClick(Self); |
| 121 |
< |
Break; |
| 122 |
< |
end; |
| 116 |
> |
filelist.ItemIndex := i; |
| 117 |
> |
listClick(Self); |
| 118 |
> |
Break; |
| 119 |
|
end; |
| 120 |
< |
for i := 0 to list_offset.Count - 1 do |
| 120 |
> |
end; |
| 121 |
> |
for i := 0 to list_offset.Count - 1 do |
| 122 |
> |
begin |
| 123 |
> |
if MidStr(list_offset.Items.Strings[i], 3, 8) = IntToHex(raw_info.SrcOffset, 8) then |
| 124 |
|
begin |
| 125 |
< |
if MidStr(list_offset.Items.Strings[i], 3, 8) = IntToHex(raw_info.SrcOffset, 8) then |
| 126 |
< |
begin |
| 127 |
< |
list_offset.ItemIndex := i; |
| 129 |
< |
Break; |
| 130 |
< |
end; |
| 125 |
> |
list_offset.ItemIndex := i; |
| 126 |
> |
list_offsetClick(Self); |
| 127 |
> |
Break; |
| 128 |
|
end; |
| 129 |
|
end; |
| 133 |
– |
mem := nil; |
| 134 |
– |
ConManager.Connection[ConID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem)); |
| 135 |
– |
hex.LoadFromStream(mem); |
| 136 |
– |
ClearValues; |
| 137 |
– |
hexSelectionChanged(Self); |
| 130 |
|
end; |
| 131 |
|
|
| 132 |
|
|
| 135 |
|
|
| 136 |
|
|
| 137 |
|
procedure TForm_RawEdit.list_offsetClick(Sender: TObject); |
| 138 |
+ |
var |
| 139 |
+ |
mem: TMemoryStream; |
| 140 |
+ |
rawinfo: TRawDataInfo; |
| 141 |
|
begin |
| 147 |
– |
ClearValues; |
| 142 |
|
datoffset := StrToInt('$' + MidStr( |
| 143 |
|
list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); |
| 144 |
< |
LoadRaw(ConManager.Connection[ConID].GetRawInfo(fileid, datoffset)); |
| 144 |
> |
|
| 145 |
> |
rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); |
| 146 |
> |
|
| 147 |
> |
mem := nil; |
| 148 |
> |
ConManager.Connection[ConnectionID].LoadRawFile(rawinfo.SrcID, rawinfo.SrcOffset, TStream(mem)); |
| 149 |
> |
hex.LoadFromStream(mem); |
| 150 |
> |
ClearValues; |
| 151 |
> |
hexSelectionChanged(Self); |
| 152 |
|
end; |
| 153 |
|
|
| 154 |
|
|
| 155 |
|
|
| 156 |
|
|
| 157 |
< |
function TForm_RawEdit.GetValue(datatype: Word; offset: LongWord): String; |
| 157 |
> |
function TForm_RawEdit.GetValue(datatype: Word; offset: Integer): String; |
| 158 |
|
var |
| 159 |
|
Data: TByteData; |
| 160 |
|
i: Word; |
| 228 |
|
i, j: Integer; |
| 229 |
|
Data: TByteData; |
| 230 |
|
str: String; |
| 231 |
< |
Value: LongWord; |
| 231 |
> |
Value: Integer; |
| 232 |
|
floatformat: TFormatSettings; |
| 233 |
|
begin |
| 234 |
|
floatformat.DecimalSeparator := '.'; |
| 311 |
|
str := ''; |
| 312 |
|
if hex.SelCount = 0 then |
| 313 |
|
begin |
| 314 |
< |
while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do |
| 314 |
> |
while (hex.SelStart + j) < hex.DataSize do |
| 315 |
|
begin |
| 316 |
+ |
if hex.Data[hex.SelStart + j] = 0 then |
| 317 |
+ |
Break; |
| 318 |
|
if hex.Data[hex.selstart + j] >= 32 then |
| 319 |
|
str := str + Char(hex.Data[hex.SelStart + j]) |
| 320 |
|
else |
| 342 |
|
|
| 343 |
|
procedure TForm_RawEdit.FormCreate(Sender: TObject); |
| 344 |
|
var |
| 345 |
< |
i: LongWord; |
| 345 |
> |
i: Integer; |
| 346 |
|
exts: String; |
| 347 |
|
begin |
| 348 |
|
inherited; |
| 390 |
|
function TForm_RawEdit.Save: Boolean; |
| 391 |
|
var |
| 392 |
|
mem: TMemoryStream; |
| 393 |
< |
i: LongWord; |
| 393 |
> |
i: Integer; |
| 394 |
|
begin |
| 395 |
|
case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' + |
| 396 |
< |
ConManager.Connection[ConID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), |
| 396 |
> |
ConManager.Connection[ConnectionID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), |
| 397 |
|
MB_YESNOCANCEL) of |
| 398 |
|
idYes: |
| 399 |
|
begin |
| 400 |
|
mem := TMemoryStream.Create; |
| 401 |
|
hex.SaveToStream(mem); |
| 402 |
|
mem.Seek(0, soFromBeginning); |
| 403 |
< |
ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, mem); |
| 403 |
> |
ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, mem); |
| 404 |
|
mem.Free; |
| 405 |
|
hex.Modified := False; |
| 406 |
|
for i := 0 to hex.Datasize - 1 do |
| 508 |
|
fs: TFileStream; |
| 509 |
|
begin |
| 510 |
|
saved.Filter := 'Files of matching extension (*.' + |
| 511 |
< |
ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' + |
| 512 |
< |
ConManager.Connection[ConID].GetFileInfo(fileid).Extension + |
| 511 |
> |
ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + |
| 512 |
> |
ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + |
| 513 |
|
'|All files|*.*'; |
| 514 |
< |
saved.DefaultExt := ConManager.Connection[ConID].GetFileInfo(fileid).Extension; |
| 514 |
> |
saved.DefaultExt := ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension; |
| 515 |
|
if saved.Execute then |
| 516 |
|
begin |
| 517 |
|
fs := TFileStream.Create(saved.FileName, fmCreate); |
| 527 |
|
var |
| 528 |
|
// Data: Tdata; |
| 529 |
|
fs: TFileStream; |
| 527 |
– |
data: TByteData; |
| 530 |
|
i: Integer; |
| 531 |
|
rawinfo: TRawDataInfo; |
| 532 |
|
begin |
| 533 |
|
opend.Filter := 'Files of matching extension (*.' + |
| 534 |
< |
ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' + |
| 535 |
< |
ConManager.Connection[ConID].GetFileInfo(fileid).Extension + |
| 534 |
> |
ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + |
| 535 |
> |
ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + |
| 536 |
|
'|All files|*.*'; |
| 537 |
|
if opend.Execute then |
| 538 |
|
begin |
| 539 |
|
fs := TFileStream.Create(opend.FileName, fmOpenRead); |
| 540 |
|
if fs.Size <> hex.DataSize then |
| 541 |
|
begin |
| 542 |
< |
if (not (CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then |
| 542 |
> |
if |
| 543 |
> |
(not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) |
| 544 |
> |
and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) |
| 545 |
> |
then |
| 546 |
|
begin |
| 547 |
|
ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + |
| 548 |
|
', file has to have same size as file in .raw with this backend.' + CrLf + |
| 562 |
|
Exit; |
| 563 |
|
end; |
| 564 |
|
end; |
| 565 |
< |
rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, datoffset); |
| 566 |
< |
if CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights then |
| 567 |
< |
ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs) |
| 568 |
< |
else if CR_AppendRaw in ConManager.Connection[ConID].ChangeRights then |
| 569 |
< |
i := ConManager.Connection[ConID].AppendRawFile(rawinfo.LocSep, fs); |
| 570 |
< |
ConManager.Connection[ConID].UpdateDatFilePart(fileid, datoffset, 4, @i); |
| 565 |
> |
rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); |
| 566 |
> |
if CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights then |
| 567 |
> |
ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs) |
| 568 |
> |
else if CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights then |
| 569 |
> |
i := ConManager.Connection[ConnectionID].AppendRawFile(rawinfo.LocSep, fs); |
| 570 |
> |
ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, datoffset, 4, @i); |
| 571 |
|
end else begin |
| 572 |
< |
ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs); |
| 572 |
> |
ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs); |
| 573 |
|
end; |
| 574 |
|
fs.Seek(0, soFromBeginning); |
| 575 |
|
hex.LoadFromStream(fs); |
| 639 |
|
var |
| 640 |
|
// i: Byte; |
| 641 |
|
Name: String; |
| 642 |
< |
Value: LongWord; |
| 642 |
> |
Value: Integer; |
| 643 |
|
begin |
| 644 |
|
Name := TMenuItem(Sender).Name; |
| 645 |
|
if Pos('asstring', Name) > 0 then |
| 698 |
|
|
| 699 |
|
|
| 700 |
|
|
| 701 |
< |
procedure TForm_RawEdit.SetNewValue(datatype: Word; offset: LongWord; Value: String); |
| 701 |
> |
procedure TForm_RawEdit.SetNewValue(datatype: Word; offset: Integer; Value: String); |
| 702 |
|
var |
| 703 |
|
Data: TByteData; |
| 704 |
|
value_int: LongWord; |
| 765 |
|
|
| 766 |
|
procedure TForm_RawEdit.value_viewerDblClick(Sender: TObject); |
| 767 |
|
var |
| 768 |
< |
offset: LongWord; |
| 768 |
> |
offset: Integer; |
| 769 |
|
datatype: Word; |
| 770 |
|
objectname: String; |
| 771 |
|
Value: String; |