using Microsoft.Win32; using SanShared; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SanSystem { class Global { public static readonly Global instance = new Global(); const string userroot = "HKEY_CURRENT_USER\\Software"; const string firmkey = "Cosysda"; const string subkey = "SanManager"; const string speicherpfad_to_projekts = "projekte"; string projektpfad = "18-850"; public string ProjektNummer { get { return projektpfad; } set { projektpfad = value; } } public string Projektpfad { get { return Path.Combine(speicherpfad_to_projekts, projektpfad); } } public ILanguage language = null; public static Global Instance { get { return instance; } } void LadeRegistry() { string keyName = userroot + "\\" + firmkey + "\\" + subkey; string lastProjektNummer = ""; try { lastProjektNummer = Registry.GetValue(keyName, "LastProjekt", "").ToString(); ProjektNummer = lastProjektNummer; } catch { } } void SpeicherInRegistry() { string keyName = userroot + "\\" + firmkey + "\\" + subkey; Registry.SetValue(keyName, "LastProjekt", ProjektNummer); } public void LoadLanguage() { language = Language.Language.GetLanguage(Language.BUILTINLANGUAGES.GERMAN); } public Global() { LadeRegistry(); } ~Global() { SpeicherInRegistry(); } } }