Skip to content

Commit

Permalink
Update to version 2.2 added dbmode command and fixed bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
poqdavid committed Aug 31, 2015
1 parent e687e95 commit 474deaa
Show file tree
Hide file tree
Showing 9 changed files with 319 additions and 353 deletions.
9 changes: 7 additions & 2 deletions TSGeoIP/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// <copyright file="AssemblyInfo.cs" company="POQDavid">
// Copyright (c) POQDavid. All rights reserved.
// </copyright>
// <author>POQDavid</author>
// <summary>This is the AssemblyInfo class.</summary>
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
Expand Down Expand Up @@ -30,5 +35,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion ("2.1")]
[assembly: AssemblyFileVersion ("2.1")]
[assembly: AssemblyVersion ("2.2")]
[assembly: AssemblyFileVersion ("2.2")]
23 changes: 22 additions & 1 deletion TSGeoIP/Settings.SourceAnalysis
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<GlobalSettings>
<BooleanProperty Name="AutoCheckForUpdate">False</BooleanProperty>
<CollectionProperty Name="RecognizedWords">
<Value>Dir</Value>
<Value>json</Value>
</CollectionProperty>
</GlobalSettings>
Expand Down Expand Up @@ -34,7 +35,10 @@
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
<AnalyzerSettings>
<StringProperty Name="CompanyName">POQDavid</StringProperty>
<StringProperty Name="Copyright">Copyright (c) POQDavid. All rights reserved.</StringProperty>
</AnalyzerSettings>
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
Expand Down Expand Up @@ -291,5 +295,22 @@
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.NamingRules">
<AnalyzerSettings>
<CollectionProperty Name="Hungarian">
<Value>i</Value>
</CollectionProperty>
</AnalyzerSettings>
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
<Rules>
<Rule Name="StatementMustNotUseUnnecessaryParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
24 changes: 18 additions & 6 deletions TSGeoIP/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace TSGeoIP
// <copyright file="Settings.cs" company="POQDavid">
// Copyright (c) POQDavid. All rights reserved.
// </copyright>
// <author>POQDavid</author>
// <summary>This is the settings class.</summary>
namespace TSGeoIP
{
// Import statements are placed here
using System;
Expand Down Expand Up @@ -56,49 +61,56 @@ public class Settings
private System.Collections.Generic.List<string> defaultAKCWList = new System.Collections.Generic.List<string> { };

///<summary>
/// Gets or sets the asPrefix property.
/// Gets or sets a value indicating whether to use prefix or not.
///</summary>
///<value>Use Prefix.</value>
[JsonProperty("asPrefix")]
[DefaultValue(true)]
public bool AsPrefix { get { return this.defaultAsPrefix; } set { this.defaultAsPrefix = value; } }

///<summary>
/// Gets or sets the asSuffix property.
/// Gets or sets a value indicating whether to use suffix or not.
///</summary>
///<value>Use Suffix.</value>
[JsonProperty("asSuffix")]
[DefaultValue(false)]
public bool AsSuffix { get { return this.defaultAsSuffix; } set { this.defaultAsSuffix = value; } }

///<summary>
/// Gets or sets the PrefixString property.
///</summary>
///<value>Prefix string.</value>
[JsonProperty("PrefixString")]
[DefaultValue("({0}) ")]
public string PrefixString { get { return this.defaultPrefixString; } set { this.defaultPrefixString = value; } }

///<summary>
/// Gets or sets the SuffixString property.
///</summary>
///<value>Suffix string.</value>
[JsonProperty("SuffixString")]
[DefaultValue(" ({0})")]
public string SuffixString { get { return this.defaultSuffixString; } set { this.defaultSuffixString = value; } }

///<summary>
/// Gets or sets the GeoIP_API property.
///</summary>
///<value>GeoIP API mode.</value>
[JsonProperty("GeoIP_API")]
[DefaultValue("GeoIP")]
public string GeoIP_API { get { return this.defaultGeoIPAPI; } set { this.defaultGeoIPAPI = value; } }

///<summary>
/// Gets or sets the AutoKickList property.
///</summary>
///<value>List of players for AutoKick.</value>
[JsonProperty("AutoKickList")]
public System.Collections.Generic.List<string> AKC_List { get { return this.defaultAKCList; } set { this.defaultAKCList = value; } }

///<summary>
/// Gets or sets the AutoKickWhiteList property.
///</summary>
///<value>List of whitelisted players for AutoKick.</value>
[JsonProperty("AutoKickWhiteList")]
public System.Collections.Generic.List<string> AKC_White_List { get { return this.defaultAKCWList; } set { this.defaultAKCWList = value; } }

Expand Down Expand Up @@ -127,7 +139,7 @@ public static void SaveSettting()
var s = new JsonSerializerSettings();
s.ObjectCreationHandling = ObjectCreationHandling.Replace; // without this, you end up with duplicates.

File.WriteAllText(TSGeoIP.Data_Dir + "TSGeoIP.json", JsonConvert.SerializeObject(TSGeoIP.iSettings, Formatting.Indented, s));
File.WriteAllText(TSGeoIP.DataDir + "TSGeoIP.json", JsonConvert.SerializeObject(TSGeoIP.ISettings, Formatting.Indented, s));
}

/// <summary>
Expand All @@ -136,13 +148,13 @@ public static void SaveSettting()
public static void LoadSettings()
{
try {
string json_string = File.ReadAllText(TSGeoIP.Data_Dir + "TSGeoIP.json");
string json_string = File.ReadAllText(TSGeoIP.DataDir + "TSGeoIP.json");
if (IsJSONValid(json_string)) {
var s = new JsonSerializerSettings();
s.NullValueHandling = NullValueHandling.Ignore;
s.ObjectCreationHandling = ObjectCreationHandling.Replace; // without this, you end up with duplicates.

TSGeoIP.iSettings = JsonConvert.DeserializeObject<Settings>(json_string, s);
TSGeoIP.ISettings = JsonConvert.DeserializeObject<Settings>(json_string, s);
//TSGeoIP.ConsoleLOG(TSGeoIP.iSettings.PrefixString);
} else {
SaveSettting();
Expand Down
Loading

0 comments on commit 474deaa

Please sign in to comment.