Esempio n. 1
0
        public static bool GetLatitudeLongitude(string filename, out double latitude, out double longitude)
        {
            latitude = longitude = 0.0;

            using (WinShell.PropertyStore store = WinShell.PropertyStore.Open(filename))
            {
                double[] angle     = (double[])store.GetValue(s_PkLatitude);
                string   direction = (string)store.GetValue(s_PkLatitudeRef);
                if (angle == null || direction == null)
                {
                    return(false);
                }
                //Debug.WriteLine("Latitude: {0} {1},{2},{3}", direction, angle[0], angle[1], angle[2]);
                latitude = DegMinSecToDouble(direction, angle);

                angle     = (double[])store.GetValue(s_PkLongitude);
                direction = (string)store.GetValue(s_PkLongitudeRef);
                if (angle == null || direction == null)
                {
                    return(false);
                }
                //Debug.WriteLine("Longitude: {0} {1},{2},{3}", direction, angle[0], angle[1], angle[2]);
                longitude = DegMinSecToDouble(direction, angle);
            }

            return(true);
        }
Esempio n. 2
0
        public static void DumpProperties(string filename)
        {
            using (WinShell.PropertySystem propsys = new WinShell.PropertySystem())
            {
                using (WinShell.PropertyStore store = WinShell.PropertyStore.Open(filename))
                {
                    int count = store.Count;
                    for (int i = 0; i < count; ++i)
                    {
                        WinShell.PROPERTYKEY key = store.GetAt(i);

                        string name;
                        try
                        {
                            using (WinShell.PropertyDescription desc = propsys.GetPropertyDescription(key))
                            {
                                name = string.Concat(desc.CanonicalName, " ", desc.DisplayName);
                            }
                        }
                        catch
                        {
                            name = string.Format("({0}:{1})", key.fmtid, key.pid);
                        }

                        object value = store.GetValue(key);
                        string strValue;

                        if (value is string[])
                        {
                            strValue = string.Join(";", (string[])value);
                        }
                        else if (value is double[])
                        {
                            strValue = string.Join(",", (double[])value);
                        }
                        else
                        {
                            strValue = value.ToString();
                        }

                        Debug.WriteLine("{0}: {1}", name, strValue);
                    }
                }
            }
        }