Ejemplo n.º 1
0
    public static void TestUTF8StructMarshalling(string[] utf8Strings)
    {
        Utf8Struct utf8Struct = new Utf8Struct();

        for (int i = 0; i < utf8Strings.Length; i++)
        {
            utf8Struct.FirstName = utf8Strings[i];
            utf8Struct.index     = i;
            TestStructWithUtf8Field(utf8Struct);
        }
    }
Ejemplo n.º 2
0
    public static void TestUTF8StructMarshalling(string[] utf8Strings)
    {
        Utf8Struct utf8Struct = new Utf8Struct();

        for (int i = 0; i < utf8Strings.Length; i++)
        {
            utf8Struct.FirstName = utf8Strings[i];
            utf8Struct.index     = i;
            TestStructWithUtf8Field(utf8Struct);
        }
        if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
        {
            CompareWithUTF8Encoding();
        }
    }
Ejemplo n.º 3
0
    public static void TestUTF8StructMarshalling(string[] utf8Strings)
    {
        Utf8Struct utf8Struct = new Utf8Struct();

        for (int i = 0; i < utf8Strings.Length; i++)
        {
            utf8Struct.FirstName = utf8Strings[i];
            utf8Struct.index     = i;
            TestStructWithUtf8Field(utf8Struct);
        }
        if (!OperatingSystem.IsWindows())
        {
            CompareWithUTF8Encoding();
        }

        string testString = "StructTestString\uD83D\uDE00";

        SetStringInStruct(ref utf8Struct, testString);

        if (utf8Struct.FirstName != testString)
        {
            throw new Exception("Incorrect UTF8 string marshalled back from native to managed.");
        }
    }
Ejemplo n.º 4
0
 public static extern void TestStructWithUtf8Field(Utf8Struct utfStruct);
Ejemplo n.º 5
0
 public static extern void SetStringInStruct(ref Utf8Struct utfStruct, [MarshalAs(UnmanagedType.LPUTF8Str)] string str);
Ejemplo n.º 6
0
	public static bool  TestUTF8StructMarshalling(string[] utf8Strings)
	{
		Utf8Struct utf8Struct = new Utf8Struct();
		for (int i = 0; i < utf8Strings.Length; i++)
		{
			utf8Struct.FirstName = utf8Strings[i];
			utf8Struct.index = i;
			TestStructWithUtf8Field(utf8Struct);
		}
		return true;
	}
Ejemplo n.º 7
0
	public static extern void TestStructWithUtf8Field(Utf8Struct utfStruct);