private bool clear_dest_attributes(string destination_file, WIN32_FIND_DATA dest_data) { var fa_existing = dest_data.dwFileAttributes; var fa_needed = dest_data.dwFileAttributes; if ((fa_existing & FileAttributes.Hidden) == FileAttributes.Hidden) { if ((options & CopyEngineOptions.AllowClearAttributes) == CopyEngineOptions.AllowClearAttributes) { fa_needed = ~((~fa_existing) | FileAttributes.Hidden); } else { if (!process_error (string.Format (Options.GetLiteral(Options.LANG_DESTINATION_0_EXISTS_AND_HIDDEN_CLEARING_ATTRS_PROHIBITED), destination_file), null)) { stop(); } return(false); } } if ((fa_existing & FileAttributes.ReadOnly) == FileAttributes.ReadOnly) { if ((options & CopyEngineOptions.AllowClearAttributes) == CopyEngineOptions.AllowClearAttributes) { fa_needed = ~((~fa_existing) | FileAttributes.ReadOnly); } else { if (!process_error (string.Format (Options.GetLiteral(Options.LANG_DESTINATION_0_EXISTS_AND_READONLY_CLEARING_ATTRS_PROHIBITED), destination_file), null)) { stop(); } return(false); } } if (fa_existing != fa_needed) { try { WinAPiFSwrapper.SetFileAttributes(destination_file, fa_needed); } catch (Exception ex) { if (!process_error (string.Format (Options.GetLiteral(Options.LANG_CANNOT_CLEAR_HIDDEN_READONLY_ATTR_DESTINATION_0), destination_file), ex)) { stop(); } return(false); } } return(true); }