public void TestWeatherMT() { try { var weather = JsonConvert.DeserializeObject <i360PointForecast>(File.ReadAllText(@"C:\Users\Banana\Desktop\weather.json")); var message1 = WeatherMT.Create(ProtocolVersion.v1, weather); var message2 = WeatherMT.Create(ProtocolVersion.v2__LocationFix, weather); var message3 = WeatherMT.Create(ProtocolVersion.v3__WeatherExtension, weather); var message4 = WeatherMT.Create(ProtocolVersion.v4__WeatherExtension, weather); var message5 = WeatherMT.Create(ProtocolVersion.v4__WeatherExtension, weather, 7); var bytes1 = message1.Pack()[0].Payload; var bytes2 = message2.Pack()[0].Payload; var bytes3 = message3.Pack()[0].Payload; var bytes4 = message4.Pack()[0].Payload; var bytes5 = message5.Pack()[0].Payload; var unpacked1 = (WeatherMT)WeatherMT.Unpack(bytes1, new InMemoryBuffer()); var unpacked2 = (WeatherMT)WeatherMT.Unpack(bytes2, new InMemoryBuffer()); var unpacked3 = (WeatherMT)WeatherMT.Unpack(bytes3, new InMemoryBuffer()); var unpacked4 = (WeatherMT)WeatherMT.Unpack(bytes4, new InMemoryBuffer()); var unpacked5 = (WeatherMT)WeatherMT.Unpack(bytes5, new InMemoryBuffer()); //var bytes1 = "1208058C9F98BEB30120867FF4FFEC3B1B0062F847FF2FB5B10230857FF47F125861074008FFE8FF8D165600C4F08FFE9F816107400CFFE8FFA516B600C4F08FFE6F022B6C01C8E01FFDBFD1C206C010FED1FFB32EAC054CE11FFDBFC4C29A8008FED1FF515085358608FCA3FF3758D70310C33FFA7F866DAD8339FCA3FF97D5D70818C23FFABF0AA2B00130847FF47F9A".ToByteArray(); //var message1 = (WeatherMT)WeatherMT.Unpack(bytes1, new InMemoryBuffer()); } catch (Exception e) { Debugger.Break(); throw; } }
public void TestWeatherMO() { try { var b0 = "120C058D199984BC0700827FF4874CC87B0020F8477F2885BC0700827FF47F13007F0FE002FF3FFF4DEFD7002AF0FFCF9F057F0F0002FFE8FFE5D0970026F08FFE8F82DE6F0090E01FFDBFE9F5020005FED1FF33E2AE0040E01FFDBF2CE616C005FED1FF5500CC358002FCA3FF37BF5C03B8C03FFA7F56BC250020FCA3FF97465B0300C23FFA3F0B7EB60230817FF47F0058".ToByteArray(); var m0 = WeatherMT.Unpack(b0, new InMemoryBuffer()); var b = "120D050C37D4AA04063168394054D30028".ToByteArray(); var m = WeatherMO.Unpack(b, new InMemoryBuffer()); var lat = -27.112535; var lon = -109.293498; var message1 = WeatherMO.Create(ProtocolVersion.v1, lat, lon); var message2 = WeatherMO.Create(ProtocolVersion.v2__LocationFix, lat, lon); var message3 = WeatherMO.Create(ProtocolVersion.v3__WeatherExtension, lat, lon); var message4 = WeatherMO.Create(ProtocolVersion.v4__WeatherExtension, lat, lon, lat, lon, 6); var message5 = WeatherMO.Create(ProtocolVersion.v4__WeatherExtension, lat, lon); var bytes1 = message1.Pack()[0].Payload; var bytes2 = message2.Pack()[0].Payload; var bytes3 = message3.Pack()[0].Payload; var bytes4 = message4.Pack()[0].Payload; var bytes5 = message5.Pack()[0].Payload; var unpacked1 = (WeatherMO)WeatherMO.Unpack(bytes1, new InMemoryBuffer()); var unpacked2 = (WeatherMO)WeatherMO.Unpack(bytes2, new InMemoryBuffer()); var unpacked3 = (WeatherMO)WeatherMO.Unpack(bytes3, new InMemoryBuffer()); var unpacked4 = (WeatherMO)WeatherMO.Unpack(bytes4, new InMemoryBuffer()); var unpacked5 = (WeatherMO)WeatherMO.Unpack(bytes5, new InMemoryBuffer()); } catch (Exception e) { Debugger.Break(); throw; } }