예제 #1
0
 protected sealed override bool InternalConvert(ConversionTarget file, ConversionType initialState, ConversionType targetState)
 {
     if (this.GetVersion(file) == targetState)
     {
         return(true);
     }
     if (!ProjectPathHelper.AttemptToMakeWritable(file.ProjectStore.DocumentReference, base.Context))
     {
         return(false);
     }
     if (!this.UpgradeProject(file.ProjectStore, initialState, targetState))
     {
         return(false);
     }
     file.ProjectStore.Save();
     return(true);
 }
예제 #2
0
 protected bool AttemptToMakeWriteable(DocumentReference documentReference)
 {
     return(ProjectPathHelper.AttemptToMakeWritable(documentReference, this.Context));
 }
        private void TryDeleteFile(string fileName, string projectPath)
        {
            string str = Microsoft.Expression.Framework.Documents.PathHelper.ResolveRelativePath(Path.GetDirectoryName(projectPath), fileName);

            if (Microsoft.Expression.Framework.Documents.PathHelper.FileExists(str) && ProjectPathHelper.AttemptToMakeWritable(DocumentReference.Create(str), base.Context))
            {
                Microsoft.Expression.Framework.Documents.PathHelper.ClearFileOrDirectoryReadOnlyAttribute(str);
                File.Delete(str);
            }
        }