Get() public method

public Get ( ) : byte[]
return byte[]
Exemplo n.º 1
0
        public static byte[] PackEnumerable(string description, IEnumerable args)
        {
            DataConverter.PackContext packContext = new DataConverter.PackContext();
            packContext.conv        = DataConverter.CopyConv;
            packContext.description = description;
            IEnumerator enumerator = args.GetEnumerator();
            bool        flag       = enumerator.MoveNext();

            packContext.i = 0;
            while (packContext.i < description.Length)
            {
                object oarg;
                if (flag)
                {
                    oarg = enumerator.Current;
                }
                else
                {
                    if (packContext.repeat != 0)
                    {
                        break;
                    }
                    oarg = null;
                }
                int i = packContext.i;
                if (DataConverter.PackOne(packContext, oarg))
                {
                    flag = enumerator.MoveNext();
                    if (packContext.repeat > 0)
                    {
                        if (--packContext.repeat > 0)
                        {
                            packContext.i = i;
                        }
                        else
                        {
                            packContext.i++;
                        }
                    }
                    else
                    {
                        packContext.i++;
                    }
                }
                else
                {
                    packContext.i++;
                }
            }
            return(packContext.Get());
        }
Exemplo n.º 2
0
        public static byte[] Pack(string description, params object[] args)
        {
            int num = 0;

            DataConverter.PackContext packContext = new DataConverter.PackContext();
            packContext.conv        = DataConverter.CopyConv;
            packContext.description = description;
            packContext.i           = 0;
            while (packContext.i < description.Length)
            {
                object oarg;
                if (num < args.Length)
                {
                    oarg = args[num];
                }
                else
                {
                    if (packContext.repeat != 0)
                    {
                        break;
                    }
                    oarg = null;
                }
                int i = packContext.i;
                if (DataConverter.PackOne(packContext, oarg))
                {
                    num++;
                    if (packContext.repeat > 0)
                    {
                        if (--packContext.repeat > 0)
                        {
                            packContext.i = i;
                        }
                        else
                        {
                            packContext.i++;
                        }
                    }
                    else
                    {
                        packContext.i++;
                    }
                }
                else
                {
                    packContext.i++;
                }
            }
            return(packContext.Get());
        }