Changeset 113 for oup/current/Tools


Ignore:
Timestamp:
Feb 25, 2007, 6:20:22 PM (18 years ago)
Author:
alloc
Message:
 
Location:
oup/current/Tools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • oup/current/Tools/BinEdit.pas

    r111 r113  
    140140var
    141141  mem:  TMemoryStream;
    142   Data: TByteData;
    143142begin
    144143  if ConID <> -1 then
     
    183182  Data: TByteData;
    184183  i:    Word;
     184  tempi: Integer;
    185185  floatformat: TFormatSettings;
    186186begin
     
    218218      Result := IntToBin(hex.Data[offset]);
    219219    11:
    220       Result := '0x' + IntToHex(ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr, 8);
     220    begin
     221      tempi := ConManager.Connection[ConID].GetRawInfo(fileid, offset).RawAddr;
     222      if tempi >= 0 then
     223        Result := '0x' + IntToHex(tempi, 8)
     224      else
     225        Result := 'unused';
     226    end;
    221227    12:
    222       Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 +
    223         hex.Data[offset + 3] * 256 * 256, 5, '0');
     228      if hex.Data[offset] = 1 then
     229        Result := FormatNumber(hex.Data[offset + 1] + hex.Data[offset + 2] * 256 +
     230          hex.Data[offset + 3] * 256 * 256, 5, '0')
     231      else
     232        Result := 'no link';
    224233    13:
    225234      Result := IntToStr(hex.Data[offset]);
     
    308317              if Pos('#', SubName) > 0 then
    309318              begin
    310                 Data.Offset  := HexToLong(MidStr(SubName, Pos('#', SubName) + 1, 8));
    311                 Data.Value   :=
     319                Data.Offset  := StrToInt('$'+MidStr(SubName, Pos('#', SubName) + 1, 8));
     320                Data.Value   := '$' +
    312321                  MidStr(SubName, PosEx('#', SubName, Pos('#', SubName) + 1) + 1, 8);
    313322                Data.Caption := MidStr(SubName, 1, Pos('#', SubName) - 1);
     
    749758    else
    750759    begin
    751       if nodedata.DataType = 11 then
     760      if (nodedata.DataType = 11) and (nodedata.Value <> 'unused') then
    752761      begin
    753762        if ConManager.Connection[ConID].GetRawInfo(fileid, nodedata.offset).RawSize > 0 then
    754763          Form_Main.open_child('rawedit', ConID, fileid);
    755764      end;
    756       if nodedata.DataType = 12 then
     765      if (nodedata.DataType = 12) and (nodedata.Value <> 'no link') then
    757766      begin
    758767        if (StrToInt(nodedata.Value) < ConManager.Connection[ConID].GetFileCount) and
     
    794803  begin
    795804    hex.SelStart := Data.Offset;
    796     hex.SelEnd   := Data.Offset + HexToLong(Data.Value) - 1;
     805    hex.SelEnd   := Data.Offset + StrToInt(Data.Value) - 1;
    797806  end;
    798807end;
     
    825834          CellText := Data.Value //GetValue(data.DataType, data.Offset)
    826835        else if Length(Data.Value) > 0 then
    827           CellText := IntToStr(HexToLong(Data.Value)) + ' Bytes';
     836          CellText := IntToStr(StrToInt(Data.Value)) + ' Bytes';
    828837      4:
    829838        CellText := Data.Description;
  • oup/current/Tools/RawEdit.pas

    r111 r113  
    5454    procedure hexChange(Sender: TObject);
    5555  private
    56     ConID, fileid, datoffset: Integer;
     56    fileid, datoffset: Integer;
    5757  public
    5858  end;
     
    115115    for i := 0 to filelist.Count - 1 do
    116116    begin
    117       if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then
     117      if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then
    118118      begin
    119119        filelist.ItemIndex := i;
     
    132132  end;
    133133  mem := nil;
    134   ConManager.Connection[ConID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem));
     134  ConManager.Connection[ConnectionID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem));
    135135  hex.LoadFromStream(mem);
    136136  ClearValues;
     
    148148  datoffset := StrToInt('$' + MidStr(
    149149    list_offset.Items.Strings[list_offset.ItemIndex], 3, 8));
    150   LoadRaw(ConManager.Connection[ConID].GetRawInfo(fileid, datoffset));
     150  LoadRaw(ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset));
    151151end;
    152152
     
    391391begin
    392392  case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' +
    393       ConManager.Connection[ConID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'),
     393      ConManager.Connection[ConnectionID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'),
    394394      MB_YESNOCANCEL) of
    395395    idYes:
     
    398398      hex.SaveToStream(mem);
    399399      mem.Seek(0, soFromBeginning);
    400       ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, mem);
     400      ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, mem);
    401401      mem.Free;
    402402      hex.Modified := False;
     
    506506begin
    507507  saved.Filter     := 'Files of matching extension (*.' +
    508     ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' +
    509     ConManager.Connection[ConID].GetFileInfo(fileid).Extension +
     508    ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' +
     509    ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension +
    510510    '|All files|*.*';
    511   saved.DefaultExt := ConManager.Connection[ConID].GetFileInfo(fileid).Extension;
     511  saved.DefaultExt := ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension;
    512512  if saved.Execute then
    513513  begin
     
    525525//  Data: Tdata;
    526526  fs:   TFileStream;
    527   data: TByteData;
    528527  i: Integer;
    529528  rawinfo: TRawDataInfo;
    530529begin
    531530  opend.Filter := 'Files of matching extension (*.' +
    532     ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' +
    533     ConManager.Connection[ConID].GetFileInfo(fileid).Extension +
     531    ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' +
     532    ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension +
    534533    '|All files|*.*';
    535534  if opend.Execute then
     
    538537    if fs.Size <> hex.DataSize then
    539538    begin
    540       if (not (CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then
     539      if (not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then
    541540      begin
    542541        ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) +
     
    558557        end;
    559558      end;
    560       rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, datoffset);
    561       if CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights then
    562         ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs)
    563       else if CR_AppendRaw in ConManager.Connection[ConID].ChangeRights then
    564         i := ConManager.Connection[ConID].AppendRawFile(rawinfo.LocSep, fs);
    565         ConManager.Connection[ConID].UpdateDatFilePart(fileid, datoffset, 4, @i);
     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);
    566565    end else begin
    567       ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs);
     566      ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs);
    568567    end;
    569568    fs.Seek(0, soFromBeginning);
  • oup/current/Tools/Template.pas

    r106 r113  
    153153    combo_extension.Items.Add('_All files_ (' +
    154154      IntToStr(ConManager.Connection[FConnectionID].GetFileCount) + ')');
     155    exts := nil;
    155156    exts := ConManager.Connection[FConnectionID].GetExtensionsList(EF_ExtCount);
    156157    for i := 0 to exts.Count - 1 do
     
    177178  pattern: String;
    178179  files: TStrings;
    179   i: Integer;
    180180begin
    181181  if FConnectionID > -1 then
     
    192192        Extension := '';
    193193
     194    files := nil;
    194195    files := ConManager.Connection[FConnectionID].GetFilesList(extension, pattern, no_zero_bytes, FSortBy);
    195196
     
    283284var
    284285  name: String;
    285   nstart, nend: Integer;
    286   i: Integer;
    287286begin
    288287  if combo_connection.ItemIndex >= 0 then
Note: See TracChangeset for help on using the changeset viewer.