Fixed build, made Box API V2 work with .NET3.5 unfortunately this means people with .NET 2.0 can't use the box plugin anymore.

This commit is contained in:
RKrom 2013-12-11 17:33:08 +01:00
commit ba0c9d0010
5 changed files with 15 additions and 34 deletions

View file

@ -216,23 +216,5 @@ namespace GreenshotBoxPlugin {
return (T)deserializer.ReadObject(stream);
}
}
/// <summary>
/// Helper method to parse JSON to object
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="jsonString"></param>
/// <returns></returns>
public static T DeserializeWithDirectory<T>(string jsonString) {
DataContractJsonSerializerSettings settings = new DataContractJsonSerializerSettings();
settings.UseSimpleDictionaryFormat = true;
var deserializer = new DataContractJsonSerializer(typeof(T), settings);
using (MemoryStream stream = new MemoryStream()) {
byte[] content = Encoding.UTF8.GetBytes(jsonString);
stream.Write(content, 0, content.Length);
stream.Seek(0, SeekOrigin.Begin);
return (T)deserializer.ReadObject(stream);
}
}
}
}