Index: oup/current/FileClasses/_DataTypes.pas
===================================================================
--- oup/current/FileClasses/_DataTypes.pas	(revision 125)
+++ oup/current/FileClasses/_DataTypes.pas	(revision 126)
@@ -4,34 +4,52 @@
 
 type
-  TDataType = class
+  TDataField = class
     private
-      function GetDataLength: Integer; virtual; abstract;
+      FOffset: Integer;
+      FName:   String;
+      FDescription: String;
+      FDataLength: Integer;
       function GetValueAsString: String; virtual; abstract;
-    published
-      property DataLength: Integer read GetDataLength;
-//      property DataLength: Integer;
+    public
+      constructor Create(Offset: Integer; Name, Description: String);
+
+      property Offset: Integer read FOffset;
+      property Name: String read FName;
+      property Description: String read FDescription;
+      property DataLength: Integer read FDataLength;
       property ValueAsString: String read GetValueAsString;
   end;
 
-
-  TDataField = record
-    Offset: Integer;
-    Data: TDataType;
-  end;
   TDataFields = array of TDataField;
 
 
-  TInt32 = class(TDataType)
+  TInt32 = class(TDataField)
     private
-      FValue: LongWord;
-      function GetDataLength: Integer; override;
+      FInt: LongWord;
       function GetValueAsString: String; override;
+    public
+      constructor Create(Offset: Integer; Name, Description: String);
   end;
 
-  TString = class(TDataType)
+
+  TString = class(TDataField)
     private
       FString: String;
-      function GetDataLength: Integer; override;
       function GetValueAsString: String; override;
+    public
+      constructor Create(Offset: Integer; Name, Description: String; Length: Integer);
+  end;
+
+
+  
+  TArray = class(TDataField)
+    private
+      FDataFields: TDataFields;
+      function GetFieldByOffset(Offset: Integer): TDataField;
+      function GetFieldByIndex(ID: Integer): TDataField;
+    public
+      constructor Create(Offset: Integer; Name, Description: String; Length, Count: Integer);
+      property FieldByOffset[Offset: Integer]: TDataField read GetFieldByOffset;
+      property FieldByIndex[ID: Integer]: TDataField read GetFieldByIndex;
   end;
 
@@ -41,21 +59,37 @@
   SysUtils;
 
+
+{ TDataType }
+
+constructor TDataField.Create(Offset: Integer; Name, Description: String);
+begin
+  FOffset := Offset;
+  FName := Name;
+  FDescription := Description; 
+end;
+
+
+
 { TInt32 }
 
-function TInt32.GetDataLength: Integer;
+constructor TInt32.Create(Offset: Integer; Name, Description: String);
 begin
-  Result := 4;
+  inherited Create(Offset, Name, Description);
 end;
 
 function TInt32.GetValueAsString: String;
 begin
-  Result := IntToStr(FValue);
+  Result := IntToStr(FInt);
 end;
+
+
 
 { TString }
 
-function TString.GetDataLength: Integer;
+constructor TString.Create(Offset: Integer; Name, Description: String;
+  Length: Integer);
 begin
-  Result := Length(FString);
+  inherited Create(Offset, Name, Description);
+
 end;
 
@@ -65,3 +99,38 @@
 end;
 
+
+
+{ TArray }
+
+constructor TArray.Create(Offset: Integer; Name, Description: String;
+  Length, Count: Integer);
+begin
+  Exit;
+end;
+
+function TArray.GetFieldByIndex(ID: Integer): TDataField;
+begin
+  if ID < Length(FDataFields) then
+    Result := FDataFields[ID]
+  else
+    Result := nil;
+end;
+
+function TArray.GetFieldByOffset(Offset: Integer): TDataField;
+var
+  i: Integer;
+begin
+  Result := nil;
+
+  if Length(FDataFields) > 0 then
+  begin
+    for i := 0 to High(FDataFields) do
+      if FDataFields[i].Offset = Offset then
+        break;
+    if i < Length(FDataFields) then
+      Result := FDataFields[i];
+  end;
+end;
+
+
 end.
Index: oup/current/FileClasses/_FileTypes.pas
===================================================================
--- oup/current/FileClasses/_FileTypes.pas	(revision 125)
+++ oup/current/FileClasses/_FileTypes.pas	(revision 126)
@@ -8,13 +8,30 @@
 
 type
-  TFileType = class
+  TFile = class
     private
+      FConnectionID: Integer;
+      FFileID: Integer;
+
       FDatLinks: TDatLinkList;
       FDataFields: TDataFields;
-      function GetDatLink(Offset: Integer): TDatLink;
-      function GetField(Offset: Integer): TDataField;
+      FRawParts: TRawDataList;
+
+      function GetDatLinkByOffset(Offset: Integer): TDatLink;
+      function GetDatLinkByIndex(ID: Integer): TDatLink;
+      function GetFieldByOffset(Offset: Integer): TDataField;
+      function GetFieldByIndex(ID: Integer): TDataField;
+      function GetRawPartByOffset(Offset: Integer): TRawDataInfo;
+      function GetRawPartByIndex(ID: Integer): TRawDataInfo;
     public
-      property LinksByID[Offset: Integer]: TDatLink read GetDatLink;
-      property Fields[Offset: Integer]: TDataField read GetField;
+      constructor Create(ConnectionID, FileID: Integer);
+      
+      property LinkByOffset[Offset: Integer]: TDatLink read GetDatLinkByOffset;
+      property LinkByIndex[ID: Integer]: TDatLink read GetDatLinkByIndex;
+
+      property FieldByOffset[Offset: Integer]: TDataField read GetFieldByOffset;
+      property FieldByIndex[ID: Integer]: TDataField read GetFieldByIndex;
+
+      property RawPartByOffset[Offset: Integer]: TRawDataInfo read GetRawPartByOffset;
+      property RawPartByIndex[ID: Integer]: TRawDataInfo read GetRawPartByIndex;
   end;
 
@@ -22,7 +39,33 @@
 implementation
 
+uses
+  DatLinks, RawList;
+
 { TFileType }
 
-function TFileType.GetDatLink(Offset: Integer): TDatLink;
+constructor TFile.Create(ConnectionID, FileID: Integer);
+begin
+  FConnectionID := ConnectionID;
+  FFileID := FileID;
+
+  FDatLinks := DatLinksManager.GetDatLinks(ConnectionID, FileID);
+  FRawParts := RawLists.GetRawList(ConnectionID, FileID);
+end;
+
+
+function TFile.GetDatLinkByIndex(ID: Integer): TDatLink;
+begin
+  if ID < Length(FDatLinks) then
+    Result := FDatLinks[ID]
+  else
+    with Result do
+    begin
+      SrcOffset := -1;
+      DestID := -1;
+      PosDestExts := '';
+    end;
+end;
+
+function TFile.GetDatLinkByOffset(Offset: Integer): TDatLink;
 var
   i: Integer;
@@ -42,10 +85,18 @@
 end;
 
-function TFileType.GetField(Offset: Integer): TDataField;
+
+function TFile.GetFieldByIndex(ID: Integer): TDataField;
+begin
+  if ID < Length(FDataFields) then
+    Result := FDataFields[ID]
+  else
+    Result := nil;
+end;
+
+function TFile.GetFieldByOffset(Offset: Integer): TDataField;
 var
   i: Integer;
 begin
-  Result.Offset := -1;
-  Result.Data := nil;
+  Result := nil;
 
   if Length(FDataFields) > 0 then
@@ -59,3 +110,40 @@
 end;
 
+
+function TFile.GetRawPartByIndex(ID: Integer): TRawDataInfo;
+begin
+  if ID < Length(FRawParts) then
+    Result := FRawParts[ID]
+  else
+    with Result do
+    begin
+      SrcID := -1;
+      SrcOffset := -1;
+      RawAddr := -1;
+      RawSize := -1;
+    end;
+end;
+
+function TFile.GetRawPartByOffset(Offset: Integer): TRawDataInfo;
+var
+  i: Integer;
+begin
+  with Result do
+  begin
+    SrcID := -1;
+    SrcOffset := -1;
+    RawAddr := -1;
+    RawSize := -1;
+  end;
+
+  if Length(FRawParts) > 0 then
+  begin
+    for i := 0 to High(FRawParts) do
+      if FRawParts[i].SrcOffset = Offset then
+        break;
+    if i < Length(FRawParts) then
+      Result := FRawParts[i];
+  end;
+end;
+
 end.
