-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathRac.Dropbox.Types.pas
More file actions
105 lines (87 loc) · 2.29 KB
/
Rac.Dropbox.Types.pas
File metadata and controls
105 lines (87 loc) · 2.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
unit Rac.Dropbox.Types;
interface
uses
System.Generics.Collections, System.SysUtils;
type TDropboxItem = class(TObject)
private
FName: string;
FId: string;
FPath: string;
FPathLower: string;
FSharedLink: string;
protected
public
function IsFile: Boolean; virtual; abstract;
function IsFolder: Boolean; virtual; abstract;
property Name: string read FName write FName;
property ID: string read FId write FId;
property Path: string read FPath write FPath;
property PathLower: string read FPathLower write FPathLower;
property SharedLink: string read FSharedLink write FSharedLink;
end;
type TDropboxItems = class(TObjectList<TDropboxItem>)
private
FCursor: string;
FHasMore: Boolean;
public
property Cursor: string read FCursor write FCursor;
property HasMore: Boolean read FHasMore write FHasMore;
function GetByID(ID: string): TDropboxItem; // return nil if not found
end;
type TDropboxFolder = class(TDropboxItem)
protected
protected
public
function IsFile: Boolean; override;
function IsFolder: Boolean; override;
end;
type TDropboxFile = class(TDropboxItem)
private
FRev: string;
FSize: UInt64;
FModifiedServer: TDateTime;
FModifiedClient: TDateTime;
FIsDownloadable: Boolean;
protected
public
function IsFile: Boolean; override;
function IsFolder: Boolean; override;
property Rev: string read FRev write FRev;
property ModifiedClient: TDateTime read FModifiedClient write FModifiedClient;
property ModifiedServer: TDateTime read FModifiedServer write FModifiedServer;
property Size: UInt64 read FSize write FSize;
property IsDownloadable: Boolean read FIsDownloadable write FIsDownloadable;
end;
implementation
{ TDropboxFile }
function TDropboxFile.IsFile: Boolean;
begin
Result := True;
end;
function TDropboxFile.IsFolder: Boolean;
begin
Result := False;
end;
{ TDropboxFolder }
function TDropboxFolder.IsFile: Boolean;
begin
Result := False;
end;
function TDropboxFolder.IsFolder: Boolean;
begin
Result := True;
end;
{ TDropboxItems }
function TDropboxItems.GetByID(ID: string): TDropboxItem;
var
i: Integer;
begin
Result := nil;
for i := 0 to Count - 1 do
if Items[i].ID.Equals(ID) then
begin
Result := Items[i];
Break;
end;
end;
end.