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

Comparing oup/current/DataAccess/ConnectionManager.pas (file contents):
Revision 109 by alloc, Wed Feb 21 03:12:33 2007 UTC vs.
Revision 247 by alloc, Sun Nov 25 14:24:53 2007 UTC

# Line 1 | Line 1
1   unit ConnectionManager;
2   interface
3  
4 < uses TypeDefs, DataAccess, Access_OniArchive, Access_OUP_ADB;
4 > uses TypeDefs, DataAccess, Access_OniArchive, Access_OUP_ADB, Access_OniSplitArchive;
5  
6   type
7    TConnections = array of TDataAccess;
# Line 34 | Line 34 | type
34      function CloseConnectionByIndex(Index: Integer; var Msg: TStatusMessages): Boolean; overload;
35      function CloseConnection(ID: Integer; var Msg: TStatusMessages): Boolean; overload;
36      function CloseConnection(FileName: String; var Msg: TStatusMessages): Boolean; overload;
37 +    function FileOpened(FileName: String): Integer;
38    published
39    end;
40  
# Line 153 | Line 154 | begin
154      backend := DB_ADB
155    else if ext = '.DAT' then
156      backend := DB_ONI
157 +  else if ext = '.ONI' then
158 +    backend := DB_ONISPLIT
159    else
160    begin
161      Msg := SM_UnknownExtension;
# Line 166 | Line 169 | begin
169        FConnections[i] := TAccess_OniArchive.Create(FileName, FLastID + 1, CreateMsg);
170      DB_ADB:
171        FConnections[i] := TAccess_OUP_ADB.Create(FileName, FLastID + 1, CreateMsg);
172 +    DB_ONISPLIT:
173 +      FConnections[i] := TAccess_OniSplitArchive.Create(FileName, FLastID + 1, CreateMsg);
174    end;
175  
176    if CreateMsg = SM_OK then
# Line 177 | Line 182 | begin
182    else
183    begin
184      FConnections[i].Close;
180    FConnections[i].Free;
185      FConnections[i] := nil;
186      SetLength(FConnections, Length(FConnections) - 1);
187      Msg := CreateMsg;
# Line 260 | Line 264 | begin
264   end;
265  
266  
267 + function TConnectionManager.FileOpened(FileName: String): Integer;
268 + var
269 +  i: Integer;
270 + begin
271 +  Result := -1;
272 +  if Length(FConnections) > 0 then
273 +    for i := 0 to High(FConnections) do
274 +      if FConnections[i].FileName = FileName then
275 +      begin
276 +        Result := FConnections[i].ConnectionID;
277 +        Exit;
278 +      end;
279 + end;
280 +
281 +
282   initialization
283    ConManager := TConnectionManager.Create;
284   finalization

Diff Legend

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