private static void GetBytes(IntPtr info) { NSJSFunctionCallbackInfo arguments = NSJSFunctionCallbackInfo.From(info); ENCODING encoding = GetEncoding(arguments.This); if (encoding == null) { Throwable.ObjectDisposedException(arguments.VirtualMachine); } else { byte[] buffer = null; if (arguments.Length > 0) { NSJSString s = arguments[0] as NSJSString; if (s != null) { buffer = encoding.GetBytes(s.Value); } } if (buffer == null) { buffer = BufferExtension.EmptryBuffer; } arguments.SetReturnValue(buffer); } }
internal void method_12(string string_0, global::System.IO.MemoryStream memoryStream_0) { global::System.Text.Encoding utf = global::System.Text.Encoding.UTF8; byte[] bytes = utf.GetBytes(string_0); this.method_9((short)bytes.Length, memoryStream_0); memoryStream_0.Write(bytes, 0, bytes.Length); }
public T FromString(string xml, global::System.Text.Encoding encoding) { MemoryStream ms = new MemoryStream(); byte[] buffer = encoding.GetBytes(xml); ms.Write(buffer, 0, buffer.Length); ms.Position = 0; return(Deserialize(ms)); }
private bool isFirst = true; // 初回起動時フラグ /// <summary> /// char -> byte列変換を行う。 /// </summary> /// <param name="strbyte">出力結果のバイト列</param> /// <param name="str">文字列</param> private void ToByte(out byte[] strbyte, string str) { try { // string -> byte[]へ変換。 strbyte = codePage.GetBytes(str + "\r\n"); } catch { // 失敗した場合はnullを設定 strbyte = null; } }