我很好奇按钮是如何工作的.你能解释一下,当我点击"在Windows中克隆"按钮时,它知道如何在我的机器上打开一个本地应用程序(GitHub).
看看GitExtension的这个补丁:它在 HKCR 中注册了该操作
<Component Id="Protocol.github_windows" Guid="*">
<RegistryKey Key="github-windows" Root="HKCR">
<RegistryValue Value="URL: Github for Windows Protocol" Type="string" />
<RegistryValue Name="URL Protocol" Value="" Type="string" />
</RegistryKey>
<RegistryKey Key="github-windows\DefaultIcon" Root="HKCR">
<RegistryValue Value="[INSTALLDIR]GitExtensions.exe" Type="string" />
</RegistryKey>
<RegistryKey Root="HKCR" Key="github-windows\shell"/>
<RegistryKey Root="HKCR" Key="github-windows\shell\open"/>
<RegistryKey Root="HKCR" Key="github-windows\shell\open\command">
<RegistryValue Value=""[INSTALLDIR]GitExtensions.exe" %1" Type="string" />
</RegistryKey>
</Component>
Run Code Online (Sandbox Code Playgroud)
它补充道:
if (args[1].StartsWith("git://"))
{
args = new string[]{args[0], "clone", args[1]};
}
if (args[1].StartsWith("github-windows://openRepo/"))
{
args = new string[]{args[0], "clone", args[1].Replace("github-windows://openRepo/", "")};
}
Run Code Online (Sandbox Code Playgroud)
Windows 版 GitHub将采用类似的方法。
| 归档时间: |
|
| 查看次数: |
1839 次 |
| 最近记录: |