Rev 40 | Rev 44 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 40 | Rev 43 | ||
---|---|---|---|
Line 115... | Line 115... | ||
115 | end; |
115 | end; |
116 | {$ENDREGION} |
116 | {$ENDREGION} |
117 | 117 | ||
118 | {$REGION 'Update the treeview'} |
118 | {$REGION 'Update the treeview'} |
119 | Self.Items.Clear; |
119 | Self.Items.Clear; |
120 | try |
- | |
121 | magic := Read(ptr, LEN_MAGIC); |
120 | magic := Read(ptr, LEN_MAGIC); |
122 | if magic = 'FAST100!' then |
121 | if magic = 'FAST100!' then |
123 | Rec100(nil, ptr) |
122 | Rec100(nil, ptr) |
124 | else |
123 | else |
125 | raise EFastNodeException.CreateFmt('FastNode version "%s" not supported.', [magic]); |
124 | raise EFastNodeException.CreateFmt('FastNode version "%s" not supported.', [magic]); |
126 | except |
- | |
127 | on E: Exception do |
- | |
128 | begin |
- | |
129 | Self.Items.Clear; |
- | |
130 | tn := Self.Items.Add(nil, 'ERROR: ' + E.Message); |
- | |
131 | tn.ImageIndex := -1; |
- | |
132 | tn.SelectedIndex := -1; |
- | |
133 | end; |
- | |
134 | end; |
- | |
135 | {$ENDREGION} |
125 | {$ENDREGION} |
136 | 126 | ||
137 | {$REGION 'Recover the previous current state (selected and expanded flags)'} |
127 | {$REGION 'Recover the previous current state (selected and expanded flags)'} |
138 | for i := 0 to Self.Items.Count-1 do |
128 | for i := 0 to Self.Items.Count-1 do |
139 | begin |
129 | begin |
Line 153... | Line 143... | ||
153 | expanded.Free; |
143 | expanded.Free; |
154 | end; |
144 | end; |
155 | end; |
145 | end; |
156 | 146 | ||
157 | function TTreeViewFastPHP.FillWithFastPHPData(data: string): boolean; |
147 | function TTreeViewFastPHP.FillWithFastPHPData(data: string): boolean; |
- | 148 | var |
|
- | 149 | tn: TTreeNode; |
|
158 | begin |
150 | begin |
- | 151 | try |
|
159 | data := Trim(data); |
152 | data := Trim(data); |
160 | if not EndsStr('X', data) then raise EFastNodeException.Create('FastNode string must end with "X"'); |
153 | if not EndsStr('X', data) then raise EFastNodeException.Create('FastNode string must end with "X"'); |
161 | 154 | ||
162 | result := DoFillWithFastPHPData(PChar(data)); |
155 | result := DoFillWithFastPHPData(PChar(data)); |
- | 156 | except |
|
- | 157 | on E: Exception do |
|
- | 158 | begin |
|
- | 159 | Self.Items.Clear; |
|
- | 160 | tn := Self.Items.Add(nil, 'ERROR: ' + E.Message); |
|
- | 161 | tn.ImageIndex := -1; |
|
- | 162 | tn.SelectedIndex := -1; |
|
- | 163 | end; |
|
- | 164 | end; |
|
163 | end; |
165 | end; |
164 | 166 | ||
165 | class function TTreeViewFastPHP.Read(var ptr: PChar; len: integer): string; |
167 | class function TTreeViewFastPHP.Read(var ptr: PChar; len: integer): string; |
166 | begin |
168 | begin |
167 | result := Copy(string(ptr), 1, len); |
169 | result := Copy(string(ptr), 1, len); |