Nexus.Client.Games.Steam.KeyValue.LoadFromString C# (CSharp) Method

LoadFromString() public static method

Attempts to create an instance of KeyValue from the given input text.
This method will swallow any exceptions that occur when reading, use ReadAsText if you wish to handle exceptions.
public static LoadFromString ( string input ) : KeyValue
input string The input text to load.
return KeyValue
		public static KeyValue LoadFromString(string input)
		{
			byte[] bytes = Encoding.UTF8.GetBytes(input);

			using (var stream = new MemoryStream(bytes))
			{
				var kv = new KeyValue(null, null);

				try
				{
					if (kv.ReadAsText(stream) == false)
						return null;

					return kv;
				}
				catch (Exception)
				{
					return null;
				}
			}
		}