use array.Empty<byte>

This commit is contained in:
UbitUmarov
2022-03-12 15:21:24 +00:00
parent 5ffa1801d8
commit e043d8a2eb
45 changed files with 100 additions and 103 deletions

View File

@@ -401,7 +401,7 @@ namespace OpenSim.Groups
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = UUID.Zero.Guid;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>();
OutgoingInstantMessage(msg, invitee);
IClientAPI inviteeClient = GetActiveRootClient(invitee);
@@ -1117,7 +1117,7 @@ namespace OpenSim.Groups
msg.timestamp = (uint)Util.UnixTimeSinceEpoch(); ;
msg.fromAgentName = string.Empty;
msg.message = string.Empty;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>(); ;
}
return msg;
@@ -1276,7 +1276,7 @@ namespace OpenSim.Groups
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = regionInfo.RegionID.Guid;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>(); ;
OutgoingInstantMessage(msg, ejecteeID);
}
@@ -1294,7 +1294,7 @@ namespace OpenSim.Groups
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = regionInfo.RegionID.Guid;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>(); ;
OutgoingInstantMessage(msg, agentID);
}

View File

@@ -292,7 +292,7 @@ namespace OpenSim.Capabilities.Handlers
private byte[] ConvertTextureData(AssetBase texture, string format)
{
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
byte[] data = new byte[0];
byte[] data = Array.Empty<byte>(); ;
MemoryStream imgstream = new MemoryStream();
Bitmap mTexture = null;

View File

@@ -320,7 +320,7 @@ namespace OpenSim.Capabilities.Handlers
private byte[] ConvertTextureData(AssetBase texture, string format)
{
m_log.DebugFormat("[GETTEXTURE]: Converting texture {0} to {1}", texture.ID, format);
byte[] data = new byte[0];
byte[] data = Array.Empty<byte>(); ;
MemoryStream imgstream = new MemoryStream();
Bitmap mTexture = null;

View File

@@ -25,10 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections;
using System.IO;
using System.Text;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
namespace OpenSim.Framework.Capabilities
@@ -62,7 +61,7 @@ namespace OpenSim.Framework.Capabilities
Hashtable hash = (Hashtable) LLSD.LLSDDeserialize(request);
if(hash == null)
return new byte[0];
return Array.Empty<byte>();
TRequest llsdRequest = new TRequest();
LLSDHelpers.DeserialiseOSDMap(hash, llsdRequest);

View File

@@ -1592,7 +1592,7 @@ namespace OpenSim.Data.MySQL
if (prim.KeyframeMotion != null)
cmd.Parameters.AddWithValue("KeyframeMotion", prim.KeyframeMotion.Serialize());
else
cmd.Parameters.AddWithValue("KeyframeMotion", new Byte[0]);
cmd.Parameters.AddWithValue("KeyframeMotion", Array.Empty<byte>());
if (prim.PhysicsInertia != null)
cmd.Parameters.AddWithValue("PhysInertia", prim.PhysicsInertia.ToXml2());

View File

@@ -2170,7 +2170,7 @@ namespace OpenSim.Data.SQLite
if (prim.KeyframeMotion != null)
row["KeyframeMotion"] = prim.KeyframeMotion.Serialize();
else
row["KeyframeMotion"] = new Byte[0];
row["KeyframeMotion"] = Array.Empty<byte>(); ;
row["PassTouches"] = prim.PassTouches;
row["PassCollisions"] = prim.PassCollisions;

View File

@@ -50,7 +50,7 @@ namespace OpenSim.Framework
public GridInstantMessage()
{
binaryBucket = new byte[0];
binaryBucket = Array.Empty<byte>(); ;
}
public GridInstantMessage(GridInstantMessage im, bool addTimestamp)
@@ -108,7 +108,7 @@ namespace OpenSim.Framework
string _message, bool _offline,
Vector3 _position) : this(scene, _fromAgentID, _fromAgentName,
_toAgentID, _dialog, false, _message,
_fromAgentID ^ _toAgentID, _offline, _position, new byte[0], true)
_fromAgentID ^ _toAgentID, _offline, _position, Array.Empty<byte>(), true)
{
}
}

View File

@@ -61,7 +61,7 @@ namespace OpenSim.Framework.Serialization
if (!dirName.EndsWith("/"))
dirName += "/";
WriteFile(dirName, new byte[0]);
WriteFile(dirName, Array.Empty<byte>());
}
/// <summary>

View File

@@ -1615,7 +1615,7 @@ namespace OpenSim.Framework.Servers.HttpServer
return null;
}
byte[] buffer = new byte[0];
byte[] buffer = Array.Empty<byte>();
if (llsdResponse.ToString() == "shutdown404!")
{
response.ContentType = "text/plain";

View File

@@ -25,6 +25,7 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.IO;
using System.Net;
using OpenSim.Framework.ServiceAuth;
@@ -65,7 +66,7 @@ namespace OpenSim.Framework.Servers.HttpServer
{
httpResponse.StatusCode = (int)statusCode;
httpResponse.ContentType = "text/plain";
return new byte[0];
return Array.Empty<byte>();
}
}

View File

@@ -24,7 +24,8 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using OpenSim.Framework;
using System;
using System.IO;
namespace OpenSim.Framework.Servers.HttpServer
@@ -78,7 +79,7 @@ namespace OpenSim.Framework.Servers.HttpServer
protected virtual byte[] ThrottledRequest(
string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
return new byte[0];
return Array.Empty<byte>();
}

View File

@@ -580,7 +580,8 @@ namespace OpenSim.Framework.Servers.HttpServer
_receiveDone.Set();
_initialMsgTimeout = 0;
}
WebSocketFrame pingFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = new byte[0] };
WebSocketFrame pingFrame = new WebSocketFrame() { Header = WebsocketFrameHeader.HeaderDefault(), WebSocketPayload = Array.Empty<byte>()
};
pingFrame.Header.Opcode = WebSocketReader.OpCode.Ping;
pingFrame.Header.IsEnd = true;
_pingtime = Util.EnvironmentTickCount();
@@ -651,7 +652,7 @@ namespace OpenSim.Framework.Servers.HttpServer
pingD(this, new PingEventArgs());
}
WebSocketFrame pongFrame = new WebSocketFrame(){Header = WebsocketFrameHeader.HeaderDefault(),WebSocketPayload = new byte[0]};
WebSocketFrame pongFrame = new WebSocketFrame(){Header = WebsocketFrameHeader.HeaderDefault(),WebSocketPayload = Array.Empty<byte>()};
pongFrame.Header.Opcode = WebSocketReader.OpCode.Pong;
pongFrame.Header.IsEnd = true;
SendSocket(pongFrame.ToBytes());
@@ -960,7 +961,7 @@ dec 0 1 2 3
* When reading these, the frames are possibly fragmented and interleaved with control frames
* the fragmented frames are not interleaved with data frames. Just control frames
*/
public static readonly WebSocketFrame DefaultFrame = new WebSocketFrame(){Header = new WebsocketFrameHeader(),WebSocketPayload = new byte[0]};
public static readonly WebSocketFrame DefaultFrame = new WebSocketFrame(){Header = new WebsocketFrameHeader(),WebSocketPayload = Array.Empty<byte>()};
public WebsocketFrameHeader Header;
public byte[] WebSocketPayload;

View File

@@ -2419,7 +2419,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
packet.FolderData[0].FolderID = UUID.Zero;
packet.FolderData[0].ParentID = UUID.Zero;
packet.FolderData[0].Type = -1;
packet.FolderData[0].Name = new byte[0];
packet.FolderData[0].Name = Array.Empty<byte>();
}
private void AddNullItemBlockToDescendentsPacket(ref InventoryDescendentsPacket packet)
@@ -3106,7 +3106,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
alertPack.AlertInfo = new AlertMessagePacket.AlertInfoBlock[1];
alertPack.AlertInfo[0] = new AlertMessagePacket.AlertInfoBlock();
alertPack.AlertInfo[0].Message = Util.StringToBytes256(info);
alertPack.AlertInfo[0].ExtraParams = new Byte[0];
alertPack.AlertInfo[0].ExtraParams = Array.Empty<byte>();
OutPacket(alertPack, ThrottleOutPacketType.Task);
}
@@ -3717,7 +3717,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (land.Description != null && land.Description != String.Empty)
reply.Data.Desc = Utils.StringToBytes(land.Description.Substring(0, land.Description.Length > 254 ? 254: land.Description.Length));
else
reply.Data.Desc = new Byte[0];
reply.Data.Desc = Array.Empty<byte>();
reply.Data.ActualArea = land.Area;
reply.Data.BillableArea = land.Area; // TODO: what is this?
@@ -4373,7 +4373,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
gmp.MethodData.Method = Util.StringToBytes256("emptymutelist");
gmp.ParamList = new GenericMessagePacket.ParamListBlock[1];
gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock();
gmp.ParamList[0].Parameter = new byte[0];
gmp.ParamList[0].Parameter = Array.Empty<byte>();
OutPacket(gmp, ThrottleOutPacketType.Task);
}
@@ -12626,7 +12626,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int idx = cachedtex.WearableData[i].TextureIndex;
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
cachedresp.WearableData[i].HostName = new byte[0];
cachedresp.WearableData[i].HostName = Array.Empty<byte>();
if (cachedtex.WearableData[i].ID == cacheItems[idx].CacheId)
{
cachedresp.WearableData[i].TextureID = cacheItems[idx].TextureID;
@@ -12645,7 +12645,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
cachedresp.WearableData[i] = new AgentCachedTextureResponsePacket.WearableDataBlock();
cachedresp.WearableData[i].TextureIndex = cachedtex.WearableData[i].TextureIndex;
cachedresp.WearableData[i].TextureID = UUID.Zero;
cachedresp.WearableData[i].HostName = new byte[0];
cachedresp.WearableData[i].HostName = Array.Empty<byte>();
}
}

View File

@@ -247,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
// "[ASSET XFER UPLOADER]: Requesting Xfer of asset {0}, type {1}, transfer id {2} from {3}",
// m_asset.FullID, m_asset.Type, XferID, ourClient.Name);
ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, new byte[0]);
ourClient.SendXferRequest(XferID, m_asset.Type, m_asset.FullID, 0, Array.Empty<byte>());
}
protected void SendCompleteMessage()

View File

@@ -322,7 +322,7 @@ namespace OpenSim.Region.CoreModules.Agent.Xfer
public class XferDownLoad
{
public IClientAPI remoteClient;
public byte[] Data = new byte[0];
public byte[] Data = Array.Empty<byte>();
public string FileName = String.Empty;
public ulong XferID = 0;
public bool isDeleted = false;

View File

@@ -142,7 +142,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
client.FirstName+" "+client.LastName,
destID, (byte)211, false,
String.Empty,
transactionID, false, new Vector3(), new byte[0], true),
transactionID, false, new Vector3(), Array.Empty<byte>(), true),
delegate(bool success) {} );
}
}

View File

@@ -305,7 +305,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
// fid is not a UUID...
if (Util.ParseUniversalUserIdentifier(fid, out agentID, out string url, out string f, out string l, out string tmp))
{
if (!agentID.Equals(UUID.Zero))
if (agentID.IsNotZero())
{
m_uMan.AddUser(agentID, f, l, url);

View File

@@ -225,7 +225,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
uint ParentEstateID=0;
Vector3 Position = Vector3.Zero;
UUID RegionID = UUID.Zero ;
byte[] binaryBucket = new byte[0];
byte[] binaryBucket = Array.Empty<byte>();
float pos_x = 0;
float pos_y = 0;
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
string requestData3 = (string)requestData["binary_bucket"];
if (string.IsNullOrEmpty(requestData3))
{
binaryBucket = new byte[0];
binaryBucket = Array.Empty<byte>();
}
else
{

View File

@@ -196,7 +196,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
client.FirstName+" "+client.LastName, targetid,
(byte)InstantMessageDialog.RequestTeleport, false,
message, sessionID, false, presence.AbsolutePosition,
new Byte[0], true);
Array.Empty<byte>(), true);
m.RegionID = client.Scene.RegionInfo.RegionID.Guid;
m_log.DebugFormat("[HG LURE MODULE]: RequestTeleport sessionID={0}, regionID={1}, message={2}", m.imSessionID, m.RegionID, m.message);

View File

@@ -180,7 +180,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
client.FirstName+" "+client.LastName, targetid,
(byte)InstantMessageDialog.GodLikeRequestTeleport, false,
message, dest, false, presence.AbsolutePosition,
new Byte[0], true);
Array.Empty<byte>(), true);
}
else
{
@@ -188,7 +188,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Lure
client.FirstName+" "+client.LastName, targetid,
(byte)InstantMessageDialog.RequestTeleport, false,
message, dest, false, presence.AbsolutePosition,
new Byte[0], true);
Array.Empty<byte>(), true);
}
if (m_TransferModule != null)

View File

@@ -567,7 +567,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
if(backImage == null)
{
SetAlpha(ref image1, newAlpha);
byte[] result = new byte[0];
byte[] result = Array.Empty<byte>();
try
{
@@ -597,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
image1.Dispose();
image2.Dispose();
byte[] result = new byte[0];
byte[] result = Array.Empty<byte>();
try
{

View File

@@ -201,7 +201,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL
RequestState state = (RequestState) result.AsyncState;
WebRequest request = (WebRequest) state.Request;
Stream stream = null;
byte[] imageJ2000 = new byte[0];
byte[] imageJ2000 = Array.Empty<byte>();
Size newSize = new Size(0, 0);
HttpWebResponse response = null;

View File

@@ -382,7 +382,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
GDIDraw(data, graph, altDataDelim, out reuseable);
}
byte[] imageJ2000 = new byte[0];
byte[] imageJ2000 = Array.Empty<byte>();
// This code exists for testing purposes, please do not remove.
// if (s_flipper)

View File

@@ -187,7 +187,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
private bool Call(GridRegion region, Dictionary<string, object> sendData)
{
string reqString = ServerUtils.BuildQueryString(sendData);
// m_log.DebugFormat("[XESTATE CONNECTOR]: queryString = {0}", reqString);
// m_log.DebugFormat("[ESTATE CONNECTOR]: queryString = {0}", reqString);
try
{
//string url = "";
@@ -207,11 +207,11 @@ namespace OpenSim.Region.CoreModules.World.Estate
return indx > 0;
}
else
m_log.DebugFormat("[XESTATE CONNECTOR]: received empty reply");
m_log.DebugFormat("[ESTATE CONNECTOR]: received empty reply");
}
catch (Exception e)
{
m_log.DebugFormat("[XESTATE CONNECTOR]: Exception when contacting remote sim: {0}", e.Message);
m_log.DebugFormat("[ESTATE CONNECTOR]: Exception when contacting remote sim: {0}", e.Message);
}
return false;

View File

@@ -52,7 +52,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
m_asset = new AssetBase(UUID.Zero, pClientFilename, type, pRemoteClient.AgentId.ToString())
{
Data = new byte[0],
Data = Array.Empty<byte>(),
Description = "empty",
Local = true,
Temporary = true

View File

@@ -232,7 +232,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
// this has to be called with a lock on m_scene
protected virtual void AddHandlers()
{
myMapImageJPEG = new byte[0];
myMapImageJPEG = Array.Empty<byte>();
string regionimage = "regionImage" + m_scene.RegionInfo.RegionID.ToString();
regionimage = regionimage.Replace("-", "");
@@ -1576,7 +1576,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{
m_scene.AssetService.Delete(lastID.ToString());
m_scene.RegionInfo.RegionSettings.TerrainImageID = UUID.Zero;
myMapImageJPEG = new byte[0];
myMapImageJPEG = Array.Empty<byte>();
needRegionSave = true;
}

View File

@@ -730,7 +730,7 @@ namespace OpenSim.Region.Framework.Scenes
if(m_particleSystemExpire > 0 && Util.GetTimeStamp() > m_particleSystemExpire)
{
m_particleSystemExpire = -1;
m_particleSystem = new byte[0];
m_particleSystem = Array.Empty<byte>();
}
return m_particleSystem;
}
@@ -1950,7 +1950,7 @@ namespace OpenSim.Region.Framework.Scenes
public void RemoveParticleSystem()
{
m_particleSystem = new byte[0];
m_particleSystem = Array.Empty<byte>();
}
public void AddTextureAnimation(Primitive.TextureAnimation pTexAnim)

View File

@@ -47,8 +47,8 @@ namespace OpenSim.Region.Framework.Scenes
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private byte[] m_inventoryFileData = new byte[0];
private byte[] m_inventoryFileNameBytes = new byte[0];
private byte[] m_inventoryFileData = Array.Empty<byte>();
private byte[] m_inventoryFileNameBytes = Array.Empty<byte>();
private string m_inventoryFileName = "";
private uint m_inventoryFileNameSerial = 0;
private bool m_inventoryPrivileged = false;
@@ -1350,14 +1350,14 @@ namespace OpenSim.Region.Framework.Scenes
if (m_inventorySerial == 0) // No inventory
{
m_items.LockItemsForRead(false);
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
client.SendTaskInventory(m_part.UUID, 0, Array.Empty<byte>());
return;
}
if (m_items.Count == 0) // No inventory
{
m_items.LockItemsForRead(false);
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
client.SendTaskInventory(m_part.UUID, 0, Array.Empty<byte>());
return;
}
@@ -1466,7 +1466,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
client.SendTaskInventory(m_part.UUID, 0, new byte[0]);
client.SendTaskInventory(m_part.UUID, 0, Array.Empty<byte>());
}
}

View File

@@ -1474,7 +1474,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
}
public byte[] GetThrottlesPacked(float multiplier)
{
return new byte[0];
return Array.Empty<byte>();
}
#pragma warning disable 0067

View File

@@ -454,7 +454,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = UUID.Zero.Guid;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>();
OutgoingInstantMessage(msg, inviteInfo.AgentID);
@@ -1222,7 +1222,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
msg.timestamp = (uint)Util.UnixTimeSinceEpoch();
msg.fromAgentName = string.Empty;
msg.message = string.Empty;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>();
}
return msg;
@@ -1365,7 +1365,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = regionInfo.RegionID.Guid;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>();
OutgoingInstantMessage(msg, ejecteeID);
// Message to ejector
@@ -1386,7 +1386,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups
msg.ParentEstateID = 0;
msg.Position = Vector3.Zero;
msg.RegionID = regionInfo.RegionID.Guid;
msg.binaryBucket = new byte[0];
msg.binaryBucket = Array.Empty<byte>();
OutgoingInstantMessage(msg, agentID);
}

View File

@@ -356,7 +356,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule
client.SendAlertMessage(e.Message + " ");
}
client.SendMoneyBalance(TransactionID, true, new byte[0], returnfunds, 0, UUID.Zero, false, UUID.Zero, false, 0, String.Empty);
client.SendMoneyBalance(TransactionID, true, Array.Empty<byte>(), returnfunds, 0, UUID.Zero, false, UUID.Zero, false, 0, String.Empty);
}
else
{

View File

@@ -208,7 +208,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
OnInstantMessage(this, new GridInstantMessage(m_scene,
m_uuid, m_firstname + " " + m_lastname,
target, 0, false, message,
UUID.Zero, false, Position, new byte[0], true));
UUID.Zero, false, Position, Array.Empty<byte>(), true));
}
public void SendAgentOffline(UUID[] agentIDs)
@@ -705,7 +705,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
}
public byte[] GetThrottlesPacked(float multiplier)
{
return new byte[0];
return Array.Empty<byte>();
}

View File

@@ -113,7 +113,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
int width, int height, bool usetex)
{
if (!m_Enabled)
return new Byte[0];
return Array.Empty<byte>();
using (Bitmap bmp = m_Generator.CreateViewImage(pos, rot, fov, width, height, usetex))
{

View File

@@ -82,7 +82,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
m_log.Debug("[WORLDVIEW]: Exception: " + e.ToString());
}
return new Byte[0];
return Array.Empty<byte>();
}
public Byte[] SendWorldView(Dictionary<string, object> request)
@@ -99,25 +99,25 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
bool usetex;
if (!request.ContainsKey("posX"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("posY"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("posZ"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("rotX"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("rotY"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("rotZ"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("fov"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("width"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("height"))
return new Byte[0];
return Array.Empty<byte>();
if (!request.ContainsKey("usetex"))
return new Byte[0];
return Array.Empty<byte>();
try
{
@@ -134,7 +134,7 @@ namespace OpenSim.Region.OptionalModules.World.WorldView
}
catch
{
return new Byte[0];
return Array.Empty<byte>();
}
Vector3 pos = new Vector3(posX, posY, posZ);

View File

@@ -566,7 +566,7 @@ public class BSShapeMesh : BSShape
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
{
// Release the fetched asset data once it has been used.
pbs.SculptData = new byte[0];
pbs.SculptData = Array.Empty<byte>();
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Unknown;
}
@@ -816,7 +816,7 @@ public class BSShapeHull : BSShape
if (prim.PrimAssetState == BSPhysObject.PrimAssetCondition.Fetched)
{
// Release the fetched asset data once it has been used.
pbs.SculptData = new byte[0];
pbs.SculptData = Array.Empty<byte>();
prim.PrimAssetState = BSPhysObject.PrimAssetCondition.Unknown;
}

View File

@@ -68,7 +68,7 @@ namespace OpenSim.Server.Handlers.Asset
protected override byte[] ProcessRequest(string path, Stream request,
IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
{
byte[] result = new byte[0];
byte[] result = Array.Empty<byte>();
string[] p = SplitParams(path);
@@ -88,7 +88,7 @@ namespace OpenSim.Server.Handlers.Asset
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
else
{
@@ -112,7 +112,7 @@ namespace OpenSim.Server.Handlers.Asset
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
}
else
@@ -120,7 +120,7 @@ namespace OpenSim.Server.Handlers.Asset
// Unknown request
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
}
else if (p.Length == 1)
@@ -142,7 +142,7 @@ namespace OpenSim.Server.Handlers.Asset
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
}
else
@@ -150,7 +150,7 @@ namespace OpenSim.Server.Handlers.Asset
// Unknown request
httpResponse.StatusCode = (int)HttpStatusCode.BadRequest;
httpResponse.ContentType = "text/plain";
result = new byte[0];
result = Array.Empty<byte>();
}
if (httpResponse.StatusCode == (int)HttpStatusCode.NotFound && !string.IsNullOrEmpty(m_RedirectURL) && !string.IsNullOrEmpty(id))

View File

@@ -187,7 +187,7 @@ namespace OpenSim.Server.Handlers.Authentication
private byte[] DoEncryptedMethods(byte[] ciphertext)
{
return new byte[0];
return Array.Empty<byte>();
}
private byte[] SuccessResult()

View File

@@ -80,7 +80,7 @@ namespace OpenSim.Server.Handlers.BakedTextures
catch
{
}
return new byte[0];
return Array.Empty<byte>();
}
public void Store(string id, byte[] data, int dataLength)

View File

@@ -47,9 +47,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
{
public class InstantMessageServerConnector : ServiceConnector
{
private static readonly ILog m_log =
LogManager.GetLogger(
MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
private IInstantMessage m_IMService;
@@ -105,7 +103,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
uint ParentEstateID = 0;
Vector3 Position = Vector3.Zero;
UUID RegionID = UUID.Zero;
byte[] binaryBucket = new byte[0];
byte[] binaryBucket = Array.Empty<byte>();
float pos_x = 0;
float pos_y = 0;
@@ -198,7 +196,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
string requestData3 = (string)requestData["binary_bucket"];
if (string.IsNullOrEmpty(requestData3))
{
binaryBucket = new byte[0];
binaryBucket = Array.Empty<byte>();
}
else
{
@@ -235,10 +233,7 @@ namespace OpenSim.Server.Handlers.Hypergrid
// calling region uses this to know when to look up a user's location again.
XmlRpcResponse resp = new XmlRpcResponse();
Hashtable respdata = new Hashtable();
if (successful)
respdata["success"] = "TRUE";
else
respdata["success"] = "FALSE";
respdata["success"] = successful ? "TRUE" : "FALSE";
resp.Value = respdata;
return resp;

View File

@@ -88,10 +88,10 @@ namespace OpenSim.Server.Handlers.MapImage
{
httpResponse.StatusCode = (int)HttpStatusCode.ServiceUnavailable;
httpResponse.AddHeader("Retry-After", "10");
return new byte[0];
return Array.Empty<byte>();
}
byte[] result = new byte[0];
byte[] result = Array.Empty<byte>();
string format = string.Empty;
//UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
@@ -119,7 +119,7 @@ namespace OpenSim.Server.Handlers.MapImage
{
httpResponse.StatusCode = (int)HttpStatusCode.NotFound;
httpResponse.ContentType = "text/plain";
return new byte[0];
return Array.Empty<byte>();
}
result = m_MapService.GetMapTile(path, scopeID, out format);

View File

@@ -596,7 +596,7 @@ namespace OpenSim.Services.FSAssetService
}
catch (Exception)
{
return new Byte[0];
return Array.Empty<byte>();
}
}
else if (File.Exists(diskFile))
@@ -611,7 +611,7 @@ namespace OpenSim.Services.FSAssetService
{
}
}
return new Byte[0];
return Array.Empty<byte>();
}

View File

@@ -256,7 +256,7 @@ namespace OpenSim.Services.MapImageService
else
{
//m_log.DebugFormat("[MAP IMAGE SERVICE]: unable to get file {0}", fileName);
return new byte[0];
return Array.Empty<byte>();
}
}
}

View File

@@ -84,7 +84,7 @@ namespace OpenSim.Services.EstateService
MuteData[] data = m_database.Get(agentID);
if (data == null || data.Length == 0)
return new Byte[0];
return Array.Empty<byte>();
StringBuilder sb = new StringBuilder(16384);
foreach (MuteData d in data)
@@ -101,7 +101,7 @@ namespace OpenSim.Services.EstateService
if (dataCrc == crc)
{
if(crc == 0)
return new Byte[0];
return Array.Empty<byte>();
Byte[] ret = new Byte[1] {1};
return ret;

View File

@@ -619,7 +619,7 @@ namespace OpenSim.Tests.Common
public byte[] GetThrottlesPacked(float multiplier)
{
return new byte[0];
return Array.Empty<byte>();
}
public virtual void SendAnimations(UUID[] animations, int[] seqs, UUID sourceAgentId, UUID[] objectIDs)

View File

@@ -221,7 +221,7 @@ namespace OpenSim.Tests.Common
public byte[] EndEventToBytes(osUTF8 sb)
{
return new byte[0];
return Array.Empty<byte>();
}
}
}