当前位置: 首页>>代码示例>>C#>>正文


C# Descriptor类代码示例

本文整理汇总了C#中Descriptor的典型用法代码示例。如果您正苦于以下问题:C# Descriptor类的具体用法?C# Descriptor怎么用?C# Descriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Descriptor类属于命名空间,在下文中一共展示了Descriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Device

        public Device(Descriptor descriptor, int baudRate)
        {
            Descriptor = descriptor;

            port = new SerialPort(
                portName: descriptor.Port,
                baudRate: baudRate,
                parity: Parity.None,
                dataBits: 8,
                stopBits: StopBits.One);

            port.ErrorReceived += (s, e) =>
            {
                throw new ApplicationException(string.Format(
                    "Serial error: {0}", e.EventType));
            };

            port.DtrEnable = false;
            port.Open();
            Thread.Sleep(50);
            port.DtrEnable = true;

            reader = new BinaryReader(port.BaseStream);
            writer = new BinaryWriter(port.BaseStream);

            port.ReadTimeout = 5000;

            byte r;
            do r = reader.ReadByte();
            while (r != ready);

            port.ReadTimeout = 500;
        }
开发者ID:reinderien,项目名称:argscope,代码行数:33,代码来源:Device.cs

示例2: TypeToolObject

        public TypeToolObject(BinaryPSDReader reader)
            : base(reader)
        {
            BinaryPSDReader r = this.GetDataReader();

            ushort Version = r.ReadUInt16(); //1= Photoshop 5.0

            this.Transform = new Matrix2D(r);

            ushort TextDescriptorVersion = r.ReadUInt16(); //=50. For Photoshop 6.0.
            if (true)
                this.TxtDescriptor = new DynVal(r, true);
            else
            {
                uint XTextDescriptorVersion = r.ReadUInt32(); //=16. For Photoshop 6.0.
                this.TextDescriptor = new Descriptor(r);
            }
            this.Data = r.ReadBytes((int)r.BytesToEnd);

            ////ushort WarpDescriptorVersion = r.ReadUInt16(); //=50. For Photoshop 6.0.
            ////uint XWarpDescriptorVersion = r.ReadUInt32(); //=16. For Photoshop 6.0.
            ////Descriptor warpDescriptor = new Descriptor(r);
            //this.WarpDescriptor = new DynVal(r, true);

            //this.WarpRect = ERectangleF.FromLTRB((float)r.ReadPSDDouble(), (float)r.ReadPSDDouble(), (float)r.ReadPSDDouble(), (float)r.ReadPSDDouble());
            ////this.WarpRect.Left = r.ReadPSDDouble();
            ////double warpRectTop = r.ReadPSDDouble();
            ////double warpRectRight = r.ReadPSDDouble();
            ////double warpRectBottom = r.ReadPSDDouble();

            //this.Data = null;
        }
开发者ID:stukalin,项目名称:ImageResizer,代码行数:32,代码来源:TypeToolObject.cs

示例3: MBeanOperationInfo

 /// <summary>
 /// Creates new MBeanOperationInfo object.
 /// </summary>
 /// <param name="name">The name of the method.</param>
 /// <param name="description">A human readable description of the operation.</param>
 /// <param name="returnType">The type of the method's return value.</param>
 /// <param name="signature">MBeanParameterInfo objects describing the parameters(arguments) of the method. It should be an empty list if operation has no parameters.</param>
 /// <param name="impact">The impact of the method.</param>
 /// <param name="descriptor">Initial descriptor values.</param>
 public MBeanOperationInfo(string name, string description, string returnType, IEnumerable<MBeanParameterInfo> signature, OperationImpact impact, Descriptor descriptor)
     : base(name, description, descriptor)
 {
     _returnType = returnType;
        _signature = new List<MBeanParameterInfo>(signature).AsReadOnly();
     _impact = impact;
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:16,代码来源:MBeanOperationInfo.cs

示例4: SetDescriptorDistance

 public void SetDescriptorDistance(Descriptor desc, double distance)
 {
     switch (desc)
     {
         case Descriptor.NONE:
             break;
         case Descriptor.CLD:
             CLDDiff = distance;
             break;
         case Descriptor.DCD:
             DCDDiff = distance;
             break;
         case Descriptor.EHD:
             EHDDiff = distance;
             break;
         case Descriptor.SCD:
             SCDDiff = distance;
             break;
         case Descriptor.CEDD:
             CEDDDiff = distance;
             break;
         case Descriptor.FCTH:
             FCTHDiff = distance;
             break;
         default:
             break;
     }
 }
开发者ID:kyrisu,项目名称:photoFinder,代码行数:28,代码来源:ImageInfo.cs

示例5: CreateMBeanAttributeInfo

 public MBeanAttributeInfo CreateMBeanAttributeInfo(PropertyInfo info)
 {
     Descriptor descriptor = new Descriptor();
      OpenType openType = OpenType.CreateOpenType(info.PropertyType);
      descriptor.SetField(OpenTypeDescriptor.Field, openType);
      object[] tmp = info.GetCustomAttributes(typeof(OpenMBeanAttributeAttribute), false);
      if (tmp.Length > 0)
      {
     OpenMBeanAttributeAttribute attr = (OpenMBeanAttributeAttribute)tmp[0];
     if (attr.LegalValues != null && (attr.MinValue != null || attr.MaxValue != null))
     {
        throw new OpenDataException("Cannot specify both min/max values and legal values.");
     }
     IComparable defaultValue = (IComparable)attr.DefaultValue;
     OpenInfoUtils.ValidateDefaultValue(openType, defaultValue);
     descriptor.SetField(DefaultValueDescriptor.Field, defaultValue);
     if (attr.LegalValues != null)
     {
        OpenInfoUtils.ValidateLegalValues(openType, attr.LegalValues);
        descriptor.SetField(LegalValuesDescriptor.Field, attr.LegalValues);
     }
     else
     {
        OpenInfoUtils.ValidateMinMaxValue(openType, defaultValue, attr.MinValue, attr.MaxValue);
        descriptor.SetField(MinValueDescriptor.Field, attr.MinValue);
        descriptor.SetField(MaxValueDescriptor.Field, attr.MaxValue);
     }
      }
      return new MBeanAttributeInfo(info.Name, InfoUtils.GetDescrition(info, info, "MBean attribute"), openType.Representation.AssemblyQualifiedName,
     info.CanRead, info.CanWrite, descriptor);
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:31,代码来源:OpenMBeanBeanInfoFactory.cs

示例6: Default

        /// <summary>Defaults.</summary>
        /// <param name="d">The Descriptor to process.</param>
        /// <param name="x">The Vector to process.</param>
        /// <param name="y">The Vector to process.</param>
        /// <param name="activation">The activation.</param>
        /// <returns>A Network.</returns>
        public static Network Default(Descriptor d, Matrix x, Vector y, IFunction activation)
        {
            var nn = new Network();

            // set output to number of choices of available
            // 1 if only two choices
            var distinct = y.Distinct().Count();
            var output = distinct > 2 ? distinct : 1;

            // identity funciton for bias nodes
            IFunction ident = new Ident();

            // set number of hidden units to (Input + Hidden) * 2/3 as basic best guess.
            var hidden = (int)Math.Ceiling((decimal)(x.Cols + output) * 2m / 3m);

            // creating input nodes
            nn.In = new Node[x.Cols + 1];
            nn.In[0] = new Node { Label = "B0", Activation = ident };
            for (var i = 1; i < x.Cols + 1; i++)
            {
                nn.In[i] = new Node { Label = d.ColumnAt(i - 1), Activation = ident };
            }

            // creating hidden nodes
            var h = new Node[hidden + 1];
            h[0] = new Node { Label = "B1", Activation = ident };
            for (var i = 1; i < hidden + 1; i++)
            {
                h[i] = new Node { Label = string.Format("H{0}", i), Activation = activation };
            }

            // creating output nodes
            nn.Out = new Node[output];
            for (var i = 0; i < output; i++)
            {
                nn.Out[i] = new Node { Label = GetLabel(i, d), Activation = activation };
            }

            // link input to hidden. Note: there are
            // no inputs to the hidden bias node
            for (var i = 1; i < h.Length; i++)
            {
                for (var j = 0; j < nn.In.Length; j++)
                {
                    Edge.Create(nn.In[j], h[i]);
                }
            }

            // link from hidden to output (full)
            for (var i = 0; i < nn.Out.Length; i++)
            {
                for (var j = 0; j < h.Length; j++)
                {
                    Edge.Create(h[j], nn.Out[i]);
                }
            }

            return nn;
        }
开发者ID:ChewyMoon,项目名称:Cupcake,代码行数:65,代码来源:Network.cs

示例7: DecisionTreeGenerator

 /// <summary>Constructor.</summary>
 /// <param name="descriptor">the descriptor.</param>
 public DecisionTreeGenerator(Descriptor descriptor)
 {
     Depth = 5;
     Width = 2;
     Descriptor = descriptor;
     ImpurityType = typeof(Entropy);
     Hint = double.Epsilon;
 }
开发者ID:sethjuarez,项目名称:numl,代码行数:10,代码来源:DecisionTreeGenerator.cs

示例8: SetFieldValuesFromDescriptor

 private void SetFieldValuesFromDescriptor(Descriptor descriptor)
 {
     Field = new List<FeatureDescriptorTypeField>();
      foreach (string fieldName in descriptor.GetFieldNames())
      {
     Field.Add(new FeatureDescriptorTypeField(fieldName, descriptor.GetFieldValue(fieldName)));
      }
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:8,代码来源:FeatureDescriptorType.cs

示例9: NotifyCompleted

 public void NotifyCompleted(Descriptor descriptor)
 {
     running.Remove(descriptor);
     if (running.Count == 0)
     {
         if (AllCompleted != null) AllCompleted(this, new EventArgs());
     }
 }
开发者ID:darwin,项目名称:silverstunts,代码行数:8,代码来源:ResourceDownloader.cs

示例10: GetLabel

 /// <summary>Gets a label.</summary>
 /// <param name="n">The Node to process.</param>
 /// <param name="d">The Descriptor to process.</param>
 /// <returns>The label.</returns>
 private static string GetLabel(int n, Descriptor d)
 {
     if (d.Label.Type.IsEnum)
         return Enum.GetName(d.Label.Type, n);
     else if (d.Label is StringProperty && ((StringProperty)d.Label).AsEnum)
         return ((StringProperty)d.Label).Dictionary[n];
     else return d.Label.Name;
 }
开发者ID:m-abubakar,项目名称:numl,代码行数:12,代码来源:Network.cs

示例11: Generate

        /// <summary>Generates.</summary>
        /// <param name="desc">The description.</param>
        /// <param name="examples">The examples.</param>
        /// <param name="linker">The linker.</param>
        /// <returns>A Cluster.</returns>
        public Cluster Generate(Descriptor desc, IEnumerable<object> examples, ILinker linker)
        {
            // Load data 
            var exampleArray = examples.ToArray();
            Descriptor = desc;
            Matrix X = Descriptor.Convert(examples).ToMatrix();

            return GenerateClustering(X, linker, exampleArray);
        }
开发者ID:m-abubakar,项目名称:numl,代码行数:14,代码来源:HClusterModel.cs

示例12: IsParentNode

 public static bool IsParentNode(Descriptor descriptor)
 {
     bool result = false;
     if (descriptor.DescriptorType.DescriptorTypeName == "To")
     {
         result = true;
     }
     return result;
 }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:9,代码来源:ConditionObjects.cs

示例13: MBeanInfo

 /// <summary>
 /// Constructs an <see cref="NetMX.MBeanInfo"/>.
 /// </summary>
 /// <param name="className">Name of the MBean described by this MBeanInfo.</param>
 /// <param name="description">Human readable description of the MBean. </param>
 /// <param name="attributes">List of MBean attributes. It should be an empty list if MBean contains no attributes.</param>
 /// <param name="constructors">List of MBean constructors. It should be an empty list if MBean contains no constructors.</param>
 /// <param name="operations">List of MBean operations. It should be an empty list if MBean contains no operations.</param>
 /// <param name="notifications">List of MBean notifications. It should be an empty list if MBean contains no notifications.</param>
 /// <param name="descriptor">Initial descriptor values.</param>
 public MBeanInfo(string className, string description, IEnumerable<MBeanAttributeInfo> attributes, IEnumerable<MBeanConstructorInfo> constructors, IEnumerable<MBeanOperationInfo> operations, IEnumerable<MBeanNotificationInfo> notifications, Descriptor descriptor)
 {
     _className = className;
     _description = description;
        _attributes = new List<MBeanAttributeInfo>(attributes).AsReadOnly();
      _constructors = new List<MBeanConstructorInfo>(constructors).AsReadOnly();
     _operations = new List<MBeanOperationInfo>(operations).AsReadOnly();
     _notifications = new List<MBeanNotificationInfo>(notifications).AsReadOnly();
        _descriptor = descriptor;
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:20,代码来源:MBeanInfo.cs

示例14: Generate

        public Cluster Generate(Descriptor descriptor, IEnumerable<object> examples, int k, IDistance metric = null)
        {
            var data = examples.ToArray();
            Descriptor = descriptor;
            Matrix X = Descriptor.Convert(examples).ToMatrix();

            var assignments = Generate(X, k, metric);

            return GenerateClustering(X, assignments, data);
        }
开发者ID:budbjames,项目名称:numl,代码行数:10,代码来源:KMeans.cs

示例15: ReadFrom_FromAStreamWithNonHexadecimalCharacters_ThrowsException

        public void ReadFrom_FromAStreamWithNonHexadecimalCharacters_ThrowsException()
        {
            var descriptorBytes = Encoding.ASCII.GetBytes("zz\0e82fe33199f25c242213ada825358e91c4261753\0b\03\0foo\0");
            var expected = new Descriptor("e82fe33199f25c242213ada825358e91c4261753", DescriptorType.File, "foo");

            using (var stream = new MemoryStream(descriptorBytes))
            {
                Assert.That(() => Descriptor.ReadFrom(stream), Throws.InstanceOf<InvalidOperationException>());
            }
        }
开发者ID:otac0n,项目名称:PortableVCS,代码行数:10,代码来源:DescriptorTests.cs


注:本文中的Descriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。