当前位置: 首页>>代码示例>>C#>>正文


C# JSONReader类代码示例

本文整理汇总了C#中JSONReader的典型用法代码示例。如果您正苦于以下问题:C# JSONReader类的具体用法?C# JSONReader怎么用?C# JSONReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


JSONReader类属于命名空间,在下文中一共展示了JSONReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Deserialize

        public static void Deserialize(string _Input, out BindRequest Out)
        {
            StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);

            JSONReader.StartObject ();
            string token = JSONReader.ReadToken ();
            Out = null;

            switch (token) {

                case "BindRequest" : {
                    Out = null;
                    throw new Exception ("Can't create abstract type");
                    }

                case "OpenRequest" : {
                    OpenRequest Result = new OpenRequest ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                default : {
                    throw new Exception ("Not supported");
                    }
                }
            JSONReader.EndObject ();

            // should we check for EOF here?
        }
开发者ID:hallambaker,项目名称:Omnibroker,代码行数:31,代码来源:Connection.cs

示例2: Deserialize

		/// <summary>
        /// Construct an instance from the specified tagged JSONReader stream.
        /// </summary>
        /// <param name="JSONReader">Input stream</param>
        /// <param name="Out">The created object</param>
        public static void Deserialize(JSONReader JSONReader, out JSONObject Out) {
	
			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                Out = null;
                return;
                }

			string token = JSONReader.ReadToken ();
			Out = null;

			switch (token) {

				case "MailProfile" : {
					var Result = new MailProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "MailProfilePrivate" : {
					var Result = new MailProfilePrivate ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					throw new Exception ("Not supported");
					}
				}	
			JSONReader.EndObject ();
            }
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:39,代码来源:SchemaMail.cs

示例3: Deserialize

        public static void Deserialize(string _Input, out AdvertiseRequest Out)
        {
            StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);

            JSONReader.StartObject ();
            string token = JSONReader.ReadToken ();
            Out = null;

            switch (token) {

                case "AdvertiseRequest" : {
                    AdvertiseRequest Result = new AdvertiseRequest ();
                    Result.Deserialize (JSONReader);
                    Out = Result;
                    break;
                    }

                default : {
                    throw new Exception ("Not supported");
                    }
                }
            JSONReader.EndObject ();

            // should we check for EOF here?
        }
开发者ID:hallambaker,项目名称:Omnibroker,代码行数:26,代码来源:Query.cs

示例4: Deserialize

		/// <summary>
        /// Construct an instance from the specified tagged JSONReader stream.
        /// </summary>
        public static void Deserialize(JSONReader JSONReader, out JSONObject Out) {
	
			JSONReader.StartObject ();
            if (JSONReader.EOR) {
                Out = null;
                return;
                }

			string token = JSONReader.ReadToken ();
			Out = null;

			switch (token) {

				case "PortalEntry" : {
					Out = null;
					throw new Exception ("Can't create abstract type");
					}


				case "Account" : {
					var Result = new Account ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "AccountProfile" : {
					var Result = new AccountProfile ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}


				case "ConnectionsPending" : {
					var Result = new ConnectionsPending ();
					Result.Deserialize (JSONReader);
					Out = Result;
					break;
					}

				default : {
					throw new Exception ("Not supported");
					}
				}	
			JSONReader.EndObject ();
            }
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:51,代码来源:PortalProtocol.cs

示例5: FromTagged

        /// <summary>
        /// Create a new instance from tagged string input.
		/// i.e. { "HostEntry" : {... data ... } }
        /// </summary>
        /// <param name="_Input">The input data.</param>
        /// <returns>The created object.</returns>		
		public static new HostEntry FromTagged (string _Input) {
			//HostEntry _Result;
			//Deserialize (_Input, out _Result);
			StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);
			return FromTagged (JSONReader) ;
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:13,代码来源:SchemaSSH.cs

示例6: HostEntry

        /// <summary>
		/// Initialize class from JSONReader stream.
        /// </summary>		
        /// <param name="JSONReader">Input stream</param>	
		public HostEntry (JSONReader JSONReader) {
			Deserialize (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:7,代码来源:SchemaSSH.cs

示例7: DeviceEntry

        /// <summary>
		/// Initialize class from JSONReader stream.
        /// </summary>		
        /// <param name="JSONReader">Input stream</param>	
		public DeviceEntry (JSONReader JSONReader) {
			Deserialize (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:7,代码来源:SchemaSSH.cs

示例8: DeserializeToken

        /// <summary>
        /// Having read a tag, process the corresponding value data.
        /// </summary>
        /// <param name="JSONReader">The input stream</param>
        /// <param name="Tag">The tag</param>
		public override void DeserializeToken (JSONReader JSONReader, string Tag) {
			
			switch (Tag) {
				case "Account" : {
					Account = JSONReader.ReadString ();
					break;
					}
				case "DeviceEntries" : {
					// Have a sequence of values
					bool _Going = JSONReader.StartArray ();
					DeviceEntries = new List <DeviceEntry> ();
					while (_Going) {
						// an untagged structure.
						var _Item = new DeviceEntry (JSONReader);
						DeviceEntries.Add (_Item);
						_Going = JSONReader.NextArray ();
						}
					break;
					}
				case "HostEntries" : {
					// Have a sequence of values
					bool _Going = JSONReader.StartArray ();
					HostEntries = new List <HostEntry> ();
					while (_Going) {
						// an untagged structure.
						var _Item = new HostEntry (JSONReader);
						HostEntries.Add (_Item);
						_Going = JSONReader.NextArray ();
						}
					break;
					}
				default : {
					base.DeserializeToken(JSONReader, Tag);
					break;
					}
				}
			// check up that all the required elements are present
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:43,代码来源:SchemaSSH.cs

示例9: From

        /// <summary>
		/// Create a new instance from untagged string input.
		/// i.e. {... data ... }
        /// </summary>	
        /// <param name="_Input">The input data.</param>
        /// <returns>The created object.</returns>				
		public static new SSHProfilePrivate From (string _Input) {
			StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);
			return new SSHProfilePrivate (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:11,代码来源:SchemaSSH.cs

示例10: LeaveResponse

        /// <summary>
		/// Initialize class from JSONReader stream.
        /// </summary>		
		public LeaveResponse (JSONReader JSONReader) {
			Deserialize (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:6,代码来源:RecryptProtocol.cs

示例11: FromTagged

        /// <summary>
        /// Create a new instance from tagged string input.
		/// i.e. { "LeaveRequest" : {... data ... } }
        /// </summary>
        /// <param name="_Input">The input data.</param>
        /// <returns>The created object.</returns>		
		public static new LeaveRequest FromTagged (string _Input) {
			//LeaveRequest _Result;
			//Deserialize (_Input, out _Result);
			StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);
			return FromTagged (JSONReader) ;
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:13,代码来源:RecryptProtocol.cs

示例12: From

        /// <summary>
		/// Create a new instance from untagged string input.
		/// i.e. {... data ... }
        /// </summary>	
        /// <param name="_Input">The input data.</param>
        /// <returns>The created object.</returns>				
		public static new LeaveRequest From (string _Input) {
			StringReader _Reader = new StringReader (_Input);
            JSONReader JSONReader = new JSONReader (_Reader);
			return new LeaveRequest (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:11,代码来源:RecryptProtocol.cs

示例13: LeaveRequest

        /// <summary>
		/// Initialize class from JSONReader stream.
        /// </summary>		
		public LeaveRequest (JSONReader JSONReader) {
			Deserialize (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:6,代码来源:RecryptProtocol.cs

示例14: JoinResponse

        /// <summary>
		/// Initialize class from JSONReader stream.
        /// </summary>		
		public JoinResponse (JSONReader JSONReader) {
			Deserialize (JSONReader);
			}
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:6,代码来源:RecryptProtocol.cs

示例15: FromFile

        /// <summary>
        /// Search for the specified profile on the local machine.
        /// </summary>
        /// <param name="UDF">Fingerprint of the profile to find.</param>
        /// <param name="FileName">The name of the file</param>
        /// <returns>The signed profile if found or null otherwise.</returns>
        public static SignedApplicationProfile FromFile(string UDF, string FileName) {

            using (var FileReader = FileName.OpenFileReadShared()) {
                using (var TextReader = FileReader.OpenTextReader()) {
                    var Reader = new JSONReader(TextReader);
                    var Result = SignedApplicationProfile.FromTagged(Reader);

                    return Result;
                    }
                }
            }
开发者ID:hallambaker,项目名称:Mathematical-Mesh,代码行数:17,代码来源:SignProfile.cs


注:本文中的JSONReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。