/*
* BuildingPlacementLogger.cs
* Authors: Bradley R. Blankenship
* Copyright (c) 2007-2008 Cornell University
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 2
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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
using System;
using Util;
namespace ColonySim
{
///
/// Logs the order of placing and removing buildings within the Colony
/// Simulator.
///
internal class StructurePlacementLogger : IDisposable
{
#region Fields
// The logger for logging the building placement, etc.
private readonly Logger mLogger;
#endregion
#region Constructs
///
/// The base constructor
///
public StructurePlacementLogger()
{
// Create the logger
mLogger = new Logger(GameScreen.GlobalRootStorageDirectory + UserProfileUtility.OutputDirectory + "BuildingPlacementLog.log", false);
}
#endregion
#region Initialization
///
/// Initialize the internal logging object.
///
public void Initialize()
{
// Initialize the logger
mLogger.Initialize();
}
///
/// Dispose of the internal logging object.
///
public void Dispose()
{
// Dispose the logger
mLogger.Dispose();
}
#endregion
#region Logging Methods
///
/// Logs that the given building was placed.
///
/// The building to log.
public void LogAddition(Structures.Structure structure)
{
// Write out that the given building was added
mLogger.Write("Structure Added " + structure.Name +
" XPos " + structure.GridPosition.X + " YPos " + structure.GridPosition.Y +
" XSize " + structure.AreaRectangle.Width + " YSize " + structure.AreaRectangle.Height);
}
///
/// Logs that the given building was removed.
///
/// The building to log.
public void LogRemoval(Structures.Structure structure)
{
// Write out that the given building was removed
mLogger.Write("Structure Removed: " + structure.Name +
" XPos " + structure.GridPosition.X + " YPos " + structure.GridPosition.Y +
" XSize " + structure.AreaRectangle.Width + " YSize " + structure.AreaRectangle.Height);
}
#endregion
}
}