// WideMargin. Simple fast bible software.
// Copyright (C) 2011  Daniel Hughes
// 
// 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 System;
using System.Reflection;
using System.IO;

namespace WideMargin.Database
{
	/// <summary>
	/// Holds information about Wide Margin
	/// </summary>
	public class AboutInfo
	{
		private static AboutInfo _instance;
		
		/// <summary>
		/// Constructor
		/// </summary>
		private AboutInfo ()
		{
			Version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
			ReleaseType = string.Empty;
		}
		
		/// <summary>
		/// Gets the AboutInfo instance
		/// </summary>
		/// <returns>AboutInfo instance</returns>
		public static AboutInfo Get()
		{
			if(_instance == null)
			{
				_instance = new AboutInfo ();
			}
			return _instance;
		}
		
		/// <summary>
		/// Release type (Alpha, Beta, Empty for Full)
		/// </summary>
		public string ReleaseType
		{
			get;
			private set;
		}
		
		/// <summary>
		/// Application version number
		/// </summary>
		public string Version
		{
			get;
			private set;
		}
		
		/// <summary>
		/// About info with markup for humans
		/// </summary>
		/// <returns>About info</returns>
		public string GetAboutInfo()
		{
			string filePath = WideMarginPaths.GetApplicationDataFile("AboutBoxText.xml");
			string rawAboutText = File.ReadAllText(filePath);
			return string.Format(rawAboutText, Version, ReleaseType);
		}
	}
}

