Ejemplo n.º 1
0
        public bool AddMsgVarList(StoreArchive ar, VarList args, int beg, int end)
        {
            try
            {
                for (int i = beg; i < end; ++i)
                {
                    switch (args.GetType(i))
                    {
                    case VarType.Int:
                        ar.WriteInt8(VarType.Int);
                        ar.WriteInt32(args.GetInt(i));
                        break;

                    case VarType.Int64:
                        ar.WriteInt8(VarType.Int64);
                        ar.WriteInt64(args.GetInt64(i));
                        break;

                    case VarType.Float:
                        ar.WriteInt8(VarType.Float);
                        ar.WriteFloat(args.GetFloat(i));
                        break;

                    case VarType.Double:
                        ar.WriteInt8(VarType.Double);
                        ar.WriteDouble(args.GetDouble(i));
                        break;

                    case VarType.String:
                        ar.WriteInt8(VarType.String);
                        ar.WriteString(args.GetString(i));
                        break;

                    case VarType.WideStr:
                        ar.WriteInt8(VarType.WideStr);
                        ar.WriteWideStr(args.GetWideStr(i));
                        break;

                    case VarType.Object:
                        ar.WriteInt8(VarType.Object);
                        ar.WriteObject(args.GetObject(i));
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                LogSystem.LogError(ex.ToString());
                return(false);
            }

            return(true);
        }
Ejemplo n.º 2
0
        bool AddMsgVarList(ref StoreArchive storeAr, ref VarList args,
                           int beg, int end)
        {
            try
            {
                for (int i = beg; i < end; i++)
                {
                    switch (args.GetType(i))
                    {
                    case VarType.Int:
                    {
                        storeAr.WriteInt8(VarType.Int);
                        storeAr.WriteInt32(args.GetInt(i));
                    }
                    break;

                    case VarType.Int64:
                    {
                        storeAr.WriteInt8(VarType.Int64);
                        storeAr.WriteInt64(args.GetInt64(i));
                    }
                    break;

                    case VarType.Float:
                    {
                        storeAr.WriteInt8(VarType.Float);
                        storeAr.WriteFloat(args.GetFloat(i));
                    }
                    break;

                    case VarType.Double:
                    {
                        storeAr.WriteInt8(VarType.Double);
                        storeAr.WriteDouble(args.GetDouble(i));
                    }
                    break;

                    case VarType.String:
                    {
                        storeAr.WriteInt8(VarType.String);
                        storeAr.WriteString(args.GetString(i));
                    }
                    break;

                    case VarType.WideStr:
                    {
                        storeAr.WriteInt8(VarType.WideStr);
                        storeAr.WriteWideStr(args.GetWideStr(i));
                    }
                    break;

                    case VarType.Object:
                    {
                        storeAr.WriteInt8(VarType.Object);
                        storeAr.WriteObject(args.GetObject(i));
                    }
                    break;

                    default:
                        //Log.Trace("unkown data type");
                        break;
                    } //end switch
                }     //end for
            }
            catch (Exception ex)
            {
                //Log.Trace("Exception:" + ex.ToString());
                return(false);
            }//end try catch
            return(true);
        }