示例#1
0
        public static void SetWCharArrayRaw(_Array arr, object value)
        {
            MemoryView view = value as MemoryView;

            if ((object)view != null)
            {
                string strVal = view.tobytes().MakeString();
                if (strVal.Length > arr.__len__())
                {
                    throw PythonOps.ValueError("string too long");
                }
                value = strVal;
            }

            arr.NativeType.SetValue(arr._memHolder, 0, value);
        }
示例#2
0
        public static void SetWCharArrayRaw(_Array arr, object value)
        {
            PythonBuffer buf = value as PythonBuffer;

            if (buf != null && (buf._object is string || buf._object is Bytes))
            {
                value = buf.ToString();
            }

            MemoryView view = value as MemoryView;

            if ((object)view != null)
            {
                string strVal = view.tobytes().ToString();
                if (strVal.Length > arr.__len__())
                {
                    throw PythonOps.ValueError("string too long");
                }
                value = strVal;
            }

            arr.NativeType.SetValue(arr._memHolder, 0, value);
        }
示例#3
0
        public static void SetWCharArrayRaw(_Array arr, object value) {
            PythonBuffer buf = value as PythonBuffer;
            if (buf != null && (buf._object is string || buf._object is Bytes))  {
                value = buf.ToString();
            }

            MemoryView view = value as MemoryView;
            if ((object)view != null) {
                string strVal = view.tobytes().ToString();
                if (strVal.Length > arr.__len__()) {
                    throw PythonOps.ValueError("string too long");
                }
                value = strVal;
            }

            arr.NativeType.SetValue(arr._memHolder, 0, value);
        }