- Timestamp:
- Jan 23, 2007, 12:05:45 AM (18 years ago)
- Location:
- oup/rewrite
- Files:
-
- 6 added
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
oup/rewrite/DataAccess/ConnectionManager.pas
r93 r97 18 18 function GetConnection(ConnectionID: Integer): TDataAccess; 19 19 function GetConnectionByIndex(Index: Integer): TDataAccess; 20 function GetConnectionIndex(ConnectionID: Integer): Integer; 20 21 procedure RemoveConnection(ArrayIndex: Integer); 21 22 protected … … 24 25 property Connection[ConnectionID: Integer]: TDataAccess read GetConnection; 25 26 property ConnectionByIndex[Index: Integer]: TDataAccess read GetConnectionByIndex; 27 property ConnectionIndexByID[ConnectionID: Integer]: Integer read GetConnectionIndex; 26 28 property OnCoonnectionListChanged: TConnectionListChangedEvent read FConnectionListChanged write FConnectionListChanged; 27 29 … … 37 39 38 40 41 var 42 ConManager: TConnectionManager; 43 44 39 45 implementation 40 46 uses … … 49 55 begin 50 56 Result := Length(FConnections); 57 end; 58 59 function TConnectionManager.GetConnectionIndex(ConnectionID: Integer): Integer; 60 var 61 i: Integer; 62 begin 63 Result := -1; 64 if Count > 0 then 65 for i := 0 to Count - 1 do 66 if ConnectionByIndex[i].ConnectionID = ConnectionID then 67 begin 68 Result := i; 69 Break; 70 end; 51 71 end; 52 72 … … 240 260 241 261 262 initialization 263 ConManager := TConnectionManager.Create; 264 finalization 265 ConManager.Free; 242 266 end. -
oup/rewrite/DataAccess/DataAccess.pas
r93 r97 13 13 FFileName: String; 14 14 FBackend: TDataBackend; 15 FDataOS: TDataOS; 15 16 FLevelNumber: Integer; 16 17 FChangeRights: TChangeRights; 18 procedure SetDataOS(DataOS: TDataOS); 17 19 protected 18 20 public 19 21 property ConnectionID: Integer read FConnectionID; 20 property FileName: String read FFileName; 21 property Backend: TDataBackend read FBackend; 22 property LevelNumber: Integer read FLevelNumber; 22 property FileName: String read FFileName; 23 property Backend: TDataBackend read FBackend; 24 property DataOS: TDataOS read FDataOS write SetDataOS; 25 property LevelNumber: Integer read FLevelNumber; 23 26 24 27 constructor Create(FileName: String; ConnectionID: Integer; var Msg: TStatusMessages); virtual; abstract; … … 34 37 35 38 procedure LoadDatFile(FileID: Integer; var Target: TStream); overload; virtual; abstract; 36 procedure LoadDatFile(FileID: Integer; var Target: TByte Array); overload; virtual; abstract;39 procedure LoadDatFile(FileID: Integer; var Target: TByteData); overload; virtual; abstract; 37 40 procedure UpdateDatFile(FileID: Integer; Src: TStream); overload; virtual; abstract; 38 procedure UpdateDatFile(FileID: Integer; Src: TByte Array); overload; virtual; abstract;41 procedure UpdateDatFile(FileID: Integer; Src: TByteData); overload; virtual; abstract; 39 42 procedure LoadDatFilePart(FileID, Offset, Size: Integer; var Target: TStream); overload; virtual; abstract; 40 procedure LoadDatFilePart(FileID, Offset, Size: Integer; var Target: TByte Array); overload; virtual; abstract;43 procedure LoadDatFilePart(FileID, Offset, Size: Integer; var Target: TByteData); overload; virtual; abstract; 41 44 procedure LoadDatFilePart(FileID, Offset, Size: Integer; Target: Pointer); overload; virtual; abstract; 42 45 procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TStream); overload; virtual; abstract; 43 procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TByte Array); overload; virtual; abstract;46 procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: TByteData); overload; virtual; abstract; 44 47 procedure UpdateDatFilePart(FileID, Offset, Size: Integer; Src: Pointer); overload; virtual; abstract; 45 48 … … 48 51 49 52 procedure LoadRawFile(FileID, DatOffset: Integer; var Target: TStream); overload; virtual; abstract; 50 procedure LoadRawFile(FileID, DatOffset: Integer; var Target: TByte Array); overload; virtual; abstract;53 procedure LoadRawFile(FileID, DatOffset: Integer; var Target: TByteData); overload; virtual; abstract; 51 54 procedure UpdateRawFile(FileID, DatOffset, Size: Integer; Src: TStream); overload; virtual; abstract; 52 procedure UpdateRawFile(FileID, DatOffset, Size: Integer; Src: TByte Array); overload; virtual; abstract;55 procedure UpdateRawFile(FileID, DatOffset, Size: Integer; Src: TByteData); overload; virtual; abstract; 53 56 procedure LoadRawFilePart(FileID, DatOffset, Offset, Size: Integer; var Target: TStream); overload; virtual; abstract; 54 procedure LoadRawFilePart(FileID, DatOffset, Offset, Size: Integer; var Target: TByte Array); overload; virtual; abstract;57 procedure LoadRawFilePart(FileID, DatOffset, Offset, Size: Integer; var Target: TByteData); overload; virtual; abstract; 55 58 procedure LoadRawFilePart(FileID, DatOffset, Offset, Size: Integer; Target: Pointer); overload; virtual; abstract; 56 59 procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TStream); overload; virtual; abstract; 57 procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TByte Array); overload; virtual; abstract;60 procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: TByteData); overload; virtual; abstract; 58 61 procedure UpdateRawFilePart(FileID, DatOffset, Offset, Size: Integer; Src: Pointer); overload; virtual; abstract; 59 62 60 63 function AppendRawFile(LocSep: Boolean; Size: Integer; Src: TStream): Integer; overload; virtual; abstract; 61 function AppendRawFile(LocSep: Boolean; Size: Integer; Src: TByte Array): Integer; overload; virtual; abstract;64 function AppendRawFile(LocSep: Boolean; Size: Integer; Src: TByteData): Integer; overload; virtual; abstract; 62 65 function AppendRawFile(LocSep: Boolean; Size: Integer; Src: Pointer): Integer; overload; virtual; abstract; 63 66 published 64 67 end; 65 68 66 67 68 69 70 {71 var72 DataConnections: array of TOniData;73 74 function CreateDataConnection(filename: String; backend: Integer): TOniData;75 function ConnectionExists(filename: String): TOniData;76 procedure CloseDataConnection(connection: TOniData);77 function GetEmptyFileInfo: TFileInfo;78 }79 69 80 70 … … 158 148 159 149 150 procedure TDataAccess.SetDataOS(DataOS: TDataOS); 151 begin 152 raise ENotImplemented.Create('TDataAccess.SetDataOS: TBD!'); 153 end; 160 154 161 155 end. -
oup/rewrite/Global/TypeDefs.pas
r93 r97 3 3 4 4 uses 5 Graphics ;5 Graphics, SysUtils; 6 6 7 7 type 8 ENotImplemented = class(Exception); 9 8 10 TDataBackend = (DB_ONI, DB_ADB); 11 TDataOS = (DOS_WIN, DOS_MAC); 9 12 10 13 TChangeRights = set of (CR_EditDat, CR_EditRaw, CR_ResizeDat, CR_ResizeRaw); … … 51 54 ); 52 55 53 TByte Array= array of Byte;56 TByteData = array of Byte; 54 57 55 58 TAppSettings = record … … 79 82 } 80 83 84 const 85 CrLf: String[2] = #13#10; 86 81 87 implementation 82 88 -
oup/rewrite/Helper/Helper_LevelDB.pas
r93 r97 16 16 procedure btn_abortokClick(Sender: TObject); 17 17 private 18 procedure HandleFile(ext: String; fileid: LongWord; dir_dat2db: Boolean);18 procedure HandleFile(ext: String; fileid: Integer; dir_dat2db: Boolean); 19 19 procedure stop_convert; 20 20 public 21 procedure CreateDatabase(Source, target: String);22 procedure CreateLevel(Source, target: String);21 procedure CreateDatabase(Source, Target: String); 22 procedure CreateLevel(Source, Target: String); 23 23 end; 24 24 … … 31 31 {$R *.dfm} 32 32 33 uses ABSMain, ABSDecUtil, Main, Functions, Data, 34 OniImgClass, DataStructures, OniDataClass; 33 uses ABSMain, ABSDecUtil, Main, Functions, Data, OniImgClass, DataStructures, ConnectionManager; 35 34 36 35 type -
oup/rewrite/Main.dfm
r93 r97 656 656 0000000000000000000000000000000000000000000000000000000000000000 657 657 00000000000000000000000000000000000000FFFF0000000000000000000000 658 00000000000000 C1C100009A9A00008585000085850000000000000000000000658 00000000000000FFFF0000FFFF0000FFFF0000FFFF0000000000000000000000 659 659 00000000000000FFFF0000FFFF0000FFFF000000000000000000292018002920 660 660 20005252520039313100DEDEDE00A4A4A40039313100DEDEDE00A4A4A4000000 … … 664 664 0000000000000000000000000000000000000000000000000000000000000000 665 665 0000000000000000FF00000000000000FF0000FFFF0000FFFF00000000000000 666 0000000 B0B000032320000707000007C7C00007C7C000070700000323200000B667 0 B00000000000000000000FFFF0000FFFF000000000000000000292018002920666 0000000000000000000000000000000000000000000000000000000000000000 667 0000000000000000000000FFFF0000FFFF000000000000000000292018002920 668 668 20005252520039313100DEDEDE00A4A4A40039313100DEDEDE00A4A4A4000000 669 669 000029202000292020000000000000000000FF00000000000000FF000000FF00 … … 671 671 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 672 672 FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 673 FF000000FF000000FF00000000000000FF0000FFFF0000FFFF0000 D9D9000016674 16000060600000B1B10000E0E00000F9F90000F9F90000E0E00000B1B1000060675 600000161600000000000000000000FFFF000000000000000000292029003129673 FF000000FF000000FF00000000000000FF0000FFFF0000FFFF0000FFFF000000 674 0000000000000000000000FFFF0000FFFF0000FFFF0000FFFF00000000000000 675 000000000000000000000000000000FFFF000000000000000000292029003129 676 676 2900525252003931310039313100A4A4A4003931310039313100A4A4A4000000 677 677 000031292900312929000000000000000000FF00000000000000FF0000000000 … … 679 679 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 680 680 0000000000000000000000000000000000000000000000000000000000000000 681 00000000FF000000FF00000000000000FF0000FFFF0000 EDED00008C8C000070682 700000D5D50000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000D5683 D50000606000000B0B0000000000000000000000000000000000525252005252681 00000000FF000000FF00000000000000FF0000FFFF0000FFFF0000FFFF000000 682 000000FFFF0000FFFF0000FFFF00000000000000000000FFFF0000FFFF0000FF 683 FF00000000000000000000000000000000000000000000000000525252005252 684 684 5200525252005252520052525200525252005252520052525200525252005252 685 685 520052525200525252000000000000000000FF00000000000000FF0000000000 … … 687 687 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 688 688 0000000000000000000000000000000000000000000000000000000000000000 689 00000000FF000000FF00000000000000FF000000000000 C2C2000067670000B1690 B10000FFFF0000C9C90000414100002C2C00002C2C00002C2C0000EAEA0000FF691 FF0000 B1B1000032320000000000000000000000000000000000000000000000689 00000000FF000000FF00000000000000FF000000000000FFFF0000FFFF000000 690 000000FFFF0000FFFF00000000000000FF000000FF000000000000FFFF0000FF 691 FF00000000000000000000000000000000000000000000000000000000000000 692 692 0000000000000000000000000000000000000000000000000000000000000000 693 693 000000000000000000000000000000000000FF00000000000000FF000000FF00 … … 695 695 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 696 696 FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 697 FF000000FF000000FF00000000000000FF00000000000000000000 70700000E0698 E00000C0C000002D2D00002B2B000062620000373700002121000039390000C9699 C90000E0E00000707000000000000000000000000000000000000000FF000000697 FF000000FF000000FF00000000000000FF0000000000000000000000000000FF 698 FF0000FFFF0000000000000000000000000000000000000000000000000000FF 699 FF0000FFFF0000000000000000000000000000000000000000000000FF000000 700 700 FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 701 701 FF000000FF000000FF000000000000000000FF00000000000000FF0000000000 … … 703 703 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 704 704 0000000000000000000000000000000000000000000000000000000000000000 705 FF000000FF000000FF00000000000000FF00000000000000000000 79790000F8706 F 80000929200003C3C0000C9C90000FFFF0000FFFF0000FFFF0000464600006A707 6A0000F8F800007C7C00008585000000000000000000000000000000FF000000705 FF000000FF000000FF00000000000000FF0000000000000000000000000000FF 706 FF000000000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF000000 707 000000FFFF000000000000FFFF000000000000000000000000000000FF000000 708 708 FF000000FF000000000000000000000000000000000000000000000000000000 709 709 FF000000FF000000FF000000000000000000FF00000000000000FF0000000000 … … 711 711 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 712 712 0000000000000000000000000000000000000000000000000000000000000000 713 FF000000FF000000FF00000000000000FF00000000000000000000 79790000F8714 F 80000F4F40000F4F40000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF715 FF0000F 8F800007C7C000085850000FFFF0000000000000000000000FF000000713 FF000000FF000000FF00000000000000FF0000000000000000000000000000FF 714 FF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF 715 FF0000FFFF000000000000FFFF0000FFFF0000000000000000000000FF000000 716 716 FF000000000000000000FFFFFF00FFFFFF00FFFFFF00FFFFFF00000000000000 717 717 00000000FF000000FF000000000000000000FF00000000000000FF000000FF00 … … 719 719 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 720 720 FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 721 FF000000FF000000FF00000000000000FF0000FFFF000000000000 60600000E0722 E00000FFFF0000424200002A2A0000FFFF0000FFFF00003B3B000052520000FF723 FF0000 E0E00000707000009A9A0000FFFF0000000000000000000000FF000000721 FF000000FF000000FF00000000000000FF0000FFFF00000000000000000000FF 722 FF0000FFFF00000000000000000000FFFF0000FFFF00000000000000000000FF 723 FF0000FFFF000000000000FFFF0000FFFF0000000000000000000000FF000000 724 724 000000000000FFFFFF00FFFFFF000000000000000000FFFFFF00FFFFFF000000 725 725 0000000000000000FF000000000000000000FF00000000000000FF0000000000 … … 727 727 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 728 728 00000000000000000000000000000000000000000000000000000000FF000000 729 FF000000FF000000FF00000000000000FF0000FFFF0000 C2C2000032320000B1730 B10000C9C900005858000045450000FFFF0000FFFF0000434300005E5E0000FF731 FF0000 B1B1000032320000C2C20000FFFF0000000000000000000000FF000000729 FF000000FF000000FF00000000000000FF0000FFFF0000FFFF00000000000000 730 000000FFFF00000000000000000000FFFF0000FFFF00000000000000000000FF 731 FF00000000000000000000FFFF0000FFFF0000000000000000000000FF000000 732 732 0000FFFFFF00FFFFFF00000000006A00BD006A00BD0000000000FFFFFF00FFFF 733 733 FF00000000000000FF000000000000000000FF00000000000000FF0000000000 … … 735 735 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 736 736 00000000000000000000000000000000000000000000000000000000FF000000 737 FF000000FF000000FF00000000000000FF0000FFFF0000 EDED00008C8C000060738 600000D5D50000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000D5739 D50000606000000B0B000000000000FFFF0000000000000000000000FF000000737 FF000000FF000000FF00000000000000FF0000FFFF0000FFFF0000FFFF000000 738 000000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FFFF0000FF 739 FF0000000000000000000000000000FFFF0000000000000000000000FF000000 740 740 0000000000000000000000000000000000000000000000000000000000000000 741 741 0000000000000000FF000000000000000000FF00000000000000FF000000FF00 … … 743 743 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 744 744 FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 745 FF000000FF000000FF00000000000000FF0000FFFF0000FFFF0000 D9D900007F746 7F000060600000B1B10000E0E00000F8F80000F8F80000E0E00000B1B1000070747 70000016160000000000000000000000000000000000000000000000FF000000745 FF000000FF000000FF00000000000000FF0000FFFF0000FFFF0000FFFF0000FF 746 FF00000000000000000000FFFF0000FFFF0000FFFF0000FFFF00000000000000 747 00000000000000000000000000000000000000000000000000000000FF000000 748 748 FF00000000000000000000000000000000000000000000000000000000000000 749 749 00000000FF000000FF000000000000000000FF00000000000000FF0000000000 … … 751 751 0000FF000000FF00000000000000FF0000000000FF00000000000000FF000000 752 752 000000000000000000000000000000000000000000000000FF000000FF000000 753 FF000000FF000000FF00000000000000FF000000000000FFFF0000FFFF0000 D9754 D900008C8C00003232000060600000797900007979000070700000676700008C755 8C0000D9D90000000000000000000000000000000000000000000000FF000000753 FF000000FF000000FF00000000000000FF000000000000FFFF0000FFFF0000FF 754 FF0000FFFF00000000000000000000000000000000000000000000FFFF0000FF 755 FF0000FFFF0000000000000000000000000000000000000000000000FF000000 756 756 FF000000FF000000FF000000FF000000FF000000FF000000FF000000FF000000 757 757 FF000000FF000000FF0000000000000000000000000000000000000000000000 … … 760 760 0000000000000000000000000000000000000000000000000000000000000000 761 761 000000000000000000000000000000000000000000000000000000FFFF0000FF 762 FF0000 EDED0000C2C2000000000000000000000000000000000000C2C20000ED763 ED0000FFFF0000FFFF0000000000000000000000000000000000000000000000762 FF0000FFFF0000FFFF000000000000000000000000000000000000FFFF0000FF 763 FF0000FFFF0000FFFF0000000000000000000000000000000000000000000000 764 764 0000000000000000000000000000000000000000000000000000000000000000 765 765 0000000000000000000000000000000000000000000000000000000000000000 -
oup/rewrite/Main.pas
r93 r97 8 8 Data, TypeDefs, ConnectionManager, 9 9 // Functions, Exporters, DataStructures, 10 Functions, 10 11 Settings, {Helper_LevelDB, } 11 Template, BinEdit, Extractor, Preview, RawEdit, TxmpReplace; 12 Template, 13 Preview; 14 // BinEdit, Extractor, RawEdit, TxmpReplace; 12 15 13 16 type … … 92 95 procedure ToolbarDockChanged(Sender: TObject); 93 96 procedure CreateConnection(filename: String); 97 function CheckConnectionCloseable(index: Integer): Boolean; 94 98 95 99 procedure menu_loadfileClick(Sender: TObject); … … 126 130 procedure WMCopyData(var Msg: TWMCopyData); message WM_COPYDATA; 127 131 private 128 ConnectionManager: TConnectionManager;129 132 public 130 133 procedure DefaultHandler(var Message); override; … … 154 157 RepMsg: TStatusMessages; 155 158 begin 156 Con nectionManager.OpenConnection(filename, RepMsg);159 ConManager.OpenConnection(filename, RepMsg); 157 160 ShowOpenMsg(RepMsg); 158 161 if RepMsg = SM_OK then … … 161 164 end; 162 165 end; 166 167 function TForm_Main.CheckConnectionCloseable(index: Integer): Boolean; 168 var 169 i: Integer; 170 toolform: TForm_ToolTemplate; 171 begin 172 if MDITab.MDIChildCount > 0 then 173 begin 174 for i := 0 to MDITab.MDIChildCount - 1 do 175 begin 176 if MDITab.MDIChildren[i] is TForm_ToolTemplate then 177 begin 178 toolform := TForm_ToolTemplate(MDITab.MDIChildren[i]); 179 if toolform.ConnectionID = ConManager.ConnectionByIndex[index].ConnectionID then 180 begin 181 if not toolform.Closeable then 182 ShowMessage('Can not close toolwindow: ' + toolform.Caption); 183 end; 184 end; 185 end; 186 end; 187 end; 188 163 189 164 190 { Eine zweite Instanz hat uns ihre Kommandozeilenparameter geschickt } … … 215 241 Self.FormResize(Self); 216 242 217 ConnectionManager := TConnectionManager.Create; 218 ConnectionManager.OnCoonnectionListChanged := UpdateConLists; 243 ConManager.OnCoonnectionListChanged := UpdateConLists; 219 244 220 245 if FileExists(ExtractFilepath(Application.EXEname) + '\oniunpacker.ini') then … … 293 318 tabIndex: Integer; 294 319 hint: String; 320 tool: TForm_ToolTemplate; 295 321 begin 296 322 pt.X := X; … … 303 329 if MDITab.MDIChildren[tabIndex] is TForm_ToolTemplate then 304 330 begin 305 if TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).Connection <> nil then 331 tool := TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]); 332 if tool.ConnectionID > -1 then 306 333 hint := 'Connection: ' + 307 ExtractFileName( TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).Connection.FileName) + #13+#10334 ExtractFileName(ConManager.Connection[tool.ConnectionID].FileName) + #13+#10 308 335 else 309 336 hint := 'Connection: none' + #13+#10; 310 if TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.ID >= 0then337 if tool.SelectedFile.ID > -1 then 311 338 hint := hint + 'Selected File: ' + 312 TForm_ToolTemplate(MDITab.MDIChildren[tabIndex]).SelectedFile.FileName 339 FormatNumber(tool.SelectedFile.ID, 5, '0') + '-' + 340 tool.SelectedFile.Name + '.' + 341 tool.SelectedFile.Extension 313 342 else 314 343 hint := hint + 'Selected File: none'; … … 387 416 procedure TForm_Main.UpdateStatBar; 388 417 begin 389 if Length(DataConnections)> 0 then418 if ConManager.Count > 0 then 390 419 begin 391 420 Self.Caption := 'Oni Un/Packer ' + version; 392 421 ActivateTools(True); 393 statbar.Panels.Items[1].Text := 'Connections: ' + IntToStr( Length(DataConnections));422 statbar.Panels.Items[1].Text := 'Connections: ' + IntToStr(ConManager.Count); 394 423 end 395 424 else … … 401 430 ActivateTools(False); 402 431 end; 403 menu_conns.Enabled := Length(DataConnections)> 0;432 menu_conns.Enabled := ConManager.Count > 0; 404 433 end; 405 434 … … 451 480 452 481 menu_conns.Clear; 453 if Con nectionManager.Count > 0 then454 begin 455 for i := 0 to Con nectionManager.Count - 1 do482 if ConManager.Count > 0 then 483 begin 484 for i := 0 to ConManager.Count - 1 do 456 485 begin 457 486 entry := TTBItem.Create(menu_conns); 458 entry.Caption := ExtractFileName( DataConnections[i].FileName);487 entry.Caption := ExtractFileName(ConManager.ConnectionByIndex[i].FileName); 459 488 entry.Name := 'menu_conn_' + IntToStr(i); 460 489 entry.OnClick := menu_conns_itemClick; … … 556 585 procedure TForm_Main.menu_previewClick(Sender: TObject); 557 586 begin 558 open_child('preview', nil, -1);587 open_child('preview', -1, -1); 559 588 end; 560 589 561 590 procedure TForm_Main.menu_bineditClick(Sender: TObject); 562 591 begin 563 open_child('binedit', nil, -1);592 open_child('binedit', -1, -1); 564 593 end; 565 594 566 595 procedure TForm_Main.menu_raweditClick(Sender: TObject); 567 596 begin 568 open_child('rawedit', nil, -1);597 open_child('rawedit', -1, -1); 569 598 end; 570 599 571 600 procedure TForm_Main.menu_txmpreplaceClick(Sender: TObject); 572 601 begin 573 open_child('txmpreplace', nil, -1);602 open_child('txmpreplace', -1, -1); 574 603 end; 575 604 576 605 procedure TForm_Main.menu_extractorClick(Sender: TObject); 577 606 begin 578 open_child('extractor', nil, -1);607 open_child('extractor', -1, -1); 579 608 end; 580 609 … … 586 615 procedure TForm_Main.menu_filecompareClick(Sender: TObject); 587 616 begin 588 open_child('compare', nil, -1);617 open_child('compare', -1, -1); 589 618 end; 590 619 … … 653 682 name: String; 654 683 i: Integer; 655 begin 656 name := TTBItem(Sender).Caption; 684 index: Integer; 685 RepMsg: TStatusMessages; 686 begin 687 // name := TTBItem(Sender).Caption; 688 index := TTBItem(Sender).Parent.IndexOf(TTBItem(Sender)); 689 name := ExtractFileName(ConManager.ConnectionByIndex[index].FileName); 657 690 if MessageBox(Handle, PChar('Do you really want to close data-connection to' +#13+#10+ 658 691 name + '?'), PChar('Close?'), MB_YESNO + MB_ICONQUESTION) = ID_YES then 659 692 begin 660 for i := 0 to High(DataConnections) do 661 if ExtractFileName(DataConnections[i].FileName) = name then 662 begin 663 CloseDataConnection(DataConnections[i]); 664 Break; 665 end; 693 CheckConnectionCloseable(index); 694 ConManager.CloseConnectionByIndex(index, RepMsg); 666 695 end; 667 696 UpdateStatBar; … … 722 751 if window_context = 'binedit' then 723 752 begin 724 toolform := TForm_BinEdit.Create(Self);753 // toolform := TForm_BinEdit.Create(Self); 725 754 toolform.Caption := 'Binary .dat-Editor ' + caption_end; 726 755 iconindex := 5; … … 728 757 if window_context = 'extractor' then 729 758 begin 730 toolform := TForm_Extractor.Create(Self);759 // toolform := TForm_Extractor.Create(Self); 731 760 toolform.Caption := 'Extractor ' + caption_end; 732 761 iconindex := 8; … … 740 769 if window_context = 'rawedit' then 741 770 begin 742 toolform := TForm_RawEdit.Create(Self);771 // toolform := TForm_RawEdit.Create(Self); 743 772 toolform.Caption := 'Binary .raw-Editor ' + caption_end; 744 773 iconindex := 6; … … 746 775 if window_context = 'txmpreplace' then 747 776 begin 748 toolform := TForm_TxmpReplace.Create(Application);777 // toolform := TForm_TxmpReplace.Create(Application); 749 778 toolform.Caption := 'TXMP Replacer ' + caption_end; 750 779 iconindex := 7; … … 757 786 MDITab.AddTab(TForm(toolform), iconindex); 758 787 toolform.Caption := AnsiReplaceStr(toolform.Caption, ' ', ''); 759 if (fileid > -1) and (connection <> nil)then788 if connection > -1 then 760 789 begin 761 toolform.SelectFileID(connection, fileid); 790 toolform.SelectConnection(connection); 791 if fileid > -1 then 792 toolform.SelectFileID(connection, fileid); 762 793 end; 763 794 Result := toolform; -
oup/rewrite/OniUnPacker.bdsproj
r93 r97 176 176 <Language Name="ProjectLang">$00000000</Language> 177 177 <Language Name="RootDir"></Language> 178 </Language> 179 180 181 182 <Excluded_Packages> 178 </Language> <Excluded_Packages> 183 179 <Excluded_Packages Name="d:\programme\borland\bds\3.0\Bin\dbwebxprt.bpl">Borland Web Wizard Package</Excluded_Packages> 184 180 </Excluded_Packages> -
oup/rewrite/OniUnPacker.dpr
r93 r97 19 19 Extractor in 'Tools\Extractor.pas' {Form_Extractor}, 20 20 Preview in 'Tools\Preview.pas' {Form_Preview}, 21 RawEdit in 'Tools\RawEdit.pas' {Form_RawEdit}; 21 RawEdit in 'Tools\RawEdit.pas' {Form_RawEdit}, 22 OniImgClass in 'Global\OniImgClass.pas', 23 Functions in 'Global\Functions.pas', 24 Helper_ValueEdit in 'Helper\Helper_ValueEdit.pas' {Form_ValueEdit}, 25 RawList in 'Global\RawList.pas', 26 DatStructureLoader in 'Global\DatStructureLoader.pas', 27 Exporters in 'Global\Exporters.pas'; 22 28 23 29 {$R *.res} … … 29 35 Application.CreateForm(TForm_Main, Form_Main); 30 36 Application.CreateForm(TForm_Settings, Form_Settings); 37 Application.CreateForm(TForm_ValueEdit, Form_ValueEdit); 31 38 Application.Run; 32 39 end. -
oup/rewrite/Tools/BinEdit.pas
r93 r97 140 140 var 141 141 mem: TMemoryStream; 142 Data: T data;142 Data: TByteData; 143 143 begin 144 144 if con <> nil then … … 397 397 procedure TForm_BinEdit.WriteValues; 398 398 var 399 i, j: Byte;399 i, j: Integer; 400 400 Data: Tdata; 401 401 str: String; -
oup/rewrite/Tools/Preview.pas
r94 r97 4 4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 5 Dialogs, StdCtrls, Template, ExtCtrls, Math, StrUtils, 6 ConnectionManager, {OniImgClass,}Data, TypeDefs, Menus, Buttons;6 ConnectionManager, OniImgClass, Data, TypeDefs, Menus, Buttons; 7 7 8 8 type … … 84 84 procedure TForm_Preview.LoadImage(fileid, index: Integer); 85 85 var 86 Data: TByte Array;86 Data: TByteData; 87 87 memstream: TMemoryStream; 88 88 OniImage: TOniImage; … … 90 90 begin 91 91 OniImage := TOniImage.Create; 92 OniImage.Load(Connection , fileid);93 Data := OniImage.GetAsBMP;92 OniImage.Load(ConnectionID, fileid); 93 OniImage.GetAsBMP(Data); 94 94 OniImage.Free; 95 95 … … 147 147 i: Byte; 148 148 begin 149 Con nection.LoadDatFilePart(_fileid, $14, SizeOf(loop_speed), @loop_speed);150 Con nection.LoadDatFilePart(_fileid, $1C, SizeOf(linkcount), @linkcount);149 ConManager.Connection[ConnectionID].LoadDatFilePart(_fileid, $14, SizeOf(loop_speed), @loop_speed); 150 ConManager.Connection[ConnectionID].LoadDatFilePart(_fileid, $1C, SizeOf(linkcount), @linkcount); 151 151 SetBitmapCount(linkcount); 152 152 for i := 0 to linkcount - 1 do 153 153 begin 154 Con nection.LoadDatFilePart(_fileid, $20 + i * 4, SizeOf(link), @link);154 ConManager.Connection[ConnectionID].LoadDatFilePart(_fileid, $20 + i * 4, SizeOf(link), @link); 155 155 link := link div 256; 156 156 if link = 0 then … … 190 190 else 191 191 actualimg := High(bitmaps); 192 Self.Caption := 'Preview ' + Con nection.GetFileInfo(_fileid).FileName +192 Self.Caption := 'Preview ' + ConManager.Connection[ConnectionID].GetFileInfo(_fileid).Name + 193 193 ' (' + IntToStr(actualimg + 1) + '/' + IntToStr(Length(bitmaps)) + ')'; 194 194 DrawImage(actualimg); … … 202 202 else 203 203 actualimg := 0; 204 Self.Caption := 'Preview ' + Con nection.GetFileInfo(_fileid).FileName +204 Self.Caption := 'Preview ' + ConManager.Connection[ConnectionID].GetFileInfo(_fileid).Name + 205 205 ' (' + IntToStr(actualimg + 1) + '/' + IntToStr(Length(bitmaps)) + ')'; 206 206 DrawImage(actualimg); -
oup/rewrite/Tools/RawEdit.pas
r93 r97 4 4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 5 Dialogs, Template, StdCtrls, ExtCtrls, Menus, Grids, Wrapgrid, 6 MPHexEditor, Clipbrd, StrUtils, 7 Data, Functions, Dat aStructures, Exporters, OniDataClass, Buttons;6 MPHexEditor, Clipbrd, StrUtils, TypeDefs, 7 Data, Functions, DatStructureLoader, ConnectionManager, Buttons; 8 8 9 9 type … … 29 29 procedure list_offsetClick(Sender: TObject); 30 30 procedure NewFile(fileinfo: TFileInfo); 31 procedure LoadRaw(raw_info: TRaw Info);31 procedure LoadRaw(raw_info: TRawDataInfo); 32 32 function Save: Boolean; 33 33 … … 259 259 procedure TForm_RawEdit.WriteValues; 260 260 var 261 i, j: Byte;261 i, j: Integer; 262 262 Data: Tdata; 263 263 str: String; -
oup/rewrite/Tools/Template.dfm
r93 r97 19 19 OnActivate = FormActivate 20 20 OnClose = FormClose 21 OnCreate = FormCreate22 21 OnResize = FormResize 23 22 PixelsPerInch = 96 -
oup/rewrite/Tools/Template.pas
r93 r97 6 6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 7 7 Dialogs, ExtCtrls, StdCtrls, StrUtils, 8 ConnectionManager, {Functions,}Data, TypeDefs, Menus, Buttons;8 Data, TypeDefs, Menus, Buttons; 9 9 10 10 type 11 11 TNewFileSelectedEvent = procedure(FileInfo: TFileInfo) of object; 12 12 TNewConnectionEvent = procedure(Connection: Integer) of object; 13 TCheckCloseableEvent = function: Boolean of object; 13 14 14 15 TForm_ToolTemplate = class(TForm) … … 40 41 combo_connection: TComboBox; 41 42 Bevel1: TBevel; 42 procedure RecreateList;43 procedure UpdateList;44 43 procedure RecreateExtList; 44 procedure UpdateConList; 45 45 procedure LoadFileNames; 46 procedure SelectFileName(connection: Integer; FileName: String); 47 procedure SelectFileID(connection: Integer; FileID: Integer); 46 procedure SelectFileName(ConnectionID: Integer; FileName: String); 47 procedure SelectFileID(ConnectionID, FileID: Integer); 48 procedure SelectConnection(ConnectionID: Integer); 48 49 procedure check_filternameClick(Sender: TObject); 49 50 procedure check_zerobyteClick(Sender: TObject); … … 54 55 55 56 procedure FormResize(Sender: TObject); 56 procedure FormCreate(Sender: TObject);57 57 procedure FormClose(Sender: TObject; var Action: TCloseAction); 58 58 procedure popup_importClick(Sender: TObject); … … 67 67 FOnNewFileSelected: TNewFileSelectedEvent; 68 68 FOnNewConnection: TNewConnectionEvent; 69 FOnCheckCloseable: TCheckCloseableEvent; 69 70 FAllowedExts: String; 70 71 FAllowMultiSelect: Boolean; 71 72 FSelectedFile: TFileInfo; 72 FConnection : Integer;73 FConnectionID: Integer; 73 74 procedure SetAllowedExts(exts: String); 74 75 procedure SetMultiSelect(allow: Boolean); 76 function GetToolCloseable: Boolean; 75 77 public 76 78 constructor Create(AOwner: TComponent); override; … … 79 81 property OnNewFileSelected: TNewFileSelectedEvent read FOnNewFileSelected write FOnNewFileSelected; 80 82 property OnNewConnection: TNewConnectionEvent read FOnNewConnection write FOnNewConnection; 83 property OnCheckCloseable: TCheckCloseableEvent read FOnCheckCloseable write FOnCheckCloseable; 81 84 property AllowedExts: String read FAllowedExts write SetAllowedExts; 82 85 property AllowMultiSelect: Boolean read FAllowMultiSelect write SetMultiSelect; 83 86 property SelectedFile: TFileInfo read FSelectedFile; 84 property Connection: Integer read FConnection; 87 property ConnectionID: Integer read FConnectionID; 88 property Closeable: Boolean read GetToolCloseable; 85 89 end; 86 90 … … 91 95 implementation 92 96 {$R *.dfm} 93 uses Main, Exporters;94 95 96 procedure TForm_ToolTemplate.Update List;97 uses Main, ConnectionManager, Exporters, Functions; 98 99 100 procedure TForm_ToolTemplate.UpdateConList; 97 101 var 98 102 i: Integer; 99 103 fn, datatype, boxstring: String; 100 104 level: Integer; 101 oldcon: String; 102 begin 103 oldcon := combo_connection.Items.Strings[combo_connection.ItemIndex]; 105 begin 104 106 combo_connection.ItemIndex := -1; 105 107 combo_connection.Items.Clear; 106 if Length(DataConnections)> 0 then107 begin 108 for i := 0 to High(DataConnections)do108 if ConManager.Count > 0 then 109 begin 110 for i := 0 to ConManager.Count - 1 do 109 111 begin 110 level := DataConnections[i].LevelInfo.LevelNumber;111 fn := ExtractFileName( DataConnections[i].FileName);112 if DataConnections[i].Backend = ODB_Datthen112 level := ConManager.ConnectionByIndex[i].LevelNumber; 113 fn := ExtractFileName(ConManager.ConnectionByIndex[i].FileName); 114 if ConManager.ConnectionByIndex[i].Backend = DB_ONI then 113 115 datatype := 'ONI-.dat: ' 114 else if DataConnections[i].Backend = ODB_ADB then116 else if ConManager.ConnectionByIndex[i].Backend = DB_ADB then 115 117 datatype := 'OUP-DB: ' 116 118 else … … 118 120 boxstring := datatype + fn + ' (Level: ' + IntToStr(level) + ')'; 119 121 combo_connection.Items.Add(boxstring); 120 if oldcon = boxstringthen122 if ConManager.ConnectionByIndex[i].ConnectionID = FConnectionID then 121 123 combo_connection.ItemIndex := combo_connection.Items.Count - 1; 122 124 end; … … 129 131 else 130 132 begin 131 FConnection := nil;133 FConnectionID := 0; 132 134 filelist.Items.Clear; 133 135 combo_extension.Items.Clear; 134 136 combo_connectionChange(Self); 135 FSelectedFile := GetEmptyFileInfo;137 FSelectedFile.ID := -1; 136 138 if Assigned(FOnNewFileSelected) then 137 139 FOnNewFileSelected(FSelectedFile); … … 139 141 end; 140 142 141 procedure TForm_ToolTemplate.RecreateList;142 var143 i: Integer;144 fn, datatype: String;145 level: Integer;146 begin147 combo_connection.Items.Clear;148 if Length(DataConnections) > 0 then149 begin150 for i := 0 to High(DataConnections) do151 begin152 level := DataConnections[i].LevelInfo.LevelNumber;153 fn := ExtractFileName(DataConnections[i].FileName);154 if DataConnections[i].Backend = ODB_Dat then155 datatype := 'ONI-.dat: '156 else if DataConnections[i].Backend = ODB_ADB then157 datatype := 'OUP-DB: '158 else159 datatype := 'Unknown: ';160 combo_connection.Items.Add(datatype + fn + ' (Level: ' + IntToStr(level) + ')');161 end;162 FConnection := DataConnections[0];163 combo_connection.ItemIndex := 0;164 combo_connectionChange(Self);165 end166 else167 begin168 FConnection := nil;169 filelist.Items.Clear;170 combo_extension.Items.Clear;171 combo_connectionChange(Self);172 end;173 end;174 175 143 procedure TForm_ToolTemplate.RecreateExtList; 176 144 var 177 i: LongWord;178 exts: TString Array;145 i: Integer; 146 exts: TStrings; 179 147 begin 180 148 combo_extension.Items.Clear; 181 if FConnection <> nilthen149 if FConnectionID > -1 then 182 150 begin 183 151 combo_extension.Items.Add('_All files_ (' + 184 IntToStr( FConnection.GetFilesCount) + ')');185 exts := FConnection.GetExtensionsList;186 for i := 0 to High(exts)do152 IntToStr(ConManager.Connection[FConnectionID].GetFileCount) + ')'); 153 exts := ConManager.Connection[FConnectionID].GetExtensionsList(EF_ExtCount); 154 for i := 0 to exts.Count - 1 do 187 155 if Length(FAllowedExts) > 0 then 188 156 begin 189 if Pos(MidStr(exts[i],1,4), FAllowedExts) > 0 then 190 begin 191 combo_extension.Items.Add(exts[i]); 192 end; 193 end else 194 combo_extension.Items.Add(exts[i]); 157 if Pos(MidStr(exts.Strings[i],1,4), FAllowedExts) > 0 then 158 combo_extension.Items.Add(exts.Strings[i]); 159 end 160 else 161 combo_extension.Items.Add(exts.Strings[i]); 195 162 combo_extension.ItemIndex := 0; 196 163 combo_extensionClick(Self); 164 exts.Free; 197 165 end; 198 166 end; … … 206 174 no_zero_bytes: Boolean; 207 175 pattern: String; 208 files: TString Array;209 i: LongWord;210 begin 211 if FConnection <> nilthen176 files: TStrings; 177 i: Integer; 178 begin 179 if FConnectionID > -1 then 212 180 begin 213 181 Extension := MidStr(combo_extension.Items.Strings[combo_extension.ItemIndex], 1, 4); … … 222 190 Extension := ''; 223 191 224 files := FConnection.GetFilesList(extension, pattern, no_zero_bytes, FSortBy);192 files := ConManager.Connection[FConnectionID].GetFilesList(extension, pattern, no_zero_bytes, FSortBy); 225 193 226 194 filelist.Visible := False; 227 195 filelist.Items.Clear; 228 if Length(files) > 0 then 229 for i := 0 to High(files) do 230 filelist.Items.Add(files[i]); 196 if files.Count > 0 then 197 filelist.Items.AddStrings(files); 231 198 filelist.Visible := True; 232 199 end; … … 239 206 ext: String; 240 207 begin 241 id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);208 id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); 242 209 ext := RightStr(filelist.Items.Strings[filelist.ItemIndex], 4); 243 210 exportd.Filter := 'Files of matching extension (*.' + ext + ')|*.' + ext + '|All files|*.*'; 244 211 exportd.DefaultExt := ext; 245 212 if exportd.Execute then 246 ExportDatFile(FConnection , id, exportd.FileName);213 ExportDatFile(FConnectionID, id, exportd.FileName); 247 214 end; 248 215 … … 252 219 finfo: TFileInfo; 253 220 fs: TFileStream; 254 data: TData; 255 begin 256 id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]); 257 finfo := FConnection.GetFileInfo(id); 221 begin 222 id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); 223 finfo := ConManager.Connection[FConnectionID].GetFileInfo(id); 258 224 259 225 importd.Filter := 'Files of matching extension (*.' + finfo.Extension + ')|*.' + … … 268 234 'Size of chosen file: ' + FormatFileSize(fs.Size)) 269 235 else begin 270 SetLength(data, fs.Size); 271 fs.Read(data[0], fs.Size); 272 FConnection.UpdateDatFile(id, data); 236 ConManager.Connection[FConnectionID].UpdateDatFile(id, fs); 273 237 Self.listClick(Self); 274 238 end; … … 283 247 begin 284 248 sender_name := TComponent(Sender).Name; 285 id := FConnection.ExtractFileID(filelist.Items.Strings[filelist.ItemIndex]);249 id := ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[filelist.ItemIndex]); 286 250 context := MidStr(sender_name, Pos('_', sender_name) + 1, Length(sender_name) - Pos('_', sender_name)); 287 Form_Main.open_child(context, FConnection , id);251 Form_Main.open_child(context, FConnectionID, id); 288 252 end; 289 253 … … 295 259 begin 296 260 if combo_connection.ItemIndex >= 0 then 297 begin 298 name := combo_connection.Items.Strings[combo_connection.ItemIndex]; 299 nstart := Pos(' ', name) + 1; 300 nend := Pos('(', name) - 1; 301 name := MidStr(name, nstart, nend - nstart); 302 303 for i := 0 to High(DataConnections) do 304 begin 305 if ExtractFileName(DataConnections[i].FileName) = name then 306 begin 307 FConnection := DataConnections[i]; 308 Break; 309 end; 310 end; 311 if i = Length(DataConnections) then 312 FConnection := nil; 313 314 RecreateExtList; 315 if Assigned(FOnNewConnection) then 316 FOnNewConnection(FConnection); 317 end; 261 FConnectionID := combo_connection.ItemIndex 262 else 263 FConnectionID := -1; 264 RecreateExtList; 265 if Assigned(FOnNewConnection) then 266 FOnNewConnection(FConnectionID); 318 267 end; 319 268 … … 330 279 begin 331 280 inherited; 332 RecreateList; 333 FSelectedFile := GetEmptyFileInfo; 281 Self.Width := 260; 282 Self.Height := 300; 283 FAllowedExts := ''; 284 FAllowMultiSelect := False; 285 FOnNewFileSelected := nil; 286 FOnNewConnection := nil; 287 FOnCheckCloseable := nil; 288 FConnectionID := -1; 289 FSelectedFile.ID := -1; 290 UpdateConList; 334 291 if Length(ToolList) > 0 then 335 292 begin … … 368 325 begin 369 326 if btn_sort_id_asc.Down then 370 FSortBy := stIDAsc327 FSortBy := ST_IDAsc 371 328 else if btn_sort_id_desc.Down then 372 FSortBy := stIDDesc329 FSortBy := ST_IDDesc 373 330 else if btn_sort_name_asc.Down then 374 FSortBy := stNameAsc331 FSortBy := ST_NameAsc 375 332 else if btn_sort_name_desc.Down then 376 FSortBy := stNameDesc333 FSortBy := ST_NameDesc 377 334 else if btn_sort_ext_asc.Down then 378 FSortBy := stExtAsc335 FSortBy := ST_ExtAsc 379 336 else if btn_sort_ext_desc.Down then 380 FSortBy := stExtDesc;337 FSortBy := ST_ExtDesc; 381 338 LoadFileNames; 382 339 end; … … 394 351 if filelist.ItemIndex > -1 then 395 352 begin 396 fileid := FConnection.ExtractFileID(353 fileid := ConManager.Connection[FConnectionID].ExtractFileIDOfName( 397 354 filelist.Items.Strings[filelist.ItemIndex]); 398 FSelectedFile := FConnection.GetFileInfo(fileid);355 FSelectedFile := ConManager.Connection[FConnectionID].GetFileInfo(fileid); 399 356 if Assigned(FOnNewFileSelected) then 400 357 FOnNewFileSelected(FSelectedFile); … … 415 372 416 373 417 procedure TForm_ToolTemplate.SelectFileID(connection: TOniData; id: Integer); 418 var 419 i: Integer; 420 name: String; 421 nstart, nend: Integer; 422 begin 423 for i := 0 to combo_connection.Items.Count - 1 do 424 begin 425 name := combo_connection.Items.Strings[i]; 426 nstart := Pos(' ', name) + 1; 427 nend := Pos('(', name) - 1; 428 name := MidStr(name, nstart, nend - nstart); 429 430 if ExtractFileName(connection.FileName) = name then 431 begin 432 combo_connection.ItemIndex := i; 433 combo_connectionChange(Self); 434 end; 435 end; 374 procedure TForm_ToolTemplate.SelectConnection(ConnectionID: Integer); 375 begin 376 if FConnectionID <> ConnectionID then 377 begin 378 combo_connection.ItemIndex := ConManager.ConnectionIndexByID[ConnectionID]; 379 combo_connectionChange(Self); 380 end; 381 end; 382 383 procedure TForm_ToolTemplate.SelectFileID(ConnectionID, FileID: Integer); 384 var 385 i: Integer; 386 begin 387 if FConnectionID <> ConnectionID then 388 SelectConnection(ConnectionID); 436 389 437 390 filelist.ItemIndex := -1; 438 391 if filelist.Items.Count > 0 then 439 392 for i := 0 to filelist.Items.Count - 1 do 440 if FConnection.ExtractFileID(filelist.Items.Strings[i]) = idthen393 if ConManager.Connection[FConnectionID].ExtractFileIDOfName(filelist.Items.Strings[i]) = FileID then 441 394 begin 442 395 filelist.ItemIndex := i; … … 446 399 end; 447 400 448 procedure TForm_ToolTemplate.SelectFileName(connection: TOniData; filename: String); 449 var 450 i: Integer; 451 name: String; 452 nstart, nend: Integer; 453 begin 454 for i := 0 to combo_connection.Items.Count - 1 do 455 begin 456 name := combo_connection.Items.Strings[i]; 457 nstart := Pos(' ', name) + 1; 458 nend := Pos('(', name) - 1; 459 name := MidStr(name, nstart, nend - nstart); 460 461 if ExtractFileName(connection.FileName) = name then 462 begin 463 combo_connection.ItemIndex := i; 464 combo_connectionChange(Self); 465 end; 466 end; 401 procedure TForm_ToolTemplate.SelectFileName(ConnectionID: Integer; filename: String); 402 var 403 i: Integer; 404 begin 405 if FConnectionID <> ConnectionID then 406 SelectConnection(ConnectionID); 467 407 468 408 filelist.ItemIndex := -1; … … 519 459 520 460 521 procedure TForm_ToolTemplate.FormCreate(Sender: TObject); 522 begin 523 Self.Width := 260; 524 Self.Height := 300; 525 FOnNewFileSelected := nil; 526 FOnNewConnection := nil; 527 FAllowedExts := ''; 528 FAllowMultiSelect := False; 461 function TForm_ToolTemplate.GetToolCloseable: Boolean; 462 begin 463 if Assigned(FOnCheckCloseable) then 464 Result := FOnCheckCloseable 465 else 466 Result := True; 529 467 end; 530 468 -
oup/rewrite/Tools/TxmpReplace.pas
r93 r97 4 4 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 5 5 Dialogs, Template, StdCtrls, ExtCtrls, 6 Functions, Data, OniImgClass, Menus, Buttons ;6 Functions, Data, OniImgClass, Menus, Buttons, TypeDefs; 7 7 8 8 type … … 41 41 implementation 42 42 {$R *.dfm} 43 uses Main, OniDataClass;43 uses Main, ConnectionManager; 44 44 45 45 … … 47 47 procedure TForm_TxmpReplace.SelectFile(fileinfo: TFileInfo); 48 48 var 49 Data: T data;49 Data: TByteData; 50 50 mem: TMemoryStream; 51 51 fadingbyte, depthbyte, storebyte: Byte;
Note:
See TracChangeset
for help on using the changeset viewer.