// 読み込み関数 public static Settings ReadSetting(string filename) { // デフォルトのセッティング var setting = new Settings(); // 設定ファイルを読み込む var siri = new XmlSerializer(typeof(Settings)); FileStream fs = null; try { fs = new FileStream(filename, FileMode.Open); setting = (Settings)siri.Deserialize(fs); } catch (FileNotFoundException e) { // ファイルが無かったら新しく作る fs = new FileStream(filename, FileMode.Create); siri.Serialize(fs, setting); } finally { fs.Close(); } return setting; }
public Faction(int id, string name, string desc, List<int> members, List<int> admins, List<int> invites, int power, List<Region> regions, byte flags, List<int> allies, List<int> allyinvites, List<int> enemies) { this.ID = id; this.name = name; this.desc = desc; this.Members = members; this.Admins = admins; this.Invites = invites; this.Regions = regions; this.Flags = (Settings)flags; this.Power = power; this.Allies = allies; this.AllyInvites = allyinvites; this.Enemies = enemies; }
public Faction(int id, string name, string desc, Player player) { this.ID = id; this.name = name; this.desc = desc; this.Power = player.Power; this.Admins = new List<int>(); this.Admins.Add(player.UserID); this.Members = new List<int>(); this.Members.Add(player.UserID); this.Allies = new List<int>(); this.AllyInvites = new List<int>(); this.Enemies = new List<int>(); this.Regions = new List<Region>(); this.Invites = new List<int>(); this.Flags = (Settings)0; }
///<summary> /// Method to Initialize plugin's code. ///</summary> public override void Initialize() { that = this; ConsoleLOG("Initializing TSGeoIP!"); if (!Directory.Exists(dataDir)) { ConsoleLOG("Didn't found TSGeoIP folder!"); Directory.CreateDirectory(dataDir); ConsoleLOG("Created TSGeoIP folder!"); } else { ConsoleLOG("Found TSGeoIP folder!"); } iSettings = new Settings(); Settings.LoadSettings(); if (iSettings.GeoIP_API.ToLower() == "geoip") { if (File.Exists(this.geoIPDB)) { this.geoIPLS = new LookupService(this.geoIPDB, LookupService.GEOIP_STANDARD); } else { ConsoleLOG("There is no GeoLiteCity.dat", TraceLevel.Error); this.geoIPLS = null; } } if (iSettings.GeoIP_API.ToLower() == "geoip2") { if (File.Exists(this.geoIP2DB)) { this.geoIP2DBR = new DatabaseReader(this.geoIP2DB); } else { ConsoleLOG("There is no GeoLite2-City.mmdb", TraceLevel.Error); this.geoIP2DBR = null; } } ServerApi.Hooks.GameInitialize.Register(this, this.OnInitialize); ServerApi.Hooks.ServerJoin.Register(this, this.OnJoin); ServerApi.Hooks.NetGreetPlayer.Register(this, this.OnNetGreet); ServerApi.Hooks.ServerChat.Register(this, this.OnChat); ServerApi.Hooks.ServerLeave.Register(this, this.OnLeave); }