public byte[] Energize(FinalObject o) { int index = 0; Energize(o, bytes, ref index, true); byte[] result = this.instantiator.AcquireByteArray(index); Buffer.BlockCopy(bytes, 0, result, 0, index); return(result); }
public void Reclaim(FinalObject o) { if (o != null) { if (o.ThingValue != null) { this.Reclaim(o.ThingValue); } o.ThingValue = default(Thing); this.instantiator.DiscardFinalObject(o); } }
public void Energize(FinalObject o, byte[] bytes, ref int index, bool writeTypeId) { if (writeTypeId) { bytes[index++] = 12; } // NULL FLAGS int nullFlagsIndex = index - 1; bytes[index++] = 0; nullFlagsIndex++; // REFERENCE: ThingValue if (o.ThingValue != null) { bytes[nullFlagsIndex] |= (byte)(128); Energize(o.ThingValue, bytes, ref index, false); } }
public void DiscardFinalObject(FinalObject o) { // Dispose? }
public object Energize(byte[] bytes, ref int index, ushort typeId) { switch (typeId) { case 11: { Thing o = this.instantiator.AcquireThing(); // PRIMITIVE: IntValue o.IntValue = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); return(o); } case 12: { // NULL FLAGS int nullFlagsIndex = index - 1; index += 1; FinalObject o = this.instantiator.AcquireFinalObject(); nullFlagsIndex++; // REFERENCE: ThingValue if ((bytes[nullFlagsIndex] & (byte)128) > 0) { o.ThingValue = (Thing)Energize(bytes, ref index, 11); } return(o); } case 22: { FinalThing1 o = this.instantiator.AcquireFinalThing1(); // PRIMITIVE: IntValue1 o.IntValue1 = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); // PRIMITIVE: IntValue2a o.IntValue2a = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); return(o); } case 23: { FinalThing2 o = this.instantiator.AcquireFinalThing2(); // PRIMITIVE: IntValue1 o.IntValue1 = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); // PRIMITIVE: IntValue2a o.IntValue2a = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); return(o); } case 24: { // NULL FLAGS int nullFlagsIndex = index - 1; index += 1; AbstractReferenceObject o = this.instantiator.AcquireAbstractReferenceObject(); nullFlagsIndex++; // REFERENCE: Thing if ((bytes[nullFlagsIndex] & (byte)128) > 0) { o.Thing = (AbstractThing)Energize(bytes, ref index); } return(o); } default: throw new ReferenceTestPatternBufferException("Unrecognized type ID: " + typeId + " "); } }
public object Energize(byte[] bytes, ref int index) { ulong vuread_e2gF4LLKmgmj = 0; for (int i_bUcUI05wA86c = 0; i_bUcUI05wA86c < 9; i_bUcUI05wA86c++) { byte b = bytes[index++]; if (i_bUcUI05wA86c < 8) { vuread_e2gF4LLKmgmj += (((ulong)b & (ulong)127) << (7 * i_bUcUI05wA86c)); if ((int)(b & 128) == 0) { break; } } else { vuread_e2gF4LLKmgmj += (ulong)b << (7 * i_bUcUI05wA86c); break; } } ushort typeId = (ushort)vuread_e2gF4LLKmgmj; switch (typeId) { case 11: { Thing o = this.instantiator.AcquireThing(); // PRIMITIVE: IntValue o.IntValue = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); return(o); } case 12: { // NULL FLAGS int nullFlagsIndex = index - 1; index += 1; FinalObject o = this.instantiator.AcquireFinalObject(); nullFlagsIndex++; // REFERENCE: ThingValue if ((bytes[nullFlagsIndex] & (byte)128) > 0) { o.ThingValue = (Thing)Energize(bytes, ref index, 11); } return(o); } case 22: { FinalThing1 o = this.instantiator.AcquireFinalThing1(); // PRIMITIVE: IntValue1 o.IntValue1 = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); // PRIMITIVE: IntValue2a o.IntValue2a = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); return(o); } case 23: { FinalThing2 o = this.instantiator.AcquireFinalThing2(); // PRIMITIVE: IntValue1 o.IntValue1 = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); // PRIMITIVE: IntValue2a o.IntValue2a = (int)( ((int)bytes[index++] << 24) | ((int)bytes[index++] << 16) | ((int)bytes[index++] << 8) | (int)bytes[index++] ); return(o); } case 24: { // NULL FLAGS int nullFlagsIndex = index - 1; index += 1; AbstractReferenceObject o = this.instantiator.AcquireAbstractReferenceObject(); nullFlagsIndex++; // REFERENCE: Thing if ((bytes[nullFlagsIndex] & (byte)128) > 0) { o.Thing = (AbstractThing)Energize(bytes, ref index); } return(o); } default: throw new ReferenceTestPatternBufferException("Unrecognized type ID: " + typeId + " "); } }