public int ReportErr(System.Exception e) { if (e is jsch::SftpException) { jsch::SftpException e1 = (jsch::SftpException)e; this.Write(1, "! sftp: {0}", e1.message); switch ((Unix.SSH_ERROR)e1.id) { case Unix.SSH_ERROR.PERMISSION_DENIED: return(-WinErrorCode.ERROR_ACCESS_DENIED); default: return(-1); } } else { Diag::StackFrame callerFrame = new Diag::StackFrame(1); Ref::MethodBase caller = callerFrame.GetMethod(); if (e is FailedToEstablishChannelException) { this.Write(0, "! Failed to establish a channel @ ", caller.Name); } else { this.Write(0, "!!ERR!! at {0}\n{1}\n !!!!!!!", caller.Name, e); } return(1); } }
//=========================================================== // CSharpName //=========================================================== /// <summary> /// メソッドのシグニチャを説明する文字列を C# 形式で取得します。 /// </summary> /// <param name="m">メソッドを指定します。</param> /// <returns>メソッドを C# 形式で表現した文字列を返します。</returns> public static string CSharpName(Ref::MethodBase m) { string ret = CSharpName(m.DeclaringType) + "." + m.Name; if (m.IsGenericMethod) { System.Type[] args = m.GetGenericArguments(); string gen = CSharpName(args[0]); for (int i = 1; i < args.Length; i++) { gen += "," + CSharpName(args[i]); } return(ret + "<" + gen + ">"); } else { return(ret); } }
/// <summary> /// メソッドの名前及びシグニチャ情報を文字列として取得します。 /// </summary> /// <param name="meth">情報を文字列にするメソッドを指定します。</param> /// <returns>メソッドの情報を文字列にして返します。</returns> public static string GetMethodSignature(Ref::MethodBase meth) { //string dll=System.IO.Path.GetFileName(m.DeclaringType.Assembly.CodeBase); string ret = ""; if (meth.IsStatic) { ret += "static "; } Ref::MethodInfo minfo = meth as Ref::MethodInfo; if (minfo != null) { ret += CSharpName(minfo.ReturnType) + " "; } //"<"+dll+"> "+ return(ret + CSharpName(meth) + "(" + Types.GetParameterList(meth) + ");"); }