Ported .Net Core commits:

hondacrx:
- Initial commit: Switch to .Net Core 2.0
- Fix build and removed not needed files
Fabi:
- Updated solution platforms.
- Changed folder structure.
- Change library target framework to netstandard2.0.
- Updated solution platforms again...
- Removed windows specific kernel32 function usage (Ctrl-C handler).
This commit is contained in:
Fabian
2017-10-26 17:23:44 +02:00
parent 227702e19c
commit a3dc7b3f48
844 changed files with 26064 additions and 1824 deletions
@@ -0,0 +1,91 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.IO;
using Game.Network;
using Game.Network.Packets;
using System.Collections.Generic;
namespace Game.Entities
{
public class UpdateData
{
public UpdateData(uint mapId)
{
MapId = mapId;
}
public void AddOutOfRangeGUID(List<ObjectGuid> guids)
{
outOfRangeGUIDs.AddRange(guids);
}
public void AddOutOfRangeGUID(ObjectGuid guid)
{
outOfRangeGUIDs.Add(guid);
}
public void AddUpdateBlock(ByteBuffer block)
{
data.WriteBytes(block.GetData());
++BlockCount;
}
public bool BuildPacket(out UpdateObject packet)
{
packet = new UpdateObject();
packet.NumObjUpdates = BlockCount;
packet.MapID = (ushort)MapId;
WorldPacket buffer = new WorldPacket();
if (buffer.WriteBit(!outOfRangeGUIDs.Empty()))
{
buffer.WriteUInt16(0); // object limit to instantly destroy - objects before this index on m_outOfRangeGUIDs list get "smoothly phased out"
buffer.WriteUInt32(outOfRangeGUIDs.Count);
foreach (var guid in outOfRangeGUIDs)
buffer.WritePackedGuid(guid);
}
var bytes = data.GetData();
buffer.WriteUInt32(bytes.Length);
buffer.WriteBytes(bytes);
packet.Data = buffer.GetData();
return true;
}
public void Clear()
{
data.Clear();
outOfRangeGUIDs.Clear();
BlockCount = 0;
MapId = 0;
}
public bool HasData() { return BlockCount > 0 || outOfRangeGUIDs.Count != 0; }
public List<ObjectGuid> GetOutOfRangeGUIDs() { return outOfRangeGUIDs; }
public void SetMapId(ushort mapId) { MapId = mapId; }
uint MapId;
uint BlockCount;
List<ObjectGuid> outOfRangeGUIDs = new List<ObjectGuid>();
ByteBuffer data = new ByteBuffer();
}
}
@@ -0,0 +1,109 @@
/*
* Copyright (C) 2012-2017 CypherCore <http://github.com/CypherCore>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using Framework.Constants;
using Framework.IO;
using System.Collections;
using System;
namespace Game.Entities
{
public class UpdateMask
{
public UpdateMask(uint valuesCount = 0)
{
_fieldCount = valuesCount;
_blockCount = (valuesCount + 32 - 1) / 32;
_mask = new BitArray((int)valuesCount, false);
}
public void SetCount(int valuesCount)
{
_fieldCount = (uint)valuesCount;
_blockCount = (uint)(valuesCount + 32 - 1) / 32;
_mask = new BitArray((int)valuesCount, false);
}
public uint GetCount() { return _fieldCount; }
public virtual void AppendToPacket(ByteBuffer data)
{
data.WriteUInt8(_blockCount);
var maskArray = new byte[_blockCount << 2];
_mask.CopyTo(maskArray, 0);
data.WriteBytes(maskArray);
}
public bool GetBit(int index)
{
return _mask.Get(index);
}
public void SetBit(int index)
{
_mask.Set(index, true);
}
void UnsetBit(int index)
{
_mask.Set(index, false);
}
public void Clear()
{
_mask.SetAll(false);
}
protected uint _fieldCount;
protected uint _blockCount;
protected BitArray _mask;
}
public class DynamicUpdateMask : UpdateMask
{
public DynamicUpdateMask(uint valuesCount) : base(valuesCount) { }
public void EncodeDynamicFieldChangeType(DynamicFieldChangeType changeType, UpdateType updateType)
{
DynamicFieldChangeType = (uint)(_blockCount | ((uint)(changeType & Entities.DynamicFieldChangeType.ValueAndSizeChanged) * ((3 - (int)updateType /*this part evaluates to 0 if update type is not VALUES*/) / 3)));
}
public override void AppendToPacket(ByteBuffer data)
{
data.WriteUInt16(DynamicFieldChangeType);
if (DynamicFieldChangeType.HasAnyFlag((uint)Entities.DynamicFieldChangeType.ValueAndSizeChanged))
data.WriteUInt32(_fieldCount);
var maskArray = new byte[_blockCount << 2];
_mask.CopyTo(maskArray, 0);
data.WriteBytes(maskArray);
}
public uint DynamicFieldChangeType;
}
public enum DynamicFieldChangeType
{
Unchanged = 0,
ValueChanged = 0x7FFF,
ValueAndSizeChanged = 0x8000
}
}