private WriteFunc <UnityEngine.Texture2D> GetTextureWriter(TextureOptions inTextureOptions) { if ((inTextureOptions & TextureOptions.JPG) != 0) { return(Write_Texture2DJPG_Cached ?? (Write_Texture2DJPG_Cached = Write_Texture2DJPG)); } return(Write_Texture2DPNG_Cached ?? (Write_Texture2DPNG_Cached = Write_Texture2DPNG)); }
private void writeMultiple <T>(WriteFunc <T> writeFunc, BinaryWriter writer, IEnumerable <T> values) { writer.Write7BitEncoded((uint)values.Count()); foreach (T value in values) { writeFunc(writer, value); } }
public LogRedirectWriter(TextBoxBase textBox) { this.textBox = textBox; oldOut = Console.Out; Console.SetOut(this); write = Write; writeLine = WriteLine; }
/// <summary> /// Writes an object onto the current array. /// </summary> private void DoWriteProxy <ProxyType, InnerType>(ref ProxyType ioData, WriteFunc <InnerType> inWriter) where ProxyType : struct, ISerializedProxy <InnerType> { BeginWriteValue(); InnerType innerData = ioData.GetProxyValue(Context); inWriter(ref innerData); EndValue(); }
/// <summary> /// Writes a value onto the current array. /// </summary> private void DoWriteUnity <T>(ref T ioData, FieldOptions inOptions, WriteFunc <T> inWriter) where T : UnityEngine.Object { if (ioData == null) { WriteNull(); return; } BeginWriteValue(); inWriter(ref ioData); EndValue(); }
/// <summary> /// Writes a value onto the current array. /// </summary> private void DoWrite <T>(ref T ioData, FieldOptions inOptions, WriteFunc <T> inWriter) { if (ioData != null) { BeginWriteValue(); inWriter(ref ioData); EndValue(); } else { WriteNull(); } }
/// <summary> /// Writes a value into the current object. /// </summary> private void DoWrite <T>(string inKey, ref T ioData, FieldOptions inOptions, WriteFunc <T> inWriter) { if (ioData != null) { BeginWriteValue(inKey, inOptions); inWriter(ref ioData); EndValue(); } else if (RequiresExplicitNull()) { WriteNull(inKey); } }
/// <summary> /// Writes a value onto the current array, substituting null if default. /// </summary> private void DoWrite <T>(ref T ioData, T inDefault, FieldOptions inOptions, WriteFunc <T> inWriter) { if (ioData != null && !ioData.Equals(inDefault)) { BeginWriteValue(); inWriter(ref ioData); EndValue(); } else { WriteNull(); } }
private static byte[] Compress(byte[] data, Compression method = Compression.int32) { int size = method == Compression.int16 ? 2 : method == Compression.int32 ? 4 : 8; int count = (data.Length / size) + (data.Length % size == 0 ? 0 : 1); WriteFunc func = size == 2 ? func16 : size == 4 ? func32 : func64; using (BitWriter writer = new BitWriter()) { writer.WriteUInt((uint)data.Length); for (int i = 0; i < count; ++i) { func(writer, data, i); } return(writer.Finalize()); } }
/// <summary> /// Acquires a write lock and invokes the function with the object inside the lock box. /// </summary> /// <param name="func">The action to invoke.</param> /// <returns>The value returned by the function.</returns> /// <typeparam name="TResult">The function result type.</typeparam> /// <exception cref="ArgumentNullException">Thrown if <paramref name="func"/> is null.</exception> public TResult Write <TResult>(WriteFunc <T, TResult> func) { if (func == null) { throw new ArgumentNullException("func"); } @lock.AcquireWriterLock(Timeout.Infinite); try { return(func(obj)); } finally { @lock.ReleaseWriterLock(); } }
/// <inheritdoc /> public TResult Write <TResult>(WriteFunc <IPreferenceSetWriter, TResult> writeFunc) { if (writeFunc == null) { throw new ArgumentNullException("writeFunc"); } return(dataLockBox.Write(data => { data.Refresh(); try { return writeFunc(new PreferenceSetWriter(data)); } finally { data.Commit(); } })); }
public void Serialize(string inKey, ref UnityEngine.Color ioData, UnityEngine.Color inDefault, FieldOptions inOptions = FieldOptions.None) { DoSerialize <UnityEngine.Color>(inKey, ref ioData, inDefault, inOptions, Read_Color_Cached ?? (Read_Color_Cached = Read_Color), Write_Color_Cached ?? (Write_Color_Cached = Write_Color)); }
public void StringProxySet <ProxyType>(string inKey, ref HashSet <ProxyType> ioSet, FieldOptions inOptions = FieldOptions.None) where ProxyType : struct, ISerializedProxy <System.String> { DoProxySet <ProxyType, System.String>(inKey, ref ioSet, inOptions, Read_String_Cached ?? (Read_String_Cached = Read_String), Write_String_Cached ?? (Write_String_Cached = Write_String)); }
public void UInt16ProxySet <ProxyType>(string inKey, ref HashSet <ProxyType> ioSet, FieldOptions inOptions = FieldOptions.None) where ProxyType : struct, ISerializedProxy <System.UInt16> { DoProxySet <ProxyType, System.UInt16>(inKey, ref ioSet, inOptions, Read_UInt16_Cached ?? (Read_UInt16_Cached = Read_UInt16), Write_UInt16_Cached ?? (Write_UInt16_Cached = Write_UInt16)); }
public void Set(string inKey, ref HashSet <System.UInt16> ioSet, FieldOptions inOptions = FieldOptions.None) { DoSet <System.UInt16>(inKey, ref ioSet, inOptions, Read_UInt16_Cached ?? (Read_UInt16_Cached = Read_UInt16), Write_UInt16_Cached ?? (Write_UInt16_Cached = Write_UInt16)); }
public void Serialize(string inKey, ref System.UInt16 ioData, System.UInt16 inDefault, FieldOptions inOptions = FieldOptions.None) { DoSerialize <System.UInt16>(inKey, ref ioData, inDefault, inOptions, Read_UInt16_Cached ?? (Read_UInt16_Cached = Read_UInt16), Write_UInt16_Cached ?? (Write_UInt16_Cached = Write_UInt16)); }
public void Map(string inKey, ref Dictionary <int, UnityEngine.Color> ioMap, FieldOptions inOptions = FieldOptions.None) { DoMap <UnityEngine.Color>(inKey, ref ioMap, inOptions, Read_Color_Cached ?? (Read_Color_Cached = Read_Color), Write_Color_Cached ?? (Write_Color_Cached = Write_Color)); }
public void Array(string inKey, ref UnityEngine.Color[] ioArray, FieldOptions inOptions = FieldOptions.None) { DoArray <UnityEngine.Color>(inKey, ref ioArray, inOptions, Read_Color_Cached ?? (Read_Color_Cached = Read_Color), Write_Color_Cached ?? (Write_Color_Cached = Write_Color)); }
public void Set(string inKey, ref HashSet <UnityEngine.Color> ioSet, FieldOptions inOptions = FieldOptions.None) { DoSet <UnityEngine.Color>(inKey, ref ioSet, inOptions, Read_Color_Cached ?? (Read_Color_Cached = Read_Color), Write_Color_Cached ?? (Write_Color_Cached = Write_Color)); }
public void UInt64ProxyArray <ProxyType>(string inKey, ref ProxyType[] ioArray, FieldOptions inOptions = FieldOptions.None) where ProxyType : struct, ISerializedProxy <System.UInt64> { DoProxyArray <ProxyType, System.UInt64>(inKey, ref ioArray, inOptions, Read_UInt64_Cached ?? (Read_UInt64_Cached = Read_UInt64), Write_UInt64_Cached ?? (Write_UInt64_Cached = Write_UInt64)); }
public void UInt16ProxyMap <ProxyType>(string inKey, ref Dictionary <int, ProxyType> ioMap, FieldOptions inOptions = FieldOptions.None) where ProxyType : struct, ISerializedProxy <System.UInt16> { DoProxyMap <ProxyType, System.UInt16>(inKey, ref ioMap, inOptions, Read_UInt16_Cached ?? (Read_UInt16_Cached = Read_UInt16), Write_UInt16_Cached ?? (Write_UInt16_Cached = Write_UInt16)); }
public void StringProxyMap <ProxyType>(string inKey, ref Dictionary <string, ProxyType> ioMap, FieldOptions inOptions = FieldOptions.None) where ProxyType : struct, ISerializedProxy <System.String> { DoProxyMap <ProxyType, System.String>(inKey, ref ioMap, inOptions, Read_String_Cached ?? (Read_String_Cached = Read_String), Write_String_Cached ?? (Write_String_Cached = Write_String)); }
public void Array(string inKey, ref System.UInt16[] ioArray, FieldOptions inOptions = FieldOptions.None) { DoArray <System.UInt16>(inKey, ref ioArray, inOptions, Read_UInt16_Cached ?? (Read_UInt16_Cached = Read_UInt16), Write_UInt16_Cached ?? (Write_UInt16_Cached = Write_UInt16)); }
public void Serialize(string inKey, ref System.String ioData, System.String inDefault, FieldOptions inOptions = FieldOptions.None) { DoSerialize <System.String>(inKey, ref ioData, inDefault, inOptions, Read_String_Cached ?? (Read_String_Cached = Read_String), Write_String_Cached ?? (Write_String_Cached = Write_String)); }
public void Map(string inKey, ref Dictionary <int, System.UInt16> ioMap, FieldOptions inOptions = FieldOptions.None) { DoMap <System.UInt16>(inKey, ref ioMap, inOptions, Read_UInt16_Cached ?? (Read_UInt16_Cached = Read_UInt16), Write_UInt16_Cached ?? (Write_UInt16_Cached = Write_UInt16)); }
public void Array(string inKey, ref System.String[] ioArray, FieldOptions inOptions = FieldOptions.None) { DoArray <System.String>(inKey, ref ioArray, inOptions, Read_String_Cached ?? (Read_String_Cached = Read_String), Write_String_Cached ?? (Write_String_Cached = Write_String)); }
public ConsoleOut(TextBox textBox) { this.textBox = textBox; write = Write; writeLine = WriteLine; }
public void Set(string inKey, ref HashSet <System.String> ioSet, FieldOptions inOptions = FieldOptions.None) { DoSet <System.String>(inKey, ref ioSet, inOptions, Read_String_Cached ?? (Read_String_Cached = Read_String), Write_String_Cached ?? (Write_String_Cached = Write_String)); }
public TextBoxWriter(TextBox textBox) { this.textBox = textBox; write = Write; writeLine = WriteLine; }
public void Map(string inKey, ref Dictionary <int, System.String> ioMap, FieldOptions inOptions = FieldOptions.None) { DoMap <System.String>(inKey, ref ioMap, inOptions, Read_String_Cached ?? (Read_String_Cached = Read_String), Write_String_Cached ?? (Write_String_Cached = Write_String)); }