Exemplo n.º 1
0
        //;

        /// <summary>
        /// Show a message box of any files that were cleared of their read-only tag.
        /// </summary>
        internal void FixReadonlyResults()
        {
            if ((FilesReadOnlytoFix.Count > 0) && (fixreadonlyActive == 0))
            {
                string       listoffixedreadonlyfiles = FilesReadOnlytoFix.Aggregate((current, file) => current + (file + "\n"));
                DialogResult dr =
                    MessageBox.Show(listoffixedreadonlyfiles + @"Read-Only must be un-set to change date. Continue?",
                                    @"PEBKAC Error ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    foreach (string file in FilesReadOnlytoFix)
                    {
                        FileAttributes fileattribs = File.GetAttributes(file);
                        File.SetAttributes(file, SharedHelper.RemoveAttributes(fileattribs, FileAttributes.ReadOnly));
                    }
                    DialogResult dr2 = MessageBox.Show(@"Turn read-only back on when the confirm window is closed?",
                                                       @"PEBKAC Error ", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (dr2 == DialogResult.No)
                    {
                        FilesReadOnlytoFix.Clear();
                    }
                    else
                    {
                        fixreadonlyActive = FilesReadOnlytoFix.Count;
                    }
                }
                else
                {
                    FilesReadOnlytoFix.Clear();
                }
            }
            else if (fixreadonlyActive > 0)
            {
                ResetReadOnly();
                fixreadonlyActive = 0;
            }
        }