From f5e7f1396d22ffc3bc65541b79fb1f3b94020bd9 Mon Sep 17 00:00:00 2001 From: inga-lovinde <52715130+inga-lovinde@users.noreply.github.com> Date: Sun, 6 Jun 2010 07:41:09 +0000 Subject: [PATCH] Core config initial commit --- Core/Config.cs | 33 +++++++++++++++++++++++++++++++++ Core/Core.csproj | 1 + 2 files changed, 34 insertions(+) create mode 100644 Core/Config.cs diff --git a/Core/Config.cs b/Core/Config.cs new file mode 100644 index 0000000..7a7fcce --- /dev/null +++ b/Core/Config.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace FLocal.Core { + + class Config where T : Config { + + private static Config _instance; + + public static Config instance { + get { + if(_instance == null) throw new FLocalException("not initialized"); + return _instance; + } + private set { + lock(_instance) { + if(_instance != null) throw new FLocalException("already initialized"); + _instance = value; + } + } + } + + private Config() { + } + + public static void doInit(Config config) { + _instance = config; + } + + } +} diff --git a/Core/Core.csproj b/Core/Core.csproj index 78eb99f..e36b53d 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -45,6 +45,7 @@ +