-
-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Updates more logging to Serilog (#1105)
Adds more serilog logging and cleans up some server files.
- Loading branch information
1 parent
1cf4a43
commit 38686c0
Showing
30 changed files
with
1,981 additions
and
1,954 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,60 @@ | ||
/************************************************************************* | ||
* ModernUO * | ||
* Copyright 2019-2022 - ModernUO Development Team * | ||
* Email: [email protected] * | ||
* File: ItemBounds.cs * | ||
* * | ||
* 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. * | ||
* * | ||
* 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 System; | ||
using System.IO; | ||
using Server.Logging; | ||
|
||
namespace Server; | ||
|
||
namespace Server | ||
public static class ItemBounds | ||
{ | ||
public static class ItemBounds | ||
private static readonly ILogger logger = LogFactory.GetLogger(typeof(ItemBounds)); | ||
|
||
static ItemBounds() | ||
{ | ||
static ItemBounds() | ||
Table = new Rectangle2D[TileData.ItemTable.Length]; | ||
|
||
if (!File.Exists("Data/Binary/Bounds.bin")) | ||
{ | ||
Table = new Rectangle2D[TileData.ItemTable.Length]; | ||
|
||
if (File.Exists("Data/Binary/Bounds.bin")) | ||
{ | ||
using var fs = new FileStream( | ||
"Data/Binary/Bounds.bin", | ||
FileMode.Open, | ||
FileAccess.Read, | ||
FileShare.Read | ||
); | ||
var bin = new BinaryReader(fs); | ||
|
||
var count = Math.Min(Table.Length, (int)(fs.Length / 8)); | ||
|
||
for (var i = 0; i < count; ++i) | ||
{ | ||
int xMin = bin.ReadInt16(); | ||
int yMin = bin.ReadInt16(); | ||
int xMax = bin.ReadInt16(); | ||
int yMax = bin.ReadInt16(); | ||
|
||
Table[i].Set(xMin, yMin, xMax - xMin + 1, yMax - yMin + 1); | ||
} | ||
|
||
bin.Close(); | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Warning: Data/Binary/Bounds.bin does not exist"); | ||
} | ||
logger.Error("Data/Binary/Bounds.bin does not exist"); | ||
return; | ||
} | ||
|
||
public static Rectangle2D[] Table { get; } | ||
using var fs = new FileStream( | ||
"Data/Binary/Bounds.bin", | ||
FileMode.Open, | ||
FileAccess.Read, | ||
FileShare.Read | ||
); | ||
var bin = new BinaryReader(fs); | ||
|
||
var count = Math.Min(Table.Length, (int)(fs.Length / 8)); | ||
|
||
for (var i = 0; i < count; ++i) | ||
{ | ||
int xMin = bin.ReadInt16(); | ||
int yMin = bin.ReadInt16(); | ||
int xMax = bin.ReadInt16(); | ||
int yMax = bin.ReadInt16(); | ||
|
||
Table[i].Set(xMin, yMin, xMax - xMin + 1, yMax - yMin + 1); | ||
} | ||
|
||
bin.Close(); | ||
} | ||
|
||
public static Rectangle2D[] Table { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.