Пример #1
0
 static Props()
 {
     using (WinShell.PropertySystem propsys = new WinShell.PropertySystem())
     {
         s_PkLatitude     = propsys.GetPropertyKeyByName("System.GPS.Latitude");
         s_PkLongitude    = propsys.GetPropertyKeyByName("System.GPS.Longitude");
         s_PkLatitudeRef  = propsys.GetPropertyKeyByName("System.GPS.LatitudeRef");
         s_PkLongitudeRef = propsys.GetPropertyKeyByName("System.GPS.LongitudeRef");
     }
 }
Пример #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);
                    }
                }
            }
        }