예제 #1
0
        public List <MetadataItem> GetList()
        {
            List <MetadataItem> result = new List <MetadataItem>();

            foreach (PropertyItem prop in fSystemImage.PropertyItems)
            {
                MetadataDefinition defn = MetadataLibrary.Lookup(prop.Id);

                if (defn == null)
                {
                    defn = new MetadataDefinition()
                    {
                        Id          = prop.Id,
                        Name        = "?",
                        Category    = "Unknown Tags",
                        Description = string.Empty,
                        DataType    = prop.Type != 0 ? (MetadataType)prop.Type : MetadataType.Undefined
                    };
                }

                object value = GetObject(prop);

                result.Add(new MetadataItem(defn, value));
            }

            return(result);
        }
예제 #2
0
        public static void ExportAllKnownMetadataDefinitions(string path)
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            foreach (MetadataDefinition defn in MetadataLibrary.GetList())
            {
                result.Add("0x" + defn.Id.ToString("X4"), defn);
            }

            File.WriteAllText(path, Json.Serialize(result));
        }
예제 #3
0
        public List <MetadataItem> GetAllDefinedMetadata()
        {
            List <MetadataItem> result = GetList();

            foreach (MetadataDefinition defn in MetadataLibrary.GetList())
            {
                MetadataItem item = result.FirstOrDefault(c => c.Definition.Id == defn.Id);

                if (item == null)
                {
                    result.Add(new MetadataItem(defn));
                }
            }

            return(result);
        }
예제 #4
0
 public static void ExportMetadataDefinitionsToCsv(string path)
 {
     using (Stream stream = new FileStream(path, FileMode.Create, FileAccess.Write))
     {
         using (StreamWriter writer = new StreamWriter(stream))
         {
             foreach (MetadataDefinition defn in MetadataLibrary.GetList())
             {
                 string line = string.Format("{0:X4}, {0}, {1}, {2}, {3}, {4}",
                                             defn.Id,
                                             defn.Category,
                                             defn.Name,
                                             "type",
                                             defn.Description
                                             );
                 writer.WriteLine(line);
             }
         }
     }
 }
예제 #5
0
        public void Remove(string propName)
        {
            int propId = MetadataLibrary.GetId(propName);

            Remove(propId);
        }
예제 #6
0
        public void Set(string propName, object value)
        {
            int propId = MetadataLibrary.GetId(propName);

            Set(propId, value);
        }
예제 #7
0
        public object Read(string propName)
        {
            int propId = MetadataLibrary.GetId(propName);

            return(Read(propId));
        }
예제 #8
0
        public bool Has(string propName)
        {
            int propId = MetadataLibrary.GetId(propName);

            return(Has(propId));
        }