-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4d6aea5
Showing
36 changed files
with
7,492 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "defaults-edit/NSData+FastHex"] | ||
path = defaults-edit/NSData+FastHex | ||
url = https://github.com/jmah/NSData-FastHex.git |
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
defaults-edit.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
defaults-edit.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
Binary file added
BIN
+285 KB
...t.xcodeproj/project.xcworkspace/xcuserdata/ian.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
97 changes: 97 additions & 0 deletions
97
defaults-edit.xcodeproj/xcshareddata/xcschemes/defaults-edit.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "1020" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3C9A3FE2222F15AD00789FD0" | ||
BuildableName = "defaults-edit.app" | ||
BlueprintName = "defaults-edit" | ||
ReferencedContainer = "container:defaults-edit.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3C9A3FE2222F15AD00789FD0" | ||
BuildableName = "defaults-edit.app" | ||
BlueprintName = "defaults-edit" | ||
ReferencedContainer = "container:defaults-edit.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "YES" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3C9A3FE2222F15AD00789FD0" | ||
BuildableName = "defaults-edit.app" | ||
BlueprintName = "defaults-edit" | ||
ReferencedContainer = "container:defaults-edit.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<CommandLineArguments> | ||
<CommandLineArgument | ||
argument = "-NSBindingDebugLogLevel 1" | ||
isEnabled = "YES"> | ||
</CommandLineArgument> | ||
</CommandLineArguments> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "3C9A3FE2222F15AD00789FD0" | ||
BuildableName = "defaults-edit.app" | ||
BlueprintName = "defaults-edit" | ||
ReferencedContainer = "container:defaults-edit.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
82 changes: 82 additions & 0 deletions
82
defaults-edit.xcodeproj/xcuserdata/ian.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Bucket | ||
type = "1" | ||
version = "2.0"> | ||
<Breakpoints> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "Yes" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
scope = "0" | ||
stopOnStyle = "0"> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.SymbolicBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "Yes" | ||
symbolName = "-[NSViewController setRepresentedObject:]" | ||
moduleName = ""> | ||
<Actions> | ||
<BreakpointActionProxy | ||
ActionExtensionID = "Xcode.BreakpointAction.DebuggerCommand"> | ||
<ActionContent | ||
consoleCommand = "po [(id)$rdi title]"> | ||
</ActionContent> | ||
</BreakpointActionProxy> | ||
</Actions> | ||
<Locations> | ||
<Location | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
symbolName = "-[NSViewController setRepresentedObject:]" | ||
moduleName = "AppKit" | ||
usesParentBreakpointCondition = "Yes" | ||
offsetFromSymbolStart = "0"> | ||
</Location> | ||
</Locations> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
<BreakpointProxy | ||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint"> | ||
<BreakpointContent | ||
shouldBeEnabled = "No" | ||
ignoreCount = "0" | ||
continueAfterRunningActions = "No" | ||
filePath = "defaults-edit/NSValueTransformer+NameSynthesis.m" | ||
timestampString = "585078981.399932" | ||
startingColumnNumber = "9223372036854775807" | ||
endingColumnNumber = "9223372036854775807" | ||
startingLineNumber = "49" | ||
endingLineNumber = "49" | ||
landmarkName = "swizzleInstanceMethod()" | ||
landmarkType = "9"> | ||
<Actions> | ||
<BreakpointActionProxy | ||
ActionExtensionID = "Xcode.BreakpointAction.DebuggerCommand"> | ||
<ActionContent | ||
consoleCommand = "po clas"> | ||
</ActionContent> | ||
</BreakpointActionProxy> | ||
<BreakpointActionProxy | ||
ActionExtensionID = "Xcode.BreakpointAction.DebuggerCommand"> | ||
<ActionContent | ||
consoleCommand = "po targetSel"> | ||
</ActionContent> | ||
</BreakpointActionProxy> | ||
<BreakpointActionProxy | ||
ActionExtensionID = "Xcode.BreakpointAction.DebuggerCommand"> | ||
<ActionContent | ||
consoleCommand = "po newSel"> | ||
</ActionContent> | ||
</BreakpointActionProxy> | ||
</Actions> | ||
</BreakpointContent> | ||
</BreakpointProxy> | ||
</Breakpoints> | ||
</Bucket> |
22 changes: 22 additions & 0 deletions
22
defaults-edit.xcodeproj/xcuserdata/ian.xcuserdatad/xcschemes/xcschememanagement.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>SchemeUserState</key> | ||
<dict> | ||
<key>defaults-edit.xcscheme_^#shared#^_</key> | ||
<dict> | ||
<key>orderHint</key> | ||
<integer>0</integer> | ||
</dict> | ||
</dict> | ||
<key>SuppressBuildableAutocreation</key> | ||
<dict> | ||
<key>3C9A3FE2222F15AD00789FD0</key> | ||
<dict> | ||
<key>primary</key> | ||
<true/> | ||
</dict> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
// | ||
// AddSheetViewController.swift | ||
// defaults-edit | ||
// | ||
// Created by Ian Gregory on 15-03-2019. | ||
// Copyright © 2019 Ian Gregory. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
class AddSheetViewController: NSViewController, NSTextFieldDelegate { | ||
|
||
@IBOutlet var itemOC: NSObjectController! { | ||
get { | ||
return itemController.objectController | ||
} | ||
set { | ||
itemController = Controller<PlistItem>(wrapping: newValue) | ||
} | ||
} | ||
var itemController: Controller<PlistItem>! | ||
|
||
override func prepare(for segue: NSStoryboardSegue, sender: Any?) { | ||
switch segue.destinationController { | ||
case let typeAndValueEditorVC as TypeAndValueEditor: | ||
typeAndValueEditorVC.representedObject = itemOC | ||
default: | ||
return | ||
} | ||
} | ||
|
||
@IBAction func ok(_ sender: Any?) { | ||
guard itemOC.commitEditing() else { | ||
return | ||
} | ||
(presentingViewController as! PlistEditViewController).add(itemController.content!) | ||
dismiss(sender) | ||
} | ||
|
||
@IBOutlet var keyFieldInvalidDataMarker: InvalidDataMarker! | ||
|
||
} | ||
|
||
extension AddSheetViewController { | ||
|
||
func invalidDataMarker(for control: NSControl) -> InvalidDataMarker? { | ||
switch control.tag { | ||
case 7038329: return keyFieldInvalidDataMarker | ||
default: return nil | ||
} | ||
} | ||
|
||
func control(_ control: NSControl, didFailToValidatePartialString string: String, errorDescription error: String?) { | ||
guard | ||
let error = error, | ||
let marker = invalidDataMarker(for: control) | ||
else { | ||
return | ||
} | ||
marker.errorString = error | ||
marker.show() | ||
} | ||
|
||
@objc var validationErrorStrings: [String] { | ||
do { | ||
try itemController.content?.validate() | ||
} catch { | ||
return [error.localizedDescription] | ||
} | ||
return [] | ||
} | ||
@objc class func keyPathsForValuesAffectingValidationErrorStrings() -> Set<String> { | ||
return ["\(#keyPath(AddSheetViewController.itemOC.selection)).\(#keyPath(PlistItem.isValid))"] | ||
} | ||
|
||
} | ||
|
||
@objc(NonEmptyStringFormatter) | ||
class NonEmptyStringFormatter: Formatter { | ||
|
||
override func string(for obj: Any?) -> String? { | ||
return obj as? String | ||
} | ||
override func getObjectValue(_ obj: AutoreleasingUnsafeMutablePointer<AnyObject?>?, for string: String, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool { | ||
obj?.pointee = string as AnyObject | ||
return true | ||
} | ||
|
||
override func isPartialStringValid(_ partialString: String, newEditingString newString: AutoreleasingUnsafeMutablePointer<NSString?>?, errorDescription error: AutoreleasingUnsafeMutablePointer<NSString?>?) -> Bool { | ||
if partialString == "" { | ||
error?.pointee = "Must not be empty." | ||
newString?.pointee = partialString as NSString | ||
return false | ||
} else { | ||
return true | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// AppDelegate.swift | ||
// defaults-edit | ||
// | ||
// Created by Ian Gregory on 05-03-2019. | ||
// Copyright © 2019 Ian Gregory. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
|
||
@NSApplicationMain | ||
class AppDelegate: NSObject, NSApplicationDelegate { | ||
|
||
func applicationDidFinishLaunching(_ aNotification: Notification) { | ||
showWarningAlert() | ||
} | ||
|
||
private let suppressWarningAlertKey: String = "SuppressLaunchWarningAlert" | ||
|
||
private func showWarningAlert() { | ||
if UserDefaults.standard.bool(forKey: suppressWarningAlertKey) { | ||
return | ||
} | ||
|
||
let warningAlert = NSAlert() | ||
warningAlert.alertStyle = .warning | ||
warningAlert.messageText = "Welcome to defaults-edit. Please use with care." | ||
warningAlert.informativeText = "defaults-edit makes it easy to view and modify user defaults on your system. While such modification can be incredibly useful, it may also be dangerous. Most applications store preference information here, and their developers have not necessarily thought about or guarded against invalid values or combinations of values. If you aren’t sure what might happen when you make a preference change, keep note of its original value, and should the application behave abnormally, change it back." | ||
warningAlert.showsSuppressionButton = true | ||
warningAlert.layout() | ||
warningAlert.suppressionButton?.title = "I understand, do not show again" | ||
warningAlert.suppressionButton?.controlSize = .small | ||
warningAlert.runModal() | ||
if let state = warningAlert.suppressionButton?.state, state == .on { | ||
UserDefaults.standard.set(true, forKey: suppressWarningAlertKey) | ||
} | ||
} | ||
|
||
func applicationWillTerminate(_ aNotification: Notification) { | ||
// Insert code here to tear down your application | ||
} | ||
|
||
} | ||
|
Oops, something went wrong.