资源简介
在Unity中快速使用svn的小工具。
从此不用只是在打开文件夹后去做svn操作,而可以在unity环境下点击文件右键直接操作svn。
代码片段和文件信息
using UnityEngine;
using UnityEditor;
using System.Collections;
///
/// Unity Svn 工具
/// 参考: http://www.cnblogs.com/me115/archive/2011/05/31/2064047.html
/// 官网:http://tortoisesvn.net/docs/release/TortoiseSVN_zh_CN/tsvn-automation.html
///
public class MiniSvn
{
#region - SVN -
[MenuItem(“Assets/SVN/showlog“)]
static void ExternalSvnShowLog()
{
SvnShowLog(GetCurProjectObjPath());
}
[MenuItem(“Assets/SVN/add“)]
static void ExternalSvnAdd()
{
SvnAdd(GetCurProjectObjPath());
}
[MenuItem(“Assets/SVN/commit“)]
static void ExternalSvnCommit()
{
SvnCommit(GetCurProjectObjPath());
}
[MenuItem(“Assets/SVN/update“)]
static void ExternalSvnUpdate()
{
SvnUpdate(GetCurProjectObjPath());
}
static string GetCurProjectObjPath()
{
if (null == Selection.objects || Selection.objects.Length != 1) return string.Empty;
string path = AssetDatabase.GetAssetPath(Selection.objects[0].GetInstanceID());
if (!string.IsNullOrEmpty(path))
{
path = System.IO.Path.GetFullPath(path);
}
return path;
}
#endregion
private const string SVN_EXE_PATH = “C:\\Program Files\\TortoiseSVN\\bin\\TortoiseProc.exe“;
public static void SvnShowLog(string filePath)
{
string args = “/command:log /path:“ + filePath + “ /closeonend:0“;
// 快捷方式
System.Diagnostics.Process.Start(SVN_EXE_PATH args);
// cmd方式
//string[] cmdArray = new string[]
//{
// “cd C:\\Program Files\\TortoiseSVN\\bin\\“
// “TortoiseProc.exe“ + “ “ + args
//};
//RunCmd(cmdArray);
}
public static void SvnAdd(string filePath)
{
string addRes = filePath;
if (System.IO.File.Exists(filePath))
{
addRes = System.IO.Path.GetDirectoryName(filePath);
}
string args = “/command:add /path:“ + addRes + “ /closeonend:0“;
System.Diagnostics.Process.Start(SVN_EXE_PATH args);
}
public static void SvnCommit(string filePath)
{
string args = “/command:commit /path:“ + filePath + “ /logmsg:res: ui“ + “ /closeonend:0“;
System.Diagnostics.Process.Start(SVN_EXE_PATH args);
}
public static void SvnUpdate(string filePath)
{
string args = “/command:update /path:“ + filePath + “ /closeonend:0“;
System.Diagnostics.Process.Start(SVN_EXE_PATH args);
}
private static void RunCmd(string[] cmds)
{
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.CreateNoWindow = true;
proc.StartInfo.FileName = “cmd.exe“;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.RedirectStandardInput
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-07-07 10:39 Unity Svn 工具\
文件 3287 2015-07-07 10:37 Unity Svn 工具\MiniSvn.cs
文件 178 2015-07-07 10:07 Unity Svn 工具\MiniSvn.cs.me
- 上一篇:Unity下调用摄像头识别二维码
- 下一篇:MSP430简易示波器
相关资源
- Unity下调用摄像头识别二维码
- 很好用的软件打包工具经典珍藏版
- USB使用记录清除工具
- NC 转 dxf 工具
- TamperIE安装程序
- School Days HQ GPK文件解包工具
- Understand破解工具
- AutoBiped-Bone转Biped工具
- HEX转BIN工具 64位系统可用
- MbFix (恢复mbr de工具)
- unity4.x-2017.2.0f03全版本破解windows版本
- robocopy.exe
- linux网络编程聊天工具代码
- obi Softbody
- 金蝶K3WISE维护工具
- 8*8、16*16、32*32点阵LED字模生成工具
- DEPENDS.EXE 查看程序调用的DLL文件工具
- TCG-正交表测试用例生成工具
- SmartMonkey
- 打印机的脱机文件.SPL转为可供查看的
- notepad下的lua配置资源
- 安卓ROM system.img 解包与打包工具unya
- PlusU盘病毒免疫工具
- 波形波表数据生成工具
- CheckTool:CRC校验、累加和校验、异或
- SP37烧录工具
- Unity路径插件
- 光盘隐藏文件查看工具破解加密光盘
- leomoon-cpu-v.zip Inter Tv-x启用检查工具官
- 啊D注入工具 V2.32 暗组破解版
评论
共有 条评论