public Configuration() { // check if local read-only configuration file exists var localPath = ApplicationInfo.CurrentDirectory + sar.Tools.AssemblyInfo.Name + ".xml"; var standardPath = ApplicationInfo.CommonDataDirectory + sar.Tools.AssemblyInfo.Name + ".xml"; if (File.Exists(localPath)) { this.path = localPath; readOnly = true; } else { this.path = standardPath; readOnly = false; } // read the file if (File.Exists(this.path)) { var reader = new XML.Reader(this.path); this.Deserialize(reader); reader.Close(); } }
public Configuration(string path) { this.path = path; this.readOnly = true; if (File.Exists(this.path)) { var reader = new XML.Reader(this.path); try { this.Deserialize(reader); } catch { } reader.Close(); } }
private void ProcessIncomingBuffer(ref string bufferIn) { string packetIn = ExtractPacket(ref bufferIn); if (String.IsNullOrEmpty(packetIn)) return; using (var sr = new StringReader(packetIn)) { using (var reader = new XML.Reader(sr)) { while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "SocketMessage": this.packetsIn++; var message = new SocketMessage(reader); if (!this.ProcessMessage(message) && this.IsHost) { this.parent.ProcessMessage(this, message); } break; default: break; } } } } } }