Procházet zdrojové kódy

Quick.Config sample updated

Exilon před 7 roky
rodič
revize
91389e945f

+ 14 - 2
samples/QuickConfig/Main.pas

@@ -52,7 +52,9 @@ type
     Complex : TProcessType;
     ModifyDate : TDateTime;
     WorkList : TObjectList<TWorker>;
+    constructor Create; override;
     destructor Destroy; override;
+    procedure DefaultValues;
     property Title : string read fTitle write fTitle;
     property SessionName : string read fSessionName write fSessionName;
   end;
@@ -129,8 +131,6 @@ begin
   cConfig.Complex.Redundant := False;
   cConfig.Title := 'a fresh title';
   cConfig.SessionName := 'First Session';
-  if Assigned(cConfig.WorkList) then cconfig.WorkList.Free;
-  cConfig.WorkList := TObjectList<TWorker>.Create(True);
   for I := 0 to 22 do
   begin
     worker := TWorker.Create;
@@ -200,6 +200,18 @@ end;
 
 { TMyConfig }
 
+constructor TMyConfig.Create;
+begin
+  inherited;
+  WorkList := TObjectList<TWorker>.Create(True);
+  DefaultValues;
+end;
+
+procedure TMyConfig.DefaultValues;
+begin
+  fTitle := 'Default value';
+end;
+
 destructor TMyConfig.Destroy;
 begin
   if Assigned(WorkList) then WorkList.Free;

+ 1 - 1
samples/QuickConfig/QuickConfigDemo.dproj

@@ -1,7 +1,7 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     <PropertyGroup>
         <ProjectGuid>{CDEBAD41-A241-457F-96FD-E367D8E3B0AE}</ProjectGuid>
-        <ProjectVersion>18.2</ProjectVersion>
+        <ProjectVersion>18.3</ProjectVersion>
         <FrameworkType>VCL</FrameworkType>
         <MainSource>QuickConfigDemo.dpr</MainSource>
         <Base>True</Base>

+ 551 - 0
samples/QuickConfig/Win64/Debug/Config.json

@@ -0,0 +1,551 @@
+{
+  "Sizes": [
+    23,
+    11,
+    554,
+    12,
+    34,
+    29,
+    77,
+    30,
+    48,
+    59,
+    773,
+    221,
+    98,
+    3,
+    22,
+    983,
+    122,
+    231,
+    433,
+    12,
+    31,
+    987
+  ],
+  "LastFilename": "library.txt",
+  "WindowPos": {
+    "PosX": 480,
+    "PosY": 0
+  },
+  "History": [
+    {
+      "Id": 0,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 1,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 2,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 3,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 4,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 5,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 6,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 7,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 8,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 9,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 10,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 11,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 12,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 13,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 14,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 15,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 0,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 1,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 2,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 3,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 4,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 5,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 6,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 7,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 8,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 9,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 10,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 11,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 12,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 13,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 14,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 15,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 0,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 1,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 2,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 3,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 4,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 5,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 6,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 7,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 8,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 9,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 10,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 11,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 12,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 13,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 14,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 15,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 0,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 1,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 2,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 3,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 4,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 5,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 6,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 7,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 8,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 9,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 10,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 11,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 12,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 13,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 14,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 15,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 0,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 1,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 2,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 3,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 4,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 5,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 6,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 7,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 8,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 9,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 10,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 11,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 12,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 13,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 14,
+      "Priority": 0,
+      "Redundant": true
+    },
+    {
+      "Id": 15,
+      "Priority": 0,
+      "Redundant": true
+    }
+  ],
+  "Complex": {
+    "Id": 0,
+    "Priority": 2,
+    "Redundant": false
+  },
+  "ModifyDate": "11/11/2017 16:37:39",
+  "WorkList": {
+    "FOwnsObjects": true,
+    "FListHelper": {
+      "FCount": 23
+    },
+    "FItems": [
+      {
+        "Name": "Process 0",
+        "Active": false
+      },
+      {
+        "Name": "Process 1",
+        "Active": false
+      },
+      {
+        "Name": "Process 2",
+        "Active": false
+      },
+      {
+        "Name": "Process 3",
+        "Active": false
+      },
+      {
+        "Name": "Process 4",
+        "Active": false
+      },
+      {
+        "Name": "Process 5",
+        "Active": false
+      },
+      {
+        "Name": "Process 6",
+        "Active": false
+      },
+      {
+        "Name": "Process 7",
+        "Active": false
+      },
+      {
+        "Name": "Process 8",
+        "Active": false
+      },
+      {
+        "Name": "Process 9",
+        "Active": false
+      },
+      {
+        "Name": "Process 10",
+        "Active": false
+      },
+      {
+        "Name": "Process 11",
+        "Active": false
+      },
+      {
+        "Name": "Process 12",
+        "Active": false
+      },
+      {
+        "Name": "Process 13",
+        "Active": false
+      },
+      {
+        "Name": "Process 14",
+        "Active": false
+      },
+      {
+        "Name": "Process 15",
+        "Active": false
+      },
+      {
+        "Name": "Process 16",
+        "Active": false
+      },
+      {
+        "Name": "Process 17",
+        "Active": false
+      },
+      {
+        "Name": "Process 18",
+        "Active": false
+      },
+      {
+        "Name": "Process 19",
+        "Active": false
+      },
+      {
+        "Name": "Process 20",
+        "Active": false
+      },
+      {
+        "Name": "Process 21",
+        "Active": false
+      },
+      {
+        "Name": "Process 22",
+        "Active": false
+      },
+      null,
+      null,
+      null,
+      null,
+      null,
+      null,
+      null,
+      null,
+      null
+    ],
+    "FComparer": {}
+  },
+  "Title": "a fresh title",
+  "SessionName": "First Session"
+}