00001 using System;
00002 using Microsoft.Win32;
00003
00004 namespace Common
00005 {
00009 public class CommonSettings {
00010 private RegistryKey regKey;
00011
00012 public CommonSettings() {
00013 regKey = Registry.CurrentUser.OpenSubKey("Software\\University of Cambridge\\GPRSWeb\\Common", true);
00014 }
00015
00016 private string cacheLocation = null;
00017 public string CacheLocation {
00018 get {
00019 if (cacheLocation == null) {
00020 cacheLocation = (string)regKey.GetValue("CacheLocation");
00021 }
00022 if (cacheLocation != null) {
00023 return cacheLocation;
00024 } else {
00025 throw new ApplicationException("Unable to fetch Cache Location: none set in registry");
00026 }
00027 }
00028 }
00029
00030 private string cacheFileExtension = null;
00031 public string CacheFileExtension {
00032 get {
00033 if (cacheFileExtension == null) {
00034 cacheFileExtension = (string)regKey.GetValue("CacheFileExtension");
00035 }
00036 if (cacheFileExtension != null) {
00037 return cacheFileExtension;
00038 } else {
00039 throw new ApplicationException("Unable to fetch Cache File Extension: none set in registry");
00040 }
00041 }
00042 }
00043 }
00044 }