public override void Dispose() { if (!this.disposed) { if (this.disposesTextReader) { try { this.json.Dispose(); } catch (ObjectDisposedException objectDisposedException) { } } else { while (this.token != Facepunch.Load.Token.End && this.token != Facepunch.Load.Token.DownloadQueueEnd) { try { this.Read(); } catch (JsonException jsonException) { this.token = Facepunch.Load.Token.End; } } } this.json = null; this.disposed = true; } }
public bool Read() { if (this.disposed) { throw new ObjectDisposedException("Reader"); } this.item = new Facepunch.Load.Item(); if (!this.json.Read()) { this.token = Facepunch.Load.Token.End; return(false); } if (!this.insideOrderList) { switch (this.json.Token) { case JsonToken.None: this.token = Facepunch.Load.Token.End; return(false); case JsonToken.ArrayStart: this.token = Facepunch.Load.Token.DownloadQueueBegin; this.insideOrderList = true; return(true); } } else if (this.insideRandomList) { switch (this.json.Token) { case JsonToken.PropertyName: this.token = Facepunch.Load.Token.BundleListing; this.ReadBundleListing(this.json.Value.AsString); return(true); case JsonToken.ObjectEnd: this.token = Facepunch.Load.Token.RandomLoadOrderAreaEnd; this.insideRandomList = false; return(true); } } else { switch (this.json.Token) { case JsonToken.ObjectStart: this.token = Facepunch.Load.Token.RandomLoadOrderAreaBegin; this.insideRandomList = true; return(true); case JsonToken.ArrayEnd: this.token = Facepunch.Load.Token.DownloadQueueEnd; this.insideOrderList = false; return(true); } } throw new JsonException("Bad json state"); }
public bool Read() { JsonToken token; if (this.disposed) { throw new ObjectDisposedException("Reader"); } this.item = new Facepunch.Load.Item(); if (!this.json.Read()) { this.token = Facepunch.Load.Token.End; return false; } if (!this.insideOrderList) { token = this.json.Token; if (token == JsonToken.None) { this.token = Facepunch.Load.Token.End; return false; } if (token == JsonToken.ArrayStart) { this.token = Facepunch.Load.Token.DownloadQueueBegin; this.insideOrderList = true; return true; } } else if (!this.insideRandomList) { token = this.json.Token; if (token == JsonToken.ObjectStart) { this.token = Facepunch.Load.Token.RandomLoadOrderAreaBegin; this.insideRandomList = true; return true; } if (token == JsonToken.ArrayEnd) { this.token = Facepunch.Load.Token.DownloadQueueEnd; this.insideOrderList = false; return true; } } else { token = this.json.Token; if (token == JsonToken.PropertyName) { this.token = Facepunch.Load.Token.BundleListing; this.ReadBundleListing(this.json.Value.AsString); return true; } if (token == JsonToken.ObjectEnd) { this.token = Facepunch.Load.Token.RandomLoadOrderAreaEnd; this.insideRandomList = false; return true; } } throw new JsonException("Bad json state"); }