Пример #1
0
        /// <summary>
        /// Determines if the project file at the specified path is locked.
        /// </summary>
        public static bool IsProjectLocked(string projectPath)
        {
            string ext = Path.GetExtension(projectPath);

            return(ext != null && ext.Equals(FdoFileHelper.ksFwDataXmlFileExtension, StringComparison.InvariantCultureIgnoreCase) &&
                   XMLBackendProvider.IsProjectLocked(projectPath));
        }
Пример #2
0
        /// <summary>
        /// This method will lock the current project in the cache given this service
        /// </summary>
        public static void LockCurrentProject(FdoCache cache)
        {
            //Make sure all the changes the user has made are on the disc before we begin.
            // Make sure any changes we want backup are saved.
            var ds = cache.ServiceLocator.GetInstance <IDataStorer>() as XMLBackendProvider;

            if (ds != null)
            {
                // REVIEW (EberhardB): I'm not sure this works as intended: XMLBackendProvider.LockProject
                // returns a FileStream, but XMLBackendProvider.UnlockProject works on a private
                // variable.
                using (XMLBackendProvider.LockProject(cache.ProjectId.Path)) { }
            }
        }