public void DeserializeSubsystem(string serialized) { if (IsMaster) { MyStringReader reader = new MyStringReader(serialized); while (reader.HasNextLine) { var s = reader.NextLine(); if (s == string.Empty) { return; } ReportFleetIntelligence(AsteroidIntel.DeserializeAsteroid(s), TimeSpan.Zero); } } }
public void DeserializeSubsystem(string serialized) { var reader = new MyStringReader(serialized); while (reader.HasNextLine) { var split = reader.NextLine().Split('-'); if (split.Length != 2) { continue; } var n = int.Parse(split[0]); if (Hangars[n] == null) { continue; } Hangars[n].Deserialize(split[1]); } }
public void DeserializeManager(string serialized) { try { var loadBuilder = new SRKStringBuilder(); var reader = new MyStringReader(serialized); loadBuilder.Clear(); // Load subsystem settings here int numSubsystems = int.Parse(reader.NextLine()); for (int i = 0; i < numSubsystems; i++) { string[] header = reader.NextLine().Split(' '); string name = header[0]; int numLines = int.Parse(header[1]); for (int j = 0; j < numLines; j++) { loadBuilder.AppendLine(reader.NextLine()); } if (Subsystems.ContainsKey(name)) { Subsystems[name].DeserializeSubsystem(loadBuilder.ToString()); } loadBuilder.Clear(); } } catch (Exception exc) { ExceptionBuilder.AppendLine(exc.StackTrace); } }