コード例 #1
0
 protected void Load()
 {
     RootDirectory.Refresh();
     if (RootDirectory.Exists)
     {
         NamedProfigurations = new Dictionary <string, Profiguration>();
         FileInfo[] files = RootDirectory.GetFiles();
         files.Each(file =>
         {
             if (file.HasNoExtension())
             {
                 NamedProfigurations[file.Name] = Profiguration.Load(file.FullName);
             }
         });
     }
 }
コード例 #2
0
        /// <summary>
        /// Get the profiguration of the specified name, creating it
        /// if necessary.
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        protected internal Profiguration Get(string name)
        {
            lock (_writeLock)
            {
                Profiguration result = new Profiguration();
                string        path   = Path.Combine(RootDirectory.FullName, name);
                if (File.Exists(path))
                {
                    result = Profiguration.Load(path);
                }
                else
                {
                    result.Save(path);
                }

                NamedProfigurations[name] = result;
                return(result);
            }
        }