--- oup/current/Tools/RawEdit.pas 2007/02/21 03:28:48 111 +++ oup/current/Tools/RawEdit.pas 2007/05/02 15:16:58 175 @@ -53,7 +53,7 @@ type procedure hexSelectionChanged(Sender: TObject); procedure hexChange(Sender: TObject); private - ConID, fileid, datoffset: Integer; + fileid, datoffset: Integer; public end; @@ -114,7 +114,7 @@ begin begin for i := 0 to filelist.Count - 1 do begin - if ConManager.Connection[ConID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then + if ConManager.Connection[ConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = Raw_Info.SrcID then begin filelist.ItemIndex := i; listClick(Self); @@ -131,7 +131,7 @@ begin end; end; mem := nil; - ConManager.Connection[ConID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem)); + ConManager.Connection[ConnectionID].LoadRawFile(raw_info.SrcID, raw_info.SrcOffset, TStream(mem)); hex.LoadFromStream(mem); ClearValues; hexSelectionChanged(Self); @@ -147,7 +147,7 @@ begin ClearValues; datoffset := StrToInt('$' + MidStr( list_offset.Items.Strings[list_offset.ItemIndex], 3, 8)); - LoadRaw(ConManager.Connection[ConID].GetRawInfo(fileid, datoffset)); + LoadRaw(ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset)); end; @@ -310,8 +310,10 @@ begin str := ''; if hex.SelCount = 0 then begin - while (hex.Data[hex.SelStart + j] > 0) and ((hex.SelStart + j) < hex.DataSize) do + while (hex.SelStart + j) < hex.DataSize do begin + if hex.Data[hex.SelStart + j] = 0 then + Break; if hex.Data[hex.selstart + j] >= 32 then str := str + Char(hex.Data[hex.SelStart + j]) else @@ -390,14 +392,14 @@ var i: Integer; begin case MessageBox(Self.Handle, PChar('Save changes to .raw-part of file ' + - ConManager.Connection[ConID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), + ConManager.Connection[ConnectionID].GetFileInfo(fileid).Name + '?'), PChar('Data changed...'), MB_YESNOCANCEL) of idYes: begin mem := TMemoryStream.Create; hex.SaveToStream(mem); mem.Seek(0, soFromBeginning); - ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, mem); + ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, mem); mem.Free; hex.Modified := False; for i := 0 to hex.Datasize - 1 do @@ -505,10 +507,10 @@ var fs: TFileStream; begin saved.Filter := 'Files of matching extension (*.' + - ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' + - ConManager.Connection[ConID].GetFileInfo(fileid).Extension + + ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + + ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + '|All files|*.*'; - saved.DefaultExt := ConManager.Connection[ConID].GetFileInfo(fileid).Extension; + saved.DefaultExt := ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension; if saved.Execute then begin fs := TFileStream.Create(saved.FileName, fmCreate); @@ -524,20 +526,19 @@ procedure TForm_RawEdit.btn_importClick( var // Data: Tdata; fs: TFileStream; - data: TByteData; i: Integer; rawinfo: TRawDataInfo; begin opend.Filter := 'Files of matching extension (*.' + - ConManager.Connection[ConID].GetFileInfo(fileid).Extension + ')|*.' + - ConManager.Connection[ConID].GetFileInfo(fileid).Extension + + ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + ')|*.' + + ConManager.Connection[ConnectionID].GetFileInfo(fileid).Extension + '|All files|*.*'; if opend.Execute then begin fs := TFileStream.Create(opend.FileName, fmOpenRead); if fs.Size <> hex.DataSize then begin - if (not (CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then + if (not (CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights)) and (not (CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights)) then begin ShowMessage('Can''t import ' + ExtractFilename(importd.FileName) + ', file has to have same size as file in .raw with this backend.' + CrLf + @@ -557,14 +558,14 @@ begin Exit; end; end; - rawinfo := ConManager.Connection[ConID].GetRawInfo(fileid, datoffset); - if CR_ResizeRaw in ConManager.Connection[ConID].ChangeRights then - ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs) - else if CR_AppendRaw in ConManager.Connection[ConID].ChangeRights then - i := ConManager.Connection[ConID].AppendRawFile(rawinfo.LocSep, fs); - ConManager.Connection[ConID].UpdateDatFilePart(fileid, datoffset, 4, @i); + rawinfo := ConManager.Connection[ConnectionID].GetRawInfo(fileid, datoffset); + if CR_ResizeRaw in ConManager.Connection[ConnectionID].ChangeRights then + ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs) + else if CR_AppendRaw in ConManager.Connection[ConnectionID].ChangeRights then + i := ConManager.Connection[ConnectionID].AppendRawFile(rawinfo.LocSep, fs); + ConManager.Connection[ConnectionID].UpdateDatFilePart(fileid, datoffset, 4, @i); end else begin - ConManager.Connection[ConID].UpdateRawFile(fileid, datoffset, fs); + ConManager.Connection[ConnectionID].UpdateRawFile(fileid, datoffset, fs); end; fs.Seek(0, soFromBeginning); hex.LoadFromStream(fs);