Skip to content

Commit

Permalink
Remove ini codes
Browse files Browse the repository at this point in the history
  • Loading branch information
yichengchen committed Oct 14, 2018
1 parent d760c49 commit c6583bf
Show file tree
Hide file tree
Showing 13 changed files with 679 additions and 2,509 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
Country.mmdb
Carthage
ClashX.a
ClashX.h
20 changes: 4 additions & 16 deletions ClashX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
4949D154213242F600EF85E6 /* Paths.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4949D153213242F600EF85E6 /* Paths.swift */; };
4949D15D2132614B00EF85E6 /* QRCodeUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4949D15C2132614B00EF85E6 /* QRCodeUtil.swift */; };
4952C3BF2115C7CA004A4FA8 /* ProxyMenuItemFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4952C3BE2115C7CA004A4FA8 /* ProxyMenuItemFactory.swift */; };
4952C3CB2116E952004A4FA8 /* PreferencesWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4952C3C82116E952004A4FA8 /* PreferencesWindowController.swift */; };
4952C3CC2116E952004A4FA8 /* PreferencesWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4952C3CA2116E952004A4FA8 /* PreferencesWindowController.xib */; };
4952C3CE2116EA2E004A4FA8 /* ProxyServerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4952C3CD2116EA2E004A4FA8 /* ProxyServerModel.swift */; };
4952C3D02117027C004A4FA8 /* ConfigFileFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4952C3CF2117027C004A4FA8 /* ConfigFileFactory.swift */; };
495340B020DE5F7200B0D3FF /* StatusItemView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 495340AF20DE5F7200B0D3FF /* StatusItemView.xib */; };
Expand All @@ -30,15 +28,14 @@
4966E9E6211824F300A391FB /* NSImage+extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4966E9E5211824F300A391FB /* NSImage+extension.swift */; };
496BDEE021196F1E00C5207F /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 496BDEDF21196F1E00C5207F /* Logger.swift */; };
49722FE4211ED56C00650A41 /* parseINI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49722FE1211ED56B00650A41 /* parseINI.swift */; };
49722FE8211F28CC00650A41 /* initConfig.ini in Resources */ = {isa = PBXBuildFile; fileRef = 49722FE7211F28CC00650A41 /* initConfig.ini */; };
49722FEF211F338B00650A41 /* FileEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49722FEA211F338B00650A41 /* FileEvent.swift */; };
49722FF0211F338B00650A41 /* EventStream.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49722FEB211F338B00650A41 /* EventStream.swift */; };
49722FF1211F338B00650A41 /* Witness.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49722FEC211F338B00650A41 /* Witness.swift */; };
49722FF2211F338B00650A41 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 49722FEE211F338B00650A41 /* Info.plist */; };
497F0DF320DE2FE50077AD41 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 497F0DF220DE2FE50077AD41 /* Icon.icns */; };
4989F98020D01C8F0001E564 /* clash.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4989F97E20D01C8F0001E564 /* clash.a */; };
4989F98420D02D200001E564 /* Country.mmdb in Resources */ = {isa = PBXBuildFile; fileRef = 4989F98320D02D200001E564 /* Country.mmdb */; };
4989F98E20D0AE990001E564 /* sampleConfig.ini in Resources */ = {isa = PBXBuildFile; fileRef = 4989F98D20D0AE990001E564 /* sampleConfig.ini */; };
4989F98E20D0AE990001E564 /* sampleConfig.yml in Resources */ = {isa = PBXBuildFile; fileRef = 4989F98D20D0AE990001E564 /* sampleConfig.yml */; };
4997732520D251A60009B136 /* SWBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 4997732320D251A60009B136 /* SWBApplication.m */; };
499976C821359F0400E7BF83 /* ClashWebViewContoller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 499976C721359F0400E7BF83 /* ClashWebViewContoller.swift */; };
49B1086A216A356D0064FFCE /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49B10869216A356D0064FFCE /* String+Extension.swift */; };
Expand Down Expand Up @@ -112,8 +109,6 @@
4949D153213242F600EF85E6 /* Paths.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Paths.swift; sourceTree = "<group>"; };
4949D15C2132614B00EF85E6 /* QRCodeUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeUtil.swift; sourceTree = "<group>"; };
4952C3BE2115C7CA004A4FA8 /* ProxyMenuItemFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyMenuItemFactory.swift; sourceTree = "<group>"; };
4952C3C82116E952004A4FA8 /* PreferencesWindowController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PreferencesWindowController.swift; sourceTree = "<group>"; };
4952C3CA2116E952004A4FA8 /* PreferencesWindowController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesWindowController.xib; sourceTree = "<group>"; };
4952C3CD2116EA2E004A4FA8 /* ProxyServerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProxyServerModel.swift; sourceTree = "<group>"; };
4952C3CF2117027C004A4FA8 /* ConfigFileFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigFileFactory.swift; sourceTree = "<group>"; };
495340AF20DE5F7200B0D3FF /* StatusItemView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = StatusItemView.xib; sourceTree = "<group>"; };
Expand All @@ -128,7 +123,6 @@
4966E9E5211824F300A391FB /* NSImage+extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSImage+extension.swift"; sourceTree = "<group>"; };
496BDEDF21196F1E00C5207F /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
49722FE1211ED56B00650A41 /* parseINI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = parseINI.swift; sourceTree = "<group>"; };
49722FE7211F28CC00650A41 /* initConfig.ini */ = {isa = PBXFileReference; lastKnownFileType = text; path = initConfig.ini; sourceTree = "<group>"; };
49722FEA211F338B00650A41 /* FileEvent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FileEvent.swift; sourceTree = "<group>"; };
49722FEB211F338B00650A41 /* EventStream.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EventStream.swift; sourceTree = "<group>"; };
49722FEC211F338B00650A41 /* Witness.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Witness.swift; sourceTree = "<group>"; };
Expand All @@ -138,7 +132,7 @@
4989F97E20D01C8F0001E564 /* clash.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = clash.a; sourceTree = "<group>"; };
4989F97F20D01C8F0001E564 /* clash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = clash.h; sourceTree = "<group>"; };
4989F98320D02D200001E564 /* Country.mmdb */ = {isa = PBXFileReference; lastKnownFileType = file; path = Country.mmdb; sourceTree = "<group>"; };
4989F98D20D0AE990001E564 /* sampleConfig.ini */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sampleConfig.ini; sourceTree = "<group>"; };
4989F98D20D0AE990001E564 /* sampleConfig.yml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = sampleConfig.yml; sourceTree = "<group>"; };
4997732320D251A60009B136 /* SWBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWBApplication.m; sourceTree = "<group>"; };
4997732420D251A60009B136 /* SWBApplication.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWBApplication.h; sourceTree = "<group>"; };
499976C721359F0400E7BF83 /* ClashWebViewContoller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClashWebViewContoller.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -278,8 +272,6 @@
4989F98520D0AA300001E564 /* ViewControllers */ = {
isa = PBXGroup;
children = (
4952C3C82116E952004A4FA8 /* PreferencesWindowController.swift */,
4952C3CA2116E952004A4FA8 /* PreferencesWindowController.xib */,
49BC061B212931F4005A0FE7 /* AboutViewController.swift */,
49B7F99F2157C1DC00484470 /* SpeedTestViewController.swift */,
499976C721359F0400E7BF83 /* ClashWebViewContoller.swift */,
Expand Down Expand Up @@ -349,9 +341,8 @@
49CF3B3A20CD783A001EBF94 /* Support Files */ = {
isa = PBXGroup;
children = (
4989F98D20D0AE990001E564 /* sampleConfig.ini */,
4989F98D20D0AE990001E564 /* sampleConfig.yml */,
4989F98320D02D200001E564 /* Country.mmdb */,
49722FE7211F28CC00650A41 /* initConfig.ini */,
);
path = "Support Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -516,12 +507,10 @@
495340B020DE5F7200B0D3FF /* StatusItemView.xib in Resources */,
49CF3B2820CD7465001EBF94 /* Main.storyboard in Resources */,
49CF3B5F20CE80D2001EBF94 /* install_proxy_helper.sh in Resources */,
49722FE8211F28CC00650A41 /* initConfig.ini in Resources */,
4952C3CC2116E952004A4FA8 /* PreferencesWindowController.xib in Resources */,
4989F98420D02D200001E564 /* Country.mmdb in Resources */,
497F0DF320DE2FE50077AD41 /* Icon.icns in Resources */,
49722FF2211F338B00650A41 /* Info.plist in Resources */,
4989F98E20D0AE990001E564 /* sampleConfig.ini in Resources */,
4989F98E20D0AE990001E564 /* sampleConfig.yml in Resources */,
49CF3B6320CED9CF001EBF94 /* check_proxy_helper.sh in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -606,7 +595,6 @@
495340B320DE68C300B0D3FF /* StatusItemView.swift in Sources */,
495A44D320D267D000888A0A /* LaunchAtLogin.swift in Sources */,
49CF3B2120CD7463001EBF94 /* AppDelegate.swift in Sources */,
4952C3CB2116E952004A4FA8 /* PreferencesWindowController.swift in Sources */,
496BDEE021196F1E00C5207F /* Logger.swift in Sources */,
49722FEF211F338B00650A41 /* FileEvent.swift in Sources */,
4913C82321157D0200F6B87C /* Notification.swift in Sources */,
Expand Down
91 changes: 91 additions & 0 deletions ClashX.xcodeproj/xcshareddata/xcschemes/ClashX.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "49CF3B1C20CD7463001EBF94"
BuildableName = "ClashX.app"
BlueprintName = "ClashX"
ReferencedContainer = "container:ClashX.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 = "49CF3B1C20CD7463001EBF94"
BuildableName = "ClashX.app"
BlueprintName = "ClashX"
ReferencedContainer = "container:ClashX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "49CF3B1C20CD7463001EBF94"
BuildableName = "ClashX.app"
BlueprintName = "ClashX"
ReferencedContainer = "container:ClashX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "49CF3B1C20CD7463001EBF94"
BuildableName = "ClashX.app"
BlueprintName = "ClashX"
ReferencedContainer = "container:ClashX.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
19 changes: 6 additions & 13 deletions ClashX/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,14 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
signal(SIGPIPE, SIG_IGN)
failLaunchProtect()

_ = ProxyConfigManager.install()
ConfigFileFactory.upgardeIniIfNeed()
ConfigFileFactory.copySampleConfigIfNeed()

PFMoveToApplicationsFolderIfNecessary()


statusItemView = StatusItemView.create(statusItem: nil,statusMenu: statusMenu)
statusItemView.onPopUpMenuAction = {
[weak self] in
Expand Down Expand Up @@ -295,19 +301,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
LaunchAtLogin.shared.isEnabled = !LaunchAtLogin.shared.isEnabled
}

var genConfigWindow:NSWindowController?=nil
@IBAction func actionGenConfig(_ sender: Any) {
let ctrl = PreferencesWindowController(windowNibName: "PreferencesWindowController")


genConfigWindow?.close()
genConfigWindow=ctrl
ctrl.window?.title = ctrl.contentViewController?.title ?? ""
ctrl.showWindow(nil)
NSApp.activate(ignoringOtherApps: true)
ctrl.window?.makeKeyAndOrderFront(self)

}

@IBAction func openConfigFolder(_ sender: Any) {
let path = (NSHomeDirectory() as NSString).appendingPathComponent("/.config/clash")
Expand Down
6 changes: 0 additions & 6 deletions ClashX/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Generate Config" id="IeJ-1Q-UaF">
<items>
<menuItem title="Generate config" id="5Ab-VJ-iIm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="actionGenConfig:" target="Voe-Tx-rLC" id="SBd-vV-e1R"/>
</connections>
</menuItem>
<menuItem title="Import bunch json file" id="GRE-Ra-Pkx">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
Expand Down
Loading

0 comments on commit c6583bf

Please sign in to comment.