예제 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public ComboBoxEditorBase(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            currentValue = property.Value;
              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              cbo = new ComboBox
              {
            Visibility = Visibility.Collapsed,
            Margin = new Thickness(0),
            VerticalAlignment = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Stretch
              };

              cbo.DropDownOpened += cbo_DropDownOpened;
              cbo.LostFocus += cbo_LostFocus;

              this.InitializeCombo();

              pnl = new StackPanel();
              pnl.Children.Add(cbo);

              this.ShowTextBox();

              this.Content = pnl;
        }
예제 #2
0
        public PersonAdapter(PersonViewModel viewModel)
        {
            items = new List<Item> ();

            foreach (var pg in viewModel.PropertyGroups) {
                items.Add (new MainHeaderItem (pg.Title));
                foreach (var p in pg.Properties) {

                    PropertyItem item;

                    switch (p.Type) {
                    case PersonViewModel.PropertyType.Phone:
                        item = new PhonePropertyItem (p);
                        break;
                    case PersonViewModel.PropertyType.Email:
                        item = new EmailPropertyItem (p);
                        break;
                    case PersonViewModel.PropertyType.Url:
                        item = new UrlPropertyItem (p);
                        break;
                    case PersonViewModel.PropertyType.Twitter:
                        item = new TwitterPropertyItem (p);
                        break;
                    default:
                        item = new PropertyItem (p);
                        break;
                    }

                    items.Add (item);
                }
            }
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PropertyItemValue"/> class.
        /// </summary>
        /// <param name="property">The property.</param>
        public PropertyItemValue(PropertyItem property)
        {
            if (property == null) throw new ArgumentNullException("property");
              this._property = property;

              _hasSubProperties = property.Converter.GetPropertiesSupported();

              if (_hasSubProperties)
              {
            object value = property.GetValue();

            PropertyDescriptorCollection descriptors = property.Converter.GetProperties(value);
            foreach (PropertyDescriptor d in descriptors)
            {
              _subProperties.Add(new PropertyItem(property.Owner, value, d));
              // TODO: Move to PropertyData as a public property
              NotifyParentPropertyAttribute notifyParent = d.Attributes[KnownTypes.Attributes.NotifyParentPropertyAttribute] as NotifyParentPropertyAttribute;
              if (notifyParent != null && notifyParent.NotifyParent)
              {
            d.AddValueChanged(value, NotifySubPropertyChanged);
              }
            }
              }

              this._property.PropertyChanged += new PropertyChangedEventHandler(ParentPropertyChanged);
        }
예제 #4
0
        public StringValueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            if (property.PropertyType == typeof(Char))
            {
                if ((char)property.Value == '\0')
                    property.Value = "";
            }

            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError);

            txt = new TextBox();
            txt.Height = 20;
            if (null != property.Value)
                txt.Text = property.Value.ToString();
            //txt.IsReadOnly = !this.Property.CanWrite;
            txt.Foreground = this.Property.CanWrite ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(Colors.Gray);
            txt.BorderThickness = new Thickness(0);
            txt.Margin = new Thickness(0);

            if (this.Property.CanWrite)
                txt.TextChanged += new TextChangedEventHandler(Control_TextChanged);

            this.Content = txt;
            this.GotFocus += new RoutedEventHandler(StringValueEditor_GotFocus);
        }
 protected virtual FrameworkElement CreateComboBox(PropertyItem pi, PropertyControlFactoryOptions options)
 {
     var cbox = new ComboBox() { IsEditable = true };
     cbox.SetBinding(Selector.SelectedItemProperty, new Binding(pi.Descriptor.Name + ".Text"));
     cbox.SetBinding(ItemsControl.ItemsSourceProperty, new Binding(pi.Descriptor.Name + ".Values"));
     return cbox;
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PropertyValueChangedEventArgs"/> class.
 /// </summary>
 /// <param name="routedEvent">The routed event.</param>
 /// <param name="property">The property.</param>
 /// <param name="oldValue">The old value.</param>
 public PropertyValueChangedEventArgs(RoutedEvent routedEvent, PropertyItem property, object oldValue)
     : base(routedEvent, property)
 {
     Property = property;
     NewValue = property.PropertyValue;
     OldValue = oldValue;
 }
예제 #7
0
        public StringEditor(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            if (property.PropertyType == typeof(Char))
              {
            if ((char)property.Value == '\0')
              property.Value = "";
              }

              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              textBox = new TextBox
              {
            Height = 20,
            Foreground = Property.CanWrite ? Brushes.Black : Brushes.Gray,
            BorderThickness = new Thickness(0),
            Margin = new Thickness(0),
            IsReadOnly = !Property.CanWrite
              };

              if (null != property.Value)
            textBox.Text = property.Value.ToString();

              if (Property.CanWrite)
            textBox.TextChanged += Control_TextChanged;

              Content = textBox;
              GotFocus += StringValueEditor_GotFocus;
        }
예제 #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public DateTimeEditor(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            currentValue = property.Value;
              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              contentPanel = new StackPanel();
              this.Content = contentPanel;

              datePicker = new DatePicker
              {
            Visibility = Visibility.Visible,
            Margin = new Thickness(0),
            VerticalAlignment = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Stretch
              };

              datePicker.CalendarOpened += dtp_CalendarOpened;
              datePicker.CalendarClosed += dtp_CalendarClosed;
              datePicker.LostFocus += dtp_LostFocus;
              contentPanel.Children.Add(datePicker);
              datePicker.Focus();

              this.ShowTextBox();
        }
        //=====================================================================
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="project">The project file reference</param>
        public UserDefinedPropertyEditorDlg(SandcastleProject project)
        {
            PropertyItem propItem;

            InitializeComponent();

            this.Project = project;
            this.UserDefinedProperties = new Collection<PropertyItem>();

            lbProperties.Sorted = true;

            try
            {
                foreach(BuildProperty prop in this.Project.GetUserDefinedProperties())
                {
                    propItem = new PropertyItem(this, prop);
                    this.UserDefinedProperties.Add(propItem);
                    lbProperties.Items.Add(propItem);
                }
            }
            catch(Exception ex)
            {
                MessageBox.Show("Unable to load user-defined properties.  " +
                    "Error " + ex.Message, Constants.AppName,
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            lbProperties.Sorted = false;

            if(lbProperties.Items.Count == 0)
                pgProps.Enabled = false;
            else
                lbProperties.SelectedIndex = 0;
        }
예제 #10
0
		/// <summary>
		///     Initializes a new instance of the <see cref="PropertyItemValue" /> class.
		/// </summary>
		/// <param name="property">The property.</param>
		public PropertyItemValue(PropertyItem property)
		{
			if (property == null) throw new ArgumentNullException("property");
			_property = property;

			_hasSubProperties = property.Converter.GetPropertiesSupported();

			if (_hasSubProperties)
			{
				var value = property.GetValue();

				var descriptors = property.Converter.GetProperties(value);
				foreach (PropertyDescriptor d in descriptors)
				{
					_subProperties.Add(new PropertyItem(property.Owner, value, d));
					// TODO: Move to PropertyData as a public property
					var notifyParent =
						d.Attributes[KnownTypes.Attributes.NotifyParentPropertyAttribute] as NotifyParentPropertyAttribute;
					if (notifyParent != null && notifyParent.NotifyParent)
					{
						d.AddValueChanged(value, NotifySubPropertyChanged);
					}
				}
			}

			if (property.IsCollection)
			{
				LoadCollectionValues();
			}

			_property.PropertyChanged += ParentPropertyChanged;
		}
예제 #11
0
        public PersonAdapter (PersonViewModel viewModel)
        {
            items = new List<Item> ();

            foreach (var pg in viewModel.PropertyGroups) {
                items.Add (new MainHeaderItem (pg.Title));
                foreach (var p in pg.Properties) {

                    PropertyItem item;

                    if (p.Type == PersonViewModel.PropertyType.Phone) {
                        item = new PhonePropertyItem (p);
                    } else if (p.Type == PersonViewModel.PropertyType.Email) {
                        item = new EmailPropertyItem (p);
                    } else if (p.Type == PersonViewModel.PropertyType.Url) {
                        item = new UrlPropertyItem (p);
                    } else if (p.Type == PersonViewModel.PropertyType.Twitter) {
                        item = new TwitterPropertyItem (p);
                    } else {
                        item = new PropertyItem (p);
                    }

                    items.Add (item);
                }
            }
        }
예제 #12
0
        public ImageVaueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError);

            _attribute = property.GetAttribute<ImageAttribute>();

            if(null == _attribute)
            {
                _attribute = new ImageAttribute();
                _attribute.OnlyImage = false;
            }
            _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) });
            _grid.ColumnDefinitions.Add(new ColumnDefinition());
            _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) });
            _grid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1d, GridUnitType.Auto) });
            _grid.Children.Add(_image);
            _grid.Children.Add(_text);
            _grid.Children.Add(_removeButton);
            _grid.Children.Add(_broswerButton);
            _image.SetValue(Grid.ColumnProperty, 0);
            _text.SetValue(Grid.ColumnProperty, 1);
            _removeButton.SetValue(Grid.ColumnProperty, 2);
            _broswerButton.SetValue(Grid.ColumnProperty, 3);
            this.Content = _grid;
            _broswerButton.Click += BroswerButton_Click;
            _removeButton.Click += RemoveButton_Click;
            UpdateLabel(property.Value);
            _text.GotFocus += Text_GotFocus;
            _text.Background = null;
            _text.BorderBrush = null;
            _text.BorderThickness = new Thickness();
        }
예제 #13
0
 public ButtonEditor(PropertyLabel label, PropertyItem property)
     : base(property)
 {
     var button = new Button { Content = "..." };
       button.Click += (sender, e) => MessageBox.Show("Custom dialog comes here...");
       this.Content = button;
 }
예제 #14
0
 public override FrameworkElement CreateControl(PropertyItem pi, PropertyControlFactoryOptions options)
 {
     if (pi.Is(typeof(IValueWithSource)))
     {
         return CreateComboBox(pi, options);
     }
     return base.CreateControl(pi, options);
 }
예제 #15
0
    //private SelectValueEditorAttribute _attrs = null;

    /// <summary>
    /// Данный конструктор используется в динамических PropertyGrid, на событии OnCustomEditor
    /// </summary>
    /// <param name="label"></param>
    /// <param name="property"></param>
    /// <param name="attrs"></param>
    public SelectValueEditor(PropertyGridLabel label, PropertyItem property, SelectValueEditorAttribute attrs)
      : base(label, property) {
      var v_attrs = attrs ?? this.Property.GetAttribute<SelectValueEditorAttribute>();
      this.SelectorPlugin = v_attrs.SelectorPluginName;
      this.DisplayField = v_attrs.DisplayFieldName;
      this.ValueField = v_attrs.ValueFieldName;
      this.IsMultiselector = v_attrs.isMultiselector;
      
    }
예제 #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExtendedPropertyEditorTab"/> class.
        /// </summary>
        /// <param name="property">The property to display extended editor for.</param>
        public ExtendedPropertyEditorTab(PropertyItem property)
            : this()
        {
            if (property == null) throw new ArgumentNullException("property");

              Property = property;
              Header = property.Name;
              Content = CreateContent(property);
        }
예제 #17
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="label">The associated label for this Editor control</param>
 /// <param name="property">The associated PropertyItem for this control</param>
 public EditorBase(PropertyItem property)
 {
     this.Name = "textBox" + property.Name;
       this.Property = property;
       this.BorderThickness = new Thickness(0);
       this.Margin = new Thickness(0);
       this.HorizontalAlignment = HorizontalAlignment.Stretch;
       this.HorizontalContentAlignment = HorizontalAlignment.Stretch;
 }
예제 #18
0
        public void ShouldApplyPropertyReadonlyState()
        {
            PropertyItem property = new PropertyItem(
            new PropertyGrid(),
            new BusinessObject(),
            TypeDescriptor.GetProperties(typeof(BusinessObject))["ReadOnlyProperty"]);

              Assert.IsTrue(property.IsReadOnly);
        }
예제 #19
0
 public BrushEditor(PropertyLabel label, PropertyItem property)
     : base(property)
 {
     currentValue = property.Value;
       property.PropertyChanged += property_PropertyChanged;
       property.ValueError += property_ValueError;
       contentPanel = new StackPanel();
       this.Content = contentPanel;
       ShowTextBox();
 }
        public override FrameworkElement CreateControl(PropertyItem pi, PropertyControlFactoryOptions options)
        {
            // Check if the property is of type Range
            if (pi.Is(typeof(IValueWithSource)))
            {
                // Create a control to edit the Range
                return this.CreateComboBox(pi, options);
            }

            return base.CreateControl(pi, options);
        }
예제 #21
0
        public void ShouldClearValue()
        {
            BusinessObject component = new BusinessObject() { Name = "TestName" };
              PropertyItem property = new PropertyItem(new PropertyGrid(), component, BusinessObject.ExtractProperty("Name"));

              Assert.AreEqual<string>("TestName", property.GetValue().ToString());

              property.ClearValue();

              Assert.AreEqual<string>("DefaultName", property.GetValue().ToString());
        }
        public override FrameworkElement CreateControl(PropertyItem pi, PropertyControlFactoryOptions options)
        {
            //if (property.Is(typeof(DateTime)))
            //{
            //    var dp = new DatePicker() { SelectedDateFormat = DatePickerFormat.Long, DisplayDateStart = DateTime.Now.AddDays(-7) };
            //    dp.SetBinding(DatePicker.SelectedDateProperty,
            //        new Binding(property.Descriptor.Name) { ValidatesOnDataErrors = true });
            //    return dp;
            //}

            return base.CreateControl(pi, options);
        }
예제 #23
0
파일: CurveEditor.cs 프로젝트: stewmc/vixen
		public override Object ShowDialog(PropertyItem propertyItem, Object propertyValue, IInputElement commandSource)
		{
			Curve curveValue = propertyValue as Curve;
			App.Curves.CurveEditor editor = new App.Curves.CurveEditor(curveValue ?? new Curve());
			editor.Text = propertyItem.DisplayName;
			if (editor.ShowDialog() == DialogResult.OK)
			{
				propertyValue = editor.Curve;
			}

			return propertyValue;
		}
        protected override IList<object> CreateItemsSource(PropertyItem propertyItem)
        {
            if (propertyItem.PropertyType == typeof(FontFamily))
                return GetFontFamilies();
            else if (propertyItem.PropertyType == typeof(FontWeight))
                return GetFontWeights();
            else if (propertyItem.PropertyType == typeof(FontStyle))
                return GetFontStyles();
            else if (propertyItem.PropertyType == typeof(FontStretch))
                return GetFontStretches();

            return null;
        }
예제 #25
0
        protected override IEnumerable CreateItemsSource( PropertyItem propertyItem )
        {
            if( propertyItem.PropertyType == typeof( FontFamily ) )
            return FontUtilities.Families;
              else if( propertyItem.PropertyType == typeof( FontWeight ) )
            return FontUtilities.Weights;
              else if( propertyItem.PropertyType == typeof( FontStyle ) )
            return FontUtilities.Styles;
              else if( propertyItem.PropertyType == typeof( FontStretch ) )
            return FontUtilities.Stretches;

              return null;
        }
예제 #26
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label">The associated label for this Editor control</param>
        /// <param name="property">The associated PropertyItem for this control</param>
        public ValueEditorBase(PropertyGridLabel label, PropertyItem property)
        {
            this.Label = label;
            this.Label.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(Label_MouseLeftButtonDown);
            this.Label.MouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(Label_MouseLeftButtonUp);
            if (!property.CanWrite)
                this.Label.Foreground = new SolidColorBrush(Colors.Gray);

            this.Property = property;
            this.BorderThickness = new Thickness(0);
            this.Margin = new Thickness(0);
            this.HorizontalAlignment = HorizontalAlignment.Stretch;
            this.HorizontalContentAlignment = HorizontalAlignment.Stretch;
        }
예제 #27
0
        public void ShouldApplyFilterForProperty()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("Name"));
              Assert.IsTrue(property.MatchesFilter);

              property.ApplyFilter(null);
              Assert.IsTrue(property.MatchesFilter);

              property.ApplyFilter(new PropertyFilter("missing"));
              Assert.IsFalse(property.MatchesFilter);

              property.ApplyFilter(new PropertyFilter("string"));
              Assert.IsTrue(property.MatchesFilter);
        }
예제 #28
0
        public FontFamilyValueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError += new EventHandler<ExceptionEventArgs>(property_ValueError);

            this.Content = _combox;
            _combox.ItemsSource = Fonts;
            _combox.SelectedValuePath = "Value";
            _combox.DisplayMemberPath = "DisplayName";

            _combox.SelectionChanged += ComboBox_SelectionChanged;
            var fontFamily = property.Value as FontFamily;
            _combox.SelectedItem = new Font(Common1.GetFontCN(fontFamily.Source), fontFamily);
        }
예제 #29
0
		public override Object ShowDialog(PropertyItem propertyItem, Object propertyValue, IInputElement commandSource)
		{
			OpenFileDialog ofd = new OpenFileDialog
			{
				//Filter = "Image Files (*.jpg, *.png, *.bmp)|*.jpg;*.png;*.bmp",
				Multiselect = false
			};

			if (ofd.ShowDialog() == true)
			{
				propertyValue = ofd.FileName;
			}

			return propertyValue;
		}
예제 #30
0
파일: FontEditor.cs 프로젝트: stewmc/vixen
		public override object ShowDialog(PropertyItem propertyItem, object value, IInputElement commandSource)
		{
			FontDialog ofd = new FontDialog();
			ofd.ShowColor = false;
			if (value is Font)
			{
				ofd.Font = (Font) value;
			}
			
			if (ofd.ShowDialog() == DialogResult.OK)
			{
				value = ofd.Font;
			}

			return value;
		}
예제 #31
0
        public void ShouldMatchFilterPredicateByDisplayName()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("Name"));

            Assert.IsTrue(property.MatchesPredicate(new PropertyFilterPredicate("Login")));
        }
예제 #32
0
        public void ShouldFailMatchingNullPredicate()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("Name"));

            Assert.IsFalse(property.MatchesPredicate(null));
        }
예제 #33
0
        public void ShouldFailValidationForDependencyProperty()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new DependencyObjectMock(), DependencyObjectMock.ExtractProperty("InvalidProperty"));

            Assert.IsFalse(property.Validate("value"));
        }
예제 #34
0
        public void ShouldMatchFilterPredicateByPropertyType()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("ReadOnlyProperty"));

            Assert.IsTrue(property.MatchesPredicate(new PropertyFilterPredicate("string")));
        }
예제 #35
0
        public void ShouldWrapDisplayNameWithParenthesis()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("ParenthesizedProperty"));

            Assert.AreEqual <string>("(Parenthesis)", property.DisplayName);
        }
예제 #36
0
파일: PropertyTag.cs 프로젝트: mdelonge/PLM
 ///<summary></summary>
 /// <param name="aPropertyItem"></param>
 public PropertyTag(PropertyItem aPropertyItem)
 {
     _prop = aPropertyItem;
 }
예제 #37
0
        public Metadata GetEXIFMetaData(string PhotoName)
        {
            // 创建一个图片的实例
            System.Drawing.Image MyImage = System.Drawing.Image.FromFile(PhotoName);
            // 创建一个整型数组来存储图像中属性数组的ID
            int[] MyPropertyIdList = MyImage.PropertyIdList;
            //创建一个封闭图像属性数组的实例
            PropertyItem[] MyPropertyItemList = new PropertyItem[MyPropertyIdList.Length];
            //创建一个图像EXIT信息的实例结构对象,并且赋初值

            #region 创建一个图像EXIT信息的实例结构对象,并且赋初值
            Metadata MyMetadata = new Metadata();
            MyMetadata.EquipmentMake.Hex    = "10f";
            MyMetadata.CameraModel.Hex      = "110";
            MyMetadata.DatePictureTaken.Hex = "9003";
            MyMetadata.ExposureTime.Hex     = "829a";
            MyMetadata.Fstop.Hex            = "829d";
            MyMetadata.ShutterSpeed.Hex     = "9201";
            MyMetadata.MeteringMode.Hex     = "9207";
            MyMetadata.Flash.Hex            = "9209";
            MyMetadata.FNumber.Hex          = "829d"; //added
            MyMetadata.ExposureProg.Hex     = "";     //added
            MyMetadata.SpectralSense.Hex    = "8824"; //added
            MyMetadata.ISOSpeed.Hex         = "8827"; //added
            MyMetadata.OECF.Hex             = "8828"; //added
            MyMetadata.Ver.Hex           = "9000";    //added
            MyMetadata.CompConfig.Hex    = "9101";    //added
            MyMetadata.CompBPP.Hex       = "9102";    //added
            MyMetadata.Aperture.Hex      = "9202";    //added
            MyMetadata.Brightness.Hex    = "9203";    //added
            MyMetadata.ExposureBias.Hex  = "9204";    //added
            MyMetadata.MaxAperture.Hex   = "9205";    //added
            MyMetadata.SubjectDist.Hex   = "9206";    //added
            MyMetadata.LightSource.Hex   = "9208";    //added
            MyMetadata.FocalLength.Hex   = "920a";    //added
            MyMetadata.FPXVer.Hex        = "a000";    //added
            MyMetadata.ColorSpace.Hex    = "a001";    //added
            MyMetadata.FocalXRes.Hex     = "a20e";    //added
            MyMetadata.FocalYRes.Hex     = "a20f";    //added
            MyMetadata.FocalResUnit.Hex  = "a210";    //added
            MyMetadata.ExposureIndex.Hex = "a215";    //added
            MyMetadata.SensingMethod.Hex = "a217";    //added
            MyMetadata.SceneType.Hex     = "a301";
            MyMetadata.CfaPattern.Hex    = "a302";
            #endregion

            // ASCII编码
            System.Text.ASCIIEncoding Value = new System.Text.ASCIIEncoding();

            int index = 0;
            int MyPropertyIdListCount = MyPropertyIdList.Length;
            if (MyPropertyIdListCount != 0)
            {
                foreach (int MyPropertyId in MyPropertyIdList)
                {
                    string hexVal = "";
                    MyPropertyItemList[index] = MyImage.GetPropertyItem(MyPropertyId);

                    #region 初始化各属性值
                    string myPropertyIdString = MyImage.GetPropertyItem(MyPropertyId).Id.ToString("x");
                    switch (myPropertyIdString)
                    {
                    case "10f":
                    {
                        MyMetadata.EquipmentMake.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.EquipmentMake.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "110":
                    {
                        MyMetadata.CameraModel.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.CameraModel.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "9003":
                    {
                        MyMetadata.DatePictureTaken.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.DatePictureTaken.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "9207":
                    {
                        MyMetadata.MeteringMode.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.MeteringMode.DisplayValue     = LookupEXIFValue("MeteringMode", BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString());
                        break;
                    }

                    case "9209":
                    {
                        MyMetadata.Flash.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.Flash.DisplayValue     = LookupEXIFValue("Flash", BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString());
                        break;
                    }

                    case "829a":
                    {
                        MyMetadata.ExposureTime.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        string StringValue = "";
                        for (int Offset = 0; Offset < MyImage.GetPropertyItem(MyPropertyId).Len; Offset = Offset + 4)
                        {
                            StringValue += BitConverter.ToInt32(MyImage.GetPropertyItem(MyPropertyId).Value, Offset).ToString() + "/";
                        }
                        MyMetadata.ExposureTime.DisplayValue = StringValue.Substring(0, StringValue.Length - 1);
                        break;
                    }

                    case "829d":
                    {
                        MyMetadata.Fstop.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        int int1;
                        int int2;
                        int1 = BitConverter.ToInt32(MyImage.GetPropertyItem(MyPropertyId).Value, 0);
                        int2 = BitConverter.ToInt32(MyImage.GetPropertyItem(MyPropertyId).Value, 4);
                        MyMetadata.Fstop.DisplayValue = "F/" + (int1 / int2);

                        MyMetadata.FNumber.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.FNumber.DisplayValue     = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();

                        break;
                    }

                    case "9201":
                    {
                        MyMetadata.ShutterSpeed.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        string StringValue = BitConverter.ToInt32(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();
                        MyMetadata.ShutterSpeed.DisplayValue = "1/" + StringValue;
                        break;
                    }

                    case "8822":
                    {
                        MyMetadata.ExposureProg.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.ExposureProg.DisplayValue     = LookupEXIFValue("ExposureProg", BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString());
                        break;
                    }

                    case "8824":
                    {
                        MyMetadata.SpectralSense.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.SpectralSense.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "8827":
                    {
                        hexVal = "";
                        MyMetadata.ISOSpeed.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        hexVal = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value).Substring(0, 2);
                        MyMetadata.ISOSpeed.DisplayValue = Convert.ToInt32(hexVal, 16).ToString();        //Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "8828":
                    {
                        MyMetadata.OECF.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.OECF.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "9000":
                    {
                        MyMetadata.Ver.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.Ver.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value).Substring(1, 1) + "." + Value.GetString(MyPropertyItemList[index].Value).Substring(2, 2);
                        break;
                    }

                    case "9101":
                    {
                        MyMetadata.CompConfig.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.CompConfig.DisplayValue     = LookupEXIFValue("CompConfig", BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString());
                        break;
                    }

                    case "9102":
                    {
                        MyMetadata.CompBPP.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.CompBPP.DisplayValue     = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();
                        break;
                    }

                    case "9202":
                    {
                        hexVal = "";
                        MyMetadata.Aperture.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        hexVal = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value).Substring(0, 2);
                        hexVal = Convert.ToInt32(hexVal, 16).ToString();
                        hexVal = hexVal + "00";
                        MyMetadata.Aperture.DisplayValue = hexVal.Substring(0, 1) + "." + hexVal.Substring(1, 2);
                        break;
                    }

                    case "9203":
                    {
                        hexVal = "";
                        MyMetadata.Brightness.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        hexVal = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value).Substring(0, 2);
                        hexVal = Convert.ToInt32(hexVal, 16).ToString();
                        hexVal = hexVal + "00";
                        MyMetadata.Brightness.DisplayValue = hexVal.Substring(0, 1) + "." + hexVal.Substring(1, 2);
                        break;
                    }

                    case "9204":
                    {
                        MyMetadata.ExposureBias.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.ExposureBias.DisplayValue     = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();
                        break;
                    }

                    case "9205":
                    {
                        hexVal = "";
                        MyMetadata.MaxAperture.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        hexVal = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value).Substring(0, 2);
                        hexVal = Convert.ToInt32(hexVal, 16).ToString();
                        hexVal = hexVal + "00";
                        MyMetadata.MaxAperture.DisplayValue = hexVal.Substring(0, 1) + "." + hexVal.Substring(1, 2);
                        break;
                    }

                    case "9206":
                    {
                        MyMetadata.SubjectDist.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.SubjectDist.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "9208":
                    {
                        MyMetadata.LightSource.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.LightSource.DisplayValue     = LookupEXIFValue("LightSource", BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString());
                        break;
                    }

                    case "920a":
                    {
                        hexVal = "";
                        MyMetadata.FocalLength.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        hexVal = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value).Substring(0, 2);
                        hexVal = Convert.ToInt32(hexVal, 16).ToString();
                        hexVal = hexVal + "00";
                        MyMetadata.FocalLength.DisplayValue = hexVal.Substring(0, 1) + "." + hexVal.Substring(1, 2);
                        break;
                    }

                    case "a000":
                    {
                        MyMetadata.FPXVer.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.FPXVer.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value).Substring(1, 1) + "." + Value.GetString(MyPropertyItemList[index].Value).Substring(2, 2);
                        break;
                    }

                    case "a001":
                    {
                        MyMetadata.ColorSpace.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        if (BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString() == "1")
                        {
                            MyMetadata.ColorSpace.DisplayValue = "RGB";
                        }
                        if (BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString() == "65535")
                        {
                            MyMetadata.ColorSpace.DisplayValue = "Uncalibrated";
                        }
                        break;
                    }

                    case "a20e":
                    {
                        MyMetadata.FocalXRes.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.FocalXRes.DisplayValue     = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();
                        break;
                    }

                    case "a20f":
                    {
                        MyMetadata.FocalYRes.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.FocalYRes.DisplayValue     = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();
                        break;
                    }

                    case "a210":
                    {
                        string aa;
                        MyMetadata.FocalResUnit.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        aa = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();;
                        if (aa == "1")
                        {
                            MyMetadata.FocalResUnit.DisplayValue = "没有单位";
                        }
                        if (aa == "2")
                        {
                            MyMetadata.FocalResUnit.DisplayValue = "英尺";
                        }
                        if (aa == "3")
                        {
                            MyMetadata.FocalResUnit.DisplayValue = "厘米";
                        }
                        break;
                    }

                    case "a215":
                    {
                        MyMetadata.ExposureIndex.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.ExposureIndex.DisplayValue     = Value.GetString(MyPropertyItemList[index].Value);
                        break;
                    }

                    case "a217":
                    {
                        string aa;
                        aa = BitConverter.ToInt16(MyImage.GetPropertyItem(MyPropertyId).Value, 0).ToString();
                        MyMetadata.SensingMethod.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        if (aa == "2")
                        {
                            MyMetadata.SensingMethod.DisplayValue = "1 chip color area sensor";
                        }
                        break;
                    }

                    case "a301":
                    {
                        MyMetadata.SceneType.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.SceneType.DisplayValue     = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        break;
                    }

                    case "a302":
                    {
                        MyMetadata.CfaPattern.RawValueAsString = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        MyMetadata.CfaPattern.DisplayValue     = BitConverter.ToString(MyImage.GetPropertyItem(MyPropertyId).Value);
                        break;
                    }
                    }
                    #endregion

                    index++;
                }
            }

            MyMetadata.XResolution.DisplayValue = MyImage.HorizontalResolution.ToString();
            MyMetadata.YResolution.DisplayValue = MyImage.VerticalResolution.ToString();
            MyMetadata.ImageHeight.DisplayValue = MyImage.Height.ToString();
            MyMetadata.ImageWidth.DisplayValue  = MyImage.Width.ToString();
            MyImage.Dispose();
            return(MyMetadata);
        }
예제 #38
0
        public void ShouldReturnTooltipByDisplayName()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("AdvancedProperty"));

            Assert.AreEqual <string>("Advanced", property.ToolTip.ToString());
        }
 /// <summary>
 /// Create the custom propertygrid editor.
 /// </summary>
 /// <param name="propertyItem"></param>
 /// <returns></returns>
 private protected abstract FrameworkElement CreateInnerElement(PropertyItem propertyItem);
 protected override IList <object> CreateItemsSource(PropertyItem propertyItem)
 {
     _type = propertyItem.PropertyType;
     return(GetValues(propertyItem.PropertyType));
 }
예제 #41
0
        public static int Load(string fileNameOrg, long lColorKey, int iMaxWidth, int iMaxHeight, bool persistent)
        {
            string fileName = GetFileName(fileNameOrg);
            string cacheKey = fileName.ToLowerInvariant();

            if (String.IsNullOrEmpty(fileName))
            {
                return(0);
            }

            CachedTexture cached;

            if (_cacheTextures.TryGetValue(cacheKey, out cached))
            {
                return(cached.Frames);
            }

            string extension = Path.GetExtension(fileName).ToLowerInvariant();

            if (extension == ".gif")
            {
                Image theImage = null;
                try
                {
                    try
                    {
                        theImage = ImageFast.FromFile(fileName);
                    }
                    catch (FileNotFoundException)
                    {
                        Log.Warn("TextureManager: texture: {0} does not exist", fileName);
                        return(0);
                    }
                    catch (Exception)
                    {
                        Log.Warn("TextureManager: Fast loading texture {0} failed using safer fallback", fileName);
                        theImage = Image.FromFile(fileName);
                    }
                    if (theImage != null)
                    {
                        CachedTexture newCache = new CachedTexture();

                        newCache.Name = fileName;
                        FrameDimension oDimension = new FrameDimension(theImage.FrameDimensionsList[0]);
                        newCache.Frames = theImage.GetFrameCount(oDimension);
                        int[] frameDelay = new int[newCache.Frames];
                        for (int num2 = 0; (num2 < newCache.Frames); ++num2)
                        {
                            frameDelay[num2] = 0;
                        }

                        // Getting Frame duration of an animated Gif image
                        try
                        {
                            int          num1  = 20736;
                            PropertyItem item1 = theImage.GetPropertyItem(num1);
                            if (item1 != null)
                            {
                                byte[] buffer1 = item1.Value;
                                for (int num2 = 0; (num2 < newCache.Frames); ++num2)
                                {
                                    frameDelay[num2] = (((buffer1[(num2 * 4)] + (256 * buffer1[((num2 * 4) + 1)])) +
                                                         (65536 * buffer1[((num2 * 4) + 2)])) + (16777216 * buffer1[((num2 * 4) + 3)]));
                                }
                            }
                        }
                        catch (Exception) { }

                        for (int i = 0; i < newCache.Frames; ++i)
                        {
                            theImage.SelectActiveFrame(oDimension, i);

                            //load gif into texture
                            using (MemoryStream stream = new MemoryStream())
                            {
                                theImage.Save(stream, ImageFormat.Png);
                                ImageInformation info2 = new ImageInformation();
                                stream.Flush();
                                stream.Seek(0, SeekOrigin.Begin);
                                Texture texture = TextureLoader.FromStream(
                                    GUIGraphicsContext.DX9Device,
                                    stream,
                                    0, 0, //width/height
                                    1,    //mipslevels
                                    0,    //Usage.Dynamic,
                                    Format.A8R8G8B8,
                                    GUIGraphicsContext.GetTexturePoolType(),
                                    Filter.None,
                                    Filter.None,
                                    (int)lColorKey,
                                    ref info2);
                                newCache.Width  = info2.Width;
                                newCache.Height = info2.Height;
                                newCache[i]     = new TextureFrame(fileName, texture, (frameDelay[i] / 5) * 50);
                            }
                        }

                        theImage.SafeDispose();
                        theImage           = null;
                        newCache.Disposed += new EventHandler(cachedTexture_Disposed);
                        if (persistent && !_persistentTextures.ContainsKey(cacheKey))
                        {
                            _persistentTextures[cacheKey] = true;
                        }

                        _cacheTextures[cacheKey] = newCache;

                        //Log.Info("  TextureManager:added:" + fileName + " total:" + _cache.Count + " mem left:" + GUIGraphicsContext.DX9Device.AvailableTextureMemory.ToString());
                        return(newCache.Frames);
                    }
                }
                catch (Exception ex)
                {
                    Log.Error("TextureManager: exception loading texture {0}", fileName);
                    Log.Error(ex);
                }
                return(0);
            }

            try
            {
                int width, height;

                if (MediaPortal.Util.Utils.FileExistsInCache(fileName))
                {
                    Texture dxtexture = LoadGraphic(fileName, lColorKey, iMaxWidth, iMaxHeight, out width, out height);
                    if (dxtexture != null)
                    {
                        CachedTexture newCache = new CachedTexture();
                        newCache.Name      = fileName;
                        newCache.Frames    = 1;
                        newCache.Width     = width;
                        newCache.Height    = height;
                        newCache.Texture   = new TextureFrame(fileName, dxtexture, 0);
                        newCache.Disposed += new EventHandler(cachedTexture_Disposed);

                        if (persistent && !_persistentTextures.ContainsKey(cacheKey))
                        {
                            _persistentTextures[cacheKey] = true;
                        }

                        _cacheTextures[cacheKey] = newCache;
                        return(1);
                    }
                }
            }
            catch (Exception)
            {
                return(0);
            }
            return(0);
        }
예제 #42
0
        ///<summary>Transformes value of the PropertyItem.Value byte array to apropriate .NET Framework type.</summary>
        /// <param name="aPropertyItem"></param>
        public static Object getValue(PropertyItem aPropertyItem)
        {
            if (aPropertyItem == null)
            {
                return(null);
            }
            switch ((PropertyTagType)aPropertyItem.Type)
            {
            case PropertyTagType.Byte:
                if (aPropertyItem.Value.Length == 1)
                {
                    return(aPropertyItem.Value[0]);
                }
                return(aPropertyItem.Value);

            case PropertyTagType.ASCII:
                return(_encoding.GetString(aPropertyItem.Value, 0, aPropertyItem.Len - 1));

            case PropertyTagType.Short:
                ushort[] _resultUShort = new ushort[aPropertyItem.Len / (16 / 8)];
                for (int i = 0; i < _resultUShort.Length; i++)
                {
                    _resultUShort[i] = BitConverter.ToUInt16(aPropertyItem.Value, i * (16 / 8));
                }
                if (_resultUShort.Length == 1)
                {
                    return(_resultUShort[0]);
                }
                return(_resultUShort);

            case PropertyTagType.Long:
                uint [] _resultUInt32 = new uint[aPropertyItem.Len / (32 / 8)];
                for (int i = 0; i < _resultUInt32.Length; i++)
                {
                    _resultUInt32[i] = BitConverter.ToUInt32(aPropertyItem.Value, i * (32 / 8));
                }
                if (_resultUInt32.Length == 1)
                {
                    return(_resultUInt32[0]);
                }
                return(_resultUInt32);

            case PropertyTagType.Rational:
                Fraction[] _resultRational = new Fraction[aPropertyItem.Len / (64 / 8)];
                uint       uNominator;
                uint       uDenominator;
                for (int i = 0; i < _resultRational.Length; i++)
                {
                    //uNominator=1;
                    uNominator   = BitConverter.ToUInt32(aPropertyItem.Value, i * (64 / 8));
                    uDenominator = BitConverter.ToUInt32(aPropertyItem.Value, (i * (64 / 8)) + (32 / 8));

                    if (uNominator > 0x7FFFFFFF || uDenominator > 0x7FFFFFFF)
                    {
                        // divide both numerator/denominator by 2 if they're too big.
                        uNominator   >>= 1;
                        uDenominator >>= 1;
                    }
                    _resultRational[i] = new Fraction(uNominator, uDenominator);
                }
                if (_resultRational.Length == 1)
                {
                    return(_resultRational[0]);
                }
                return(_resultRational);

            case PropertyTagType.Undefined:
                if (aPropertyItem.Value.Length == 1)
                {
                    return(aPropertyItem.Value[0]);
                }
                return(aPropertyItem.Value);

            case PropertyTagType.SLONG:
                int [] _resultInt32 = new int[aPropertyItem.Len / (32 / 8)];
                for (int i = 0; i < _resultInt32.Length; i++)
                {
                    _resultInt32[i] = BitConverter.ToInt32(aPropertyItem.Value, i * (32 / 8));
                }
                if (_resultInt32.Length == 1)
                {
                    return(_resultInt32[0]);
                }
                return(_resultInt32);

            case PropertyTagType.SRational:
                Fraction[] _resultSRational = new Fraction[aPropertyItem.Len / (64 / 8)];
                int        sNominator;
                int        sDenominator;
                for (int i = 0; i < _resultSRational.Length; i++)
                {
                    sNominator          = BitConverter.ToInt32(aPropertyItem.Value, i * (64 / 8));
                    sDenominator        = BitConverter.ToInt32(aPropertyItem.Value, i * (64 / 8) + (32 / 8));
                    _resultSRational[i] = new Fraction(sNominator, sDenominator);
                }
                if (_resultSRational.Length == 1)
                {
                    return(_resultSRational[0]);
                }
                return(_resultSRational);

            default:
                if (aPropertyItem.Value.Length == 1)
                {
                    return(aPropertyItem.Value[0]);
                }
                return(aPropertyItem.Value);
            }
        }
예제 #43
0
        /// <summary>
        /// Parse the <see cref="EEDID"/> given.
        /// </summary>
        /// <param name="instance"><see cref="EEDID"/> instance to parse.</param>
        public void Parse(EEDID instance)
        {
            Logger.Info("");
            Logger.Info(@" Implemented Blocks");
            Logger.Info(@" ══════════════════");

            DataBlockCollection blocks = instance.Blocks;

            foreach (KnownDataBlock block in blocks.ImplementedBlocks)
            {
                Logger.Info($@" │ {block}");
            }

            foreach (DataBlock block in blocks)
            {
                var blockLiteral = $@"{block.Key} Block";

                Logger.Info("");
                Logger.Info($@" {blockLiteral}");
                Logger.Info($@" {new string('═', blockLiteral.Length)}");

                Logger.Info("");
                Logger.Info(@" Implemented Sections");
                Logger.Info(@" ┌───────────────────");
                var implSections = instance.Blocks[block.Key].Sections.ImplementedSections;
                foreach (Enum section in implSections)
                {
                    Logger.Info($@" │ {section.AsFriendlyName()}");
                }

                Logger.Info("");
                Logger.Info(@" Sections");
                Logger.Info(@" ┌───────");
                BaseDataSectionCollection sections = block.Sections;
                foreach (DataSection section in sections)
                {
                    var sectionLiteral = $"{section.Key.AsFriendlyName()} Section";

                    Logger.Info($@" │");
                    Logger.Info($@" ├ {sectionLiteral}");
                    Logger.Info($@" │ ┌{new string('─', sectionLiteral.Length - 1)}");

                    IEnumerable <IPropertyKey> properties = section.ImplementedProperties;
                    foreach (IPropertyKey property in properties)
                    {
                        string       friendlyName = property.GetPropertyName();
                        PropertyUnit valueUnit    = property.PropertyUnit;
                        string       unit         = valueUnit == PropertyUnit.None ? string.Empty : valueUnit.ToString();

                        QueryPropertyResult queryResult  = section.GetProperty(property);
                        PropertyItem        propertyItem = queryResult.Result;
                        object value = propertyItem.Value;
                        if (value == null)
                        {
                            Logger.Info($@" │ │ {friendlyName}: NULL");
                            continue;
                        }

                        if (value is string)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit}");
                        }
                        else if (value is bool)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit}");
                        }
                        else if (value is double)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit}");
                        }
                        else if (value is byte)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X2}h]");
                        }
                        else if (value is short)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X4}h]");
                        }
                        else if (value is ushort)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X4}h]");
                        }
                        else if (value is int)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X4}h]");
                        }
                        else if (value is uint)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X4}h]");
                        }
                        else if (value is long)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X8}h]");
                        }
                        else if (value is ulong)
                        {
                            Logger.Info($@" │ │ {friendlyName}: {value}{unit} [{value:X8}h]");
                        }
                        else if (value is PointF)
                        {
                            var pointLiteral = $"{ friendlyName }";
                            Logger.Info($@" │ │ {pointLiteral}");
                            Logger.Info($@" │ │ ┌{new string('─', pointLiteral.Length - 1)}");
                            Logger.Info($@" │ │ │ X: {((PointF)value).X}");
                            Logger.Info($@" │ │ │ Y: {((PointF)value).Y}");
                            Logger.Info($@" │ │");
                        }
                        else if (value is StandardTimingIdentifierDescriptorItem)
                        {
                            Logger.Info($@" │ │ {(StandardTimingIdentifierDescriptorItem)value}");
                        }
                        else if (value.GetType() == typeof(ReadOnlyCollection <byte>))
                        {
                            Logger.Info($@" │ │ {friendlyName}: {string.Join(", ", (ReadOnlyCollection<byte>)value)}");
                        }
                        else if (value.GetType() == typeof(ReadOnlyCollection <string>))
                        {
                            Logger.Info($@" │ │ {friendlyName}");
                            Logger.Info($@" │ │ ┌{new string('─', friendlyName.Length - 1)}");
                            var items = (ReadOnlyCollection <string>)value;
                            foreach (string item in items)
                            {
                                Logger.Info($@" │ │ │ {item}");
                            }
                        }
                        else if (value.GetType() == typeof(ReadOnlyCollection <MonitorResolutionInfo>))
                        {
                            var items = (ReadOnlyCollection <MonitorResolutionInfo>)value;
                            foreach (MonitorResolutionInfo item in items)
                            {
                                Logger.Info($@" │ │ {item}");
                            }
                        }
                        else if (value.GetType() == typeof(SectionPropertiesTable))
                        {
                            Logger.Info($@" │ │ {friendlyName}");
                            Logger.Info($@" │ │ ┌{new string('─', friendlyName.Length - 1)}");
                            var dataBlockProperties = (SectionPropertiesTable)value;
                            foreach (PropertyItem dataBlockProperty in dataBlockProperties)
                            {
                                IPropertyKey dataBlockPropertyKey  = (PropertyKey)dataBlockProperty.Key;
                                string       dataBlockPropertyName = dataBlockPropertyKey.GetPropertyName();

                                PropertyUnit dataBlockPropertyUnit = dataBlockPropertyKey.PropertyUnit;
                                string       dataUnit = dataBlockPropertyKey.PropertyUnit == PropertyUnit.None ? string.Empty : dataBlockPropertyUnit.ToString();

                                object dataBlockPropertyValue = dataBlockProperty.Value;
                                if (dataBlockPropertyValue.GetType() == typeof(ReadOnlyCollection <byte>))
                                {
                                    Logger.Info($@" │ │ │ {dataBlockPropertyName}: {string.Join(" ", (ReadOnlyCollection<byte>)dataBlockPropertyValue)}");
                                }
                                else if (dataBlockPropertyValue.GetType() == typeof(ReadOnlyCollection <string>))
                                {
                                    var items = (ReadOnlyCollection <string>)dataBlockPropertyValue;
                                    foreach (string item in items)
                                    {
                                        Logger.Info($@" │ │ │ {item}");
                                    }
                                }
                                else
                                {
                                    Logger.Info($@" │ │ │ {dataBlockPropertyName}: {dataBlockPropertyValue} {dataUnit}");
                                }
                            }

                            Logger.Info($@" │ │");
                        }
                        else if (value.GetType() == typeof(List <SectionPropertiesTable>))
                        {
                            Logger.Info($@" │ │ {friendlyName}");
                            Logger.Info($@" │ │ ┌{new string('─', friendlyName.Length - 1)}");
                            var sectionPropertiesCollection = (List <SectionPropertiesTable>)value;
                            foreach (SectionPropertiesTable sectionProperty in sectionPropertiesCollection)
                            {
                                foreach (PropertyItem dataBlockProperty in sectionProperty)
                                {
                                    IPropertyKey dataBlockPropertyKey  = (PropertyKey)dataBlockProperty.Key;
                                    string       dataBlockPropertyName = dataBlockPropertyKey.GetPropertyName();

                                    PropertyUnit dataBlockPropertyUnit = dataBlockPropertyKey.PropertyUnit;
                                    string       dataUnit = dataBlockPropertyKey.PropertyUnit == PropertyUnit.None ? string.Empty : dataBlockPropertyUnit.ToString();

                                    object dataBlockPropertyValue = dataBlockProperty.Value;
                                    if (dataBlockPropertyValue.GetType() == typeof(ReadOnlyCollection <string>))
                                    {
                                        Logger.Info($@" │ │ │ {dataBlockPropertyName}");
                                        Logger.Info($@" │ │ │ ┌{new string('─', dataBlockPropertyName.Length - 1)}");
                                        var items = (ReadOnlyCollection <string>)dataBlockPropertyValue;
                                        foreach (string item in items)
                                        {
                                            Logger.Info($@" │ │ │ │ {item}");
                                        }
                                    }
                                    else
                                    {
                                        Logger.Info($@" │ │ │ {dataBlockPropertyName}: {dataBlockPropertyValue} {dataUnit}");
                                    }
                                }
                            }

                            Logger.Info($@" │ │");
                        }
                        else
                        {
                            Logger.Info($@" │ │ {friendlyName} > {value}{unit}");
                        }
                    }
                }
            }
        }
예제 #44
0
 // This is a "verification" test untill the corresponding property is implemented
 public void ShouldFailGettingIsDefaultValueByDefault()
 {
     bool isDefault = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("AdvancedProperty")).IsDefaultValue;
 }
예제 #45
0
 public SizePrecentEditor(PropertyItem propertyItem) : base(propertyItem)
 {
 }
예제 #46
0
        public void ShouldApproveCollectionProperty()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("CollectionProperty"));

            Assert.IsTrue(property.IsCollection);
        }
예제 #47
0
 public Widget ResolveEditor(PropertyItem item = null)
 {
     return(null);
 }
예제 #48
0
        public void ShouldSkipParenthesizedAttribute()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("NonParenthesizedProperty"));

            Assert.AreEqual <string>("NoParenthesis", property.DisplayName);
        }
예제 #49
0
파일: frmMain.cs 프로젝트: mamikonmn/S-O
        private void btnSpeedTest_Click(object sender, EventArgs e)
        {
            if (!File.Exists(txtFileName.Text))
            {
                MessageBox.Show(this, "Please enter a valid filename", "File not found", MessageBoxButtons.OK);
                return;
            }

            if (MessageBox.Show(this, "This will take 10 seconds to complete.", "Exif library speed test", MessageBoxButtons.OKCancel) !=
                DialogResult.OK)
            {
                return;
            }

            // See how many single parameter reads can be done in 5 seconds with
            // 1. The .NET Image class
            // 2. The ExifReader

            TimeSpan msInterval, exifLibInterval;
            int      msCount = 0, exifLibCount = 0;
            DateTime startTime = DateTime.Now;

            try
            {
                Cursor = Cursors.WaitCursor;

                // Using the imaging classes
                while (startTime.AddSeconds(5) > DateTime.Now)
                {
                    using (
                        FileStream stream = new FileStream(txtFileName.Text, FileMode.Open, FileAccess.Read,
                                                           FileShare.ReadWrite))
                    {
                        using (Image image = Image.FromStream(stream, true, false))
                        {
                            PropertyItem propertyItem = image.GetPropertyItem((int)ExifTags.Model);
                            BitConverter.ToString(propertyItem.Value, 0);
                            msCount++;
                        }
                    }
                }
                msInterval = DateTime.Now - startTime;

                startTime = DateTime.Now;

                // Using the ExifLib classes
                while (startTime.AddSeconds(5) > DateTime.Now)
                {
                    using (ExifReader reader = new ExifReader(txtFileName.Text))
                    {
                        string model;
                        reader.GetTagValue(ExifTags.Model, out model);
                        exifLibCount++;
                    }
                }
                exifLibInterval = DateTime.Now.Subtract(startTime);
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            finally
            {
                Cursor = Cursors.Default;
            }
            string results = string.Format("System.Drawing: {0:F0} reads per second\r\nExifLib: {1:F0} reads per second.\r\nExifLib speed is {2:P0} of System.Drawing", msCount / msInterval.TotalSeconds, exifLibCount / exifLibInterval.TotalSeconds, (exifLibCount / exifLibInterval.TotalSeconds) / (msCount / msInterval.TotalSeconds));

            MessageBox.Show(this, results, "Test results", MessageBoxButtons.OK);
        }
예제 #50
0
        public void SetPropertyItem_InvokeBitmapJpg_Success(int propid)
        {
            using var bitmap = new Bitmap(Helpers.GetTestBitmapPath("nature24bits.jpg"));

            // Change data.
            PropertyItem item = bitmap.GetPropertyItem(PropertyTagExifUserComment);

            item.Value = Encoding.ASCII.GetBytes("Hello World\0");
            item.Len   = item.Value.Length;

            bitmap.SetPropertyItem(item);

            Assert.Equal(new int[] { PropertyTagExifUserComment, PropertyTagChrominanceTable, PropertyTagLuminanceTable }, bitmap.PropertyIdList);
            PropertyItem[] items = bitmap.PropertyItems;
            Assert.Equal(3, items.Length);
            Assert.Equal(PropertyTagExifUserComment, items[0].Id);
            Assert.Equal(12, items[0].Len);
            Assert.Equal(PropertyTagTypeASCII, items[0].Type);
            Assert.Equal("Hello World\0", Encoding.ASCII.GetString(items[0].Value));
            Assert.Equal(PropertyTagChrominanceTable, items[1].Id);
            Assert.Equal(128, items[1].Len);
            Assert.Equal(PropertyTagTypeShort, items[1].Type);
            Assert.Equal(new byte[]
            {
                0x16, 0x00, 0x17, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x17,
                0x00, 0x1B, 0x00, 0x22, 0x00, 0x57, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x1F,
                0x00, 0x22, 0x00, 0x49, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x3E,
                0x00, 0x57, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00
            }, items[1].Value);
            Assert.Equal(PropertyTagLuminanceTable, items[2].Id);
            Assert.Equal(128, items[2].Len);
            Assert.Equal(PropertyTagTypeShort, items[2].Type);
            Assert.Equal(new byte[]
            {
                0x15, 0x00, 0x0E, 0x00, 0x0D, 0x00, 0x15, 0x00, 0x1F, 0x00, 0x34, 0x00, 0x43, 0x00, 0x50, 0x00, 0x0F,
                0x00, 0x0F, 0x00, 0x12, 0x00, 0x19, 0x00, 0x22, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x48, 0x00, 0x12,
                0x00, 0x11, 0x00, 0x15, 0x00, 0x1F, 0x00, 0x34, 0x00, 0x4B, 0x00, 0x5B, 0x00, 0x49, 0x00, 0x12,
                0x00, 0x16, 0x00, 0x1D, 0x00, 0x26, 0x00, 0x43, 0x00, 0x72, 0x00, 0x69, 0x00, 0x51, 0x00, 0x17,
                0x00, 0x1D, 0x00, 0x30, 0x00, 0x49, 0x00, 0x59, 0x00, 0x8F, 0x00, 0x87, 0x00, 0x65, 0x00, 0x1F,
                0x00, 0x2E, 0x00, 0x48, 0x00, 0x54, 0x00, 0x6A, 0x00, 0x89, 0x00, 0x95, 0x00, 0x79, 0x00, 0x40,
                0x00, 0x54, 0x00, 0x66, 0x00, 0x72, 0x00, 0x87, 0x00, 0x9F, 0x00, 0x9E, 0x00, 0x85, 0x00, 0x5F,
                0x00, 0x79, 0x00, 0x7D, 0x00, 0x81, 0x00, 0x93, 0x00, 0x84, 0x00, 0x87, 0x00, 0x82, 0x00,
            }, items[2].Value);

            // New data.
            item.Id    = propid;
            item.Value = Encoding.ASCII.GetBytes("New Value\0");
            item.Len   = item.Value.Length;

            bitmap.SetPropertyItem(item);

            Assert.Equal(new int[] { PropertyTagExifUserComment, PropertyTagChrominanceTable, PropertyTagLuminanceTable, propid }, bitmap.PropertyIdList);
            items = bitmap.PropertyItems;
            Assert.Equal(4, items.Length);
            Assert.Equal(PropertyTagExifUserComment, items[0].Id);
            Assert.Equal(12, items[0].Len);
            Assert.Equal(PropertyTagTypeASCII, items[0].Type);
            Assert.Equal("Hello World\0", Encoding.ASCII.GetString(items[0].Value));
            Assert.Equal(PropertyTagChrominanceTable, items[1].Id);
            Assert.Equal(128, items[1].Len);
            Assert.Equal(PropertyTagTypeShort, items[1].Type);
            Assert.Equal(new byte[]
            {
                0x16, 0x00, 0x17, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x17,
                0x00, 0x1B, 0x00, 0x22, 0x00, 0x57, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x1F,
                0x00, 0x22, 0x00, 0x49, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x3E,
                0x00, 0x57, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00
            }, items[1].Value);
            Assert.Equal(PropertyTagLuminanceTable, items[2].Id);
            Assert.Equal(128, items[2].Len);
            Assert.Equal(PropertyTagTypeShort, items[2].Type);
            Assert.Equal(new byte[]
            {
                0x15, 0x00, 0x0E, 0x00, 0x0D, 0x00, 0x15, 0x00, 0x1F, 0x00, 0x34, 0x00, 0x43, 0x00, 0x50, 0x00, 0x0F,
                0x00, 0x0F, 0x00, 0x12, 0x00, 0x19, 0x00, 0x22, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x48, 0x00, 0x12,
                0x00, 0x11, 0x00, 0x15, 0x00, 0x1F, 0x00, 0x34, 0x00, 0x4B, 0x00, 0x5B, 0x00, 0x49, 0x00, 0x12,
                0x00, 0x16, 0x00, 0x1D, 0x00, 0x26, 0x00, 0x43, 0x00, 0x72, 0x00, 0x69, 0x00, 0x51, 0x00, 0x17,
                0x00, 0x1D, 0x00, 0x30, 0x00, 0x49, 0x00, 0x59, 0x00, 0x8F, 0x00, 0x87, 0x00, 0x65, 0x00, 0x1F,
                0x00, 0x2E, 0x00, 0x48, 0x00, 0x54, 0x00, 0x6A, 0x00, 0x89, 0x00, 0x95, 0x00, 0x79, 0x00, 0x40,
                0x00, 0x54, 0x00, 0x66, 0x00, 0x72, 0x00, 0x87, 0x00, 0x9F, 0x00, 0x9E, 0x00, 0x85, 0x00, 0x5F,
                0x00, 0x79, 0x00, 0x7D, 0x00, 0x81, 0x00, 0x93, 0x00, 0x84, 0x00, 0x87, 0x00, 0x82, 0x00,
            }, items[2].Value);
            Assert.Equal(propid, items[3].Id);
            Assert.Equal(10, items[3].Len);
            Assert.Equal(PropertyTagTypeASCII, items[3].Type);
            Assert.Equal("New Value\0", Encoding.ASCII.GetString(items[3].Value));

            // Set same.
            bitmap.SetPropertyItem(item);

            Assert.Equal(new int[] { PropertyTagExifUserComment, PropertyTagChrominanceTable, PropertyTagLuminanceTable, propid }, bitmap.PropertyIdList);
            items = bitmap.PropertyItems;
            Assert.Equal(4, items.Length);
            Assert.Equal(PropertyTagExifUserComment, items[0].Id);
            Assert.Equal(12, items[0].Len);
            Assert.Equal(PropertyTagTypeASCII, items[0].Type);
            Assert.Equal("Hello World\0", Encoding.ASCII.GetString(items[0].Value));
            Assert.Equal(PropertyTagChrominanceTable, items[1].Id);
            Assert.Equal(128, items[1].Len);
            Assert.Equal(PropertyTagTypeShort, items[1].Type);
            Assert.Equal(new byte[]
            {
                0x16, 0x00, 0x17, 0x00, 0x1F, 0x00, 0x3E, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x17,
                0x00, 0x1B, 0x00, 0x22, 0x00, 0x57, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x1F,
                0x00, 0x22, 0x00, 0x49, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x3E,
                0x00, 0x57, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82,
                0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00
            }, items[1].Value);
            Assert.Equal(PropertyTagLuminanceTable, items[2].Id);
            Assert.Equal(128, items[2].Len);
            Assert.Equal(PropertyTagTypeShort, items[2].Type);
            Assert.Equal(new byte[]
            {
                0x15, 0x00, 0x0E, 0x00, 0x0D, 0x00, 0x15, 0x00, 0x1F, 0x00, 0x34, 0x00, 0x43, 0x00, 0x50, 0x00, 0x0F,
                0x00, 0x0F, 0x00, 0x12, 0x00, 0x19, 0x00, 0x22, 0x00, 0x4C, 0x00, 0x4F, 0x00, 0x48, 0x00, 0x12,
                0x00, 0x11, 0x00, 0x15, 0x00, 0x1F, 0x00, 0x34, 0x00, 0x4B, 0x00, 0x5B, 0x00, 0x49, 0x00, 0x12,
                0x00, 0x16, 0x00, 0x1D, 0x00, 0x26, 0x00, 0x43, 0x00, 0x72, 0x00, 0x69, 0x00, 0x51, 0x00, 0x17,
                0x00, 0x1D, 0x00, 0x30, 0x00, 0x49, 0x00, 0x59, 0x00, 0x8F, 0x00, 0x87, 0x00, 0x65, 0x00, 0x1F,
                0x00, 0x2E, 0x00, 0x48, 0x00, 0x54, 0x00, 0x6A, 0x00, 0x89, 0x00, 0x95, 0x00, 0x79, 0x00, 0x40,
                0x00, 0x54, 0x00, 0x66, 0x00, 0x72, 0x00, 0x87, 0x00, 0x9F, 0x00, 0x9E, 0x00, 0x85, 0x00, 0x5F,
                0x00, 0x79, 0x00, 0x7D, 0x00, 0x81, 0x00, 0x93, 0x00, 0x84, 0x00, 0x87, 0x00, 0x82, 0x00,
            }, items[2].Value);
            Assert.Equal(propid, items[3].Id);
            Assert.Equal(10, items[3].Len);
            Assert.Equal(PropertyTagTypeASCII, items[3].Type);
            Assert.Equal("New Value\0", Encoding.ASCII.GetString(items[3].Value));
        }
예제 #51
0
        public void ShouldReturnNullForMissingMetadata()
        {
            PropertyItem property = new PropertyItem(new PropertyGrid(), new BusinessObject(), BusinessObject.ExtractProperty("Name"));

            Assert.IsNull(property.Metadata["missing"]);
        }