public static TorrentFConfig GetConfig() { if (_config == null) { _config = new TorrentFConfig(); TorrentFConfig tfc = _config.DeserializeConfiguration(); if (tfc != null) { // we make a copy of that object Trace.Assert(tfc.privateCharacters.Length > 0, "No private characters were specified."); Trace.Assert(tfc.trackerHttpPort > 1024, "Invalid Tracker Http Port."); Trace.Assert(tfc.trackerIp.Length > 0, "Invalid Tracker ip."); Trace.Assert(tfc.uploadingServerPort > 1024, "Invalid Uploading Server Port."); Trace.Assert(tfc.bitHocClientRelativePath.Length > 0, "Relative path to the BitHoc Client."); Trace.Assert(tfc.applicationName.Length > 0, "Invalid application name."); _config.CopyTorrentFConfig(ref tfc); } else { // Serialize the current object file _config.SerializeConfiguation(); } return _config; } else { return _config; } }
private void CopyTorrentFConfig(ref TorrentFConfig c) { serializationFileName = c.serializationFileName; uploadingServerPort = c.uploadingServerPort; trackerIp = c.trackerIp; trackerHttpPort = c.trackerHttpPort; privateCharacters = c.privateCharacters; }