• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Descriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: ChangeClassLabels

        /// <summary>
        /// Returns a Vector of positive and negative labels in 1 - 0 form.
        /// </summary>
        /// <param name="examples">Object examples.</param>
        /// <param name="descriptor">Descriptor.</param>
        /// <param name="truthLabel">The truth label's value (see <see cref="LabelAttribute"/>).</param>
        /// <returns></returns>
        public static Vector ChangeClassLabels(object[] examples, Descriptor descriptor, object truthLabel)
        {
            Vector y = new Vector(examples.Length);

            for (int i = 0; i < y.Length; i++)
            {
                y[i] = (descriptor.GetValue(examples.ElementAt(i), descriptor.Label).Equals(truthLabel) ? 1.0 : 0.0);
            }

            return y;
        }
开发者ID:sethjuarez,项目名称:numl,代码行数:18,代码来源:MultiClassLearner.cs


示例17: GetDescriptorFromFieldValues

 protected Descriptor GetDescriptorFromFieldValues()
 {
     Descriptor descriptor = new Descriptor();
      if (Field != null)
      {
     foreach (FeatureDescriptorTypeField field in Field)
     {
        descriptor.SetField(field.Name, field.Value.Deserialize());
     }
      }
      return descriptor;
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:12,代码来源:FeatureDescriptorType.cs


示例18: Device

        public Device(ref Descriptor desc, FeatureLevel featureLevel = FeatureLevel.Level_12_0)
            : base(ref desc)
        {
            if (desc.DebugDevice)
            {
                var debugInterface = SharpDX.Direct3D12.DebugInterface.Get();
                if (debugInterface != null)
                {
                    debugInterface.EnableDebugLayer();
                }
                else
                {
                    Log.Error("Failed to obtain DX12 debug layer.");
                }
            }

            // Use first adapter that is supported.
            using (SharpDX.DXGI.Factory dxgiFactory = new Factory4())
            {
                for (int adapterIndex = 0;; ++adapterIndex)
                {
                    var adapter = dxgiFactory.GetAdapter(adapterIndex);
                    if (adapter == null)
                    {
                        // TODO: Throw exception
                        return;
                    }

                    try
                    {
                        DeviceD3D12 = new SharpDX.Direct3D12.Device(adapter, (SharpDX.Direct3D.FeatureLevel) featureLevel);
                        Adapter = adapter;
                        break;
                    }

                    catch (Exception)
                    {
                        DeviceD3D12 = null;
                        adapter.Dispose();
                    }
                }
            }

            // Get Resource handle increment sizes.
            descriptorHandleIncrementSize[(int)DescriptorHeap.Descriptor.ResourceDescriptorType.Sampler] = DeviceD3D12.GetDescriptorHandleIncrementSize(DescriptorHeapType.Sampler);
            descriptorHandleIncrementSize[(int)DescriptorHeap.Descriptor.ResourceDescriptorType.DepthStencil] = DeviceD3D12.GetDescriptorHandleIncrementSize(DescriptorHeapType.DepthStencilView);
            descriptorHandleIncrementSize[(int)DescriptorHeap.Descriptor.ResourceDescriptorType.RenderTarget] = DeviceD3D12.GetDescriptorHandleIncrementSize(DescriptorHeapType.RenderTargetView);
            descriptorHandleIncrementSize[(int)DescriptorHeap.Descriptor.ResourceDescriptorType.ShaderResource] = DeviceD3D12.GetDescriptorHandleIncrementSize(DescriptorHeapType.ConstantBufferViewShaderResourceViewUnorderedAccessView);

            Memory.Enums.InitLookupTables();

            Log.Info("Successfully created a DX12 device with adapter \"{0}\"", Adapter.Description.Description);
        }
开发者ID:Wumpf,项目名称:ClearSight,代码行数:53,代码来源:Device.cs


示例19: ReadFrom_FromAStreamWithAValidFolderDescriptor_ReturnsTheDescriptor

        public void ReadFrom_FromAStreamWithAValidFolderDescriptor_ReturnsTheDescriptor()
        {
            var descriptorBytes = Encoding.ASCII.GetBytes("28\0e82fe33199f25c242213ada825358e91c4261753\0t\03\0foo\0");
            var expected = new Descriptor("e82fe33199f25c242213ada825358e91c4261753", DescriptorType.Folder, "foo");

            using (var stream = new MemoryStream(descriptorBytes))
            {
                var descriptor = Descriptor.ReadFrom(stream);

                Assert.That(descriptor, Is.EqualTo(expected));
            }
        }
开发者ID:otac0n,项目名称:PortableVCS,代码行数:12,代码来源:DescriptorTests.cs


示例20: AddItem

        public void AddItem(string item, string name, IProgressBar progress)
        {
            if (Running) throw new Exception("Resource Downloader was already started.");

            string resourceUrl = UrlResourceName(category, item, name);

            Downloader downloader = new Downloader();
            downloader.Open("GET", new Uri(resourceUrl, UriKind.RelativeOrAbsolute));

            Descriptor descriptor = new Descriptor(this, downloader, progress);
            descriptors.Add(resourceUrl, descriptor);
        }
开发者ID:darwin,项目名称:silverstunts,代码行数:12,代码来源:ResourceDownloader.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# DeserializeContext类代码示例发布时间:2022-05-24
下一篇:
C# DescribeVolumesRequestMarshaller类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap