|
@@ -62,13 +62,16 @@ type
|
|
|
TReadStrEvent = function(const ASection, Item, Default: string): string of object;
|
|
|
TWriteStrEvent = procedure(const ASection, Item, Value: string) of object;
|
|
|
TEraseSectEvent = procedure(const ASection: string) of object;
|
|
|
-
|
|
|
+ TPropStorageOption = (psoAlwaysStoreStringsCount);
|
|
|
+ TPropStorageOptions = set of TPropStorageOption;
|
|
|
+
|
|
|
TPropsStorage = class(TObject)
|
|
|
private
|
|
|
FObject: TObject;
|
|
|
FOwner: TComponent;
|
|
|
FPrefix: string;
|
|
|
FSection: string;
|
|
|
+ FOptions : TPropStorageOptions;
|
|
|
FOnReadString: TReadStrEvent;
|
|
|
FOnWriteString: TWriteStrEvent;
|
|
|
FOnEraseSection: TEraseSectEvent;
|
|
@@ -113,6 +116,7 @@ type
|
|
|
procedure LoadProperties(PropList: TStrings);
|
|
|
procedure LoadObjectsProps(AComponent: TComponent; StoredList: TStrings);
|
|
|
procedure StoreObjectsProps(AComponent: TComponent; StoredList: TStrings);
|
|
|
+ Property Options : TPropStorageOptions Read FOptions Write FOptions;
|
|
|
property AObject: TObject read FObject write FObject;
|
|
|
property Prefix: string read FPrefix write FPrefix;
|
|
|
property Section: string read FSection write FSection;
|
|
@@ -465,11 +469,13 @@ begin
|
|
|
List := TObject(GetObjectProp(Self.FObject, PropInfo));
|
|
|
SectName := Format('%s.%s', [Section, GetItemName(PropInfo^.Name)]);
|
|
|
EraseSection(SectName);
|
|
|
- if (List is TStrings) and (TStrings(List).Count > 0) then begin
|
|
|
+ if (List is TStrings)
|
|
|
+ and ((TStrings(List).Count > 0) or (psoAlwaysStoreStringsCount in Options)) then
|
|
|
+ begin
|
|
|
WriteString(SectName, sCount, IntToStr(TStrings(List).Count));
|
|
|
for I := 0 to TStrings(List).Count - 1 do
|
|
|
WriteString(SectName, Format(sItem, [I]), TStrings(List)[I]);
|
|
|
- end;
|
|
|
+ end;
|
|
|
end;
|
|
|
|
|
|
function TPropsStorage.StoreComponentProperty(PropInfo: PPropInfo): string;
|