-
-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #3453 Suppress incompatibility warning at game launch
- Loading branch information
Showing
11 changed files
with
160 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.IO; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using log4net; | ||
|
||
using CKAN.Versioning; | ||
|
||
namespace CKAN | ||
{ | ||
class SuppressedCompatWarningIdentifiers | ||
{ | ||
public GameVersion GameVersionWhenWritten; | ||
public HashSet<string> Identifiers = new HashSet<string>(); | ||
|
||
public static SuppressedCompatWarningIdentifiers LoadFrom(GameVersion gameVer, string filename) | ||
{ | ||
try | ||
{ | ||
var saved = JsonConvert.DeserializeObject<SuppressedCompatWarningIdentifiers>(File.ReadAllText(filename)); | ||
// Reset warnings if e.g. Steam auto-updates the game | ||
if (saved.GameVersionWhenWritten == gameVer) | ||
{ | ||
return saved; | ||
} | ||
} | ||
catch (Exception exc) | ||
{ | ||
log.Debug("Failed to load", exc); | ||
} | ||
return new SuppressedCompatWarningIdentifiers() | ||
{ | ||
GameVersionWhenWritten = gameVer | ||
}; | ||
} | ||
|
||
public void SaveTo(string filename) | ||
{ | ||
File.WriteAllText(filename, JsonConvert.SerializeObject(this)); | ||
} | ||
|
||
private static readonly ILog log = LogManager.GetLogger(typeof(SuppressedCompatWarningIdentifiers)); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters