You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/c#/GeneralUpdate.Common/Shared/Object/ConfiginfoBuilder-Usage.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,48 @@
1
1
# ConfiginfoBuilder Usage Guide
2
2
3
-
The `ConfiginfoBuilder` class provides a simple and convenient way to create `Configinfo` objects for the GeneralUpdate system. It only requires three essential parameters while automatically generating platform-appropriate defaults for all other configuration items.
3
+
The `ConfiginfoBuilder` class provides a simple and convenient way to create `Configinfo` objects for the GeneralUpdate system. It supports both JSON-based configuration and programmatic configuration.
4
4
5
5
**Design Philosophy**: Inspired by zero-configuration patterns from projects like [Velopack](https://github.com/velopack/velopack), this builder minimizes required configuration while maintaining flexibility through optional fluent setters.
6
6
7
+
## Configuration Methods
8
+
9
+
There are two main ways to configure the update system:
10
+
11
+
### 1. JSON Configuration File (Recommended)
12
+
13
+
Place an `update_config.json` file in your application's running directory. When this file exists, ConfiginfoBuilder automatically loads all settings from it, giving the configuration file the highest priority.
14
+
15
+
**Example `update_config.json`:**
16
+
```json
17
+
{
18
+
"UpdateUrl": "https://api.example.com/updates",
19
+
"Token": "your-authentication-token",
20
+
"Scheme": "https",
21
+
"AppName": "Update.exe",
22
+
"MainAppName": "MyApplication.exe",
23
+
"ClientVersion": "1.0.0",
24
+
"InstallPath": "/path/to/installation",
25
+
"BlackFormats": [".log", ".tmp", ".cache"],
26
+
"SkipDirectorys": ["/temp", "/logs"]
27
+
}
28
+
```
29
+
30
+
See [update_config.example.json](update_config.example.json) for a complete example with all available options.
31
+
32
+
**Usage:**
33
+
```csharp
34
+
// The Create method will automatically load from update_config.json if it exists
The `ConfiginfoBuilder` class provides a simple, fluent API for creating `Configinfo` objects with minimal effort. It automatically handles platform-specific defaults and only requires three essential parameters.
6
6
7
+
**NEW**: ConfiginfoBuilder now supports loading configuration from a JSON file (`update_config.json`) placed in the running directory. When this file exists, it takes the highest priority, overriding any parameters passed to the builder.
8
+
7
9
**Design Inspiration**: The zero-configuration approach is inspired by projects like [Velopack](https://github.com/velopack/velopack), focusing on sensible defaults extracted from the running application with minimal user input required.
8
10
11
+
## Configuration Priority
12
+
13
+
The ConfiginfoBuilder follows this priority order:
Place an `update_config.json` file in your application's running directory to configure all update settings. When this file is present, ConfiginfoBuilder will automatically load settings from it, ignoring parameters passed to the `Create()` method.
22
+
23
+
**Example `update_config.json`:**
24
+
```json
25
+
{
26
+
"UpdateUrl": "https://api.example.com/updates",
27
+
"Token": "your-authentication-token",
28
+
"Scheme": "https",
29
+
"AppName": "Update.exe",
30
+
"MainAppName": "MyApplication.exe",
31
+
"ClientVersion": "1.0.0",
32
+
"InstallPath": "/path/to/installation"
33
+
}
34
+
```
35
+
36
+
See [update_config.example.json](update_config.example.json) for a complete example with all available options.
37
+
9
38
## Auto-Configuration Features
10
39
11
40
🔍 **Application Name Detection**: Automatically reads `<AssemblyName>` from `.csproj`
@@ -19,30 +48,36 @@ The `ConfiginfoBuilder` class provides a simple, fluent API for creating `Config
19
48
```csharp
20
49
usingGeneralUpdate.Common.Shared.Object;
21
50
22
-
// Method 1: Direct constructor
23
-
varconfig=newConfiginfoBuilder(
24
-
updateUrl: "https://api.example.com/updates",
25
-
token: "your-auth-token",
26
-
scheme: "https"
27
-
).Build();
51
+
// Method 1: With JSON configuration file (RECOMMENDED)
52
+
// Place update_config.json in your app's running directory
53
+
// The Create method will automatically load from the file
0 commit comments