Esempio n. 1
0
 public L2PointF(L2PointF pt)
 {
     this.X = pt.X;
     this.Y = pt.Y;
 }
Esempio n. 2
0
 public void SetPoint(L2PointF pt)
 {
     this.X = pt.X;
     this.Y = pt.Y;
 }
Esempio n. 3
0
        public object ReadObject(int objType = -1)
        {
            if (objType < 0) //Read Type first
            {
                objType = ReadNumber();
            }

            if (objType == (int)L2ObjType.ObjectRef)
            {
                var id = ReadInt32();
                return(Objects[id]);
            }

            object obj = null;

            switch (objType)
            {
            case (int)L2ObjType.Null:
                obj = null;
                break;

            case (int)L2ObjType.DrawDataID:
                obj = ReadUTF8String();
                break;

            case (int)L2ObjType.BaseDataID:
                obj = ReadUTF8String();
                break;

            case (int)L2ObjType.PartsDataID:
                obj = ReadUTF8String();
                break;

            case (int)L2ObjType.ParamID:
                obj = ReadUTF8String();
                break;

            case (int)L2ObjType.String:
                obj = ReadUTF8String();
                break;

            case (int)L2ObjType.Color:
                obj = new L2Color(ReadInt32(), true);
                break;

            case (int)L2ObjType.RectF:
                obj = new L2RectF(ReadSingle(), ReadSingle(), ReadSingle(), ReadSingle());
                break;

            case (int)L2ObjType.RectD:
                obj = new L2RectF(ReadDouble(), ReadDouble(), ReadDouble(), ReadDouble());
                break;

            case (int)L2ObjType.PointF:
                obj = new L2PointF(ReadSingle(), ReadSingle());
                break;

            case (int)L2ObjType.PointD:
                obj = new L2PointF(ReadDouble(), ReadDouble());
                break;

            case (int)L2ObjType.ObjectArray:
                obj = ReadObjects();
                break;

            case (int)L2ObjType.IntArray:
            case (int)L2ObjType.IntArray2:
                obj = ReadIntArray();
                break;

            case (int)L2ObjType.Matrix2x3:
                obj = new L2Matrix2x3F(ReadDouble(), ReadDouble(), ReadDouble(), ReadDouble(), ReadDouble(),
                                       ReadDouble());
                break;

            case (int)L2ObjType.Rect:
                obj = new L2Rect(ReadInt32(), ReadInt32(), ReadInt32(), ReadInt32());
                break;

            case (int)L2ObjType.Point:
                obj = new L2Point(ReadInt32(), ReadInt32());
                break;

            case (int)L2ObjType.DoubleArray:
                obj = ReadDoubleArray();
                break;

            case (int)L2ObjType.FloatArray:
                obj = ReadFloatArray();
                break;

            case (int)L2ObjType.Array:
                throw new NotImplementedException($"L2ObjType {L2ObjType.Array} is not implemented.");

            default:
                if (objType >= L2Consts.SERIALIZABLE_START)
                {
                    var t = (L2ObjType)objType;
                    obj = ReadKnownTypeObject(objType);
                }
                else
                {
                    throw new ArgumentOutOfRangeException("", $"L2ObjType {objType} is not implemented.");
                }

                break;
            }

            Objects.Add(obj);
            return(obj);
        }