ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/oup/current/Tools/RawEdit.pas
(Generate patch)

Comparing oup/current/Tools/RawEdit.pas (file contents):
Revision 111 by alloc, Wed Feb 21 03:28:48 2007 UTC vs.
Revision 113 by alloc, Sun Feb 25 17:20:22 2007 UTC

# Line 53 | Line 53 | type
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  
# Line 114 | Line 114 | begin
114    begin
115      for i := 0 to filelist.Count - 1 do
116      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
118        begin
119          filelist.ItemIndex := i;
120          listClick(Self);
# Line 131 | Line 131 | begin
131      end;
132    end;
133    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));
135    hex.LoadFromStream(mem);
136    ClearValues;
137    hexSelectionChanged(Self);
# Line 147 | Line 147 | begin
147    ClearValues;
148    datoffset := StrToInt('$' + MidStr(
149      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));
151   end;
152  
153  
# Line 390 | Line 390 | var
390    i:    Integer;
391   begin
392    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...'),
394        MB_YESNOCANCEL) of
395      idYes:
396      begin
397        mem := TMemoryStream.Create;
398        hex.SaveToStream(mem);
399        mem.Seek(0, soFromBeginning);
400 <      ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, mem);
400 >      ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, mem);
401        mem.Free;
402        hex.Modified := False;
403        for i := 0 to hex.Datasize - 1 do
# Line 505 | Line 505 | var
505    fs: TFileStream;
506   begin
507    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 +
510      '|All files|*.*';
511 <  saved.DefaultExt := ConManager.Connection[ConID].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);
# Line 524 | Line 524 | procedure TForm_RawEdit.btn_importClick(
524   var
525   //  Data: Tdata;
526    fs:   TFileStream;
527  data: TByteData;
527    i: Integer;
528    rawinfo: TRawDataInfo;
529   begin
530    opend.Filter := 'Files of matching extension (*.' +
531 <    ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' +
532 <    ConManager.Connection[ConID].GetFileInfo(fileid).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 <      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
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 +
# Line 557 | Line 556 | begin
556            Exit;
557          end;
558        end;
559 <      rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, datoffset);
560 <      if CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights then
561 <        ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs)
562 <      else if CR_AppendRaw in ConManager.Connection[ConID].ChangeRights then
563 <        i := ConManager.Connection[ConID].AppendRawFile(rawinfo.LocSep, fs);
564 <        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);
565      end else begin
566 <      ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs);
566 >      ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs);
567      end;
568      fs.Seek(0, soFromBeginning);
569      hex.LoadFromStream(fs);

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)