public void TestSetupData()
 {
     _objCache = new HdCache();
     if (_testData.Count == 0)
     {
         _testData.Add("roses", "red");
         _testData.Add("fish", "blue");
         _testData.Add("sugar", "sweet");
         _testData.Add("number", "4");
     }
 }
Esempio n. 2
0
        /// <summary>
        /// This is the main constructor for the class HD4
        /// </summary>
        /// <param name="request">Curret Request Object</param>
        /// <param name="configuration">config can be an array of config options or a fully qualified path to an alternate config file.</param>
        public Hd4(HttpRequest request, dynamic configuration = null)
        {
            _request = request;
            if (configuration != null && configuration is IDictionary)
            {
                foreach (KeyValuePair <string, string> item in (Dictionary <string, string>)configuration)
                {
                    if (Config.ContainsKey(item.Key))
                    {
                        Config[item.Key] = item.Value;
                    }
                    else
                    {
                        Config.Add(item.Key, item.Value);
                    }
                }
            }
            else if (configuration != null && configuration is string && File.Exists(ApplicationRootDirectory + configuration))
            {
                AddConfigSettingFromFile(ApplicationRootDirectory + configuration);
            }
            else if (!File.Exists(ApplicationRootDirectory + _configFile))
            {
                throw new Exception("Error : Invalid config file and no config passed to constructor");
            }
            else
            {
                AddConfigSettingFromFile(ApplicationRootDirectory + _configFile);
            }

            _store = HdStore.Instance;
            _store.SetPath(Config["filesdir"], true);

            _cache  = new HdCache();
            _device = new HdDevice();

            Setup();
        }
Esempio n. 3
0
 private HdStore()
 {
     _path     = ApplicationRootDirectory;
     Directory = _path + "\\" + Dirname;
     _cache    = new HdCache();
 }