override protected void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(text); stream.write(toggled); }
override protected void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(text); stream.write(maxLength); }
protected override void doSerialize(Stream stream) { stream.write(guiUpdateRate); stream.write(stateUpdateRate); stream.write(showGui); stream.write(updateGui); stream.write(updateWindows); stream.write(updateState); stream.write(control); }
protected override void doSerialize(Stream stream) { stream.write(inverseRotation); stream.write(fixedDeltaTime); stream.write(time); stream.write(celestialBodies.Count); foreach(var body in celestialBodies) body.serialize(stream); }
override protected void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(minValue); stream.write(maxValue); stream.write(value); stream.write(isHorizontal); serializeStyle(thumbStyle, stream); }
override protected void doSerialize(Stream stream) { body.serialize(stream); orbit.serialize(stream); _rootRotation.serialize(stream); _rotatingFrameVelocity.serialize(stream); gravity.serialize(stream); stream.write(altitude); stream.write(atmosphericDensity); }
override protected void doSerialize(Stream stream) { stream.write(name); position.serialize(stream); rotation.serialize(stream); stream.write(radius); stream.write(mass); stream.write(gravParameter); }
override protected void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(id); stream.write(title); area.serialize(stream); stream.write(draggable); _views.serialize(stream); }
override protected void doSerialize(Stream stream) { stream.write(inverseRotation); stream.write(fixedDeltaTime); stream.write(time); stream.write(celestialBodies.Count); foreach (var body in celestialBodies) { body.serialize(stream); } }
/// <summary> /// Writes content to a file /// (mode can be 'w' for write, 'a' for append or 'wb' for binary write). /// </summary> /// <param name="path"></param> /// <param name="content"></param> /// <param name="mode"></param> public void write(string path, string content, string mode) { Stream stream = new Stream(path, mode); stream.write(content); stream.close(); }
override protected void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(isVertical); _views.serialize(stream); }
override protected void doSerialize(Stream stream) { centerOfMass.serialize(stream); stream.write(mass); torque.serialize(stream); momentumOfInertia.serialize(stream); angularMomentum.serialize(stream); }
public static void add_entry(this ZipArchive zip, string entry_name, byte content, CompressionLevel comp_lvl = CompressionLevel.Fastest) { Stream s = zip.CreateEntry(entry_name, comp_lvl).Open(); s.write(content); s.Close(); s.Dispose(); }
public void serializeState(Stream stream) { stream.write(_childs.Count); foreach (View view in _childs) { view.serializeState(stream); } }
/// <summary> /// Save func for the CWLD-format<para /> /// For information on the format check the load/read func /// </summary> public static void cwld_save(WL wl, string file) { dbg("[CWLD]Saving file..."); Stream s = File.Open(file, Create, FileAccess.Write); s.write(cwld_header); s.write(4, 3); dbg("[CWLD]Wrote header..."); DeflateStream d = new DeflateStream(s, CompressionLevel.Optimal, false); foreach (Item i in wl) { i.write_bytes(d, 3); dbg("[CWLD]Wrote {0}...", i.dbgfmt()); } d.Close(); dbg("[CWLD]Saved file."); }
protected static void serializeStyle(Style style, Stream stream) { if (style != Style.Default) { stream.write(style.ToString()); } else { stream.writeNull(); } }
/// <summary>Write string to stream with specified encoding, using ArrayPool to save RAM allocations.</summary> public static void write(this Stream stm, string str, int bytesCount, Encoding enc) { #if DEBUG Debug.Assert(bytesCount == enc.GetByteCount(str)); #endif byte[] buffer = bufferRent(bytesCount); int cb = enc.GetBytes(str, 0, str.Length, buffer, 0); Debug.Assert(cb == bytesCount); stm.write(buffer, bytesCount); bufferReturn(buffer); }
private void serializeState(Stream stream, ButtonState state) { if (state == ButtonState.NONE) { stream.writeNull(); } else { stream.write(stateString(state)); } }
/** * Writes a String with a specified len to a file. * This is useful for fixed-size String fields in * files. Any leftover space will be filled with 0x00s. * * @param s * @param len * @ */ public static void writeString(Stream dos, String s, int len) { if (s == null) { return; } if (s.Length() != 0) { byte[] dest = s.getBytes(StandardCharsets.ISO_8859_1); dos.write(dest, 0, Math.Min(len, dest.Length)); // Fill in with 0s if something's left. if (dest.Length < len) { for (int i = 0; i < len - dest.Length; i++) { dos.write((byte)0x00); } } } }
override protected void doSerializeState(Stream stream) { if (_updated) { _updated = false; stream.write(toggled); } else { stream.writeNull(); } }
override protected void doSerializeState(Stream stream) { if (_isUpdated) { _isUpdated = false; stream.write(text); } else { stream.writeNull(); } }
protected override void doSerialize(Stream stream) { stream.write(throttle); stream.write(yaw); stream.write(pitch); stream.write(roll); stream.write(dx); stream.write(dy); stream.write(dz); }
override protected void doSerialize(Stream stream) { stream.write(trueAnomaly); stream.write(eccentricity); stream.write(parameter); stream.write(inclination); stream.write(LAN); stream.write(argumentOfPeriapsis); stream.write(timeAtPeriapsis); mainBody.serialize(stream); }
override protected void doSerialize(Stream stream) { stream.write(guiUpdateRate); stream.write(stateUpdateRate); stream.write(showGui); stream.write(updateGui); stream.write(updateWindows); stream.write(updateState); stream.write(control); }
override protected void doSerialize(Stream stream) { stream.write(throttle); stream.write(yaw); stream.write(pitch); stream.write(roll); stream.write(dx); stream.write(dy); stream.write(dz); }
// constructor /** * Constructs a <CODE>HtmlWriter</CODE>. * * @param doc The <CODE>Document</CODE> that has to be written as HTML * @param os The <CODE>OutputStream</CODE> the writer has to write to. */ protected HtmlWriter(Document doc, Stream os) { super(doc, os); document.addDocListener(this); this.pageN = document.PageNumber; try { os.write(LT); os.write(getISOBytes(HtmlTags.HTML)); os.write(GT); os.write(NEWLINE); os.write(TAB); os.write(LT); os.write(getISOBytes(HtmlTags.HEAD)); os.write(GT); } catch (IOException ioe) { throw new ExceptionConverter(ioe); } }
/// <summary> /// Write func for the CWLS-format<para /> /// For information on the format check the load/read func /// </summary> public static void write_recents(string file, IEnumerable <string> recents) { dbg("[CWLS]Writing file..."); Stream fs = File.Open(file, Create, FileAccess.Write); fs.write(cwls_header); fs.WriteByte(5); dbg("[CWLS]Wrote header."); DeflateStream d = new DeflateStream(fs, CompressionLevel.Optimal, false); foreach (string r in recents) { d.write(utf8(r)); d.WriteByte(11); dbg("[CWLS]Wrote \"" + r + "\"."); } d.Close(); dbg("[CWLS]Finished."); }
protected override void doSerialize(Stream stream) { stream.write(a); stream.write(r); stream.write(g); stream.write(b); }
protected override void doSerializeState(Stream stream) { if(_isUpdated) { _isUpdated = false; stream.write(value); } else stream.writeNull(); }
protected override void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(minValue); stream.write(maxValue); stream.write(value); stream.write(isHorizontal); serializeStyle(thumbStyle, stream); }
public static void write(this Stream s, string t, encoding_s2b encoding) { s.write(encoding(t)); }
protected override void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(text); stream.write(maxLength); }
public void write_bytes(Stream s, int format) { if (format == 1) { s.write(name, utf16); s.write(10, 13); s.write(url, utf16); s.write(10, 13); } else if (format == 2) { s.write(name, utf16); s.write(11); if (url.StartsWith(tinyurl)) { s.write(1); s.write(url.Substring(tinyurl_length), ascii); } else { s.write(0); s.write(url, utf16); } s.write(11); } else if (format == 3) { s.write(name, utf8); if (url.StartsWith(tinyurl)) { s.write(D3_TU); s.write(url.Substring(tinyurl_length), b64); } else { s.write(D3_NOTU); s.write(url.StartsWith(https) ? url.Substring(https.Length) : url, utf8); s.write(D3_ENDSTR); } } }
protected override void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(id); stream.write(title); area.serialize(stream); stream.write(draggable); _views.serialize(stream); }
protected override void doSerializeState(Stream stream) { _state.serialize(stream); stream.write(_clicked); }
override protected void doSerialize(Stream stream) { stream.write(x); stream.write(y); stream.write(z); }
override protected void doSerializeState(Stream stream) { _state.serialize(stream); stream.write(_clicked); }
protected static void serializeStyle(Style style, Stream stream) { if(style != Style.Default) stream.write(style.ToString()); else stream.writeNull(); }
protected override void doSerialize(Stream stream) { stream.write(width); stream.write(height); }
protected override void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(text); stream.write(toggled); }
protected override void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(_size); }
private void serializeState(Stream stream, ButtonState state) { if(state == ButtonState.NONE) stream.writeNull(); else stream.write(stateString(state)); }
public void serializeState(Stream stream) { stream.write(_childs.Count); foreach(View view in _childs) view.serializeState(stream); }
protected override void doSerialize(Stream stream) { base.doSerialize(stream); stream.write(isVertical); _views.serialize(stream); }
protected override void doSerializeState(Stream stream) { if(_updated) { _updated = false; stream.write(toggled); } else stream.writeNull(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: public void setHueLifxSettings(int lightType2, @Nullable InetAddress[] lightIpAddresses2, @Nullable byte[] lightSectorAssignments2, @Nullable String hueBridgeUsername2, @Nullable byte[] hueBulbIds2, @Nullable byte[] hueBridgeClientKey2, int hueBridgeGroupNumber2, @Nullable String[] lightNames2, @Nullable String hueBridgeGroupName2) public virtual void setHueLifxSettings(int lightType2, InetAddress[] lightIpAddresses2, sbyte[] lightSectorAssignments2, string hueBridgeUsername2, sbyte[] hueBulbIds2, sbyte[] hueBridgeClientKey2, int hueBridgeGroupNumber2, string[] lightNames2, string hueBridgeGroupName2) { Log.i("Connect", "setHueLifxSettings"); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.json.JSONObject json = new org.json.JSONObject(); JSONObject json = new JSONObject(); if (lightType2 >= 0 && lightType2 <= 2) { try { initLightType(lightType2); json.put(JSON_LIGHT_TYPE, lightType2); } catch (JSONException) { Log.i("Connect", "setHueLifxSettings json failed"); return; } } if (lightIpAddresses2 != null) { initLightIpAddresses(lightIpAddresses2); string asciiHex = ""; foreach (InetAddress inetAddress in lightIpAddresses2) { asciiHex = asciiHex + byteArrayToAsciiHex(inetAddress.Address, inetAddress.Address.length); } json.put(JSON_LIGHT_IPADDRESSES, asciiHex); } if (lightSectorAssignments2 != null) { initLightSectorAssignments(lightSectorAssignments2); json.put(JSON_LIGHT_SECTOR_ASSIGNMENTS, byteArrayToAsciiHex(lightSectorAssignments2, lightSectorAssignments2.Length)); } if (!string.ReferenceEquals(hueBridgeUsername2, null)) { initHueBridgeUsername(hueBridgeUsername2); json.put(JSON_HUE_BRIDGE_USERNAME, hueBridgeUsername2); } if (hueBulbIds2 != null) { initHueBulbIds(hueBulbIds2); json.put(JSON_HUE_BULB_IDS, byteArrayToAsciiHex(hueBulbIds2, hueBulbIds2.Length)); } if (hueBridgeClientKey2 != null) { initHueBridgeClientKey(hueBridgeClientKey2); json.put(JSON_HUE_BRIDGE_CLIENT_KEY, byteArrayToAsciiHex(hueBridgeClientKey2, hueBridgeClientKey2.Length)); } if (hueBridgeGroupNumber2 >= 0) { initHueBridgeGroupNumber(hueBridgeGroupNumber2); json.put(JSON_HUE_BRIDGE_GROUP_NUMBER, hueBridgeGroupNumber2); } if (!string.ReferenceEquals(hueBridgeGroupName2, null)) { initHueBridgeGroupName(hueBridgeGroupName2); json.put(JSON_HUE_BRIDGE_GROUP_NAME, hueBridgeGroupName2); } if (lightNames2 != null) { initLightNames(lightNames2); MemoryStream byteArrayOutputStream = new MemoryStream(); try { foreach (string lightName in lightNames2) { byteArrayOutputStream.WriteByte(Arrays.copyOf(lightName.GetBytes(Encoding.UTF8), 32)); } } catch (IOException) { } json.put(JSON_LIGHT_NAMES, byteArrayToAsciiHex(byteArrayOutputStream.toByteArray(), byteArrayOutputStream.toByteArray().length)); } Log.i("Connect", "json: " + json.ToString()); (new Thread(() => { HttpURLConnection httpURLConnection = null; try { httpURLConnection = (HttpURLConnection)(new URL("http://" + Connect.this.Ip + "/api/connect/state")).openConnection(); httpURLConnection.DoOutput = true; httpURLConnection.RequestMethod = "PUT"; httpURLConnection.setRequestProperty("Content-Type", "application/json"); Stream outputStream = httpURLConnection.OutputStream; outputStream.write(json.ToString().GetBytes(Encoding.UTF8)); outputStream.close(); Log.i("Connect", "responseCode " + httpURLConnection.ResponseCode); if (httpURLConnection != null) { httpURLConnection.disconnect(); } } catch (IOException e) { Log.i("Connect", "setHueLifxSettings error: " + e.ToString()); if (httpURLConnection != null) { httpURLConnection.disconnect(); } } catch (Exception th) { if (httpURLConnection != null) { httpURLConnection.disconnect(); } throw th; } })).Start(); }
override protected void doSerialize(Stream stream) { if (alignment != Alignment.Default) { stream.write(alignment.ToString()); } else { stream.writeNull(); } if (style != FontStyle.Default) { stream.write(style.ToString()); } else { stream.writeNull(); } if (normal != null) { normal.serialize(stream); } else { stream.writeNull(); } if (onNormal != null) { onNormal.serialize(stream); } else { stream.writeNull(); } if (hover != null) { hover.serialize(stream); } else { stream.writeNull(); } if (onHover != null) { onHover.serialize(stream); } else { stream.writeNull(); } if (focused != null) { focused.serialize(stream); } else { stream.writeNull(); } if (onFocused != null) { onFocused.serialize(stream); } else { stream.writeNull(); } if (active != null) { active.serialize(stream); } else { stream.writeNull(); } if (onActive != null) { onActive.serialize(stream); } else { stream.writeNull(); } }
protected override void doSerialize(Stream stream) { stream.write(name); position.serialize(stream); rotation.serialize(stream); stream.write(radius); stream.write(mass); stream.write(gravParameter); }