4 Commits

Author SHA1 Message Date
db019639da Update 2026-01-17 02:10:04 +01:00
3c0ff7f9dd Add profiles from other branches 2026-01-17 02:09:58 +01:00
aa4e7a443f Implement configuration profiles 2026-01-17 02:09:53 +01:00
b50491a08d Fix issue where hiding thumbnails was delayed 2026-01-16 23:35:50 +01:00
15 changed files with 710 additions and 205 deletions

View File

@@ -1,100 +0,0 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"EVE-O-Preview/1.0.0": {
"dependencies": {
"LightInject": "7.0.1",
"MediatR": "9.0.0",
"Microsoft.CSharp": "4.7.0",
"Microsoft.NET.ILLink.Analyzers": "7.0.100-1.23211.1",
"Microsoft.NET.ILLink.Tasks": "7.0.100-1.23211.1",
"Newtonsoft.Json": "13.0.3"
},
"runtime": {
"EVE-O-Preview.dll": {}
}
},
"LightInject/7.0.1": {
"runtime": {
"lib/netstandard2.0/LightInject.dll": {
"assemblyVersion": "7.0.1.0",
"fileVersion": "7.0.1.0"
}
}
},
"MediatR/9.0.0": {
"runtime": {
"lib/netstandard2.1/MediatR.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.0.0"
}
}
},
"Microsoft.CSharp/4.7.0": {},
"Microsoft.NET.ILLink.Analyzers/7.0.100-1.23211.1": {},
"Microsoft.NET.ILLink.Tasks/7.0.100-1.23211.1": {},
"Newtonsoft.Json/13.0.3": {
"runtime": {
"lib/net6.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.3.27908"
}
}
}
}
},
"libraries": {
"EVE-O-Preview/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"LightInject/7.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-aw4ayG2Pe68i+85ws8zYk7MPCKjEd4DeBoTqVvmjA2cfpYYNnw+v0E5T3PKdriKaxdKF+eUzlnxWWZnYK/gx4w==",
"path": "lightinject/7.0.1",
"hashPath": "lightinject.7.0.1.nupkg.sha512"
},
"MediatR/9.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-8b3UYNxegHVYcJMG2zH8wn+YqxLvXG+eMfj0cMCq/jTW72p6O3PCKMkrIv0mqyxdW7bA4gblsocw7n+/9Akg5g==",
"path": "mediatr/9.0.0",
"hashPath": "mediatr.9.0.0.nupkg.sha512"
},
"Microsoft.CSharp/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
"path": "microsoft.csharp/4.7.0",
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
},
"Microsoft.NET.ILLink.Analyzers/7.0.100-1.23211.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-0GvbEgDGcUQA9KuWcQU1WwYHXt1tBzNr1Nls/M57rM7NA/AndFwCaCEoJpJkmxRY7xLlPDBnmGp8h5+FNqUngg==",
"path": "microsoft.net.illink.analyzers/7.0.100-1.23211.1",
"hashPath": "microsoft.net.illink.analyzers.7.0.100-1.23211.1.nupkg.sha512"
},
"Microsoft.NET.ILLink.Tasks/7.0.100-1.23211.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tvG8XZYLjT0o3WicCyKBZysVWo1jC9HdCFmNRmddx3WbAz0UCsd0qKZqpiEo99VLA8Re+FzWK51OcRldQPbt2Q==",
"path": "microsoft.net.illink.tasks/7.0.100-1.23211.1",
"hashPath": "microsoft.net.illink.tasks.7.0.100-1.23211.1.nupkg.sha512"
},
"Newtonsoft.Json/13.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-HrC5BXdl00IP9zeV+0Z848QWPAoCr9P3bDEZguI+gkLcBKAOxix/tLEAAHC+UvDNPv4a2d18lOReHMOagPa+zQ==",
"path": "newtonsoft.json/13.0.3",
"hashPath": "newtonsoft.json.13.0.3.nupkg.sha512"
}
}
}

View File

@@ -1,18 +0,0 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
},
{
"name": "Microsoft.WindowsDesktop.App",
"version": "6.0.0"
}
],
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false
}
}
}

View File

@@ -0,0 +1,135 @@
{
"ConfigVersion": 1,
"CycleGroup1ForwardHotkeys": [
"F14",
"Control+F14"
],
"CycleGroup1BackwardHotkeys": [
"F13",
"Control+F13"
],
"CycleGroup1ClientsOrder": {
"EVE - Example DPS Toon 1": 1,
"EVE - Example DPS Toon 2": 2,
"EVE - Example DPS Toon 3": 3
},
"CycleGroup2ForwardHotkeys": [
"F16",
"Control+F16"
],
"CycleGroup2BackwardHotkeys": [
"F15",
"Control+F15"
],
"CycleGroup2ClientsOrder": {
"EVE - Example Logi Toon 1": 1,
"EVE - Example Scout Toon 2": 2,
"EVE - Example Tackle Toon 3": 3
},
"CycleGroup3ForwardHotkeys": [
""
],
"CycleGroup3BackwardHotkeys": [
""
],
"CycleGroup3ClientsOrder": {
"EVE - cycle group 3": 1
},
"CycleGroup4ForwardHotkeys": [
""
],
"CycleGroup4BackwardHotkeys": [
""
],
"CycleGroup4ClientsOrder": {
"EVE - cycle group 4": 1
},
"CycleGroup5ForwardHotkeys": [
""
],
"CycleGroup5BackwardHotkeys": [
""
],
"CycleGroup5ClientsOrder": {
"EVE - cycle group 5": 1
},
"PerClientActiveClientHighlightColor": {
"EVE - Example Toon 1": "Red",
"EVE - Example Toon 2": "Green"
},
"PerClientThumbnailSize": {
"EVE - Example Toon 1": "200, 200",
"EVE - Example Toon 2": "200, 200"
},
"PerClientThumbnailRegion": {},
"PerClientZoomAnchor": {
"EVE - Example Toon 1": 1,
"EVE - Example Toon 2": 7
},
"MinimizeToTray": true,
"ThumbnailRefreshPeriod": 500,
"ThumbnailResizeTimeoutPeriod": 500,
"WineCompatibilityMode": false,
"ThumbnailsOpacity": 1.0,
"EnableClientLayoutTracking": false,
"HideActiveClientThumbnail": false,
"HideLoginClientThumbnail": false,
"MinimizeInactiveClients": false,
"WindowsAnimationStyle": 1,
"ShowThumbnailsAlwaysOnTop": true,
"EnablePerClientThumbnailLayouts": false,
"HideThumbnailsOnLostFocus": false,
"HideThumbnailsDelay": 2,
"ThumbnailSize": "451, 238",
"ThumbnailMaximumSize": "960, 540",
"ThumbnailMinimumSize": "192, 108",
"EnableThumbnailSnap": true,
"ThumbnailSnapRange": 150,
"EnableThumbnailZoom": false,
"ThumbnailZoomFactor": 2,
"ThumbnailZoomAnchor": 0,
"OverlayLabelAnchor": 0,
"ShowThumbnailOverlays": true,
"ShowThumbnailFrames": false,
"LockThumbnailLocation": false,
"ThumbnailSnapToGrid": true,
"ThumbnailSnapToGridSizeX": 112,
"ThumbnailSnapToGridSizeY": 59,
"EnableActiveClientHighlight": true,
"ActiveClientHighlightColor": "GreenYellow",
"OverlayLabelColor": "Orange",
"OverlayLabelSize": 10,
"EnableThumbnailRegionSnipping": true,
"DefaultThumbnailRegion": "1664, 188, 451, 238",
"CurrentProfile": "Default",
"ProfileReadOnly": false,
"IconName": "IconOriginal",
"ActiveClientHighlightThickness": 3,
"LoginThumbnailLocation": "5, 5",
"ToggleTrackingHotkey": "Alt+F16",
"ToggleSingleProcessHotkey": "Control+F16",
"ToggleAllThumbnailsHotkey": "Shift+Alt+Oem3",
"ThumbnailsManuallyHidden": false,
"PerClientLayout": {},
"FlatLayout": {
"EVE - Sn v1 cosunoo (2)": "1995, 1058",
"EVE - Primorium (1)": "240, 645",
"EVE - PhatPhuckDave (3)": "224, -2",
"EVE - Primorium (3)": "146, 285",
"EVE - PhatPhuckDave (2)": "146, 57",
"EVE - Sn v1 cosunoo (1)": "154, 472",
"EVE - Sn v1 cosunoo (3)": "292, 517",
"EVE - Primorium (2)": "224, 236",
"EVE - PhatPhuckDave (1)": "292, 57",
"EVE - Secundamen (1)": "224, 474"
},
"ClientLayout": {},
"ClientHotkey": {},
"DisableThumbnail": {
"EVE - PhatPhuckDave (1)": false
},
"PriorityClients": [],
"ExecutablesToPreview": [
"exefile"
]
}

View File

@@ -66,11 +66,11 @@
"EVE - Example Toon 1": 1, "EVE - Example Toon 1": 1,
"EVE - Example Toon 2": 7 "EVE - Example Toon 2": 7
}, },
"MinimizeToTray": false, "MinimizeToTray": true,
"ThumbnailRefreshPeriod": 500, "ThumbnailRefreshPeriod": 500,
"ThumbnailResizeTimeoutPeriod": 500, "ThumbnailResizeTimeoutPeriod": 500,
"WineCompatibilityMode": false, "WineCompatibilityMode": false,
"ThumbnailsOpacity": 0.5, "ThumbnailsOpacity": 1.0,
"EnableClientLayoutTracking": false, "EnableClientLayoutTracking": false,
"HideActiveClientThumbnail": false, "HideActiveClientThumbnail": false,
"HideLoginClientThumbnail": false, "HideLoginClientThumbnail": false,
@@ -80,11 +80,11 @@
"EnablePerClientThumbnailLayouts": false, "EnablePerClientThumbnailLayouts": false,
"HideThumbnailsOnLostFocus": false, "HideThumbnailsOnLostFocus": false,
"HideThumbnailsDelay": 2, "HideThumbnailsDelay": 2,
"ThumbnailSize": "408, 177", "ThumbnailSize": "429, 140",
"ThumbnailMaximumSize": "960, 540", "ThumbnailMaximumSize": "960, 540",
"ThumbnailMinimumSize": "192, 108", "ThumbnailMinimumSize": "192, 108",
"EnableThumbnailSnap": true, "EnableThumbnailSnap": true,
"ThumbnailSnapRange": 20, "ThumbnailSnapRange": 0,
"EnableThumbnailZoom": false, "EnableThumbnailZoom": false,
"ThumbnailZoomFactor": 2, "ThumbnailZoomFactor": 2,
"ThumbnailZoomAnchor": 0, "ThumbnailZoomAnchor": 0,
@@ -93,14 +93,14 @@
"ShowThumbnailFrames": false, "ShowThumbnailFrames": false,
"LockThumbnailLocation": false, "LockThumbnailLocation": false,
"ThumbnailSnapToGrid": true, "ThumbnailSnapToGrid": true,
"ThumbnailSnapToGridSizeX": 102, "ThumbnailSnapToGridSizeX": 107,
"ThumbnailSnapToGridSizeY": 44, "ThumbnailSnapToGridSizeY": 35,
"EnableActiveClientHighlight": false, "EnableActiveClientHighlight": true,
"ActiveClientHighlightColor": "GreenYellow", "ActiveClientHighlightColor": "GreenYellow",
"OverlayLabelColor": "Orange", "OverlayLabelColor": "Orange",
"OverlayLabelSize": 10, "OverlayLabelSize": 10,
"EnableThumbnailRegionSnipping": true, "EnableThumbnailRegionSnipping": true,
"DefaultThumbnailRegion": "1187, 1252, 398, 174", "DefaultThumbnailRegion": "1205, 1269, 429, 140",
"CurrentProfile": "Default", "CurrentProfile": "Default",
"AvailableProfiles": [ "AvailableProfiles": [
"Default" "Default"
@@ -110,13 +110,15 @@
"LoginThumbnailLocation": "5, 5", "LoginThumbnailLocation": "5, 5",
"ToggleTrackingHotkey": "Alt+F16", "ToggleTrackingHotkey": "Alt+F16",
"ToggleSingleProcessHotkey": "Control+F16", "ToggleSingleProcessHotkey": "Control+F16",
"ToggleAllThumbnailsHotkey": "Alt+F12", "ToggleAllThumbnailsHotkey": "Alt+Oem3",
"ThumbnailsManuallyHidden": false, "ThumbnailsManuallyHidden": false,
"PerClientLayout": {}, "PerClientLayout": {},
"FlatLayout": { "FlatLayout": {
"EVE - Sn v1 cosunoo (2)": "1938, 1100", "EVE - Quartio": "0, 1295",
"EVE - Primorium (1)": "1530, 1100", "EVE - Tertiale": "0, 1155",
"EVE - PhatPhuckDave (3)": "1122, 1100" "EVE - Secundamen": "0, 1015",
"EVE - Primorium": "0, 875",
"EVE - PhatPhuckDave": "0, 735"
}, },
"ClientLayout": {}, "ClientLayout": {},
"ClientHotkey": {}, "ClientHotkey": {},
@@ -125,4 +127,4 @@
"ExecutablesToPreview": [ "ExecutablesToPreview": [
"exefile" "exefile"
] ]
} }

View File

@@ -0,0 +1,4 @@
{
"CurrentProfile": "capacitor",
"ProfileReadOnly": true
}

View File

@@ -0,0 +1,130 @@
{
"ConfigVersion": 1,
"CycleGroup1ForwardHotkeys": [
"F14",
"Control+F14"
],
"CycleGroup1BackwardHotkeys": [
"F13",
"Control+F13"
],
"CycleGroup1ClientsOrder": {
"EVE - Example DPS Toon 1": 1,
"EVE - Example DPS Toon 2": 2,
"EVE - Example DPS Toon 3": 3
},
"CycleGroup2ForwardHotkeys": [
"F16",
"Control+F16"
],
"CycleGroup2BackwardHotkeys": [
"F15",
"Control+F15"
],
"CycleGroup2ClientsOrder": {
"EVE - Example Logi Toon 1": 1,
"EVE - Example Scout Toon 2": 2,
"EVE - Example Tackle Toon 3": 3
},
"CycleGroup3ForwardHotkeys": [
""
],
"CycleGroup3BackwardHotkeys": [
""
],
"CycleGroup3ClientsOrder": {
"EVE - cycle group 3": 1
},
"CycleGroup4ForwardHotkeys": [
""
],
"CycleGroup4BackwardHotkeys": [
""
],
"CycleGroup4ClientsOrder": {
"EVE - cycle group 4": 1
},
"CycleGroup5ForwardHotkeys": [
""
],
"CycleGroup5BackwardHotkeys": [
""
],
"CycleGroup5ClientsOrder": {
"EVE - cycle group 5": 1
},
"PerClientActiveClientHighlightColor": {
"EVE - Example Toon 1": "Red",
"EVE - Example Toon 2": "Green"
},
"PerClientThumbnailSize": {
"EVE - Example Toon 1": "200, 200",
"EVE - Example Toon 2": "200, 200"
},
"PerClientThumbnailRegion": {},
"PerClientZoomAnchor": {
"EVE - Example Toon 1": 1,
"EVE - Example Toon 2": 7
},
"MinimizeToTray": true,
"ThumbnailRefreshPeriod": 500,
"ThumbnailResizeTimeoutPeriod": 500,
"WineCompatibilityMode": false,
"ThumbnailsOpacity": 1.0,
"EnableClientLayoutTracking": false,
"HideActiveClientThumbnail": false,
"HideLoginClientThumbnail": false,
"MinimizeInactiveClients": false,
"WindowsAnimationStyle": 1,
"ShowThumbnailsAlwaysOnTop": true,
"EnablePerClientThumbnailLayouts": false,
"HideThumbnailsOnLostFocus": false,
"HideThumbnailsDelay": 2,
"ThumbnailSize": "451, 238",
"ThumbnailMaximumSize": "960, 540",
"ThumbnailMinimumSize": "192, 108",
"EnableThumbnailSnap": true,
"ThumbnailSnapRange": 150,
"EnableThumbnailZoom": false,
"ThumbnailZoomFactor": 2,
"ThumbnailZoomAnchor": 0,
"OverlayLabelAnchor": 0,
"ShowThumbnailOverlays": true,
"ShowThumbnailFrames": false,
"LockThumbnailLocation": false,
"ThumbnailSnapToGrid": true,
"ThumbnailSnapToGridSizeX": 112,
"ThumbnailSnapToGridSizeY": 59,
"EnableActiveClientHighlight": true,
"ActiveClientHighlightColor": "GreenYellow",
"OverlayLabelColor": "Orange",
"OverlayLabelSize": 10,
"EnableThumbnailRegionSnipping": true,
"DefaultThumbnailRegion": "1384, 188, 451, 238",
"CurrentProfile": "Default",
"AvailableProfiles": [
"Default"
],
"IconName": "IconOriginal",
"ActiveClientHighlightThickness": 3,
"LoginThumbnailLocation": "5, 5",
"ToggleTrackingHotkey": "Alt+F16",
"ToggleSingleProcessHotkey": "Control+F16",
"ToggleAllThumbnailsHotkey": "Shift+Alt+Oem3",
"ThumbnailsManuallyHidden": false,
"PerClientLayout": {},
"FlatLayout": {
"EVE - Quartio": "0, 1239",
"EVE - Tertiale": "0, 1003",
"EVE - Secundamen": "0, 767",
"EVE - Primorium": "448, 1121",
"EVE - PhatPhuckDave": "448, 885"
},
"ClientLayout": {},
"ClientHotkey": {},
"DisableThumbnail": {},
"PriorityClients": [],
"ExecutablesToPreview": [
"exefile"
]
}

View File

@@ -0,0 +1,130 @@
{
"ConfigVersion": 1,
"CycleGroup1ForwardHotkeys": [
"F14",
"Control+F14"
],
"CycleGroup1BackwardHotkeys": [
"F13",
"Control+F13"
],
"CycleGroup1ClientsOrder": {
"EVE - Example DPS Toon 1": 1,
"EVE - Example DPS Toon 2": 2,
"EVE - Example DPS Toon 3": 3
},
"CycleGroup2ForwardHotkeys": [
"F16",
"Control+F16"
],
"CycleGroup2BackwardHotkeys": [
"F15",
"Control+F15"
],
"CycleGroup2ClientsOrder": {
"EVE - Example Logi Toon 1": 1,
"EVE - Example Scout Toon 2": 2,
"EVE - Example Tackle Toon 3": 3
},
"CycleGroup3ForwardHotkeys": [
""
],
"CycleGroup3BackwardHotkeys": [
""
],
"CycleGroup3ClientsOrder": {
"EVE - cycle group 3": 1
},
"CycleGroup4ForwardHotkeys": [
""
],
"CycleGroup4BackwardHotkeys": [
""
],
"CycleGroup4ClientsOrder": {
"EVE - cycle group 4": 1
},
"CycleGroup5ForwardHotkeys": [
""
],
"CycleGroup5BackwardHotkeys": [
""
],
"CycleGroup5ClientsOrder": {
"EVE - cycle group 5": 1
},
"PerClientActiveClientHighlightColor": {
"EVE - Example Toon 1": "Red",
"EVE - Example Toon 2": "Green"
},
"PerClientThumbnailSize": {
"EVE - Example Toon 1": "200, 200",
"EVE - Example Toon 2": "200, 200"
},
"PerClientThumbnailRegion": {},
"PerClientZoomAnchor": {
"EVE - Example Toon 1": 1,
"EVE - Example Toon 2": 7
},
"MinimizeToTray": true,
"ThumbnailRefreshPeriod": 500,
"ThumbnailResizeTimeoutPeriod": 500,
"WineCompatibilityMode": false,
"ThumbnailsOpacity": 1.0,
"EnableClientLayoutTracking": false,
"HideActiveClientThumbnail": false,
"HideLoginClientThumbnail": false,
"MinimizeInactiveClients": false,
"WindowsAnimationStyle": 1,
"ShowThumbnailsAlwaysOnTop": true,
"EnablePerClientThumbnailLayouts": false,
"HideThumbnailsOnLostFocus": false,
"HideThumbnailsDelay": 2,
"ThumbnailSize": "451, 388",
"ThumbnailMaximumSize": "960, 540",
"ThumbnailMinimumSize": "192, 108",
"EnableThumbnailSnap": true,
"ThumbnailSnapRange": 0,
"EnableThumbnailZoom": false,
"ThumbnailZoomFactor": 2,
"ThumbnailZoomAnchor": 0,
"OverlayLabelAnchor": 0,
"ShowThumbnailOverlays": true,
"ShowThumbnailFrames": false,
"LockThumbnailLocation": false,
"ThumbnailSnapToGrid": true,
"ThumbnailSnapToGridSizeX": 112,
"ThumbnailSnapToGridSizeY": 97,
"EnableActiveClientHighlight": true,
"ActiveClientHighlightColor": "GreenYellow",
"OverlayLabelColor": "Orange",
"OverlayLabelSize": 10,
"EnableThumbnailRegionSnipping": true,
"DefaultThumbnailRegion": "1384, 188, 451, 388",
"CurrentProfile": "Default",
"AvailableProfiles": [
"Default"
],
"IconName": "IconOriginal",
"ActiveClientHighlightThickness": 3,
"LoginThumbnailLocation": "5, 5",
"ToggleTrackingHotkey": "Alt+F16",
"ToggleSingleProcessHotkey": "Control+F16",
"ToggleAllThumbnailsHotkey": "Shift+Alt+Oem3",
"ThumbnailsManuallyHidden": true,
"PerClientLayout": {},
"FlatLayout": {
"EVE - Quartio": "-1229, 1067",
"EVE - Tertiale": "-1680, 1067",
"EVE - Secundamen": "-2131, 1067",
"EVE - Primorium": "-2576, 679",
"EVE - PhatPhuckDave": "-2576, 291"
},
"ClientLayout": {},
"ClientHotkey": {},
"DisableThumbnail": {},
"PriorityClients": [],
"ExecutablesToPreview": [
"exefile"
]
}

View File

@@ -1,9 +1,14 @@
using System.IO; using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace EveOPreview.Configuration.Implementation { namespace EveOPreview.Configuration.Implementation {
class ConfigurationStorage : IConfigurationStorage { class ConfigurationStorage : IConfigurationStorage {
private const string CONFIGURATION_FILE_NAME = "EVE-O-Preview.json"; private const string CONFIGURATION_FILE_NAME = "EVE-O-Preview.json";
private const string PROFILES_DIRECTORY = "Profiles";
private const string MASTER_CONFIG_FILE = "master.json";
private readonly IAppConfig _appConfig; private readonly IAppConfig _appConfig;
private readonly IThumbnailConfiguration _thumbnailConfiguration; private readonly IThumbnailConfiguration _thumbnailConfiguration;
@@ -14,39 +19,185 @@ namespace EveOPreview.Configuration.Implementation {
} }
public void Load() { public void Load() {
string filename = this.GetConfigFileName(); string masterConfigPath = this.GetMasterConfigPath();
if (!File.Exists(filename)) { // First, load the master configuration which contains ProfileReadOnly and CurrentProfile
return; string currentProfile = "Default";
bool profileReadOnly = false;
if (File.Exists(masterConfigPath)) {
string masterRawData = File.ReadAllText(masterConfigPath);
var masterConfig = JsonConvert.DeserializeObject<dynamic>(masterRawData);
if (masterConfig.CurrentProfile != null) {
currentProfile = masterConfig.CurrentProfile.ToString();
}
if (masterConfig.ProfileReadOnly != null) {
profileReadOnly = (bool)masterConfig.ProfileReadOnly;
}
} }
string rawData = File.ReadAllText(filename); this._thumbnailConfiguration.CurrentProfile = currentProfile;
this._thumbnailConfiguration.ProfileReadOnly = profileReadOnly;
JsonSerializerSettings jsonSerializerSettings = // Scan the profiles directory for available profiles AFTER loading master config
new JsonSerializerSettings() { ObjectCreationHandling = ObjectCreationHandling.Replace }; List<string> scannedProfiles = this.ScanAvailableProfiles();
// StageHotkeyArraysToAvoidDuplicates(rawData); // Replace AvailableProfiles with scanned profiles (they are the source of truth)
this._thumbnailConfiguration.AvailableProfiles.Clear();
foreach (string profile in scannedProfiles) {
this._thumbnailConfiguration.AvailableProfiles.Add(profile);
}
JsonConvert.PopulateObject(rawData, this._thumbnailConfiguration, jsonSerializerSettings); // Ensure CurrentProfile is in the list
if (!string.IsNullOrEmpty(this._thumbnailConfiguration.CurrentProfile) &&
!this._thumbnailConfiguration.AvailableProfiles.Contains(this._thumbnailConfiguration.CurrentProfile)) {
this._thumbnailConfiguration.AvailableProfiles.Add(this._thumbnailConfiguration.CurrentProfile);
}
// Then, load the profile-specific configuration
// IMPORTANT: Reset the configuration to clean state before loading
// to avoid merging with existing default values
string profileConfigPath = this.GetProfileConfigPath(currentProfile);
if (File.Exists(profileConfigPath)) {
string profileRawData = File.ReadAllText(profileConfigPath);
JsonSerializerSettings jsonSerializerSettings =
new JsonSerializerSettings() { ObjectCreationHandling = ObjectCreationHandling.Replace };
JsonConvert.PopulateObject(profileRawData, this._thumbnailConfiguration, jsonSerializerSettings);
} else {
// Try to load from legacy config file for backwards compatibility
string legacyConfigPath = this.GetConfigFileName();
if (File.Exists(legacyConfigPath)) {
string legacyRawData = File.ReadAllText(legacyConfigPath);
JsonSerializerSettings jsonSerializerSettings =
new JsonSerializerSettings() { ObjectCreationHandling = ObjectCreationHandling.Replace };
JsonConvert.PopulateObject(legacyRawData, this._thumbnailConfiguration, jsonSerializerSettings);
}
}
// Restore the values we just set (they might have been overwritten by profile load)
this._thumbnailConfiguration.CurrentProfile = currentProfile;
this._thumbnailConfiguration.ProfileReadOnly = profileReadOnly;
// Re-scan profiles after loading in case the profile overwrote AvailableProfiles
this._thumbnailConfiguration.AvailableProfiles.Clear();
foreach (string profile in scannedProfiles) {
this._thumbnailConfiguration.AvailableProfiles.Add(profile);
}
// Validate data after loading it // Validate data after loading it
this._thumbnailConfiguration.ApplyRestrictions(); this._thumbnailConfiguration.ApplyRestrictions();
} }
public void Save() { public void Save() {
string rawData = JsonConvert.SerializeObject(this._thumbnailConfiguration, Formatting.Indented); // Save master configuration (contains ProfileReadOnly and CurrentProfile)
string filename = this.GetConfigFileName(); this.SaveMasterConfig();
// If profile is read-only, don't save to the profile file
if (!this._thumbnailConfiguration.ProfileReadOnly) {
this.SaveProfileConfig();
}
}
private void SaveMasterConfig() {
string masterConfigPath = this.GetMasterConfigPath();
string directory = Path.GetDirectoryName(masterConfigPath);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) {
Directory.CreateDirectory(directory);
}
// Create a minimal master config with only ProfileReadOnly and CurrentProfile
// AvailableProfiles is determined by scanning the folder, not saved here
var masterConfig = new {
CurrentProfile = this._thumbnailConfiguration.CurrentProfile ?? "Default",
ProfileReadOnly = this._thumbnailConfiguration.ProfileReadOnly
};
string rawData = JsonConvert.SerializeObject(masterConfig, Formatting.Indented);
try { try {
File.WriteAllText(filename, rawData); File.WriteAllText(masterConfigPath, rawData);
} catch (IOException) { } catch (IOException) {
// Ignore error if for some reason the updated config cannot be written down // Ignore error if for some reason the updated config cannot be written down
} }
} }
private void SaveProfileConfig() {
string profileConfigPath = this.GetProfileConfigPath();
string directory = Path.GetDirectoryName(profileConfigPath);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) {
Directory.CreateDirectory(directory);
}
// Serialize the full configuration to the profile file
string rawData = JsonConvert.SerializeObject(this._thumbnailConfiguration, Formatting.Indented);
try {
File.WriteAllText(profileConfigPath, rawData);
} catch (IOException) {
// Ignore error if for some reason the updated config cannot be written down
}
}
private string GetMasterConfigPath() {
return Path.Combine(PROFILES_DIRECTORY, MASTER_CONFIG_FILE);
}
private string GetProfileConfigPath() {
return this.GetProfileConfigPath(this._thumbnailConfiguration.CurrentProfile ?? "Default");
}
private string GetProfileConfigPath(string profileName) {
string sanitizedProfileName = this.SanitizeFileName(profileName);
return Path.Combine(PROFILES_DIRECTORY, $"{sanitizedProfileName}.json");
}
private string GetConfigFileName() { private string GetConfigFileName() {
return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? ConfigurationStorage.CONFIGURATION_FILE_NAME return string.IsNullOrEmpty(this._appConfig.ConfigFileName) ? ConfigurationStorage.CONFIGURATION_FILE_NAME
: this._appConfig.ConfigFileName; : this._appConfig.ConfigFileName;
} }
private string SanitizeFileName(string fileName) {
string invalidChars = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
foreach (char c in invalidChars) {
fileName = fileName.Replace(c, '_');
}
return fileName;
}
private List<string> ScanAvailableProfiles() {
List<string> profiles = new List<string>();
if (!Directory.Exists(PROFILES_DIRECTORY)) {
profiles.Add("Default");
return profiles;
}
try {
foreach (string filePath in Directory.GetFiles(PROFILES_DIRECTORY, "*.json")) {
string fileName = Path.GetFileNameWithoutExtension(filePath);
// Skip the master config file
if (fileName.Equals(MASTER_CONFIG_FILE.Replace(".json", ""), StringComparison.OrdinalIgnoreCase)) {
continue;
}
// Add the profile name
if (!string.IsNullOrEmpty(fileName) && !profiles.Contains(fileName)) {
profiles.Add(fileName);
}
}
} catch (IOException) {
// If there's an error scanning the directory, just return what we have
}
// Ensure Default is always in the list
if (!profiles.Contains("Default")) {
profiles.Add("Default");
}
return profiles;
}
} }
} }

View File

@@ -120,6 +120,7 @@ namespace EveOPreview.Configuration.Implementation {
this.CurrentProfile = "Default"; this.CurrentProfile = "Default";
this.AvailableProfiles = new List<string> { "Default" }; this.AvailableProfiles = new List<string> { "Default" };
this.ProfileReadOnly = false;
this.IconName = ""; this.IconName = "";
@@ -304,7 +305,10 @@ namespace EveOPreview.Configuration.Implementation {
public Rectangle DefaultThumbnailRegion { get; set; } public Rectangle DefaultThumbnailRegion { get; set; }
public string CurrentProfile { get; set; } public string CurrentProfile { get; set; }
[JsonIgnore]
public List<string> AvailableProfiles { get; set; } public List<string> AvailableProfiles { get; set; }
[JsonProperty("ProfileReadOnly")]
public bool ProfileReadOnly { get; set; }
[JsonProperty("IconName")] [JsonProperty("IconName")]
public string IconName { public string IconName {
get; set; get; set;

View File

@@ -81,6 +81,7 @@ namespace EveOPreview.Configuration {
string CurrentProfile { get; set; } string CurrentProfile { get; set; }
List<string> AvailableProfiles { get; set; } List<string> AvailableProfiles { get; set; }
bool ProfileReadOnly { get; set; }
string IconName { get; set; } string IconName { get; set; }

View File

@@ -132,6 +132,7 @@ namespace EveOPreview.Presenters {
this.View.AvailableProfiles = this._configuration.AvailableProfiles; this.View.AvailableProfiles = this._configuration.AvailableProfiles;
this.View.CurrentProfile = this._configuration.CurrentProfile; this.View.CurrentProfile = this._configuration.CurrentProfile;
this.View.ProfileReadOnly = this._configuration.ProfileReadOnly;
this.View.ToggleTrackingHotkey = this._configuration.ToggleTrackingHotkey; this.View.ToggleTrackingHotkey = this._configuration.ToggleTrackingHotkey;
this.View.ToggleSingleProcessHotkey = this._configuration.ToggleSingleProcessHotkey; this.View.ToggleSingleProcessHotkey = this._configuration.ToggleSingleProcessHotkey;
@@ -184,6 +185,7 @@ namespace EveOPreview.Presenters {
this._configuration.AvailableProfiles = this.View.AvailableProfiles; this._configuration.AvailableProfiles = this.View.AvailableProfiles;
this._configuration.CurrentProfile = this.View.CurrentProfile; this._configuration.CurrentProfile = this.View.CurrentProfile;
this._configuration.ProfileReadOnly = this.View.ProfileReadOnly;
this._configuration.ToggleTrackingHotkey = this.View.ToggleTrackingHotkey; this._configuration.ToggleTrackingHotkey = this.View.ToggleTrackingHotkey;
this._configuration.ToggleSingleProcessHotkey = this.View.ToggleSingleProcessHotkey; this._configuration.ToggleSingleProcessHotkey = this.View.ToggleSingleProcessHotkey;

View File

@@ -177,6 +177,8 @@ namespace EveOPreview.Services {
this._toggleAllThumbnailsHotkey = new HotkeyHandler(mainHandle, toggleAllThumbnailsKey); this._toggleAllThumbnailsHotkey = new HotkeyHandler(mainHandle, toggleAllThumbnailsKey);
this._toggleAllThumbnailsHotkey.Pressed += (object s, HandledEventArgs e) => { this._toggleAllThumbnailsHotkey.Pressed += (object s, HandledEventArgs e) => {
this._configuration.ThumbnailsManuallyHidden = !this._configuration.ThumbnailsManuallyHidden; this._configuration.ThumbnailsManuallyHidden = !this._configuration.ThumbnailsManuallyHidden;
this._hideThumbnailsDelay = 0;
this.RefreshThumbnails();
System.Diagnostics.Debug.WriteLine( System.Diagnostics.Debug.WriteLine(
$"Toggled all thumbnails: {(this._configuration.ThumbnailsManuallyHidden ? "Hidden" : "Visible")}"); $"Toggled all thumbnails: {(this._configuration.ThumbnailsManuallyHidden ? "Hidden" : "Visible")}");
e.Handled = true; e.Handled = true;
@@ -256,6 +258,8 @@ namespace EveOPreview.Services {
this._toggleAllThumbnailsHotkey = new HotkeyHandler(mainHandle, toggleAllThumbnailsKey); this._toggleAllThumbnailsHotkey = new HotkeyHandler(mainHandle, toggleAllThumbnailsKey);
this._toggleAllThumbnailsHotkey.Pressed += (object s, HandledEventArgs e) => { this._toggleAllThumbnailsHotkey.Pressed += (object s, HandledEventArgs e) => {
this._configuration.ThumbnailsManuallyHidden = !this._configuration.ThumbnailsManuallyHidden; this._configuration.ThumbnailsManuallyHidden = !this._configuration.ThumbnailsManuallyHidden;
this._hideThumbnailsDelay = 0;
this.RefreshThumbnails();
System.Diagnostics.Debug.WriteLine( System.Diagnostics.Debug.WriteLine(
$"Toggled all thumbnails: {(this._configuration.ThumbnailsManuallyHidden ? "Hidden" : "Visible")}"); $"Toggled all thumbnails: {(this._configuration.ThumbnailsManuallyHidden ? "Hidden" : "Visible")}");
e.Handled = true; e.Handled = true;

View File

@@ -27,10 +27,13 @@ namespace EveOPreview.View {
/// </summary> /// </summary>
private void InitializeComponent() { private void InitializeComponent() {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
ToolStripMenuItem RestoreWindowMenuItem; RestoreWindowMenuItem = new ToolStripMenuItem();
ToolStripMenuItem ExitMenuItem; ExitMenuItem = new ToolStripMenuItem();
ToolStripMenuItem TitleMenuItem; TitleMenuItem = new ToolStripMenuItem();
ToolStripSeparator SeparatorMenuItem; SeparatorMenuItem = new ToolStripSeparator();
ProfileSeparatorMenuItem = new ToolStripSeparator();
ProfilesMenuItem = new ToolStripMenuItem();
ProfileReadOnlyMenuItem = new ToolStripMenuItem();
TabControl ContentTabControl; TabControl ContentTabControl;
TabPage GeneralTabPage; TabPage GeneralTabPage;
Panel GeneralSettingsPanel; Panel GeneralSettingsPanel;
@@ -82,8 +85,7 @@ namespace EveOPreview.View {
PickRegionButton = new Button(); PickRegionButton = new Button();
ProfileLabel = new Label(); ProfileLabel = new Label();
ProfileComboBox = new ComboBox(); ProfileComboBox = new ComboBox();
SaveProfileButton = new Button(); ProfileReadOnlyCheckBox = new CheckBox();
DeleteProfileButton = new Button();
ThumbnailSnapRangeLabel = new Label(); ThumbnailSnapRangeLabel = new Label();
ThumbnailSnapRangeNumericEdit = new NumericUpDown(); ThumbnailSnapRangeNumericEdit = new NumericUpDown();
ThumbnailSnapToGridCheckBox = new CheckBox(); ThumbnailSnapToGridCheckBox = new CheckBox();
@@ -133,10 +135,6 @@ namespace EveOPreview.View {
DocumentationLink = new LinkLabel(); DocumentationLink = new LinkLabel();
NotifyIcon = new NotifyIcon(components); NotifyIcon = new NotifyIcon(components);
TrayMenu = new ContextMenuStrip(components); TrayMenu = new ContextMenuStrip(components);
RestoreWindowMenuItem = new ToolStripMenuItem();
ExitMenuItem = new ToolStripMenuItem();
TitleMenuItem = new ToolStripMenuItem();
SeparatorMenuItem = new ToolStripSeparator();
ContentTabControl = new TabControl(); ContentTabControl = new TabControl();
GeneralTabPage = new TabPage(); GeneralTabPage = new TabPage();
GeneralSettingsPanel = new Panel(); GeneralSettingsPanel = new Panel();
@@ -216,6 +214,26 @@ namespace EveOPreview.View {
SeparatorMenuItem.Name = "SeparatorMenuItem"; SeparatorMenuItem.Name = "SeparatorMenuItem";
SeparatorMenuItem.Size = new Size(150, 6); SeparatorMenuItem.Size = new Size(150, 6);
// //
// ProfileSeparatorMenuItem
//
ProfileSeparatorMenuItem.Name = "ProfileSeparatorMenuItem";
ProfileSeparatorMenuItem.Size = new Size(150, 6);
//
// ProfilesMenuItem
//
ProfilesMenuItem.DropDownItems.Clear();
ProfilesMenuItem.Name = "ProfilesMenuItem";
ProfilesMenuItem.Size = new Size(153, 22);
ProfilesMenuItem.Text = "Profiles";
//
// ProfileReadOnlyMenuItem
//
ProfileReadOnlyMenuItem.CheckOnClick = true;
ProfileReadOnlyMenuItem.Name = "ProfileReadOnlyMenuItem";
ProfileReadOnlyMenuItem.Size = new Size(153, 22);
ProfileReadOnlyMenuItem.Text = "Read Only";
ProfileReadOnlyMenuItem.Click += ProfileReadOnlyMenuItem_Click;
//
// ContentTabControl // ContentTabControl
// //
ContentTabControl.Alignment = TabAlignment.Left; ContentTabControl.Alignment = TabAlignment.Left;
@@ -474,8 +492,7 @@ namespace EveOPreview.View {
ThumbnailSettingsPanel.Controls.Add(PickRegionButton); ThumbnailSettingsPanel.Controls.Add(PickRegionButton);
ThumbnailSettingsPanel.Controls.Add(ProfileLabel); ThumbnailSettingsPanel.Controls.Add(ProfileLabel);
ThumbnailSettingsPanel.Controls.Add(ProfileComboBox); ThumbnailSettingsPanel.Controls.Add(ProfileComboBox);
ThumbnailSettingsPanel.Controls.Add(SaveProfileButton); ThumbnailSettingsPanel.Controls.Add(ProfileReadOnlyCheckBox);
ThumbnailSettingsPanel.Controls.Add(DeleteProfileButton);
ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapRangeLabel); ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapRangeLabel);
ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapRangeNumericEdit); ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapRangeNumericEdit);
ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridCheckBox); ThumbnailSettingsPanel.Controls.Add(ThumbnailSnapToGridCheckBox);
@@ -636,27 +653,16 @@ namespace EveOPreview.View {
ProfileComboBox.TabIndex = 51; ProfileComboBox.TabIndex = 51;
ProfileComboBox.SelectedIndexChanged += ProfileComboBox_SelectedIndexChanged; ProfileComboBox.SelectedIndexChanged += ProfileComboBox_SelectedIndexChanged;
// //
// SaveProfileButton // ProfileReadOnlyCheckBox
// //
SaveProfileButton.Location = new Point(179, 277); ProfileReadOnlyCheckBox.AutoSize = true;
SaveProfileButton.Margin = new Padding(4); ProfileReadOnlyCheckBox.Location = new Point(310, 278);
SaveProfileButton.Name = "SaveProfileButton"; ProfileReadOnlyCheckBox.Margin = new Padding(4);
SaveProfileButton.Size = new Size(56, 21); ProfileReadOnlyCheckBox.Name = "ProfileReadOnlyCheckBox";
SaveProfileButton.TabIndex = 52; ProfileReadOnlyCheckBox.Size = new Size(107, 19);
SaveProfileButton.Text = "Save"; ProfileReadOnlyCheckBox.TabIndex = 54;
SaveProfileButton.UseVisualStyleBackColor = true; ProfileReadOnlyCheckBox.Text = "Read Only";
SaveProfileButton.Click += SaveProfileButton_Click; ProfileReadOnlyCheckBox.UseVisualStyleBackColor = true;
//
// DeleteProfileButton
//
DeleteProfileButton.Location = new Point(243, 277);
DeleteProfileButton.Margin = new Padding(4);
DeleteProfileButton.Name = "DeleteProfileButton";
DeleteProfileButton.Size = new Size(56, 21);
DeleteProfileButton.TabIndex = 53;
DeleteProfileButton.Text = "Delete";
DeleteProfileButton.UseVisualStyleBackColor = true;
DeleteProfileButton.Click += DeleteProfileButton_Click;
// //
// ThumbnailSnapRangeLabel // ThumbnailSnapRangeLabel
// //
@@ -1467,7 +1473,7 @@ namespace EveOPreview.View {
// //
TrayMenu.ImageScalingSize = new Size(24, 24); TrayMenu.ImageScalingSize = new Size(24, 24);
TrayMenu.Items.AddRange( TrayMenu.Items.AddRange(
new ToolStripItem[] { TitleMenuItem, RestoreWindowMenuItem, SeparatorMenuItem, ExitMenuItem }); new ToolStripItem[] { TitleMenuItem, RestoreWindowMenuItem, SeparatorMenuItem, ProfileSeparatorMenuItem, ProfilesMenuItem, ProfileReadOnlyMenuItem, ExitMenuItem });
TrayMenu.Name = "contextMenuStrip1"; TrayMenu.Name = "contextMenuStrip1";
TrayMenu.Size = new Size(154, 76); TrayMenu.Size = new Size(154, 76);
// //
@@ -1530,6 +1536,13 @@ namespace EveOPreview.View {
#endregion #endregion
private NotifyIcon NotifyIcon; private NotifyIcon NotifyIcon;
private ContextMenuStrip TrayMenu; private ContextMenuStrip TrayMenu;
private ToolStripMenuItem TitleMenuItem;
private ToolStripMenuItem RestoreWindowMenuItem;
private ToolStripMenuItem ExitMenuItem;
private ToolStripMenuItem ProfilesMenuItem;
private ToolStripMenuItem ProfileReadOnlyMenuItem;
private ToolStripSeparator SeparatorMenuItem;
private ToolStripSeparator ProfileSeparatorMenuItem;
private TabPage ZoomTabPage; private TabPage ZoomTabPage;
private CheckBox EnableClientLayoutTrackingCheckBox; private CheckBox EnableClientLayoutTrackingCheckBox;
private CheckBox HideActiveClientThumbnailCheckBox; private CheckBox HideActiveClientThumbnailCheckBox;
@@ -1578,8 +1591,7 @@ namespace EveOPreview.View {
private Label RegionHeightLabel; private Label RegionHeightLabel;
private Button PickRegionButton; private Button PickRegionButton;
private ComboBox ProfileComboBox; private ComboBox ProfileComboBox;
private Button SaveProfileButton; private CheckBox ProfileReadOnlyCheckBox;
private Button DeleteProfileButton;
private Label ProfileLabel; private Label ProfileLabel;
private Label ThumbnailSnapRangeLabel; private Label ThumbnailSnapRangeLabel;
private NumericUpDown ThumbnailSnapRangeNumericEdit; private NumericUpDown ThumbnailSnapRangeNumericEdit;

View File

@@ -21,6 +21,7 @@ namespace EveOPreview.View {
private Size _minimumSize; private Size _minimumSize;
private Size _maximumSize; private Size _maximumSize;
private string _iconName; private string _iconName;
private string _lastSetProfile;
#endregion #endregion
public MainForm(ApplicationContext context) { public MainForm(ApplicationContext context) {
@@ -302,15 +303,6 @@ namespace EveOPreview.View {
} }
} }
public string CurrentProfile {
get => this.ProfileComboBox.Text;
set {
if (this.ProfileComboBox.Items.Contains(value)) {
this.ProfileComboBox.SelectedItem = value;
}
}
}
public List<string> AvailableProfiles { public List<string> AvailableProfiles {
get => this.ProfileComboBox.Items.Cast<string>().ToList(); get => this.ProfileComboBox.Items.Cast<string>().ToList();
set { set {
@@ -318,36 +310,85 @@ namespace EveOPreview.View {
foreach (var profile in value) { foreach (var profile in value) {
this.ProfileComboBox.Items.Add(profile); this.ProfileComboBox.Items.Add(profile);
} }
this.UpdateTrayProfilesMenu(value);
}
}
public bool ProfileReadOnly {
get => this.ProfileReadOnlyCheckBox.Checked;
set {
this.ProfileReadOnlyCheckBox.Checked = value;
this.ProfileReadOnlyMenuItem.Checked = value;
}
}
public string CurrentProfile {
get => this.ProfileComboBox.Text;
set {
this._lastSetProfile = value;
if (this.ProfileComboBox.Items.Contains(value)) {
this.ProfileComboBox.SelectedItem = value;
}
this.UpdateTrayProfilesMenuCheckedState();
} }
} }
private void ProfileComboBox_SelectedIndexChanged(object sender, EventArgs e) { private void ProfileComboBox_SelectedIndexChanged(object sender, EventArgs e) {
if (!this._suppressEvents) { if (!this._suppressEvents && this.ProfileComboBox.SelectedItem != null) {
this.ApplicationSettingsChanged?.Invoke(); string newProfile = this.ProfileComboBox.SelectedItem.ToString();
// Only restart if this is a user-initiated change (not during initial load)
if (newProfile != this._lastSetProfile) {
this._lastSetProfile = newProfile;
// Save ONLY the master config, not the profile file
// This prevents corrupting the target profile with current settings
SaveMasterOnly();
Application.Restart();
Environment.Exit(0);
}
} }
} }
private void SaveProfileButton_Click(object sender, EventArgs e) { private void SaveMasterOnly() {
using (var inputDialog = new InputDialog("Save Profile", "Enter profile name:")) { // Set to read-only temporarily so Save() only saves master config
if (inputDialog.ShowDialog() == DialogResult.OK) { bool originalReadOnly = this.ProfileReadOnlyCheckBox.Checked;
string profileName = inputDialog.InputText; this.ProfileReadOnlyCheckBox.Checked = true;
if (!string.IsNullOrWhiteSpace(profileName)) { this.ApplicationSettingsChanged?.Invoke();
this.ProfileComboBox.Items.Add(profileName); this.ProfileReadOnlyCheckBox.Checked = originalReadOnly;
this.ProfileComboBox.SelectedItem = profileName; }
private void UpdateTrayProfilesMenu(List<string> profiles) {
this._suppressEvents = true;
this.ProfilesMenuItem.DropDownItems.Clear();
foreach (string profile in profiles) {
var menuItem = new ToolStripMenuItem(profile);
if (profile == this.CurrentProfile) {
menuItem.Checked = true;
}
menuItem.Click += (sender, e) => {
if (!this._suppressEvents) {
this.CurrentProfile = profile;
// Save ONLY the master config, not the profile file
bool originalReadOnly = this.ProfileReadOnlyCheckBox.Checked;
this.ProfileReadOnlyCheckBox.Checked = true;
this.ApplicationSettingsChanged?.Invoke(); this.ApplicationSettingsChanged?.Invoke();
this.ProfileReadOnlyCheckBox.Checked = originalReadOnly;
Application.Restart();
Environment.Exit(0);
} }
} };
this.ProfilesMenuItem.DropDownItems.Add(menuItem);
} }
this._suppressEvents = false;
} }
private void DeleteProfileButton_Click(object sender, EventArgs e) { private void UpdateTrayProfilesMenuCheckedState() {
if (this.ProfileComboBox.SelectedItem != null) { this._suppressEvents = true;
string selectedProfile = this.ProfileComboBox.SelectedItem.ToString(); foreach (ToolStripMenuItem item in this.ProfilesMenuItem.DropDownItems) {
if (selectedProfile != "Default") { item.Checked = (item.Text == this.CurrentProfile);
this.ProfileComboBox.Items.Remove(selectedProfile);
this.ApplicationSettingsChanged?.Invoke();
}
} }
this._suppressEvents = false;
} }
public new void Show() {// Registers the current instance as the application's Main Form public new void Show() {// Registers the current instance as the application's Main Form
@@ -632,6 +673,12 @@ namespace EveOPreview.View {
private void ExitMenuItemClick_Handler(object sender, EventArgs e) { private void ExitMenuItemClick_Handler(object sender, EventArgs e) {
this.ApplicationExitRequested?.Invoke(); this.ApplicationExitRequested?.Invoke();
} }
private void ProfileReadOnlyMenuItem_Click(object sender, EventArgs e) {
if (!this._suppressEvents) {
this.ApplicationSettingsChanged?.Invoke();
}
}
#endregion #endregion
private void InitZoomAnchorMap() { private void InitZoomAnchorMap() {

View File

@@ -46,6 +46,7 @@ namespace EveOPreview.View {
string CurrentProfile { get; set; } string CurrentProfile { get; set; }
List<string> AvailableProfiles { get; set; } List<string> AvailableProfiles { get; set; }
bool ProfileReadOnly { get; set; }
string ToggleTrackingHotkey { get; set; } string ToggleTrackingHotkey { get; set; }
string ToggleSingleProcessHotkey { get; set; } string ToggleSingleProcessHotkey { get; set; }