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


C# CharSet类代码示例

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


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

示例1: StructLayoutAttribute

 internal StructLayoutAttribute(LayoutKind layoutKind, int pack, int size, CharSet charSet)
 {
     this._val = layoutKind;
     this.Pack = pack;
     this.Size = size;
     this.CharSet = charSet;
 }
开发者ID:x335,项目名称:WootzJs,代码行数:7,代码来源:StructLayoutAttribute.cs

示例2: CharClass

		/// <summary>
		/// 初始化 <see cref="Cyjb.Compilers.Lexers.CharClass"/> 类的新实例。
		/// </summary>
		public CharClass()
		{
			CharSet defaultSet = new CharSet();
			for (int i = 0; i <= char.MaxValue; i++)
			{
				defaultSet.Add((char)i);
			}
			charClassList = new List<CharSet>();
			charClassList.Add(defaultSet);
		}
开发者ID:qhhndaye888,项目名称:Cyjb.Compilers,代码行数:13,代码来源:CharClass.cs

示例3: IsSuperSetOf

	public bool IsSuperSetOf(CharSet rhs)
	{
	    Contract.Requires(rhs != null);
	    foreach (char ch in rhs.m_chars)
		{
			if (m_chars.IndexOf(ch) < 0)
				return false;
		}
		
		return true;
	}
开发者ID:dbremner,项目名称:peg-sharp,代码行数:11,代码来源:CharSet.cs

示例4: AutoTile

 public static char[,] AutoTile(char[,] data, CharSet charSet)
 {
     var width = data.GetLength(0);
     var height = data.GetLength(1);
     var tiles = new char[width, height];
     for(var x = 0; x < width; ++x) {
         for(var y = 0; y < height; ++y) {
             tiles[x, y] = GetTile(data, charSet, x, y);
         }
     }
     return tiles;
 }
开发者ID:timothy-s-dev,项目名称:Emergence,代码行数:12,代码来源:AutoTiler.cs

示例5: GetText

        public static unsafe string GetText(IntPtr ptr, CharSet charSet)
        {
            switch (charSet)
            {
                case CharSet.None:
                case CharSet.Ansi:
                    return Marshal.PtrToStringAnsi(((void*) ptr).pszText);

                case CharSet.Unicode:
                    return Marshal.PtrToStringUni(((void*) ptr).pszText);
            }
            return Marshal.PtrToStringAuto(((void*) ptr).pszText);
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:13,代码来源:NMLVGETINFOTIP.cs

示例6: DynamicDllFunctionInvoke

        public static object DynamicDllFunctionInvoke(
            string dllPath,
            string entryPoint,
            MethodAttributes methodAttr,
            CallingConvention nativeCallConv,
            CharSet nativeCharSet,
            Type returnType,
            Type[] parameterTypes,
            object[] parameterValues
            )
        {
            string dllName = Path.GetFileNameWithoutExtension(dllPath);
            // ����һ����̬����(assembly)��ģ��(module)
            AssemblyName assemblyName = new AssemblyName();
            assemblyName.Name = string.Format("A{0}{1}",
                dllName,
                Guid.NewGuid().ToString( "N" )
                );
            AssemblyBuilder dynamicAssembly =
              AppDomain.CurrentDomain.DefineDynamicAssembly(
              assemblyName, AssemblyBuilderAccess.Run);
            ModuleBuilder dynamicModule =
              dynamicAssembly.DefineDynamicModule(
              string.Format("M{0}{1}",
              dllName,
              Guid.NewGuid().ToString("N"))
              );

            // ʹ��ָ������Ϣ����ƽ̨����ǩ��
            MethodBuilder dynamicMethod =
                dynamicModule.DefinePInvokeMethod(
                entryPoint,
                dllPath,
                methodAttr,
                CallingConventions.Standard,
                returnType,
                parameterTypes,
                nativeCallConv,
                nativeCharSet
                );

            // ��������
            dynamicModule.CreateGlobalFunctions();

            // ���ƽ̨���õķ���
            MethodInfo methodInfo =
                dynamicModule.GetMethod(entryPoint, parameterTypes);
            // ���÷��йܺ�������÷��صĽ��
            object result = methodInfo.Invoke(null, parameterValues);
            return result;
        }
开发者ID:zhaohengyi,项目名称:dotNet_PInvoke,代码行数:51,代码来源:DynamicPInvokeViaEmit.cs

示例7: GetText

        public static string GetText(IntPtr ptr, CharSet charSet)
        {
            IntPtr ptr2 = Marshal.ReadIntPtr(ptr, Marshal.SizeOf(typeof(NMHDR)));
            if (ptr2 == IntPtr.Zero)
            {
                NMTTDISPINFO nmttdispinfo = (NMTTDISPINFO) Marshal.PtrToStructure(ptr, typeof(NMTTDISPINFO));
                return nmttdispinfo.szText;
            }
            switch (charSet)
            {
                case CharSet.None:
                case CharSet.Ansi:
                    return Marshal.PtrToStringAnsi(ptr2);

                case CharSet.Unicode:
                    return Marshal.PtrToStringUni(ptr2);
            }
            return Marshal.PtrToStringAuto(ptr2);
        }
开发者ID:shankithegreat,项目名称:commanderdotnet,代码行数:19,代码来源:NMTTDISPINFO.cs

示例8: GetTile

        public static char GetTile(char[,] data, CharSet charSet, int x, int y)
        {
            if(data[x, y] == '-') {
                return charSet.HorizontalLine;
            } else if(data[x, y] == '|') {
                return charSet.VerticalLine;
            } else if(data[x, y] == ' ') {
                return charSet.Empty;
            } else {
                var top = GetCharAt(data, x, y - 1) != ' ';
                var bottom = GetCharAt(data, x, y + 1) != ' ';
                var left = GetCharAt(data, x - 1, y) != ' ';
                var right = GetCharAt(data, x + 1, y) != ' ';

                if(top && bottom && left && right) {
                    return charSet.Cross;
                } else if(!top && bottom && left && right) {
                    return charSet.STee;
                } else if(top && !bottom && left && right) {
                    return charSet.NTee;
                } else if(top && bottom && !left && right) {
                    return charSet.ETee;
                } else if(top && bottom && left && !right) {
                    return charSet.WTee;
                } else if(!top && !bottom && left && right) {
                    return charSet.HorizontalLine;
                } else if(top && bottom && !left && !right) {
                    return charSet.VerticalLine;
                } else if(!top && bottom && !left && right) {
                    return charSet.NWCorner;
                } else if(!top && bottom && left && !right) {
                    return charSet.NECorner;
                } else if(top && !bottom && !left && right) {
                    return charSet.SWCorner;
                } else if(top && !bottom && left && !right) {
                    return charSet.SECorner;
                }
                return charSet.Pillar;
            }
        }
开发者ID:timothy-s-dev,项目名称:Emergence,代码行数:40,代码来源:AutoTiler.cs

示例9: DefinePInvokeMethod

        [System.Security.SecurityCritical] // auto-generated
#endif
        public MethodBuilder DefinePInvokeMethod(String name, String dllName, String entryName, MethodAttributes attributes, 
            CallingConventions callingConvention, Type returnType, Type[] parameterTypes, CallingConvention nativeCallConv, 
            CharSet nativeCharSet)
        {
            Contract.Ensures(Contract.Result<MethodBuilder>() != null);

            lock(SyncRoot)
            {
                return DefinePInvokeMethodNoLock(name, dllName, entryName, attributes, callingConvention, 
                                                 returnType, parameterTypes, nativeCallConv, nativeCharSet);
            }
        }
开发者ID:crummel,项目名称:dotnet_coreclr,代码行数:14,代码来源:ModuleBuilder.cs

示例10: DefaultCharSetAttribute

	// Constructors
	public DefaultCharSetAttribute(CharSet charSet) {}
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:2,代码来源:DefaultCharSetAttribute.cs

示例11: DefinePInvokeMethodHelper

        [System.Security.SecurityCritical]  // auto-generated
        private MethodBuilder DefinePInvokeMethodHelper(
            String name, String dllName, String importName, MethodAttributes attributes, CallingConventions callingConvention, 
            Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers,
            Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers,
            CallingConvention nativeCallConv, CharSet nativeCharSet)
        {
            CheckContext(returnType);
            CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
            CheckContext(parameterTypeRequiredCustomModifiers);
            CheckContext(parameterTypeOptionalCustomModifiers);

            AppDomain.CheckDefinePInvokeSupported();

            lock (SyncRoot)
            {
                return DefinePInvokeMethodHelperNoLock(name, dllName, importName, attributes, callingConvention, 
                                                       returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers,
                                                       parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers,
                                                       nativeCallConv, nativeCharSet);
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:22,代码来源:typebuilder.cs

示例12: DefinePInvokeMethod

 public MethodBuilder DefinePInvokeMethod(String name, String dllName, MethodAttributes attributes,
     CallingConventions callingConvention, Type returnType, Type[] parameterTypes,
     CallingConvention nativeCallConv, CharSet nativeCharSet)
 {
     MethodBuilder method = DefinePInvokeMethodHelper(
         name, dllName, name, attributes, callingConvention, returnType, null, null, 
         parameterTypes, null, null, nativeCallConv, nativeCharSet);
     return method;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:9,代码来源:typebuilder.cs

示例13: MakeDllImport

        private string MakeDllImport(
            CallingConvention? cc = null,
            CharSet? charSet = null,
            bool? exactSpelling = null,
            bool? preserveSig = null,
            bool? setLastError = null,
            bool? bestFitMapping = null,
            bool? throwOnUnmappableChar = null)
        {
            StringBuilder sb = new StringBuilder("[DllImport(\"bar\"");
            if (cc != null)
            {
                sb.Append(", CallingConvention = CallingConvention.");
                sb.Append(cc.Value);
            }

            if (charSet != null)
            {
                sb.Append(", CharSet = CharSet.");
                sb.Append(charSet.Value);
            }

            if (exactSpelling != null)
            {
                sb.Append(", ExactSpelling = ");
                sb.Append(exactSpelling.Value ? "true" : "false");
            }

            if (preserveSig != null)
            {
                sb.Append(", PreserveSig = ");
                sb.Append(preserveSig.Value ? "true" : "false");
            }

            if (setLastError != null)
            {
                sb.Append(", SetLastError = ");
                sb.Append(setLastError.Value ? "true" : "false");
            }

            if (bestFitMapping != null)
            {
                sb.Append(", BestFitMapping = ");
                sb.Append(bestFitMapping.Value ? "true" : "false");
            }

            if (throwOnUnmappableChar != null)
            {
                sb.Append(", ThrowOnUnmappableChar = ");
                sb.Append(throwOnUnmappableChar.Value ? "true" : "false");
            }

            sb.Append(")]");
            return sb.ToString();
        }
开发者ID:AnthonyDGreen,项目名称:roslyn,代码行数:55,代码来源:AttributeTests_WellKnownAttributes.cs

示例14: ResolveGlobalAttributes

		/// <summary>
		/// It is called very early therefore can resolve only predefined attributes
		/// </summary>
		void ResolveGlobalAttributes ()
		{
			if (OptAttributes == null)
				return;

			if (!OptAttributes.CheckTargets ())
				return;

			// FIXME: Define is wrong as the type may not exist yet
			var DefaultCharSet_attr = new PredefinedAttribute (this, "System.Runtime.InteropServices", "DefaultCharSetAttribute");
			DefaultCharSet_attr.Define ();
			Attribute a = ResolveModuleAttribute (DefaultCharSet_attr);
			if (a != null) {
				has_default_charset = true;
				DefaultCharSet = a.GetCharSetValue ();
				switch (DefaultCharSet) {
				case CharSet.Ansi:
				case CharSet.None:
					break;
				case CharSet.Auto:
					DefaultCharSetType = TypeAttributes.AutoClass;
					break;
				case CharSet.Unicode:
					DefaultCharSetType = TypeAttributes.UnicodeClass;
					break;
				default:
					Report.Error (1724, a.Location, "Value specified for the argument to `{0}' is not valid", 
						DefaultCharSet_attr.GetSignatureForError ());
					break;
				}
			}
		}
开发者ID:hindlemail,项目名称:mono,代码行数:35,代码来源:roottypes.cs

示例15: SetCustomAttribute

		public void SetCustomAttribute (CustomAttributeBuilder customBuilder)
		{
			if (customBuilder == null)
				throw new ArgumentNullException ("customBuilder");

			switch (customBuilder.Ctor.ReflectedType.FullName) {
				case "System.Runtime.CompilerServices.MethodImplAttribute":
					byte[] data = customBuilder.Data;
					int impla; // the (stupid) ctor takes a short or an int ... 
					impla = (int)data [2];
					impla |= ((int)data [3]) << 8;
					iattrs |= (MethodImplAttributes)impla;
					return;

				case "System.Runtime.InteropServices.DllImportAttribute":
					CustomAttributeBuilder.CustomAttributeInfo attr = CustomAttributeBuilder.decode_cattr (customBuilder);
					bool preserveSig = true;

					/*
					 * It would be easier to construct a DllImportAttribute from
					 * the custom attribute builder, but the DllImportAttribute 
					 * does not contain all the information required here, ie.
					 * - some parameters, like BestFitMapping has three values
					 *   ("on", "off", "missing"), but DllImportAttribute only
					 *   contains two (on/off).
					 * - PreserveSig is true by default, while it is false by
					 *   default in DllImportAttribute.
					 */

					pi_dll = (string)attr.ctorArgs[0];
					if (pi_dll == null || pi_dll.Length == 0)
						throw new ArgumentException ("DllName cannot be empty");

					native_cc = System.Runtime.InteropServices.CallingConvention.Winapi;

					for (int i = 0; i < attr.namedParamNames.Length; ++i) {
						string name = attr.namedParamNames [i];
						object value = attr.namedParamValues [i];

						if (name == "CallingConvention")
							native_cc = (CallingConvention)value;
						else if (name == "CharSet")
							charset = (CharSet)value;
						else if (name == "EntryPoint")
							pi_entry = (string)value;
						else if (name == "ExactSpelling")
							ExactSpelling = (bool)value;
						else if (name == "SetLastError")
							SetLastError = (bool)value;
						else if (name == "PreserveSig")
							preserveSig = (bool)value;
					else if (name == "BestFitMapping")
						BestFitMapping = (bool)value;
					else if (name == "ThrowOnUnmappableChar")
						ThrowOnUnmappableChar = (bool)value;
					}

					attrs |= MethodAttributes.PinvokeImpl;
					if (preserveSig)
						iattrs |= MethodImplAttributes.PreserveSig;
					return;

				case "System.Runtime.InteropServices.PreserveSigAttribute":
					iattrs |= MethodImplAttributes.PreserveSig;
					return;
				case "System.Runtime.CompilerServices.SpecialNameAttribute":
					attrs |= MethodAttributes.SpecialName;
					return;
				case "System.Security.SuppressUnmanagedCodeSecurityAttribute":
					attrs |= MethodAttributes.HasSecurity;
					break;
			}

			if (cattrs != null) {
				CustomAttributeBuilder[] new_array = new CustomAttributeBuilder [cattrs.Length + 1];
				cattrs.CopyTo (new_array, 0);
				new_array [cattrs.Length] = customBuilder;
				cattrs = new_array;
			} else {
				cattrs = new CustomAttributeBuilder [1];
				cattrs [0] = customBuilder;
			}
		}
开发者ID:stabbylambda,项目名称:mono,代码行数:83,代码来源:MethodBuilder.cs


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