/// <summary> /// 获取常用的打印命令 /// </summary> /// <returns></returns> private byte[] GetPrintCommond(CommondType commondType) { byte[] byteList = null; switch (commondType) { case CommondType.Initial: byteList = new byte[] { 0x1b, 0x40 }; break; case CommondType.Align_Center: byteList = new byte[] { 0x1b, 0x61, (byte)1 }; break; case CommondType.NextLine: byteList = Encoding.GetEncoding("gb18030").GetBytes("\n"); break; case CommondType.LineHeight_Zero: byteList = new byte[] { 0x1B, 0x33, 0x00 }; break; case CommondType.Cut: byteList = new byte[] { (byte)('\n'), (byte)29, (byte)86, (byte)66, (byte)1 }; break; } return(byteList); }
/// <summary> /// 获取调用命令字符串 /// </summary> /// <param name="commandType"></param> /// <param name="localConfigPath"></param> /// <param name="serverConfigPath"></param> /// <param name="ip"></param> /// <param name="port"></param> /// <param name="user"></param> /// <param name="passWord"></param> /// <returns></returns> public string GetPSCPCommandArgument( CommondType commandType, string localConfigPath, string serverConfigPath, string ip, string port, string user, string passWord) { StringBuilder sb = new StringBuilder(""); if (!string.IsNullOrEmpty(port)) { sb.AppendFormat("-P {0} -pw {1} ", port, passWord); } if (commandType == CommondType.UpLoad) { sb.Append(localConfigPath); sb.AppendFormat(" {0}@{1}:{2}", user, ip, serverConfigPath); } else { sb.AppendFormat("{0}@{1}:{2} ", user, ip, serverConfigPath); sb.Append(localConfigPath); } return(sb.ToString()); }
protected ErrorCode SetCommandValue(CommondType commond) { Debug.Assert(_handle != IntPtr.Zero); return(OfficialApi.SetCommandValue(_handle, commond.ToString())); }
protected ErrorCode SetEnumValue(CommondType commond, uint value) { Debug.Assert(_handle != IntPtr.Zero); return(OfficialApi.SetEnumValue(_handle, commond.ToString(), value)); }
protected ErrorCode GetInt32Value(CommondType commond, ref Int32Value value) { Debug.Assert(_handle != IntPtr.Zero); return(OfficialApi.GetIntValue(_handle, commond.ToString(), ref value)); }