Esempio n. 1
0
        //private static readonly Object StateLock = new object();
        /// <summary>
        /// Initializes the repository by searching for the vcsRoot of the file system in the configuration and initializing
        /// a FileSystemAdaptee, Cache and Config to keep track of the files under the repository structure.
        /// </summary>
        /// <exception cref="KeyNotFoundException">If the root directory could not be found</exception>
        private Repository()
        {
            // Read the config
            Config = Config.GetInstance();

            String root = Config["rootDirectory"];

            // Init file system
            FileSystem = new PieFileSystem(new FileSystem(root), this);

            // Create .pie folder if it does not exist
            if (!FileSystem.Exists(InputOutputLayer.FileSystem.META_DIR))
            {
                FileSystem.CreateDirectory(InputOutputLayer.FileSystem.META_DIR);
            }

            // Verify cache
            var vcs = new VersionControlSystem("", FileSystem);
            var cache = new Cache(vcs);
            cache.Verify();
        }
Esempio n. 2
0
 /// <summary>
 /// Retrieves the singleton instance.
 /// </summary>
 public static Config GetInstance()
 {
     //lock (FileLock)
     //{
         if (_instance == null)
         {
             _instance = new Config();
         }
         return _instance;
     //}
 }