Skip to content

Commit

Permalink
Merge pull request #166 from Commander-Scott/master
Browse files Browse the repository at this point in the history
Fixes for issues #146, #151, #153
  • Loading branch information
Moustachauve committed Sep 22, 2014
2 parents 846abc2 + 9d65a2b commit 267be6a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 13 deletions.
11 changes: 7 additions & 4 deletions SEModAPI/API/Definitions/DedicatedConfigDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Xml;

using Sandbox.Common.ObjectBuilders;
using System.Linq;

namespace SEModAPI.API.Definitions
{
Expand Down Expand Up @@ -681,13 +682,15 @@ public int AsteroidAmount
/// <summary>
/// Get or set the list of administrators of the server
/// </summary>
public List<string> Administrators
public BindingList<string> Administrators
{
get { return m_definition.Administrators; }
get
{
return new BindingList<string>(m_definition.Administrators);
}
set
{
if (m_definition.Administrators == value) return;
m_definition.Administrators = value;
m_definition.Administrators = value.ToList();
Changed = true;
}
}
Expand Down
6 changes: 4 additions & 2 deletions SEModAPIInternal/API/Common/WorldManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,15 @@ internal void InternalSaveWorld()
Type type = BackingObject.GetType();
Type[] argTypes = new Type[1];
argTypes[0] = typeof(string);

m_isSaving = true;
bool result = (bool)BaseObject.InvokeEntityMethod(BackingObject, WorldManagerSaveWorldMethod, new object[] { null }, argTypes);
m_isSaving = false;

if (result)
{
TimeSpan timeToSave = DateTime.Now - saveStartTime;
LogManager.APILog.WriteLineAndConsole("Save complete and took " + timeToSave.TotalSeconds + " seconds");
m_isSaving = false;

EntityEventManager.EntityEvent newEvent = new EntityEventManager.EntityEvent();
newEvent.type = EntityEventManager.EntityEventType.OnSectorSaved;
Expand All @@ -253,11 +255,11 @@ internal void InternalSaveWorld()
else
{
LogManager.APILog.WriteLineAndConsole("Save failed!");
m_isSaving = false;
}
}
catch (Exception ex)
{
m_isSaving = false;
LogManager.ErrorLog.WriteLine(ex);
}
}
Expand Down
16 changes: 9 additions & 7 deletions SEModAPIInternal/Support/LogManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,15 @@ public void WriteLineAndConsole(string msg)
return;

WriteLine(msg);

m_stringBuilder.Clear();
AppendDateAndTime(m_stringBuilder);
m_stringBuilder.Append(" - ");
m_stringBuilder.Append(msg);
Console.WriteLine(m_stringBuilder.ToString());
m_stringBuilder.Clear();
lock (_logLock)
{
m_stringBuilder.Clear();
AppendDateAndTime(m_stringBuilder);
m_stringBuilder.Append(" - ");
m_stringBuilder.Append(msg);
Console.WriteLine(m_stringBuilder.ToString());
m_stringBuilder.Clear();
}
}

private int GetThreadId()
Expand Down

0 comments on commit 267be6a

Please sign in to comment.