Skip to content

Commit d7b2556

Browse files
committed
fix compatibility settings detection being unreliable
1 parent f796176 commit d7b2556

5 files changed

Lines changed: 29 additions & 20 deletions

File tree

FlashpointSecurePlayer/EnvironmentVariables.cs

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ public void Activate(string name, string server, string applicationMutexName) {
2121
base.Activate(name);
2222
ModificationsElement modificationsElement = GetModificationsElement(true, Name);
2323
string value = null;
24+
List<string> values = null;
2425
string compatibilityLayerValue = null;
26+
List<string> compatibilityLayerValues = new List<string>();
2527

2628
try {
2729
compatibilityLayerValue = Environment.GetEnvironmentVariable(COMPATIBILITY_LAYER_NAME);
@@ -31,10 +33,6 @@ public void Activate(string name, string server, string applicationMutexName) {
3133
throw new TaskRequiresElevationException();
3234
}
3335

34-
if (compatibilityLayerValue != null) {
35-
compatibilityLayerValue = compatibilityLayerValue.ToUpper();
36-
}
37-
3836
EnvironmentVariablesElement environmentVariablesElement = null;
3937

4038
for (int i = 0;i < modificationsElement.EnvironmentVariables.Count;i++) {
@@ -54,15 +52,23 @@ public void Activate(string name, string server, string applicationMutexName) {
5452
throw new TaskRequiresElevationException();
5553
}
5654

57-
if (value != null) {
58-
value = value.ToUpper();
59-
}
60-
6155
// if this is the compatibility layer variable
6256
// and the value is not what we want to set it to
6357
// and we're in server mode...
64-
if (environmentVariablesElement.Name == COMPATIBILITY_LAYER_NAME && value != compatibilityLayerValue && !String.IsNullOrEmpty(server)) {
65-
throw new CompatibilityLayersException();
58+
if (environmentVariablesElement.Name == COMPATIBILITY_LAYER_NAME && !String.IsNullOrEmpty(server)) {
59+
values = new List<string>();
60+
61+
if (compatibilityLayerValue != null) {
62+
compatibilityLayerValues = compatibilityLayerValue.ToUpper().Split(' ').ToList();
63+
}
64+
65+
if (value != null) {
66+
values = value.ToUpper().Split(' ').ToList();
67+
}
68+
69+
if (values.Except(compatibilityLayerValues).Any()) {
70+
throw new CompatibilityLayersException();
71+
}
6672
}
6773
}
6874
}
@@ -81,7 +87,9 @@ public void Deactivate(string server) {
8187
}
8288

8389
string value = null;
90+
List<string> values = null;
8491
string compatibilityLayerValue = null;
92+
List<string> compatibilityLayerValues = new List<string>();
8593

8694
try {
8795
compatibilityLayerValue = Environment.GetEnvironmentVariable(COMPATIBILITY_LAYER_NAME);
@@ -92,7 +100,7 @@ public void Deactivate(string server) {
92100
}
93101

94102
if (compatibilityLayerValue != null) {
95-
compatibilityLayerValue = compatibilityLayerValue.ToUpper();
103+
compatibilityLayerValues = compatibilityLayerValue.ToUpper().Split(' ').ToList();
96104
}
97105

98106
EnvironmentVariablesElement environmentVariablesElement = null;
@@ -105,15 +113,16 @@ public void Deactivate(string server) {
105113
}
106114

107115
value = environmentVariablesElement.Value;
116+
values = new List<string>();
108117

109118
if (value != null) {
110-
value = value.ToUpper();
119+
values = value.ToUpper().Split(' ').ToList();
111120
}
112121

113122
// if this isn't the compatibility layer variable
114123
// or the value isn't what we want to set it to
115124
// or we're not in server mode...
116-
if (environmentVariablesElement.Name != COMPATIBILITY_LAYER_NAME || value != compatibilityLayerValue && String.IsNullOrEmpty(server)) {
125+
if (environmentVariablesElement.Name != COMPATIBILITY_LAYER_NAME || values.Except(compatibilityLayerValues).Any() || String.IsNullOrEmpty(server)) {
117126
try {
118127
Environment.SetEnvironmentVariable(environmentVariablesElement.Name, null);
119128
} catch (ArgumentException) {

FlashpointSecurePlayer/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
// You can specify all the values or you can default the Build and Revision Numbers
3434
// by using the '*' as shown below:
3535
// [assembly: AssemblyVersion("1.0.*")]
36-
[assembly: AssemblyVersion("1.0.3.0")]
37-
[assembly: AssemblyFileVersion("1.0.3.0")]
36+
[assembly: AssemblyVersion("1.0.4.0")]
37+
[assembly: AssemblyFileVersion("1.0.4.0")]
3838
[assembly: NeutralResourcesLanguage("en")]
3939

FlashpointSecurePlayer/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Flashpoint Secure Player 1.0.3
1+
# Flashpoint Secure Player 1.0.4
22
This player attempts to solve common compatibility or portability issues posed by browser plugins on Windows for the purpose of playback in BlueMaxima's Flashpoint.
33

44
It is compatible with Windows 7, Windows 8, Windows 8.1 and Windows 10, and requires .NET Framework 4.5. If you are on Windows 8.1 or Windows 10, or if you are on Windows 7/8 and have updates enabled, you already have .NET Framework 4.5. Otherwise, you may [download .NET Framework 4.5.](http://www.microsoft.com/en-us/download/details.aspx?id=30653)

FlashpointSecurePlayer/RegistryBackups.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1348,7 +1348,7 @@ private void KCBStopped(RegistryTraceData registryTraceData) {
13481348
// we want to take care of any queued registry timeline events
13491349
// an event entails the date and time of the registry modification
13501350
if (ModificationsQueue.ContainsKey(safeKeyHandle)) {
1351-
while (ModificationsQueue[safeKeyHandle].Count > 0) {
1351+
while (ModificationsQueue[safeKeyHandle].Any()) {
13521352
// get the first event
13531353
queuedModification = ModificationsQueue[safeKeyHandle].First();
13541354

FlashpointSecurePlayer/SingleInstance.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ public void Activate(string name, string commandLine) {
116116
processesByNameStrict = processesByName;
117117
}
118118

119-
if (processesByNameStrict.Count > 0) {
119+
if (processesByNameStrict.Any()) {
120120
DialogResult? dialogResult = ShowClosableMessageBox(Task.Run(delegate () {
121-
while (processesByNameStrict.Count > 0) {
121+
while (processesByNameStrict.Any()) {
122122
if (!processesByNameStrict[0].HasExited) {
123123
processesByNameStrict[0].WaitForExit();
124124
}
@@ -132,7 +132,7 @@ public void Activate(string name, string commandLine) {
132132
throw new InvalidModificationException();
133133
}
134134
}
135-
} while (processesByNameStrict.Count > 0);
135+
} while (processesByNameStrict.Any());
136136
}
137137
}
138138
}

0 commit comments

Comments
 (0)