private void OnDeserialized(StreamingContext context) { if (string.IsNullOrEmpty(this._threadPositionString)) { return; } this.position = new ModCommentPosition(); // - Parse Thread Position - string[] positionElements = this._threadPositionString.Split('.'); this.position.depth = 0; this.position.mainThread = -1; this.position.replyThread = -1; this.position.subReplyThread = -1; if (positionElements.Length > 0) { this.position.depth = 1; if (int.TryParse(positionElements[0], out this.position.mainThread) && positionElements.Length > 1) { this.position.depth = 2; if (int.TryParse(positionElements[1], out this.position.replyThread) && positionElements.Length > 2) { this.position.depth = 3; int.TryParse(positionElements[2], out this.position.subReplyThread); } } } this._threadPositionString = null; }
private void OnDeserialized(StreamingContext context) { if (_additionalData == null) { return; } JToken token; if (_additionalData.TryGetValue("thread_position", out token)) { this.position = new ModCommentPosition(); // - Parse Thread Position - string[] positionElements = ((string)token).Split('.'); this.position.depth = 0; this.position.mainThread = -1; this.position.replyThread = -1; this.position.subReplyThread = -1; if (positionElements.Length > 0) { this.position.depth = 1; if (int.TryParse(positionElements[0], out this.position.mainThread) && positionElements.Length > 1) { this.position.depth = 2; if (int.TryParse(positionElements[1], out this.position.replyThread) && positionElements.Length > 2) { this.position.depth = 3; int.TryParse(positionElements[2], out this.position.subReplyThread); } } } } }