Exemple #1
0
        private List <IStreamable> ReceiveObjectList(IZetboxContext ctx, ZetboxStreamReader sr)
        {
            List <IStreamable> result = new List <IStreamable>();
            var cont = sr.ReadBoolean();

            while (cont)
            {
                var objType = sr.ReadSerializableType();

                IStreamable obj = (IStreamable)ctx.Internals().CreateUnattached(_iftFactory(objType.GetSystemType()));
                obj.FromStream(sr);

                result.Add((IStreamable)obj);
                cont = sr.ReadBoolean();
            }
            return(result);
        }
Exemple #2
0
        private List <IStreamable> ReceiveObjectList(IZetboxContext ctx, ZetboxStreamReader sr)
        {
            List <IStreamable> result = new List <IStreamable>();
            bool cont                  = sr.ReadBoolean();
            long dbgByteCounter        = 0;
            long dbgObjTypeByteCounter = 0;

            while (cont)
            {
                long dbgCurrentPos = sr.BaseStream.Position;
                var  objType       = sr.ReadSerializableType();
                dbgObjTypeByteCounter += sr.BaseStream.Position - dbgCurrentPos;

                IStreamable obj = (IStreamable)ctx.Internals().CreateUnattached(_iftFactory(objType.GetSystemType()));
                obj.FromStream(sr);
                result.Add((IStreamable)obj);

                cont = sr.ReadBoolean();
                long dbgSize = sr.BaseStream.Position - dbgCurrentPos;
                dbgByteCounter += dbgSize;
            }
            Logging.Facade.DebugFormat("ReceiveObjectList: {0:n0} objects; {1:n0} bytes total size; {2:n0} bytes avg. size / object; Total ObjType size: {3:n0}; {4:n2}% of total", result.Count, dbgByteCounter, (double)dbgByteCounter / (double)result.Count, dbgObjTypeByteCounter, (double)dbgObjTypeByteCounter / (double)dbgByteCounter * 100.0);
            return(result);
        }