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


C# Primitive类代码示例

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


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

示例1: Remove

 /// <summary>
 /// Remove a file (or directory with all sub files) from an existing zip archive.
 /// </summary>
 /// <param name="zipFile">The zip archive to remove a file from.</param>
 /// <param name="files">
 /// An array of files to remove from the zip archive.
 /// A single file or directory may also be deleted.
 /// Any directories will be recursively removed from the zip.
 /// </param>
 /// <returns>An error message or "".</returns>
 public static Primitive Remove(Primitive zipFile, Primitive files)
 {
     try
     {
         using (ZipFile zip = ZipFile.Read(zipFile))
         {
             if (SBArray.IsArray(files))
             {
                 Primitive indices = SBArray.GetAllIndices(files);
                 int count = SBArray.GetItemCount(indices);
                 for (int i = 1; i <= count; i++)
                 {
                     RemoveFromArchive(zip, files[indices[i]]);
                 }
             }
             else
             {
                 RemoveFromArchive(zip, files);
             }
             zip.Save();
         }
         return "";
     }
     catch (Exception ex)
     {
         Utilities.OnError(Utilities.GetCurrentMethod(), ex);
         return Utilities.GetCurrentMethod() + " " + ex.Message;
     }
 }
开发者ID:litdev1,项目名称:LitDev,代码行数:39,代码来源:Zip.cs

示例2: CreateCursor

        /// <summary>
        /// Create a cursor that can be set using SetUserCursor or SetShapeCursor.
        /// An ImageList image can be resized with LDImage.Resize.
        /// </summary>
        /// <param name="imageName">The file path or ImageList image.</param>
        /// <param name="xHotSpot">The x pixel to use as the hot spot.</param>
        /// <param name="yHotSpot">The y pixel to use as the hot spot.</param>
        /// <returns>A cursor.</returns>
        public static Primitive CreateCursor(Primitive imageName, Primitive xHotSpot, Primitive yHotSpot)
        {
            Type ShapesType = typeof(Shapes);
            Type ImageListType = typeof(ImageList);
            Dictionary<string, BitmapSource> _savedImages;
            BitmapSource img;
            string cursorName = "";

            try
            {
                _savedImages = (Dictionary<string, BitmapSource>)ImageListType.GetField("_savedImages", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                if (!_savedImages.TryGetValue((string)imageName, out img))
                {
                    imageName = ImageList.LoadImage(imageName);
                    if (!_savedImages.TryGetValue((string)imageName, out img))
                    {
                        return cursorName;
                    }
                }

                MethodInfo method = ShapesType.GetMethod("GenerateNewName", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);
                cursorName = method.Invoke(null, new object[] { "Cursor" }).ToString();

                Bitmap bmp = FastPixel.GetBitmap(img);
                Cursor cursor = createCursor(bmp, xHotSpot, yHotSpot);
                cursors[cursorName] = cursor;
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
            }
            return cursorName;
        }
开发者ID:litdev1,项目名称:LitDev,代码行数:41,代码来源:Cursors.cs

示例3: FFTForward

 /// <summary>
 /// Compute a FFT (Fast Fourier Transform).
 /// </summary>
 /// <param name="real">An array of real values to calculate the FFT from.</param>
 /// <returns>An array of complex data (real amplitude and imaginary phase) or "FAILED".
 /// For each complex pair the index is the real part and the value is the imaginary part.</returns>
 public static Primitive FFTForward(Primitive real)
 {
     try
     {
         Type PrimitiveType = typeof(Primitive);
         Dictionary<Primitive, Primitive> dataMap;
         dataMap = (Dictionary<Primitive, Primitive>)PrimitiveType.GetField("_arrayMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance).GetValue(real);
         int length = dataMap.Count;
         Complex[] complex = new Complex[length];
         int i = 0;
         foreach (KeyValuePair<Primitive, Primitive> kvp in dataMap)
         {
             double realData = double.Parse(kvp.Value);
             complex[i++] = new Complex(realData, 0);
         }
         Fourier.BluesteinForward(complex, FourierOptions.Default);
         string result = "";
         for (i = 0; i < length; i++)
         {
             result += (i + 1).ToString() + "=" + (complex[i].Real.ToString(CultureInfo.InvariantCulture) + "\\=" + complex[i].Imaginary.ToString(CultureInfo.InvariantCulture) + "\\;") + ";";
         }
         return Utilities.CreateArrayMap(result);
     }
     catch (Exception ex)
     {
         Utilities.OnError(Utilities.GetCurrentMethod(), ex);
         return "FAILED";
     }
 }
开发者ID:litdev1,项目名称:LitDev,代码行数:35,代码来源:MathX.cs

示例4: StateFactory

		/// <summary>
		/// Initializes a new instance of the StateFactory
		/// </summary>
		/// <param name="device"></param>
		/// <param name="enumType"></param>
		/// <param name="ubershader"></param>
		/// <param name="vertexInputElements"></param>
		/// <param name="blendState"></param>
		/// <param name="rasterizerState"></param>
		private StateFactory ( Ubershader ubershader, Type enumType, Primitive primitive, VertexInputElement[] vertexInputElements ) 
		 : base(ubershader.GraphicsDevice)
		{
			this.ubershader		= ubershader;

			Enumerate( enumType, ubershader, (ps,i) => { ps.VertexInputElements = vertexInputElements; ps.Primitive = primitive; } );
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:16,代码来源:StateFactory.cs

示例5: TransformTexCoords

        public void TransformTexCoords(List<Vertex> vertices, Vector3 center, Primitive.TextureEntryFace teFace)
        {
            float r = teFace.Rotation;
            float os = teFace.OffsetU;
            float ot = teFace.OffsetV;
            float ms = teFace.RepeatU;
            float mt = teFace.RepeatV;
            float cosAng = (float)Math.Cos(r);
            float sinAng = (float)Math.Sin(r);

            for (int i = 0; i < vertices.Count; i++)
            {
                Vertex vertex = vertices[i];

                if (teFace.TexMapType == MappingType.Default)
                {
                    TransformTexCoord(ref vertex.TexCoord, cosAng, sinAng, os, ot, ms, mt);
                }
                else if (teFace.TexMapType == MappingType.Planar)
                {
                    Vector3 vec = vertex.Position;
                    vec.X *= vec.X;
                    vec.Y *= vec.Y;
                    vec.Z *= vec.Z;

                    TransformPlanarTexCoord(ref vertex.TexCoord, vertex, center, vec);
                }

                vertices[i] = vertex;
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:31,代码来源:Texture.cs

示例6: GetImage

        /// <summary>
        /// Do a Bing search for Web images.
        /// </summary>
        /// <param name="search">The search text.</param>
        /// <returns>An array of results, index url and value description.</returns>
        public static Primitive GetImage(Primitive search)
        {
            try
            {
                if (bNewAPI)
                {
                    JsonWeb jsonWeb = cognitive.SearchRequest(search);
                    if (null == jsonWeb.images) return "";

                    string result = "";
                    foreach (var site in jsonWeb.images.value)
                    {
                        result += Utilities.ArrayParse(site.contentUrl) + "=" + Utilities.ArrayParse(site.name) + ";";
                    }
                    return Utilities.CreateArrayMap(result);
                }
                else
                {
                    var query = bing.Image(search, null, cognitive.mkt, null, null, null, null);
                    var sites = query.Execute();

                    string result = "";
                    foreach (var site in sites)
                    {
                        result += Utilities.ArrayParse(site.MediaUrl) + "=" + Utilities.ArrayParse(site.Title) + ";";
                    }
                    return Utilities.CreateArrayMap(result);
                }
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                return "";
            }
        }
开发者ID:litdev1,项目名称:LitDev,代码行数:40,代码来源:Search.cs

示例7: BuildFace

        private static void BuildFace(ref Face face, Primitive prim, List<Vertex> vertices, Path path,
            Profile profile, Primitive.TextureEntryFace teFace, bool isSculpted)
        {
            if (teFace != null)
                face.TextureFace = teFace;
            else
                throw new ArgumentException("teFace cannot be null");

            face.Vertices.Clear();

            if ((face.Mask & FaceMask.Cap) != 0)
            {
                if (((face.Mask & FaceMask.Hollow) == 0) &&
                    ((face.Mask & FaceMask.Open) == 0) &&
                    (prim.PrimData.PathBegin == 0f) &&
                    (prim.PrimData.ProfileCurve == ProfileCurve.Square) &&
                    (prim.PrimData.PathCurve == PathCurve.Line))
                {
                    CreateUnCutCubeCap(ref face, vertices, path, profile);
                }
                else
                {
                    CreateCap(ref face, vertices, path, profile);
                }
            }
            else if ((face.Mask & FaceMask.End) != 0 || (face.Mask & FaceMask.Side) != 0)
            {
                CreateSide(ref face, prim, vertices, path, profile, isSculpted);
            }
            else
            {
                throw new RenderingException("Unknown/uninitialized face type");
            }
        }
开发者ID:RavenB,项目名称:gridsearch,代码行数:34,代码来源:Face.cs

示例8: Container

        public Container(Stream stream)
        {
            UInt16 stringLength = stream.ReadUInt16();
            Name = stream.ReadAsciiString(stringLength);
            ContainerType = stream.ReadUInt8();
            Flags = (ContainerFlags)stream.ReadUInt16();
            PrimitiveCount = stream.ReadUInt16();
            PackfileBaseOffset = stream.ReadUInt32();
            CompressionType = stream.ReadUInt8();
            stringLength = stream.ReadUInt16();
            StubContainerParentName = stream.ReadAsciiString(stringLength);
            Int32 auxDataSize = stream.ReadInt32();
            AuxData = new byte[auxDataSize];
            stream.Read(AuxData, 0, auxDataSize);
            TotalCompressedPackfileReadSize = stream.ReadInt32();

            Primitives = new List<Primitive>();
            PrimitiveSizes = new List<WriteTimeSizes>();

            for (UInt16 i = 0; i < PrimitiveCount; i++)
            {
                var sizes = stream.ReadStruct<WriteTimeSizes>();
                PrimitiveSizes.Add(sizes);
            }

            for (UInt16 i = 0; i < PrimitiveCount; i++)
            {
                Primitive primitive = new Primitive(stream);
                Primitives.Add(primitive);
            }
        }
开发者ID:rodrigonh,项目名称:ThomasJepp.SaintsRow,代码行数:31,代码来源:Container.cs

示例9: Equals

 public bool Equals(Primitive primitive)
 {
     if (this.GetType().Equals(primitive.GetType()))
     {
         if (this is Activity)
         {
             Activity a = this as Activity;
             Activity target = primitive as Activity;
             if (a.PrID == target.PrID)
                 return true;
         }
         else if (this is Event)
         {
             Event ev = this as Event;
             Event target = primitive as Event;
             if (ev.categ.Equals(target.categ))
                 return true;
         }
         else if (this is Flow)
         {
             Flow f = this as Flow;
             Flow target = primitive as Flow;
             if (f.categ.Equals(target.categ) &&
                 f.Condition.Equals(target.Condition) &&
                 f.SourceID == target.SourceID &&
                 f.TargetID  == target.TargetID)
                 return true;
         }
     }
     return false;
 }
开发者ID:Vnepomuceno,项目名称:organix,代码行数:31,代码来源:Primitive.cs

示例10: FFTComplex

 /// <summary>
 /// Create an array of complex values from arrays of real and imaginary parts.
 /// </summary>
 /// <param name="real">An array of real data.</param>
 /// <param name="imaginary">An array of imaginary data.</param>
 /// <returns>An array of complex data (real amplitude and imaginary phase), "MISMATCH" or "FAILED".
 /// For each complex pair the index is the real part and the value is the imaginary part.</returns>
 public static Primitive FFTComplex(Primitive real, Primitive imaginary)
 {
     try
     {
         Type PrimitiveType = typeof(Primitive);
         Dictionary<Primitive, Primitive> dataReal, dataImaginary;
         dataReal = (Dictionary<Primitive, Primitive>)PrimitiveType.GetField("_arrayMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance).GetValue(real);
         dataImaginary = (Dictionary<Primitive, Primitive>)PrimitiveType.GetField("_arrayMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.Instance).GetValue(imaginary);
         int length = dataReal.Count;
         if (length != dataImaginary.Count) return "MISMATCH";
         List<double> realData = new List<double>();
         foreach (KeyValuePair<Primitive, Primitive> kvp in dataReal)
         {
             realData.Add(kvp.Value);
         }
         List<double> imaginaryData = new List<double>();
         foreach (KeyValuePair<Primitive, Primitive> kvp in dataImaginary)
         {
             imaginaryData.Add(kvp.Value);
         }
         string result = "";
         for (int i = 0; i < length; i++)
         {
             result += (i + 1).ToString() + "=" + (realData[i].ToString(CultureInfo.InvariantCulture) + "\\=" + imaginaryData[i].ToString(CultureInfo.InvariantCulture) + "\\;") + ";";
         }
         return Utilities.CreateArrayMap(result);
     }
     catch (Exception ex)
     {
         Utilities.OnError(Utilities.GetCurrentMethod(), ex);
         return "FAILED";
     }
 }
开发者ID:litdev1,项目名称:LitDev,代码行数:40,代码来源:MathX.cs

示例11: Render

 public void Render(Primitive primitive, SpriteBatch spriteBatch)
 {
     if (this.spriteBatch == null)
     {
         this.spriteBatch = new SpriteBatchWrapper(spriteBatch);
     }
     Render(primitive);
 }
开发者ID:xxy1991,项目名称:cozy,代码行数:8,代码来源:XNARenderer.cs

示例12: CachePrimitiveWrapper

 private CachePrimitiveWrapper(SerializationInfo info, StreamingContext context)
 {
     this.Primitive = new Primitive
     {
         Type = (DynamoDBEntryType)info.GetValue("Type", typeof(DynamoDBEntryType)),
         Value = info.GetValue("Value", typeof(object))
     };
 }
开发者ID:LCHarold,项目名称:linq2dynamodb,代码行数:8,代码来源:CachePrimitiveWrapper.cs

示例13: MD5HashFile

 /// <summary>
 /// Create an MD5 hash of a file.
 /// This 32 character hash is for file data integrity checks (e.g. a file contents is unchanged).
 /// </summary>
 /// <param name="fileName">The full path to a file to get the hash.</param>
 /// <returns>The 32 character hex MD5 Hash.</returns>
 public static Primitive MD5HashFile(Primitive fileName)
 {
     if (!System.IO.File.Exists(fileName))
     {
         Utilities.OnFileError(Utilities.GetCurrentMethod(), fileName);
         return "";
     }
     return StringEncryption.CalculateMD5HashFile(fileName);
 }
开发者ID:litdev1,项目名称:LitDev,代码行数:15,代码来源:Encryption.cs

示例14: Initialize

        public override void Initialize(string tableName, Type tableEntityType, Primitive hashKeyValue)
        {
            base.Initialize(tableName, tableEntityType, hashKeyValue);

            if (GetIndexListKeyInCache(_hashKeyValue).Length > MaxKeyLength)
            {
                throw new ArgumentException("The hash key value is too long for MemcacheD. Cannot use cache with that value.");
            }
        }
开发者ID:howcheng,项目名称:linq2dynamodb,代码行数:9,代码来源:EnyimTableCache.cs

示例15: startAllAccessTrial

 public Response startAllAccessTrial(int vismastersID, string acmID)
 {
     Hashtable vars = new Hashtable();
     vars["action"] = "startAllAccessTrial";
     vars["aid"] = vismastersID;
     vars["acmid"] = acmID;
     Primitive<string> prim = new Primitive<string>("trial");
     return makePost(vars, new ResponseParser.DataParser(prim.fromResponseXml));
 }
开发者ID:archvision,项目名称:vismasters_web_services_net,代码行数:9,代码来源:Acms.cs


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