Esempio n. 1
0
 private static void setLocation(BitmapMetadata dest, GpsLocation loc)
 {
     dest.SetQuery(LatitudeRefQuery, Encoding.Default.GetString(loc.LatSignBytes));
     dest.SetQuery(LatitudeQuery, bytesToLongs(loc.LatBytes).ToArray());
     dest.SetQuery(LongitudeRefQuery, Encoding.Default.GetString(loc.LonSignBytes));
     dest.SetQuery(LongitudeQuery, bytesToLongs(loc.LonBytes).ToArray());
 }
Esempio n. 2
0
        private static GpsLocation readLocation(BitmapMetadata metadata)
        {
            var latProp = metadata.GetQuery(LatitudeQuery) as ulong[];
            var lonProp = metadata.GetQuery(LongitudeQuery) as ulong[];

            if (!(metadata.GetQuery(LatitudeRefQuery) is string latSignProp) ||
                latProp == null ||
                !(metadata.GetQuery(LongitudeRefQuery) is string lonSignProp) ||
                lonProp == null)
            {
                return(null);
            }
            if (latSignProp.Length != 1 || lonSignProp.Length != 1 ||
                latProp.Length != 3 || lonProp.Length != 3)
            {
                return(null);
            }
            return(GpsLocation.FromBytes(
                       Encoding.ASCII.GetBytes(latSignProp),
                       latProp.SelectMany(BitConverter.GetBytes).ToArray(),
                       Encoding.ASCII.GetBytes(lonSignProp),
                       lonProp.SelectMany(BitConverter.GetBytes).ToArray()));
        }