| 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 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 62 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 63 | 
   | 
 implementation | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 64 | 
   | 
 {$R *.dfm} | 
 
 
 
 
 
 
 
 
 
 
 
 | 65 | 
 < | 
 uses Main, ValueEdit; | 
 
 
 
 
 
 
 
 
 
 | 65 | 
 > | 
 uses Main, ValueEdit, RawList; | 
 
 
 
 
 
 
 
 
 
 
 
 | 66 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 67 | 
   | 
 procedure TForm_RawEdit.NewFile(fileinfo: TFileInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 68 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 100 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 101 | 
   | 
 procedure TForm_RawEdit.LoadRaw(raw_info: TRawDataInfo); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 102 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 103 | 
 < | 
   i:    LongWord; | 
 
 
 
 
 
 
 
 
 
 | 103 | 
 > | 
   i:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 104 | 
   | 
   mem: TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 105 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 106 | 
   | 
   if hex.Modified then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 114 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 115 | 
   | 
     for i := 0 to filelist.Count - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 116 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 117 | 
 < | 
       if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[i]) = RawInfo.SrcID then | 
 
 
 
 
 
 
 
 
 
 | 117 | 
 > | 
       if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then | 
 
 
 
 
 
 
 
 
 
 
 
 | 118 | 
   | 
       begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 119 | 
   | 
         filelist.ItemIndex := i; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 120 | 
   | 
         listClick(Self); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 131 | 
   | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 132 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 133 | 
   | 
   mem := nil; | 
 
 
 
 
 
 
 
 
 
 
 
 | 134 | 
 < | 
   ConManager.Connection[ConID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, mem); | 
 
 
 
 
 
 
 
 
 
 | 134 | 
 > | 
   ConManager.Connection[ConnectionID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem)); | 
 
 
 
 
 
 
 
 
 
 
 
 | 135 | 
   | 
   hex.LoadFromStream(mem); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 136 | 
   | 
   ClearValues; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 137 | 
   | 
   hexSelectionChanged(Self); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 145 | 
   | 
 procedure TForm_RawEdit.list_offsetClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 146 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 147 | 
   | 
   ClearValues; | 
 
 
 
 
 
 
 
 
 
 
 
 | 148 | 
 < | 
   dat_offset := StrToInt('$' + MidStr( | 
 
 
 
 
 
 
 
 
 
 | 148 | 
 > | 
   datoffset := StrToInt('$' + MidStr( | 
 
 
 
 
 
 
 
 
 
 
 
 | 149 | 
   | 
     list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); | 
 
 
 
 
 
 
 
 
 
 
 
 | 150 | 
 < | 
   LoadRaw(Connection.GetRawInfo(fileid, dat_offset)); | 
 
 
 
 
 
 
 
 
 
 | 150 | 
 > | 
   LoadRaw(ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset)); | 
 
 
 
 
 
 
 
 
 
 
 
 | 151 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 152 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 153 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 154 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 155 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 156 | 
 < | 
 function IntToBin(Value: Byte): String; | 
 
 
 
 
 
 
 
 
 
 | 156 | 
 > | 
 function TForm_RawEdit.GetValue(datatype: Word; offset: Integer): String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 157 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 158 | 
 < | 
   i: Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 159 | 
 < | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 160 | 
 < | 
   Result := ''; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 161 | 
 < | 
   for i := 7 downto 0 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 162 | 
 < | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 163 | 
 < | 
     Result := Result + IntToStr((Value shr i) and $01); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 164 | 
 < | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 165 | 
 < | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 166 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 167 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 168 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 169 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 170 | 
 < | 
 function TForm_RawEdit.GetValue(datatype: Word; offset: LongWord): String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 171 | 
 < | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 172 | 
 < | 
   Data: Tdata; | 
 
 
 
 
 
 
 
 
 
 | 158 | 
 > | 
   Data: TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 159 | 
   | 
   i:    Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 160 | 
   | 
   floatformat: TFormatSettings; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 161 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 216 | 
   | 
   i: Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 217 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 218 | 
   | 
   for i := 1 to value_viewer.RowCount - 1 do | 
 
 
 
 
 
 
 
 
 
 | 233 | 
 – | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 219 | 
   | 
     value_viewer.Cells[1, i] := ''; | 
 
 
 
 
 
 
 
 
 
 | 235 | 
 – | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 220 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 221 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 222 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 225 | 
   | 
 procedure TForm_RawEdit.WriteValues; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 226 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 227 | 
   | 
   i, j:  Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 228 | 
 < | 
   Data:  Tdata; | 
 
 
 
 
 
 
 
 
 
 | 228 | 
 > | 
   Data:  TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 | 229 | 
   | 
   str:   String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 230 | 
 < | 
   Value: LongWord; | 
 
 
 
 
 
 
 
 
 
 | 230 | 
 > | 
   Value: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 231 | 
   | 
   floatformat: TFormatSettings; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 232 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 233 | 
   | 
   floatformat.DecimalSeparator := '.'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 339 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 340 | 
   | 
 procedure TForm_RawEdit.FormCreate(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 341 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 342 | 
 < | 
   i:     LongWord; | 
 
 
 
 
 
 
 
 
 
 | 342 | 
 > | 
   i:     Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 343 | 
   | 
   exts: String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 344 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 345 | 
   | 
   inherited; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 346 | 
   | 
   Self.OnNewFileSelected := Self.NewFile; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 347 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 348 | 
   | 
   exts := ''; | 
 
 
 
 
 
 
 
 
 
 
 
 | 349 | 
 < | 
   if Length(RawListHandlers) > 0 then | 
 
 
 
 
 
 
 
 
 
 | 349 | 
 > | 
   if Length(RawLists.RawListHandlers) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 350 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 351 | 
 < | 
     for i := 0 to High(RawListHandlers) do | 
 
 
 
 
 
 
 
 
 
 | 351 | 
 > | 
     for i := 0 to High(RawLists.RawListHandlers) do | 
 
 
 
 
 
 
 
 
 
 
 
 | 352 | 
   | 
       if Length(exts) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 | 353 | 
 < | 
         exts := exts + ',' + RawListHandlers[i].Ext | 
 
 
 
 
 
 
 
 
 
 | 353 | 
 > | 
         exts := exts + ',' + RawLists.RawListHandlers[i].Ext | 
 
 
 
 
 
 
 
 
 
 
 
 | 354 | 
   | 
       else | 
 
 
 
 
 
 
 
 
 
 
 
 | 355 | 
 < | 
         exts := RawListHandlers[i].Ext; | 
 
 
 
 
 
 
 
 
 
 | 355 | 
 > | 
         exts := RawLists.RawListHandlers[i].Ext; | 
 
 
 
 
 
 
 
 
 
 
 
 | 356 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 357 | 
   | 
   Self.AllowedExts := exts; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 358 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 387 | 
   | 
 function TForm_RawEdit.Save: Boolean; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 388 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 389 | 
   | 
   mem:  TMemoryStream; | 
 
 
 
 
 
 
 
 
 
 
 
 | 390 | 
 < | 
   Data: Tdata; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 407 | 
 < | 
   i:    LongWord; | 
 
 
 
 
 
 
 
 
 
 | 390 | 
 > | 
   i:    Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 391 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 392 | 
   | 
   case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' + | 
 
 
 
 
 
 
 
 
 
 
 
 | 393 | 
 < | 
       Connection.GetFileInfo(fileid).FileName + '?'), PChar('Data changed...'), | 
 
 
 
 
 
 
 
 
 
 | 393 | 
 > | 
       ConManager.Connection[ConnectionID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), | 
 
 
 
 
 
 
 
 
 
 
 
 | 394 | 
   | 
       MB_YESNOCANCEL) of | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 395 | 
   | 
     idYes: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 396 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 397 | 
   | 
       mem := TMemoryStream.Create; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 398 | 
   | 
       hex.SaveToStream(mem); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 399 | 
   | 
       mem.Seek(0, soFromBeginning); | 
 
 
 
 
 
 
 
 
 
 
 
 | 400 | 
 < | 
       SetLength(Data, mem.Size); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 418 | 
 < | 
       mem.Read(Data[0], mem.Size); | 
 
 
 
 
 
 
 
 
 
 | 400 | 
 > | 
       ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, mem); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 401 | 
   | 
       mem.Free; | 
 
 
 
 
 
 
 
 
 
 | 420 | 
 – | 
       Connection.UpdateRawFile(fileid_opened, dat_offset_opened, | 
 
 
 
 
 
 
 
 
 
 | 421 | 
 – | 
         Length(Data), @Data[0]); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 402 | 
   | 
       hex.Modified := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 403 | 
   | 
       for i := 0 to hex.Datasize - 1 do | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 404 | 
   | 
         hex.ByteChanged[i] := False; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 407 | 
   | 
     idNo: | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 408 | 
   | 
       Result := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 409 | 
   | 
     idCancel: | 
 
 
 
 
 
 
 
 
 
 | 430 | 
 – | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 410 | 
   | 
       Result := False; | 
 
 
 
 
 
 
 
 
 
 | 432 | 
 – | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 411 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 412 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 413 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 417 | 
   | 
 procedure TForm_RawEdit.FormCloseQuery(Sender: TObject; var CanClose: Boolean); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 418 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 419 | 
   | 
   if hex.Modified then | 
 
 
 
 
 
 
 
 
 
 | 442 | 
 – | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 420 | 
   | 
     if not Save then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 421 | 
   | 
       CanClose := False; | 
 
 
 
 
 
 
 
 
 
 | 445 | 
 – | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 422 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 423 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 424 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 504 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 505 | 
   | 
   fs: TFileStream; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 506 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 507 | 
 < | 
   saved.Filter     := 'Files of matching extension (*.' + Connection.GetFileInfo( | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 508 | 
 < | 
     fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 507 | 
 > | 
   saved.Filter     := 'Files of matching extension (*.' + | 
 
 
 
 
 
 | 508 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + | 
 
 
 
 
 
 | 509 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 
 
 | 510 | 
   | 
     '|All files|*.*'; | 
 
 
 
 
 
 
 
 
 
 
 
 | 511 | 
 < | 
   saved.DefaultExt := Connection.GetFileInfo(fileid).Extension; | 
 
 
 
 
 
 
 
 
 
 | 511 | 
 > | 
   saved.DefaultExt := ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension; | 
 
 
 
 
 
 
 
 
 
 
 
 | 512 | 
   | 
   if saved.Execute then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 513 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 514 | 
   | 
     fs := TFileStream.Create(saved.FileName, fmCreate); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 524 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 525 | 
   | 
 //  Data: Tdata; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 526 | 
   | 
   fs:   TFileStream; | 
 
 
 
 
 
 
 
 
 | 527 | 
 + | 
   i: Integer; | 
 
 
 
 
 
 
 
 
 | 528 | 
 + | 
   rawinfo: TRawDataInfo; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 529 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 530 | 
 < | 
   opend.Filter := 'Files of matching extension (*.' + Connection.GetFileInfo( | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 531 | 
 < | 
     fileid).Extension + ')|*.' + Connection.GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 530 | 
 > | 
   opend.Filter := 'Files of matching extension (*.' + | 
 
 
 
 
 
 | 531 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + | 
 
 
 
 
 
 | 532 | 
 > | 
     ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + | 
 
 
 
 
 
 
 
 
 
 
 
 | 533 | 
   | 
     '|All files|*.*'; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 534 | 
   | 
   if opend.Execute then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 535 | 
   | 
   begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 536 | 
   | 
     fs := TFileStream.Create(opend.FileName, fmOpenRead); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 537 | 
   | 
     if fs.Size <> hex.DataSize then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 538 | 
   | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 | 539 | 
 < | 
       ShowMessage('Can''t import ' + ExtractFilename(opend.FileName) + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 540 | 
 < | 
         ', file has to have same size as file in .dat.' + CrLf + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 541 | 
 < | 
         'Size of file in .dat: ' + FormatFileSize(hex.datasize) + CrLf + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 542 | 
 < | 
         'Size of chosen file: ' + FormatFileSize(fs.Size)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 543 | 
 < | 
     end | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 544 | 
 < | 
     else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 545 | 
 < | 
     begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 546 | 
 < | 
       hex.LoadFromStream(fs); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 547 | 
 < | 
       hex.Modified := True; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 548 | 
 < | 
     end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 539 | 
 > | 
       if (not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then | 
 
 
 
 
 
 | 540 | 
 > | 
       begin | 
 
 
 
 
 
 | 541 | 
 > | 
         ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + | 
 
 
 
 
 
 | 542 | 
 > | 
             ', file has to have same size as file in .raw with this backend.' + CrLf + | 
 
 
 
 
 
 | 543 | 
 > | 
             'Size of file in .raw: ' + FormatFileSize(hex.DataSize) + CrLf + | 
 
 
 
 
 
 | 544 | 
 > | 
             'Size of chosen file: ' + FormatFileSize(fs.Size)); | 
 
 
 
 
 
 | 545 | 
 > | 
         Exit; | 
 
 
 
 
 
 | 546 | 
 > | 
       end else begin | 
 
 
 
 
 
 | 547 | 
 > | 
         if MessageBox(Self.Handle, | 
 
 
 
 
 
 | 548 | 
 > | 
               PChar('File has different size from the file in the .raw.' + CrLf + | 
 
 
 
 
 
 | 549 | 
 > | 
                     'Size of file in .dat: ' + FormatFileSize(hex.DataSize) + CrLf + | 
 
 
 
 
 
 | 550 | 
 > | 
                     'Size of chosen file: ' + FormatFileSize(fs.Size) + CrLf + | 
 
 
 
 
 
 | 551 | 
 > | 
                     'Replace anyway?' + CrLf + | 
 
 
 
 
 
 | 552 | 
 > | 
                     'WARNING: This only replaces the raw-data. It doesn''t' + CrLf + | 
 
 
 
 
 
 | 553 | 
 > | 
                     'do the according changes in the .dat. Oni probably' + CrLf + | 
 
 
 
 
 
 | 554 | 
 > | 
                     'won''t be able to use the data correctly!'), PChar('Different size'), MB_YESNO + MB_ICONWARNING) = ID_NO then | 
 
 
 
 
 
 | 555 | 
 > | 
         begin | 
 
 
 
 
 
 | 556 | 
 > | 
           Exit; | 
 
 
 
 
 
 | 557 | 
 > | 
         end; | 
 
 
 
 
 
 | 558 | 
 > | 
       end; | 
 
 
 
 
 
 | 559 | 
 > | 
       rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); | 
 
 
 
 
 
 | 560 | 
 > | 
       if CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights then | 
 
 
 
 
 
 | 561 | 
 > | 
         ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs) | 
 
 
 
 
 
 | 562 | 
 > | 
       else if CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights then | 
 
 
 
 
 
 | 563 | 
 > | 
         i := ConManager.Connection[ConnectionID].AppendRawFile(rawinfo.LocSep, fs); | 
 
 
 
 
 
 | 564 | 
 > | 
         ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, datoffset, 4, @i); | 
 
 
 
 
 
 | 565 | 
 > | 
     end else begin | 
 
 
 
 
 
 | 566 | 
 > | 
       ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs); | 
 
 
 
 
 
 | 567 | 
 > | 
     end; | 
 
 
 
 
 
 | 568 | 
 > | 
     fs.Seek(0, soFromBeginning); | 
 
 
 
 
 
 | 569 | 
 > | 
     hex.LoadFromStream(fs); | 
 
 
 
 
 
 | 570 | 
 > | 
     hex.Modified := False; | 
 
 
 
 
 
 | 571 | 
 > | 
     for i := 0 to hex.Datasize - 1 do | 
 
 
 
 
 
 | 572 | 
 > | 
       hex.ByteChanged[i] := False; | 
 
 
 
 
 
 
 
 
 
 
 
 | 573 | 
   | 
     fs.Free; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 574 | 
   | 
   end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 575 | 
   | 
 end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 633 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 634 | 
   | 
 //  i:     Byte; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 635 | 
   | 
   Name:  String; | 
 
 
 
 
 
 
 
 
 
 
 
 | 636 | 
 < | 
   Value: LongWord; | 
 
 
 
 
 
 
 
 
 
 | 636 | 
 > | 
   Value: Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 637 | 
   | 
 begin | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 638 | 
   | 
   Name := TMenuItem(Sender).Name; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 639 | 
   | 
   if Pos('asstring', Name) > 0 then | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 692 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 693 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 694 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 695 | 
 < | 
 procedure TForm_RawEdit.SetNewValue(datatype: Word; offset: LongWord; Value: String); | 
 
 
 
 
 
 
 
 
 
 | 695 | 
 > | 
 procedure TForm_RawEdit.SetNewValue(datatype: Word; offset: Integer; Value: String); | 
 
 
 
 
 
 
 
 
 
 
 
 | 696 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 697 | 
 < | 
   Data: Tdata; | 
 
 
 
 
 
 
 
 
 
 | 697 | 
 > | 
   Data: TByteData; | 
 
 
 
 
 
 
 
 
 
 
 
 | 698 | 
   | 
   value_int: LongWord; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 699 | 
   | 
   value_float: Single; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 700 | 
   | 
   i: Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 759 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 760 | 
   | 
 procedure TForm_RawEdit.value_viewerDblClick(Sender: TObject); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 761 | 
   | 
 var | 
 
 
 
 
 
 
 
 
 
 
 
 | 762 | 
 < | 
   offset:     LongWord; | 
 
 
 
 
 
 
 
 
 
 | 762 | 
 > | 
   offset:     Integer; | 
 
 
 
 
 
 
 
 
 
 
 
 | 763 | 
   | 
   datatype:   Word; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 764 | 
   | 
   objectname: String; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 765 | 
   | 
   Value:      String; |