diff --git a/.gitignore b/.gitignore
index e68f954..a003cf4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
# Compiled Files
out
+Rap-ID
## Assembly temp files
AssemblyInfo.old
diff --git a/Auth/Program.cs b/Auth/Program.cs
index a8b231a..7b64e79 100644
--- a/Auth/Program.cs
+++ b/Auth/Program.cs
@@ -17,23 +17,10 @@ static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- // callback& app
- var callback = DecodeUrlString(args[0]);
- var app = Crypt.Decrypt(Crypt.Decrypt(Crypt.Decrypt(args[1])));
- var waitFrm = new Wait(callback, app);
+ // app
+ var app = Crypt.Decrypt(Crypt.Decrypt(Crypt.Decrypt(args[0])));
+ var waitFrm = new Wait(app);
Application.Run(waitFrm);
}
-
- /*
- * (C) 2015 @ogi from StackOverflow
- * Original Post: http://stackoverflow.com/questions/1405048/how-do-i-decode-a-url-parameter-using-c
- */
- private static string DecodeUrlString(string url)
- {
- string newUrl;
- while ((newUrl = Uri.UnescapeDataString(url)) != url)
- url = newUrl;
- return newUrl;
- }
}
}
diff --git a/Auth/Properties/AssemblyInfo.cs b/Auth/Properties/AssemblyInfo.cs
index 99338c8..f47a392 100644
--- a/Auth/Properties/AssemblyInfo.cs
+++ b/Auth/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
[assembly: AssemblyTitle("Auth")]
[assembly: AssemblyDescription("auth ui provider for Rap-ID")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Cotr Community")]
+[assembly: AssemblyCompany("Rap-ID Project")]
[assembly: AssemblyProduct("Rap-ID")]
[assembly: AssemblyCopyright("Copyright © 2015 coderfox")]
[assembly: AssemblyTrademark("Rap-ID")]
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0.13")]
-[assembly: AssemblyFileVersion("1.2.0.13")]
+[assembly: AssemblyVersion("1.3.1.3")]
+[assembly: AssemblyFileVersion("1.3.1.3")]
diff --git a/Auth/Wait.cs b/Auth/Wait.cs
index 85c72da..61c1c68 100644
--- a/Auth/Wait.cs
+++ b/Auth/Wait.cs
@@ -16,12 +16,10 @@ namespace RapID.Auth
{
public partial class Wait : Form
{
- private string _callback;
private string _app;
- public Wait(string callback, string app)
+ public Wait(string app)
{
InitializeComponent();
- this._callback = callback;
this._app = app;
}
@@ -58,6 +56,7 @@ private async void okButton_Click(object sender, EventArgs e)
const string auth_prefix = "AUTH";
const string authok_prefix = "AUTHOK";
const string authfail_prefix = "AUTHFAIL";
+ const string c_cliResultPrefix = "#Rap-ID-Windows/CLI/1.0d/Auth/";
this.SetInfoText("正在读取配置文件...");
@@ -85,25 +84,25 @@ private async void okButton_Click(object sender, EventArgs e)
using (var tcpStreamReader = new StreamReader(tcpClient.GetStream()))
{
var message = Crypt.Decrypt(await tcpStreamReader.ReadLineAsync(), Crypt.GenerateKey(cryptionKey));
-#if DEBUG
- MessageBox.Show(message);
-#endif
if (message.StartsWith(authok_prefix))
{
+ var token = message.Remove(message.IndexOf(authok_prefix), authok_prefix.Length);
+#if DEBUG
+ MessageBox.Show(token);
+#endif
this.SetInfoText("授权成功!");
System.Threading.Thread.Sleep(1000);
- if (_callback != String.Empty)
- {
- System.Diagnostics.Process.Start(_callback + message.Replace(authok_prefix, String.Empty));
- }
+ // output token
+ Console.WriteLine(c_cliResultPrefix + "result=ok;token=" + token);
}
else if (message.StartsWith(authfail_prefix))
{
this.SetInfoText("授权失败!");
System.Threading.Thread.Sleep(1000);
+ // output error
+ Console.WriteLine(c_cliResultPrefix + "result=fail;error=NotImpled");
}
}
-
}
}
Application.Exit();
diff --git a/Configure/Properties/AssemblyInfo.cs b/Configure/Properties/AssemblyInfo.cs
index 7c0d2d7..9fb9ce4 100644
--- a/Configure/Properties/AssemblyInfo.cs
+++ b/Configure/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
[assembly: AssemblyTitle("Rap-ID Configure")]
[assembly: AssemblyDescription("configure program for Rap-ID")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Cotr Community")]
+[assembly: AssemblyCompany("Rap-ID Project")]
[assembly: AssemblyProduct("Rap-ID")]
[assembly: AssemblyCopyright("Copyright © 2015 coderfox")]
[assembly: AssemblyTrademark("Rap-ID")]
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0.9")]
-[assembly: AssemblyFileVersion("1.1.0.9")]
+[assembly: AssemblyVersion("1.1.0.13")]
+[assembly: AssemblyFileVersion("1.1.0.13")]
diff --git a/CryptionDebugger/Properties/AssemblyInfo.cs b/CryptionDebugger/Properties/AssemblyInfo.cs
index d25262d..69370fb 100644
--- a/CryptionDebugger/Properties/AssemblyInfo.cs
+++ b/CryptionDebugger/Properties/AssemblyInfo.cs
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.1.6")]
-[assembly: AssemblyFileVersion("1.1.1.6")]
+[assembly: AssemblyVersion("1.1.1.12")]
+[assembly: AssemblyFileVersion("1.1.1.12")]
diff --git a/Installer/Install.cs b/Installer/Install.cs
index 84f7a5c..7cfd972 100644
--- a/Installer/Install.cs
+++ b/Installer/Install.cs
@@ -22,41 +22,42 @@ private void Install_Load(object sender, EventArgs e)
this.dirBox.Text = AppDomain.CurrentDomain.BaseDirectory;
}
- ///
- /// 注册启动项到注册表
- ///
public void RegURL(string name)
{
- //注册的协议头,即在地址栏中的路径 如QQ的:tencent://xxxxx/xxx 我注册的是jun 在地址栏中输入:jun:// 就能打开本程序
var surekamKey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(name);
- //以下这些参数都是固定的,不需要更改,直接复制过去
var shellKey = surekamKey.CreateSubKey("shell");
var openKey = shellKey.CreateSubKey("open");
var commandKey = openKey.CreateSubKey("command");
surekamKey.SetValue("URL Protocol", "");
- //这里可执行文件取当前程序全路径,可根据需要修改
var exePath = this.dirBox.Text + "URLSchemeHandler.exe";
commandKey.SetValue("", "\"" + exePath + "\"" + " \"%1\"");
}
- ///
- /// 取消注册
- ///
- public void UnRegURL(string name)
+ public void UnReg(string name)
{
- //直接删除节点
Microsoft.Win32.Registry.ClassesRoot.DeleteSubKeyTree(name);
}
+ public void RegFilePos(string name)
+ {
+ var surekamKey = Microsoft.Win32.Registry.ClassesRoot.CreateSubKey(name);
+ var dirKey = surekamKey.CreateSubKey("dir");
+ var insPath = this.dirBox.Text;
+ dirKey.SetValue("", insPath);
+ var authPath = this.dirBox.Text + "auth.exe";
+ dirKey.SetValue("auth", authPath);
+ }
+
private void insButton_Click(object sender, EventArgs e)
{
RegURL("rapid");
+ RegFilePos("rapid");
System.Diagnostics.Process.Start(this.dirBox.Text + "conf.exe");
}
private void uninsButton_Click(object sender, EventArgs e)
{
- UnRegURL("rapid");
+ UnReg("rapid");
}
}
}
diff --git a/Installer/Properties/AssemblyInfo.cs b/Installer/Properties/AssemblyInfo.cs
index 1ab5198..2c0e480 100644
--- a/Installer/Properties/AssemblyInfo.cs
+++ b/Installer/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
[assembly: AssemblyTitle("Rap-ID Installer")]
[assembly: AssemblyDescription("installer for Rap-ID")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Cotr Community")]
+[assembly: AssemblyCompany("Rap-ID Project")]
[assembly: AssemblyProduct("Rap-ID")]
[assembly: AssemblyCopyright("Copyright © 2015 coderfox")]
[assembly: AssemblyTrademark("Rap-ID")]
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.15")]
-[assembly: AssemblyFileVersion("1.0.0.15")]
+[assembly: AssemblyVersion("1.1.0.9")]
+[assembly: AssemblyFileVersion("1.1.0.9")]
diff --git a/Jakefile b/Jakefile
new file mode 100644
index 0000000..cf2f790
--- /dev/null
+++ b/Jakefile
@@ -0,0 +1,26 @@
+desc('Gather the DEBUG compiled files.');
+task('debug', function () {
+ jake.mkdirP('Rap-ID/debug');
+ jake.exec([
+ 'cp -R Auth/bin/Debug/* Rap-ID/debug/',
+ 'cp -R Configure/bin/Debug/* Rap-ID/debug/',
+ 'cp -R Installer/bin/Debug/* Rap-ID/debug/',
+ 'cp -R URLSchemeHandler/bin/Debug/* Rap-ID/debug/',
+ 'cp -R Library/bin/Debug/* Rap-ID/debug/'
+ ]);
+});
+desc('Gather the RELEASE compiled files.');
+task('release', function () {
+ jake.mkdirP('Rap-ID/release');
+ jake.exec([
+ 'cp -R Auth/bin/Release/* Rap-ID/release/',
+ 'cp -R Configure/bin/Release/* Rap-ID/release/',
+ 'cp -R Installer/bin/Release/* Rap-ID/release/',
+ 'cp -R URLSchemeHandler/bin/Release/* Rap-ID/release/',
+ 'cp -R Library/bin/Release/* Rap-ID/release/'
+ ]);
+});
+desc('Clean up the directory.');
+task('clean', function () {
+ jake.rmRf('Rap-ID');
+});
\ No newline at end of file
diff --git a/Library/Library.csproj b/Library/Library.csproj
index 5734d05..ce6d920 100644
--- a/Library/Library.csproj
+++ b/Library/Library.csproj
@@ -56,16 +56,12 @@
-
- Form
-
+
-
-
diff --git a/Library/Properties/AssemblyInfo.cs b/Library/Properties/AssemblyInfo.cs
index 0c3700b..1d9f157 100644
--- a/Library/Properties/AssemblyInfo.cs
+++ b/Library/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
[assembly: AssemblyTitle("Rap-ID Library")]
[assembly: AssemblyDescription("class library of Rap-ID")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Cotr Community")]
+[assembly: AssemblyCompany("Rap-ID Project")]
[assembly: AssemblyProduct("Rap-ID")]
[assembly: AssemblyCopyright("Copyright © 2015 coderfox")]
[assembly: AssemblyTrademark("Rap-ID")]
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0.11")]
-[assembly: AssemblyFileVersion("1.2.0.11")]
+[assembly: AssemblyVersion("1.2.0.19")]
+[assembly: AssemblyFileVersion("1.2.0.19")]
diff --git a/Library/Utils/TCPClient.cs b/Library/Utils/TCPClient.cs
deleted file mode 100644
index 37aa4ce..0000000
--- a/Library/Utils/TCPClient.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Net;
-using System.Net.Sockets;
-using System.IO;
-
-namespace RapID.ClassLibrary
-{
- public class TCPClient : INetworkSender
- {
- private TcpClient tcpClient { get; set; }
- private IPEndPoint remote { get; set; }
- private NetworkStream stream
- {
- get
- {
- return this.tcpClient.GetStream();
- }
- }
- private StreamReader reader;
- private StreamWriter writer;
- public bool listening { get; private set; }
- public bool Connected
- {
- get
- {
- return this.tcpClient.Connected;
- }
- }
- public TCPClient(IPEndPoint remote)
- {
- this.remote = remote;
- this.tcpClient = new TcpClient();
- }
- public TCPClient(IPAddress IP, int Port)
- : this(new IPEndPoint(IP, Port))
- {
- }
- public TCPClient(string IP, int Port)
- : this(new IPEndPoint(IPAddress.Parse(IP), Port))
- {
- }
- public TCPClient(TcpClient client)
- {
- this.tcpClient = client;
- }
- public void Connect()
- {
- this.tcpClient.Connect(this.remote.Address, this.remote.Port);
- this.reader = new StreamReader(this.stream, Encodes.UTF8NoBOM);
- this.writer = new StreamWriter(this.stream, Encodes.UTF8NoBOM);
- this.listening = true;
- Read();
- }
- public async void Send(string msg)
- {
- var cmsg = Crypt.Encrypt(msg);
- await this.writer.WriteLineAsync(cmsg);
- await this.writer.FlushAsync();
- }
- public void SendSync(string msg)
- {
- var cmsg = Crypt.Encrypt(msg);
- this.writer.WriteLine(cmsg);
- this.writer.Flush();
- }
- public delegate void OnMessageEventHandler(object sender, string message);
- public event OnMessageEventHandler OnMessage;
- private async void Read()
- {
- while (listening)
- {
- var msg = await this.reader.ReadLineAsync();
- if (msg != String.Empty)
- {
- OnMessage.Invoke(this, Crypt.Decrypt(msg));
- }
- }
- }
- public void Close()
- {
- this.listening = false;
- this.tcpClient.Close();
- }
- }
-}
diff --git a/Library/Utils/TCPServer.cs b/Library/Utils/TCPServer.cs
deleted file mode 100644
index 17892b1..0000000
--- a/Library/Utils/TCPServer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Net;
-using System.Net.Sockets;
-using System.IO;
-
-namespace RapID.ClassLibrary
-{
- public class TCPServer
- {
- private TcpListener tcpServer { get; set; }
- public bool looping { get; private set; }
- public TCPServer(int port)
- {
- this.tcpServer = new TcpListener(IPAddress.Any, port);
- this.tcpServer.Start();
- Loop();
- }
-
- private async void Loop()
- {
- var tcpClient = await this.tcpServer.AcceptTcpClientAsync();
- if (tcpClient.Connected == true)
- {
- OnConnection.Invoke(new TCPClient(tcpClient));
- }
- if (looping)
- {
- Loop();
- }
- }
-
- public void Stop()
- {
- this.looping = false;
- this.tcpServer.Stop();
- }
-
- public delegate void OnConnectionEventHandler(TCPClient client);
- public event OnConnectionEventHandler OnConnection;
- }
-}
diff --git a/URLSchemeHandler/Program.cs b/URLSchemeHandler/Program.cs
index 8cf597c..bfd03d2 100644
--- a/URLSchemeHandler/Program.cs
+++ b/URLSchemeHandler/Program.cs
@@ -13,6 +13,7 @@ class Program
{
const string scheme_name = "rapid";
const string uri_host = "authorize";
+ const string c_cliTokenResultPrefix = "#Rap-ID-Windows/CLI/1.0d/Auth/result=ok;token=";
static void Main(string[] args)
{
if (args.Count() == 1)
@@ -26,8 +27,26 @@ static void Main(string[] args)
{
case uri_host:
{
- var query = uri.Query;
- Process.Start(AppDomain.CurrentDomain.BaseDirectory + "auth.exe", GetParam(query, "callback") + " " + GetParam(query, "app"));
+ // Start the child process.
+ Process p = new Process();
+ // Redirect the output stream of the child process.
+ p.StartInfo.UseShellExecute = false;
+ p.StartInfo.RedirectStandardOutput = true;
+ p.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + "auth.exe";
+ p.StartInfo.Arguments = GetParam(uri.Query, "app");
+ p.Start();
+ var resultGot = false;
+ while(!resultGot)
+ {
+ var message = p.StandardOutput.ReadLine();
+ if (message.StartsWith(c_cliTokenResultPrefix))
+ {
+ var token = message.Remove(message.IndexOf(c_cliTokenResultPrefix), c_cliTokenResultPrefix.Length);
+ var callback = DecodeUrlString(GetParam(uri.Query, "callback"));
+ Process.Start(callback + token);
+ resultGot = true;
+ }
+ }
break;
}
default:
@@ -56,5 +75,18 @@ private static string GetParam(string query, string paramName)
}
throw new KeyNotFoundException();
}
+
+
+ /*
+ * (C) 2015 @ogi from StackOverflow
+ * Original Post: http://stackoverflow.com/questions/1405048/how-do-i-decode-a-url-parameter-using-c
+ */
+ private static string DecodeUrlString(string url)
+ {
+ string newUrl;
+ while ((newUrl = Uri.UnescapeDataString(url)) != url)
+ url = newUrl;
+ return newUrl;
+ }
}
}
diff --git a/URLSchemeHandler/Properties/AssemblyInfo.cs b/URLSchemeHandler/Properties/AssemblyInfo.cs
index 31c3a10..28ccaa9 100644
--- a/URLSchemeHandler/Properties/AssemblyInfo.cs
+++ b/URLSchemeHandler/Properties/AssemblyInfo.cs
@@ -8,7 +8,7 @@
[assembly: AssemblyTitle("URLSchemeHandler")]
[assembly: AssemblyDescription("URL Scheme handler for Rap-ID")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Cotr Community")]
+[assembly: AssemblyCompany("Rap-ID Project")]
[assembly: AssemblyProduct("Rap-ID")]
[assembly: AssemblyCopyright("Copyright © 2015 coderfox")]
[assembly: AssemblyTrademark("Rap-ID")]
@@ -32,5 +32,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.0.17")]
-[assembly: AssemblyFileVersion("1.1.0.17")]
+[assembly: AssemblyVersion("1.1.1.2")]
+[assembly: AssemblyFileVersion("1.1.1.2")]
diff --git a/URLSchemeHandler/URLSchemeHandler.csproj b/URLSchemeHandler/URLSchemeHandler.csproj
index 9175b4d..a062ce7 100644
--- a/URLSchemeHandler/URLSchemeHandler.csproj
+++ b/URLSchemeHandler/URLSchemeHandler.csproj
@@ -5,7 +5,7 @@
Debug
AnyCPU
{3F20C6B6-4AFB-451A-9E70-0A4229A96147}
- Exe
+ WinExe
Properties
RapID.URLSchemeHandler
URLSchemeHandler
@@ -37,6 +37,9 @@
Rap-ID.ico
+
+
+