public static CheckedRet <object> Deserial(ByteList bytes) { try { return(CheckedRet <object> .Gen(true, bytes.DropInt32())); } catch (Exception e) { Debug.Log("Int parse error" + e); return(CheckedRet <object> .Fail()); } }
public static CheckedRet <object> Deserial(ByteList bytes) { try { var size = bytes.DropInt32(); var data = System.Text.Encoding.UTF8.GetString(bytes.DropRange(0, size)); return(CheckedRet <object> .Gen(true, data)); } catch (Exception e) { Debug.Log("parse error" + e); return(CheckedRet <object> .Fail()); } }
public static CheckedRet <object> Deserial(ByteList bytes) { try { var size = bytes.DropInt32(); var data = BitConverter.ToSingle(bytes.DropRange(0, size), 0); return(CheckedRet <object> .Gen(true, data)); } catch (Exception e) { Debug.Log("parse error" + e); return(CheckedRet <object> .Fail()); } }
/// <summary> /// 基本的に [型番号] [[情報長]情報]です。 /// </summary> public CheckedRet <object> Deserial(ByteList bytes) { int id = bytes.DropInt32(); var func = mParser.TryGet(id); if (func.Key == false) { throw new Exception("id(" + id + ")is cannot find(byte.c is " + bytes.Count + "& dic.c" + mParser.Count + ")"); } // DebugLog.Log.Print("Deserial id({0}) Count({1})", id, bytes.Count); return(func.Value(bytes)); }
public static CheckedRet <object> Deserial(ByteList bytes) { try { var size = bytes.DropInt32(); object [] arr = new object [size]; for (int i = 0; i < size; i++) { arr [i] = Serializer.Deserialize(bytes); } return(CheckedRet <object> .Gen(true, arr)); } catch (Exception e) { Debug.Log("parse error" + e); return(CheckedRet <object> .Fail()); } }
/// <summary> /// Dictionary < object , object >として戻ることに注意 /// </summary> public static CheckedRet <object> Deserial(ByteList bytes) { try { var size = bytes.DropInt32(); Dictionary <object, object> dic = new Dictionary <object, object>(); for (int i = 0; i < size; i++) { var key = Serializer.Deserialize(bytes); var val = Serializer.Deserialize(bytes); dic.Add(key, val); } return(CheckedRet <object> .Gen(true, dic)); } catch (Exception e) { Debug.Log("parse error" + e); return(CheckedRet <object> .Fail()); } }