public static WriteResourceToFile ( string pathName, string fileName, byte buffer ) : string | ||
pathName | string | |
fileName | string | |
buffer | byte | |
Результат | string |
/// <summary> /// Constructor class function, create batch file helper in the temp space /// </summary> public ClassSSH() { string pathHelpertLong = ClassUtils.WriteResourceToFile(Path.GetTempPath(), "git_ssh_helper.sh", Properties.Resources.git_ssh_helper); pathHelper = ClassUtils.GetShortPathName(pathHelpertLong); // Make the batch file executable: this trick will only work with Mono File.SetAttributes(pathHelper, (FileAttributes)((uint)File.GetAttributes(pathHelper) | 0x80000000)); App.PrintLogMessage("SSH helper path:" + pathHelper, MessageType.Error); ClassUtils.AddEnvar("GIT_SSH", pathHelper); }
/// <summary> /// Constructor class function, create executables in the temp space /// </summary> public ClassPutty() { string pathPageantLong = ClassUtils.WriteResourceToFile(Path.GetTempPath(), "pageant.exe", Properties.Resources.pageant); string pathPlinkLong = ClassUtils.WriteResourceToFile(Path.GetTempPath(), "plink.exe", Properties.Resources.plink); string pathPuttyGenLong = ClassUtils.WriteResourceToFile(Path.GetTempPath(), "puttygen.exe", Properties.Resources.puttygen); pathPageant = ClassUtils.GetShortPathName(pathPageantLong); pathPlink = ClassUtils.GetShortPathName(pathPlinkLong); pathPuttyGen = ClassUtils.GetShortPathName(pathPuttyGenLong); ClassUtils.AddEnvar("PLINK_PROTOCOL", "ssh"); ClassUtils.AddEnvar("GIT_SSH", pathPlink); // Run the daemon process, update keys RunPageantUpdateKeys(); }