Show example file function

Show example file function
This commit is contained in:
qinyuhang
2016-08-27 18:58:40 +08:00
parent 6df2715651
commit d5d9aeabf8
5 changed files with 45 additions and 19 deletions
+2 -2
View File
@@ -92,8 +92,8 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
085641E71D711AEF00116B27 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = "<group>"; };
085641E91D7188C400116B27 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = Base; path = Base.lproj/Localizable.strings; sourceTree = "<group>"; };
085641EB1D71A48700116B27 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = "<group>"; };
0880CE3F1D6FE6D900BD39E2 /* example-gui-config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "example-gui-config.json"; sourceTree = "<group>"; };
0880CE411D6FF7F600BD39E2 /* BunchImportUtils.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BunchImportUtils.swift; sourceTree = "<group>"; };
088EC3961D5F5B8600E40791 /* whitelist.pac */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = whitelist.pac; sourceTree = "<group>"; };
@@ -689,7 +689,7 @@
isa = PBXVariantGroup;
children = (
9B0BFFED1D0460A70040E62B /* Base */,
085641E71D711AEF00116B27 /* zh-Hans */,
085641EB1D71A48700116B27 /* zh-Hans */,
);
name = MainMenu.xib;
sourceTree = "<group>";
+10 -2
View File
@@ -62,8 +62,16 @@
"White List IP" = "White List IP";
"Import Server Profile succeed!" = "Import Server Profile succeed!"
"Import Server Profile succeed!" = "Import Server Profile succeed!";
"Import Server Profile failed!" = "Import Server Profile failed!"
"Import Server Profile failed!" = "Import Server Profile failed!";
/*
* ./BunchImportUtils.swift
*/
"Import Server Profile succeed!" = "Import Server Profile succeed!";
"Import Server Profile failed!" = "Import Server Profile failed!";
+13 -3
View File
@@ -9,12 +9,22 @@
import Foundation
//Todo: function 1 showExampleFile, 调用fileManager 拷贝 json 到Downloads文件夹,然后打开Downloads文件夹
//Function 3 导出json配置文件
//拷贝json配置文件到~/Downloads文件夹
func showExampleConfigFile() {
//copy file to ~/Downloads folder
let filePath:String = NSBundle.mainBundle().bundlePath + "/Contents/Resources/example-gui-config.json"
let fileMgr = NSFileManager.defaultManager()
let dataPath = NSHomeDirectory().stringByAppendingString("/Downloads")
let destPath = dataPath + "/example-gui-config.json"
//检测文件是否已经存在,如果存在直接用sharedWorkspace显示
if fileMgr.fileExistsAtPath(destPath) {
NSWorkspace.sharedWorkspace().selectFile(destPath, inFileViewerRootedAtPath: dataPath)
}else{
try! fileMgr.copyItemAtPath(filePath, toPath: destPath)
NSWorkspace.sharedWorkspace().selectFile(destPath, inFileViewerRootedAtPath: dataPath)
}
}
//importConfigFile, String->void
//调用fileManager,读取json文件,对configs for循环调用 profileManager 生成 profile并保存
func importConfigFile() {
let openPanel = NSOpenPanel()
@@ -66,6 +66,14 @@
"White List IP" = "IP白名单";
"Import Server Profile succeed!" = "导入服务器配置文件成功!"
"Import Server Profile succeed!" = "导入服务器配置文件成功!";
"Import Server Profile failed!" = "导入服务器配置文件失败!"
"Import Server Profile failed!" = "导入服务器配置文件失败!";
/*
* ./BunchImportUtils.swift
*/
"Import Server Profile succeed!" = "导入服务器配置文件成功!";
"Import Server Profile failed!" = "导入服务器配置文件失败!";
+10 -10
View File
@@ -1,26 +1,26 @@
/* Class = "NSMenuItem"; title = "Export All Server To Json..."; ObjectID = "6k0-gn-DQv"; */
"6k0-gn-DQv.title" = "导出全部服务器配置";
"6k0-gn-DQv.title" = "导出全部服务器配置...";
/* Class = "NSMenuItem"; title = "手动模式"; ObjectID = "8PR-gs-c5N"; */
/* Class = "NSMenuItem"; title = "Manual Mode"; ObjectID = "8PR-gs-c5N"; */
"8PR-gs-c5N.title" = "手动模式";
/* Class = "NSMenu"; title = "服务器"; ObjectID = "9Y1-db-3HK"; */
/* Class = "NSMenu"; title = "Servers"; ObjectID = "9Y1-db-3HK"; */
"9Y1-db-3HK.title" = "服务器";
/* Class = "NSMenuItem"; title = "打开 ShadowsocksX"; ObjectID = "GSu-Tf-StS"; */
"GSu-Tf-StS.title" = "打开 ShadowsocksX";
/* Class = "NSMenuItem"; title = "Turn ShadowsocksX On"; ObjectID = "GSu-Tf-StS"; */
"GSu-Tf-StS.title" = "打开ShadowsocksX";
/* Class = "NSMenu"; title = "ShadowsocksX-NG"; ObjectID = "Hob-KD-bx9"; */
"Hob-KD-bx9.title" = "ShadowsocksX-NG";
/* Class = "NSMenuItem"; title = "显示日志..."; ObjectID = "Jfy-sf-Fhl"; */
/* Class = "NSMenuItem"; title = "Show Logs..."; ObjectID = "Jfy-sf-Fhl"; */
"Jfy-sf-Fhl.title" = "显示日志...";
/* Class = "NSMenuItem"; title = "White List Domain"; ObjectID = "L27-aH-Wwl"; */
"L27-aH-Wwl.title" = "域名白名单";
/* Class = "NSMenuItem"; title = "关于"; ObjectID = "LgB-6g-Gba"; */
/* Class = "NSMenuItem"; title = "About"; ObjectID = "LgB-6g-Gba"; */
"LgB-6g-Gba.title" = "关于";
/* Class = "NSMenuItem"; title = "Server Preferences..."; ObjectID = "M5r-E7-44f"; */
@@ -39,10 +39,10 @@
"RvZ-Zn-29U.title" = "白名单模式";
/* Class = "NSMenuItem"; title = "Import Bunch Json File..."; ObjectID = "T9g-gy-gvv"; */
"T9g-gy-gvv.title" = "批量导入...";
"T9g-gy-gvv.title" = "导入服务器配置文件...";
/* Class = "NSMenuItem"; title = "Update PAC from GFW List"; ObjectID = "TFc-Ec-duM"; */
"TFc-Ec-duM.title" = "从 GFW List 更新PAC";
"TFc-Ec-duM.title" = "从 GFW List 更新 PAC";
/* Class = "NSMenuItem"; title = "Feedback"; ObjectID = "W7u-7g-Gv4"; */
"W7u-7g-Gv4.title" = "反馈";
@@ -72,7 +72,7 @@
"nAe-c2-Q79.title" = "白名单模式";
/* Class = "NSMenuItem"; title = "Show Bunch Json Example File..."; ObjectID = "pdy-JE-50Q"; */
"pdy-JE-50Q.title" = "显示示范配置文件";
"pdy-JE-50Q.title" = "显示示例服务器配置文件...";
/* Class = "NSMenuItem"; title = "Auto Mode By PAC"; ObjectID = "r07-Gu-aEz"; */
"r07-Gu-aEz.title" = "PAC自动模式";