コード例 #1
0
        public void parseBytes(byte[] arr, bool withType)
        {
            byte[] rawbytes = arr;
            if (withType)
            {
                this.type = this.configTypeFromBytes(arr);
                rawbytes  = this.byteWithoutTypeByteFlag(arr);
            }

            if (this.type != ConfigType.None)
            {
                if (this.type == ConfigType.Fishing)
                {
                    this.fishingConfig = this.fishingConfigFromBytes(rawbytes);
                }
                else if (this.type == ConfigType.Combat)
                {
                    this.combatConfig = this.combatConfigFromBytes(rawbytes);
                }
                else if (this.type == ConfigType.Gathering)
                {
                    this.gatheringConfig = this.gatheringConfigFromBytes(rawbytes);
                }
            }
        }
コード例 #2
0
        public CombatConfig combatConfigFromBytes(byte[] arr)
        {
            CombatConfig str = new CombatConfig();

            int    size = Marshal.SizeOf(str);
            IntPtr ptr  = Marshal.AllocHGlobal(size);

            Marshal.Copy(arr, 0, ptr, size);

            str = (CombatConfig)Marshal.PtrToStructure(ptr, str.GetType());
            Marshal.FreeHGlobal(ptr);

            return(str);
        }