init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public class AESUtil
|
||||
{
|
||||
private static string key = "lserpasebygyc222";
|
||||
|
||||
#region AES加解密
|
||||
/// <summary>
|
||||
///AES加密(加密步骤)
|
||||
///1,加密字符串得到2进制数组;
|
||||
///2,将2进制数组转为16进制;
|
||||
///3,进行base64编码
|
||||
/// </summary>
|
||||
/// <param name="toEncrypt">要加密的字符串</param>
|
||||
/// <param name="key">密钥</param>
|
||||
public static string Encrypt(string toEncrypt)
|
||||
{
|
||||
if (string.IsNullOrEmpty(toEncrypt)) return "";
|
||||
byte[] _key = Encoding.ASCII.GetBytes(key);
|
||||
byte[] _source = Encoding.UTF8.GetBytes(toEncrypt);
|
||||
|
||||
Aes aes = Aes.Create("AES");
|
||||
aes.Mode = CipherMode.ECB;
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
aes.Key = _key;
|
||||
ICryptoTransform cTransform = aes.CreateEncryptor();
|
||||
byte[] cryptData = cTransform.TransformFinalBlock(_source, 0, _source.Length);
|
||||
string hexCryptString = Hex_2To16(cryptData);
|
||||
byte[] hexCryptData = Encoding.UTF8.GetBytes(hexCryptString);
|
||||
return Convert.ToBase64String(hexCryptData);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// AES解密(解密步骤)
|
||||
/// 1,将BASE64字符串转为16进制数组
|
||||
/// 2,将16进制数组转为字符串
|
||||
/// 3,将字符串转为2进制数据
|
||||
/// 4,用AES解密数据
|
||||
/// </summary>
|
||||
/// <param name="encryptedSource">已加密的内容</param>
|
||||
/// <param name="key">密钥</param>
|
||||
public static string Decrypt(string toDecrypt)
|
||||
{
|
||||
if (string.IsNullOrEmpty(toDecrypt)) return "";
|
||||
try
|
||||
{
|
||||
byte[] _key = Encoding.ASCII.GetBytes(key);
|
||||
Aes aes = Aes.Create("AES");
|
||||
aes.Mode = CipherMode.ECB;
|
||||
aes.Padding = PaddingMode.PKCS7;
|
||||
aes.Key = _key;
|
||||
ICryptoTransform cTransform = aes.CreateDecryptor();
|
||||
|
||||
byte[] encryptedData = Convert.FromBase64String(toDecrypt);
|
||||
string encryptedString = Encoding.UTF8.GetString(encryptedData);
|
||||
byte[] _source = Hex_16To2(encryptedString);
|
||||
byte[] originalSrouceData = cTransform.TransformFinalBlock(_source, 0, _source.Length);
|
||||
return Encoding.UTF8.GetString(originalSrouceData);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 2进制转16进制
|
||||
/// </summary>
|
||||
static string Hex_2To16(byte[] bytes)
|
||||
{
|
||||
string hexString = string.Empty;
|
||||
Int32 iLength = 65535;
|
||||
if (bytes != null)
|
||||
{
|
||||
StringBuilder strB = new StringBuilder();
|
||||
|
||||
if (bytes.Length < iLength)
|
||||
{
|
||||
iLength = bytes.Length;
|
||||
}
|
||||
|
||||
for (int i = 0; i < iLength; i++)
|
||||
{
|
||||
strB.Append(bytes[i].ToString("X2"));
|
||||
}
|
||||
hexString = strB.ToString();
|
||||
}
|
||||
return hexString;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 16进制转2进制
|
||||
/// </summary>
|
||||
static byte[] Hex_16To2(string hexString)
|
||||
{
|
||||
if ((hexString.Length % 2) != 0)
|
||||
{
|
||||
hexString += " ";
|
||||
}
|
||||
byte[] returnBytes = new Byte[hexString.Length / 2];
|
||||
for (Int32 i = 0; i < returnBytes.Length; i++)
|
||||
{
|
||||
returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16);
|
||||
}
|
||||
return returnBytes;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,201 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public static class BaseHttpClient
|
||||
{
|
||||
private const String CHARSET = "UTF-8";
|
||||
private const String RATE_LIMIT_QUOTA = "X-Rate-Limit-Limit";
|
||||
private const String RATE_LIMIT_Remaining = "X-Rate-Limit-Remaining";
|
||||
private const String RATE_LIMIT_Reset = "X-Rate-Limit-Reset";
|
||||
|
||||
private const int RESPONSE_OK = 200;
|
||||
|
||||
//设置连接超时时间
|
||||
private const int DEFAULT_CONNECTION_TIMEOUT = (20 * 1000); // milliseconds
|
||||
//设置读取超时时间
|
||||
private const int DEFAULT_SOCKET_TIMEOUT = (30 * 1000); // milliseconds
|
||||
|
||||
public static ResponseWrapper sendPost(String url, String auth, String reqParams)
|
||||
{
|
||||
return sendRequest( "POST", url, auth, reqParams);
|
||||
}
|
||||
public static ResponseWrapper sendDelete(String url, String auth, String reqParams)
|
||||
{
|
||||
return sendRequest("DELETE", url, auth, reqParams);
|
||||
}
|
||||
public static ResponseWrapper sendGet(String url, String auth, String reqParams)
|
||||
{
|
||||
return sendRequest("GET", url, auth, reqParams);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* method "POST" or "GET"
|
||||
* url
|
||||
* auth 可选
|
||||
*/
|
||||
public static ResponseWrapper sendRequest(String method, String url, String auth, String reqParams)
|
||||
{
|
||||
Console.WriteLine("Send request - " + method.ToString() + " " + url + " "+ DateTime.Now);
|
||||
if (null != reqParams)
|
||||
{
|
||||
Console.WriteLine("Request Content - " + reqParams +" "+ DateTime.Now);
|
||||
}
|
||||
ResponseWrapper result = new ResponseWrapper();
|
||||
HttpWebRequest myReq = null;
|
||||
HttpWebResponse response = null;
|
||||
try
|
||||
{
|
||||
myReq = (HttpWebRequest)WebRequest.Create(url);
|
||||
myReq.Method = method;
|
||||
myReq.ContentType = "application/json";
|
||||
if ( !String.IsNullOrEmpty(auth) )
|
||||
{
|
||||
myReq.Headers.Add("Authorization", "Basic " + auth);
|
||||
}
|
||||
if (method == "POST")
|
||||
{
|
||||
byte[] bs = UTF8Encoding.UTF8.GetBytes(reqParams);
|
||||
myReq.ContentLength = bs.Length;
|
||||
using (Stream reqStream = myReq.GetRequestStream())
|
||||
{
|
||||
reqStream.Write(bs, 0, bs.Length);
|
||||
reqStream.Close();
|
||||
}
|
||||
}
|
||||
response = (HttpWebResponse)myReq.GetResponse();
|
||||
HttpStatusCode statusCode = response.StatusCode;
|
||||
result.responseCode = statusCode;
|
||||
if (Equals(response.StatusCode, HttpStatusCode.OK))
|
||||
{
|
||||
using (StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.UTF8))
|
||||
{
|
||||
result.responseContent = reader.ReadToEnd();
|
||||
}
|
||||
String limitQuota = response.GetResponseHeader(RATE_LIMIT_QUOTA);
|
||||
String limitRemaining = response.GetResponseHeader(RATE_LIMIT_Remaining);
|
||||
String limitReset = response.GetResponseHeader(RATE_LIMIT_Reset);
|
||||
result.setRateLimit(limitQuota, limitRemaining, limitReset);
|
||||
Console.WriteLine("Succeed to get response - 200 OK" +" "+ DateTime.Now);
|
||||
Console.WriteLine("Response Content - {0}", result.responseContent +" "+ DateTime.Now);
|
||||
}
|
||||
}
|
||||
catch (WebException e)
|
||||
{
|
||||
if (e.Status == WebExceptionStatus.ProtocolError)
|
||||
{
|
||||
HttpStatusCode errorCode = ((HttpWebResponse)e.Response).StatusCode;
|
||||
string statusDescription = ((HttpWebResponse)e.Response).StatusDescription;
|
||||
using (StreamReader sr = new StreamReader(((HttpWebResponse)e.Response).GetResponseStream(), System.Text.Encoding.UTF8))
|
||||
{
|
||||
result.responseContent = sr.ReadToEnd();
|
||||
}
|
||||
result.responseCode = errorCode;
|
||||
result.exceptionString = e.Message;
|
||||
String limitQuota = ((HttpWebResponse)e.Response).GetResponseHeader(RATE_LIMIT_QUOTA);
|
||||
String limitRemaining = ((HttpWebResponse)e.Response).GetResponseHeader(RATE_LIMIT_Remaining);
|
||||
String limitReset = ((HttpWebResponse)e.Response).GetResponseHeader(RATE_LIMIT_Reset);
|
||||
result.setRateLimit(limitQuota, limitRemaining, limitReset);
|
||||
Debug.Print(e.Message);
|
||||
//result.setErrorObject();
|
||||
Console.WriteLine(string.Format("fail to get response - {0}", errorCode) + " "+ DateTime.Now);
|
||||
Console.WriteLine(string.Format("Response Content - {0}", result.responseContent) + " "+ DateTime.Now);
|
||||
|
||||
throw ;
|
||||
}
|
||||
else
|
||||
{//
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
//这里不再抓取非http的异常,如果异常抛出交给开发者自行处理
|
||||
//catch (System.Exception ex)
|
||||
//{
|
||||
// String errorMsg = ex.Message;
|
||||
// Debug.Print(errorMsg);
|
||||
//}
|
||||
finally
|
||||
{
|
||||
if (response != null)
|
||||
{
|
||||
response.Close();
|
||||
}
|
||||
if(myReq != null)
|
||||
{
|
||||
myReq.Abort();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
public class ResponseWrapper
|
||||
{
|
||||
private const int RESPONSE_CODE_NONE = -1;
|
||||
|
||||
//private static Gson _gson = new Gson();
|
||||
|
||||
public HttpStatusCode responseCode = HttpStatusCode.BadRequest;
|
||||
private String _responseContent;
|
||||
public String responseContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return _responseContent;
|
||||
}
|
||||
set
|
||||
{
|
||||
_responseContent = value;
|
||||
}
|
||||
}
|
||||
|
||||
public int rateLimitQuota;
|
||||
public int rateLimitRemaining;
|
||||
public int rateLimitReset;
|
||||
|
||||
public bool isServerResponse()
|
||||
{
|
||||
return responseCode == HttpStatusCode.OK;
|
||||
}
|
||||
public String exceptionString;
|
||||
|
||||
public ResponseWrapper()
|
||||
{
|
||||
}
|
||||
public void setRateLimit(String quota, String remaining, String reset)
|
||||
{
|
||||
if (null == quota) return;
|
||||
try
|
||||
{
|
||||
if (quota != "" && StringUtil.IsInt(quota))
|
||||
{
|
||||
rateLimitQuota = int.Parse(quota);
|
||||
}
|
||||
if (remaining != "" && StringUtil.IsInt(remaining))
|
||||
{
|
||||
rateLimitRemaining = int.Parse(remaining);
|
||||
}
|
||||
if (reset != "" && StringUtil.IsInt(reset))
|
||||
{
|
||||
rateLimitReset = int.Parse(reset);
|
||||
}
|
||||
Console.WriteLine(string.Format("JPush API Rate Limiting params - quota:{0}, remaining:{1}, reset:{2} ", quota, remaining, reset) + " " + DateTime.Now);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.Print(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// 剪切板公共方法
|
||||
/// </summary>
|
||||
public static class ClipboardHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 查找剪切板图片
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Image FindClipboardImage()
|
||||
{
|
||||
try
|
||||
{
|
||||
IDataObject data = Clipboard.GetDataObject();
|
||||
if (data.GetDataPresent(typeof(Bitmap)))
|
||||
{
|
||||
return (Image)data.GetData(typeof(Bitmap));
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// 剪切板是否包含图片
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool ContainsImage()
|
||||
{
|
||||
try
|
||||
{
|
||||
return Clipboard.ContainsImage();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,318 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Security.Cryptography;
|
||||
using DevExpress.XtraGrid.Columns;
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.XtraTreeList.Columns;
|
||||
using DevExpress.XtraGrid;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using DevExpress.XtraEditors.Repository;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public static class CommonUtils
|
||||
{
|
||||
#region 计算字宽度
|
||||
private static string[] words = { "A", "B", "C", "D", "E", "F", "G", " H", " I", " J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
|
||||
/// <summary>
|
||||
/// 计算字宽度
|
||||
/// </summary>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static int GetFontWidth(string source)
|
||||
{
|
||||
return CutStr_BytesLen(source) * 6 + GetWords(source);
|
||||
}
|
||||
private static int GetWords(string source)
|
||||
{
|
||||
int len = 0;
|
||||
Regex reg = new Regex("[A-Z]");
|
||||
MatchCollection mcs = reg.Matches(source);
|
||||
foreach (Match item in mcs)
|
||||
{
|
||||
if (words.Contains(item.Value)) len += 2;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
/// <summary>
|
||||
/// 截断字符串 1个汉字长度为2 (超过则截断 拼上…)
|
||||
/// </summary>
|
||||
/// <param name="strInput"></param>
|
||||
/// <param name="intlen"></param>
|
||||
/// <returns></returns>
|
||||
private static int CutStr_BytesLen(string strInput)//截取字符串
|
||||
{
|
||||
strInput = strInput.Trim();
|
||||
|
||||
ASCIIEncoding ascii = new ASCIIEncoding();
|
||||
int intLength = 0;
|
||||
byte[] s = ascii.GetBytes(strInput);
|
||||
for (int i = 0; i < s.Length; i++)
|
||||
{
|
||||
//中文字符转化ASCII吗后不能识别全部都变成63,才回出现这样结果,但是如何碰上日文就麻烦了,全半角假名全部都是63无法识别!所以该方法谨慎使用!
|
||||
if ((int)s[i] == 63)
|
||||
{
|
||||
intLength += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
intLength += 1;
|
||||
}
|
||||
}
|
||||
return intLength;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 格式化列
|
||||
/// <summary>
|
||||
/// Grid格式化
|
||||
/// </summary>
|
||||
/// <param name="gridColumn"></param>
|
||||
/// <param name="formatString"></param>
|
||||
/// <param name="fieldType"></param>
|
||||
public static void DataFormat(GridColumn gridColumn, string formatString, int fieldType)
|
||||
{
|
||||
if (string.IsNullOrEmpty(formatString)) return;
|
||||
switch (fieldType)
|
||||
{
|
||||
case ControlType.LabTextInt: // 数字格式化
|
||||
case ControlType.LabCalcText: // 计算器格式化
|
||||
gridColumn.DisplayFormat.FormatType = FormatType.Numeric;
|
||||
gridColumn.DisplayFormat.FormatString = formatString;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// TreeList格式化
|
||||
/// </summary>
|
||||
/// <param name="treeColumn"></param>
|
||||
/// <param name="formatString"></param>
|
||||
/// <param name="fieldType"></param>
|
||||
public static void DataFormat(TreeListColumn treeColumn, string formatString, int fieldType)
|
||||
{
|
||||
if (string.IsNullOrEmpty(formatString)) return;
|
||||
// 数字格式化
|
||||
if (fieldType == 7)
|
||||
{
|
||||
treeColumn.Format.FormatType = FormatType.Numeric;
|
||||
treeColumn.Format.FormatString = formatString;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取参数
|
||||
public static List<string> GetParamValue(string param)
|
||||
{
|
||||
string SqlParamRegex = "{([^{])+}";
|
||||
List<string> list = new List<string>();
|
||||
Regex regex = new Regex(SqlParamRegex);
|
||||
MatchCollection mcs = regex.Matches(param);
|
||||
foreach (Match item in mcs)
|
||||
{
|
||||
list.Add(item.Value);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 特殊情况导出Excel
|
||||
/// <summary>
|
||||
/// 替换GridControl总bit类型,替换为是,否
|
||||
/// </summary>
|
||||
/// <param name="SourceGrid"></param>
|
||||
/// <returns></returns>
|
||||
public static GridControl ReplaceBitType(GridControl SourceGrid)
|
||||
{
|
||||
GridView gridView = SourceGrid.FocusedView as GridView;
|
||||
bool hasBoolean = false;
|
||||
GridColumn sortColumn = null;
|
||||
|
||||
List<string> boolList = new List<string>();
|
||||
List<string> visibleList = new List<string>();
|
||||
|
||||
foreach (GridColumn col in gridView.Columns)
|
||||
{
|
||||
if ((col.ColumnEdit != null && col.ColumnEdit.GetType() == typeof(RepositoryItemCheckEdit)) ||
|
||||
(col.ColumnType != null && col.ColumnType.Name.ToLower() == "boolean"))
|
||||
{
|
||||
boolList.Add(col.FieldName);
|
||||
hasBoolean = true;
|
||||
}
|
||||
if (sortColumn == null && col.SortOrder != DevExpress.Data.ColumnSortOrder.None)
|
||||
{
|
||||
sortColumn = col;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasBoolean)
|
||||
{
|
||||
|
||||
ExportExsForm exsForm = new ExportExsForm();
|
||||
|
||||
GridControl newGridControl = exsForm.gridControl1;
|
||||
GridView newGridView = exsForm.gridView1;
|
||||
|
||||
// 复制列
|
||||
foreach (GridColumn col in gridView.Columns)
|
||||
{
|
||||
if (col.Visible)
|
||||
{
|
||||
GridColumn newCol = new GridColumn();
|
||||
newCol.Caption = col.Caption;
|
||||
newCol.FieldName = col.FieldName;
|
||||
newCol.Name = col.Name;
|
||||
newCol.VisibleIndex = col.VisibleIndex;
|
||||
newCol.Width = col.Width;
|
||||
newCol.OptionsColumn.AllowEdit = col.OptionsColumn.AllowEdit;
|
||||
newCol.ColumnEdit = boolList.Contains(col.FieldName) ? null : col.ColumnEdit;
|
||||
newGridView.Columns.Add(newCol);
|
||||
visibleList.Add(col.FieldName);
|
||||
}
|
||||
}
|
||||
|
||||
DataTable sourceTable = (gridView.DataSource as DataView).Table;
|
||||
DataTable dtTable = new DataTable();
|
||||
// 复制DataTable列
|
||||
foreach (DataColumn col in sourceTable.Columns)
|
||||
{
|
||||
if (visibleList.Contains(col.ColumnName))
|
||||
{
|
||||
DataColumn newCol = new DataColumn();
|
||||
newCol.ColumnName = col.ColumnName;
|
||||
newCol.Caption = col.Caption;
|
||||
newCol.DataType = boolList.Contains(col.ColumnName) ? typeof(String) : col.DataType;
|
||||
|
||||
dtTable.Columns.Add(newCol);
|
||||
}
|
||||
}
|
||||
// 复制DataTable行
|
||||
foreach (DataRow row in sourceTable.Rows)
|
||||
{
|
||||
DataRow newRow = dtTable.NewRow();
|
||||
foreach (DataColumn col in sourceTable.Columns)
|
||||
{
|
||||
if (visibleList.Contains(col.ColumnName))
|
||||
{
|
||||
if (boolList.Contains(col.ColumnName))
|
||||
{
|
||||
newRow[col.ColumnName] = row[col.ColumnName] + "" == "0" ||
|
||||
(row[col.ColumnName] + "").ToLower() == "false" ? "否" : "是";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrEmpty(row[col.ColumnName] + ""))
|
||||
{
|
||||
if (col.DataType == typeof(Int16) ||
|
||||
col.DataType == typeof(Int32) ||
|
||||
col.DataType == typeof(Int64) ||
|
||||
col.DataType == typeof(Decimal) ||
|
||||
col.DataType == typeof(Double))
|
||||
{
|
||||
newRow[col.ColumnName] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newRow[col.ColumnName] = row[col.ColumnName] + "";
|
||||
}
|
||||
}
|
||||
|
||||
//处理统计
|
||||
DataColumn dcIsSum = sourceTable.Columns["isSum"];
|
||||
if (dcIsSum != null && !String.IsNullOrEmpty(row["isSum"] + ""))
|
||||
{
|
||||
int isSum = Convert.ToInt32(row["isSum"]);
|
||||
int fieldsqlTag = Convert.ToInt32(row["fieldsqlTag"]);
|
||||
string dataFormat = row["DataFormat"] + "";
|
||||
|
||||
GridColumn gridColumn = newGridView.Columns[col.ColumnName];
|
||||
|
||||
CommonUtils.DataFormat(gridColumn, dataFormat, fieldsqlTag);
|
||||
|
||||
if (isSum == 1)
|
||||
{
|
||||
newGridView.OptionsView.ShowFooter = true;
|
||||
if ((row["calcExpr"] + "").IndexOf("/{") == -1)
|
||||
{
|
||||
gridColumn.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Sum, row["fieldname"].ToString(), "{0:" + dataFormat + "}") });
|
||||
newGridView.GroupSummary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Sum, row["fieldname"].ToString(), null, "{0:" + dataFormat + "}") });
|
||||
}
|
||||
else
|
||||
{
|
||||
gridColumn.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Custom, row["fieldname"].ToString(), "{0:" + dataFormat + "}") });
|
||||
newGridView.GroupSummary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Custom, row["fieldname"].ToString(), null, "{0:" + dataFormat + "}") });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dtTable.Rows.Add(newRow);
|
||||
}
|
||||
|
||||
if (gridView.Columns.Count > 0)
|
||||
{
|
||||
GridColumn firstColumn = newGridView.Columns[0];
|
||||
if (firstColumn != null)
|
||||
{
|
||||
newGridView.OptionsView.ShowFooter = true;
|
||||
firstColumn.Summary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridColumnSummaryItem(DevExpress.Data.SummaryItemType.Count, firstColumn.FieldName.ToString(), "合计: {0:#,###}行") });
|
||||
newGridView.GroupSummary.AddRange(new DevExpress.XtraGrid.GridSummaryItem[] { new DevExpress.XtraGrid.GridGroupSummaryItem(DevExpress.Data.SummaryItemType.Count, firstColumn.FieldName.ToString(), null, "合计: {0:#,###}行") });
|
||||
}
|
||||
}
|
||||
|
||||
if (sortColumn != null)
|
||||
{
|
||||
DataView dataView = dtTable.DefaultView;
|
||||
dataView.Sort = string.Format(" {0} {1} ", sortColumn.FieldName, sortColumn.SortOrder == DevExpress.Data.ColumnSortOrder.Descending ? "desc" : "asc");
|
||||
dtTable = dataView.ToTable();
|
||||
}
|
||||
newGridControl.DataSource = dtTable;
|
||||
return newGridControl;
|
||||
}
|
||||
else
|
||||
{
|
||||
return SourceGrid;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 设置系统时间
|
||||
[DllImport("kernel32.dll", EntryPoint = "GetSystemDefaultLCID")]
|
||||
public static extern int GetSystemDefaultLCID();
|
||||
[DllImport("kernel32.dll", EntryPoint = "SetLocaleInfoA")]
|
||||
public static extern int SetLocaleInfo(int Locale, int LCType, string lpLCData);
|
||||
|
||||
public const int LOCALE_SLONGDATE = 0x20;
|
||||
public const int LOCALE_SSHORTDATE = 0x1F;
|
||||
public const int LOCALE_STIME = 0x1003;
|
||||
|
||||
/// <summary>
|
||||
/// 设置时间日期格式yyyy-MM-dd HH:mm:ss
|
||||
/// </summary>
|
||||
public static void SetDateTimeFormat()
|
||||
{
|
||||
try
|
||||
{
|
||||
int x = GetSystemDefaultLCID();
|
||||
SetLocaleInfo(x, LOCALE_STIME, "HH:mm:ss"); //时间格式
|
||||
SetLocaleInfo(x, LOCALE_SSHORTDATE, "yyyy-MM-dd"); //短日期格式
|
||||
//SetLocaleInfo(x, LOCALE_SLONGDATE, "yyyy-MM-dd"); //长日期格式
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public class ControlModelTag
|
||||
{
|
||||
public ControlModelTag()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public ControlModelTag(bool IsSave, bool IsEmpt, string TipMsg, int filedTypeid, bool IsClear, string DefaultValue,
|
||||
string DefaultText, object Tag)
|
||||
{
|
||||
this.IsSave = IsSave;
|
||||
this.IsEmpt = IsEmpt;
|
||||
this.TipMsg = TipMsg;
|
||||
this.fieldTypeId = filedTypeid;
|
||||
this.IsClear = IsClear;
|
||||
this.DefaultValue = DefaultValue;
|
||||
this.DefaultText = DefaultText;
|
||||
this.Tag = Tag;
|
||||
}
|
||||
/// <summary>
|
||||
/// 是否保存
|
||||
/// </summary>
|
||||
public bool IsSave { get; set; }
|
||||
/// <summary>
|
||||
/// 是否为空
|
||||
/// </summary>
|
||||
public bool IsEmpt { get; set; }
|
||||
/// <summary>
|
||||
/// 提示信息
|
||||
/// </summary>
|
||||
public string TipMsg { get; set; }
|
||||
/// <summary>
|
||||
/// 控件类型
|
||||
/// </summary>
|
||||
public int fieldTypeId { get; set; }
|
||||
/// <summary>
|
||||
/// 控件字段
|
||||
/// </summary>
|
||||
public string fieldName { get; set; }
|
||||
/// <summary>
|
||||
/// 是否清除
|
||||
/// </summary>
|
||||
public bool IsClear { get; set; }
|
||||
/// <summary>
|
||||
///默认Vlaue值
|
||||
/// </summary>
|
||||
public string DefaultValue { get; set; }
|
||||
/// <summary>
|
||||
/// 默认Text
|
||||
/// </summary>
|
||||
public string DefaultText { get; set; }
|
||||
/// <summary>
|
||||
/// 关联字段
|
||||
/// </summary>
|
||||
public string unionFields { get; set; }
|
||||
/// <summary>
|
||||
/// 关联值
|
||||
/// </summary>
|
||||
public string unionValue { get; set; }
|
||||
/// <summary>
|
||||
/// 扩展字段
|
||||
/// </summary>
|
||||
public object Tag { get; set; }
|
||||
/// <summary>
|
||||
/// 赋值
|
||||
/// </summary>
|
||||
public bool isSetText { get; set; }
|
||||
/// <summary>
|
||||
/// 时间格式化
|
||||
/// </summary>
|
||||
public string DateFormat { get; set; }
|
||||
///<summary>
|
||||
///下拉sql
|
||||
///</summary>
|
||||
public string lookupSql { get; set; }
|
||||
|
||||
///<summary>
|
||||
///刷新来源标记
|
||||
///</summary>
|
||||
public int refreshSource { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public class ControlType
|
||||
{
|
||||
public const int LabText = 0;//文本框
|
||||
public const int LabComboxValue = 1;//下拉框 获取Value值
|
||||
public const int LabTreeType = 3;// 树
|
||||
public const int LabComboxText = 2;//下拉框 获取Text值
|
||||
public const int LabDate = 4;//日期(年-月-日)
|
||||
public const int LabDateTime = 44;//日期和时间(年-月-日 时-分-秒)
|
||||
public const int LabDateTimeShort = 444; // 日期短时间(年-月-日 时-分)
|
||||
public const int LabTime = 4444; // 时间(时-分-秒)
|
||||
public const int LabShortTime = 44444; // 短时间(时-分)
|
||||
public const int LabAutoSeacherValue = 5;//自动搜索 获取Value值
|
||||
public const int LabAutoSeacherText = 6;//自动搜索 获取Text值
|
||||
public const int LabTextInt = 7;//数字控件
|
||||
public const int LabPassword = 8;//密码控件
|
||||
public const int LabRemark = 9;//备注
|
||||
public const int LabWWW = 10;//网址
|
||||
public const int LabQQ = 11;//QQ
|
||||
public const int LabPhone = 12; // 电话拨号(手机端拨号)
|
||||
public const int LabMultiSelectValue = 13;//多选,获取Value
|
||||
public const int LabMultiSelectText = 14;//多选,获取Text
|
||||
public const int LabComboxValueParam = 15; // 自动搜索 获取Value值,需要带参数
|
||||
public const int LabComboxTextParam = 16; // 自动搜索 获取Text值,需要带参数
|
||||
public const int LabCheckBox = 17; //复选框
|
||||
public const int LabComboxCheckListValue = 18;
|
||||
public const int LabComboxCheckListText = 19;
|
||||
public const int LabMemoEdit = 20; // Memo控件
|
||||
public const int LabCheckComboxValue = 21;
|
||||
public const int LabCheckComboxText = 22;
|
||||
public const int LabComboxInputParam = 23;
|
||||
public const int LabCheckDateEx = 24;
|
||||
public const int LabCheckAutoSeacherValue = 25;
|
||||
public const int LabCheckAutoSeacherText = 26;
|
||||
public const int LabCalcText = 27; // 计算器
|
||||
public const int LabMultiSelectValueParam = 33; // 多选 获取Value值,需要带参数
|
||||
public const int LabMultiSelectTextParam = 34; // 多选 获取Text值,需要带参数
|
||||
public const int LabRichEdit = 37; //富文本框
|
||||
public const int LabMap = 97; // 地图(手机端)
|
||||
public const int LabSacn = 98; // 扫码(手机端)
|
||||
public const int LabPic = 99;// 图片
|
||||
public const int LabPicEx = 100;// 图片,存地址
|
||||
public const int LabCheckDateTimeEx = 244;
|
||||
public const int LabCheckDateTimeShort = 2444;
|
||||
public const int LabCheckTime = 24444;
|
||||
public const int LabCheckShortTime = 244444;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// 日期格式化类型
|
||||
/// </summary>
|
||||
public static class DateFormatType
|
||||
{
|
||||
/// <summary>
|
||||
/// 空时间
|
||||
/// </summary>
|
||||
public const string Empty = " ";
|
||||
/// <summary>
|
||||
/// 例如:年-月-日
|
||||
/// </summary>
|
||||
public const string Date = "yyyy-MM-dd";
|
||||
/// <summary>
|
||||
/// 例如:年-月-日 时:分
|
||||
/// </summary>
|
||||
public const string DateTimeShort = "yyyy-MM-dd HH:mm";
|
||||
/// <summary>
|
||||
/// 例如年-月-日 时:分:秒
|
||||
/// </summary>
|
||||
public const string DateTime = "yyyy-MM-dd HH:mm:ss";
|
||||
/// <summary>
|
||||
/// 例如 时:分:秒
|
||||
/// </summary>
|
||||
public const string Time = "HH:mm:ss";
|
||||
/// <summary>
|
||||
/// 例如 时:分
|
||||
/// </summary>
|
||||
public const string ShortTime = "HH:mm";
|
||||
/// <summary>
|
||||
/// 通过ControlType获取Value
|
||||
/// </summary>
|
||||
/// <param name="typeId"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetFormatValue(int typeId)
|
||||
{
|
||||
string formatValue = string.Empty;
|
||||
switch (typeId)
|
||||
{
|
||||
case (int)ControlType.LabDate:
|
||||
case (int)ControlType.LabCheckDateEx:
|
||||
formatValue = Date;
|
||||
break;
|
||||
case (int)ControlType.LabDateTime:
|
||||
case (int)ControlType.LabCheckDateTimeEx:
|
||||
formatValue = DateTime;
|
||||
break;
|
||||
case (int)ControlType.LabDateTimeShort:
|
||||
case (int)ControlType.LabCheckDateTimeShort:
|
||||
formatValue = DateTimeShort;
|
||||
break;
|
||||
case (int)ControlType.LabTime:
|
||||
case (int)ControlType.LabCheckTime:
|
||||
formatValue = Time;
|
||||
break;
|
||||
case (int)ControlType.LabShortTime:
|
||||
case (int)ControlType.LabCheckShortTime:
|
||||
formatValue = ShortTime;
|
||||
break;
|
||||
default:
|
||||
formatValue = Empty;
|
||||
break;
|
||||
}
|
||||
return formatValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
partial class ExportExsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.gridControl1 = new DevExpress.XtraGrid.GridControl();
|
||||
this.gridView1 = new DevExpress.XtraGrid.Views.Grid.GridView();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridView1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// gridControl1
|
||||
//
|
||||
this.gridControl1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridControl1.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridControl1.MainView = this.gridView1;
|
||||
this.gridControl1.Name = "gridControl1";
|
||||
this.gridControl1.Size = new System.Drawing.Size(465, 368);
|
||||
this.gridControl1.TabIndex = 1;
|
||||
this.gridControl1.ViewCollection.AddRange(new DevExpress.XtraGrid.Views.Base.BaseView[] {
|
||||
this.gridView1});
|
||||
//
|
||||
// gridView1
|
||||
//
|
||||
this.gridView1.GridControl = this.gridControl1;
|
||||
this.gridView1.Name = "gridView1";
|
||||
//
|
||||
// ExportExsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(465, 368);
|
||||
this.Controls.Add(this.gridControl1);
|
||||
this.Name = "ExportExsForm";
|
||||
this.Text = "ExportExsForm";
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridControl1)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridView1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public DevExpress.XtraGrid.GridControl gridControl1;
|
||||
public DevExpress.XtraGrid.Views.Grid.GridView gridView1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using DevExpress.Utils;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public partial class ExportExsForm : Form
|
||||
{
|
||||
public ExportExsForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
gridView1.Appearance.HeaderPanel.Font = new Font("宋体", 9);
|
||||
gridView1.Appearance.HeaderPanel.TextOptions.HAlignment = HorzAlignment.Center;
|
||||
gridView1.Appearance.Preview.Font = new Font("宋体", 9);
|
||||
gridView1.Appearance.Row.Font = new Font("宋体", 9);
|
||||
gridView1.OptionsView.RowAutoHeight = true;
|
||||
gridView1.RowCellStyle += new RowCellStyleEventHandler(gridView1_RowCellStyle);
|
||||
}
|
||||
|
||||
public void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
|
||||
{
|
||||
if (!e.Column.OptionsColumn.AllowEdit)
|
||||
{
|
||||
Color color1 = ColorTranslator.FromHtml("#d0d0d0");
|
||||
e.Appearance.BackColor = color1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,155 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public class GraphicsText
|
||||
{
|
||||
private Graphics _graphics;
|
||||
|
||||
public GraphicsText()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public Graphics Graphics
|
||||
{
|
||||
get { return _graphics; }
|
||||
set { _graphics = value; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制根据矩形旋转文本
|
||||
/// </summary>
|
||||
/// <param name="s">文本</param>
|
||||
/// <param name="font">字体</param>
|
||||
/// <param name="brush">填充</param>
|
||||
/// <param name="layoutRectangle">局部矩形</param>
|
||||
/// <param name="format">布局方式</param>
|
||||
/// <param name="angle">角度</param>
|
||||
public void DrawString(string s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format, float angle)
|
||||
{
|
||||
// 求取字符串大小
|
||||
SizeF size = _graphics.MeasureString(s, font);
|
||||
|
||||
// 根据旋转角度,求取旋转后字符串大小
|
||||
SizeF sizeRotate = ConvertSize(size, angle);
|
||||
|
||||
// 根据旋转后尺寸、布局矩形、布局方式计算文本旋转点
|
||||
PointF rotatePt = GetRotatePoint(sizeRotate, layoutRectangle, format);
|
||||
|
||||
// 重设布局方式都为Center
|
||||
StringFormat newFormat = new StringFormat(format);
|
||||
newFormat.Alignment = StringAlignment.Center;
|
||||
newFormat.LineAlignment = StringAlignment.Center;
|
||||
|
||||
// 绘制旋转后文本
|
||||
DrawString(s, font, brush, rotatePt, newFormat, angle);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制根据点旋转文本,一般旋转点给定位文本包围盒中心点
|
||||
/// </summary>
|
||||
/// <param name="s">文本</param>
|
||||
/// <param name="font">字体</param>
|
||||
/// <param name="brush">填充</param>
|
||||
/// <param name="point">旋转点</param>
|
||||
/// <param name="format">布局方式</param>
|
||||
/// <param name="angle">角度</param>
|
||||
public void DrawString(string s, Font font, Brush brush, PointF point, StringFormat format, float angle)
|
||||
{
|
||||
// Save the matrix
|
||||
Matrix mtxSave = _graphics.Transform;
|
||||
|
||||
Matrix mtxRotate = _graphics.Transform;
|
||||
mtxRotate.RotateAt(angle, point);
|
||||
_graphics.Transform = mtxRotate;
|
||||
|
||||
_graphics.DrawString(s, font, brush, point, format);
|
||||
|
||||
// Reset the matrix
|
||||
_graphics.Transform = mtxSave;
|
||||
}
|
||||
|
||||
private SizeF ConvertSize(SizeF size, float angle)
|
||||
{
|
||||
Matrix matrix = new Matrix();
|
||||
matrix.Rotate(angle);
|
||||
|
||||
// 旋转矩形四个顶点
|
||||
PointF[] pts = new PointF[4];
|
||||
pts[0].X = -size.Width / 2f;
|
||||
pts[0].Y = -size.Height / 2f;
|
||||
pts[1].X = -size.Width / 2f;
|
||||
pts[1].Y = size.Height / 2f;
|
||||
pts[2].X = size.Width / 2f;
|
||||
pts[2].Y = size.Height / 2f;
|
||||
pts[3].X = size.Width / 2f;
|
||||
pts[3].Y = -size.Height / 2f;
|
||||
matrix.TransformPoints(pts);
|
||||
|
||||
// 求取四个顶点的包围盒
|
||||
float left = float.MaxValue;
|
||||
float right = float.MinValue;
|
||||
float top = float.MaxValue;
|
||||
float bottom = float.MinValue;
|
||||
|
||||
foreach (PointF pt in pts)
|
||||
{
|
||||
// 求取并集
|
||||
if (pt.X < left)
|
||||
left = pt.X;
|
||||
if (pt.X > right)
|
||||
right = pt.X;
|
||||
if (pt.Y < top)
|
||||
top = pt.Y;
|
||||
if (pt.Y > bottom)
|
||||
bottom = pt.Y;
|
||||
}
|
||||
|
||||
SizeF result = new SizeF(right - left, bottom - top);
|
||||
return result;
|
||||
}
|
||||
|
||||
private PointF GetRotatePoint(SizeF size, RectangleF layoutRectangle, StringFormat format)
|
||||
{
|
||||
PointF pt = new PointF();
|
||||
|
||||
switch (format.Alignment)
|
||||
{
|
||||
case StringAlignment.Near:
|
||||
pt.X = layoutRectangle.Left + size.Width / 2f;
|
||||
break;
|
||||
case StringAlignment.Center:
|
||||
pt.X = (layoutRectangle.Left + layoutRectangle.Right) / 2f;
|
||||
break;
|
||||
case StringAlignment.Far:
|
||||
pt.X = layoutRectangle.Right - size.Width / 2f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (format.LineAlignment)
|
||||
{
|
||||
case StringAlignment.Near:
|
||||
pt.Y = layoutRectangle.Top + size.Height / 2f;
|
||||
break;
|
||||
case StringAlignment.Center:
|
||||
pt.Y = (layoutRectangle.Top + layoutRectangle.Bottom) / 2f;
|
||||
break;
|
||||
case StringAlignment.Far:
|
||||
pt.Y = layoutRectangle.Bottom - size.Height / 2f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return pt;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public class INIHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 写入INI文件
|
||||
/// </summary>
|
||||
/// <param name="section">节点名称[如[TypeName]]</param>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="val">值</param>
|
||||
/// <param name="filepath">文件路径</param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filepath);
|
||||
/// <summary>
|
||||
/// 读取INI文件
|
||||
/// </summary>
|
||||
/// <param name="section">节点名称</param>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="def">值</param>
|
||||
/// <param name="retval">stringbulider对象</param>
|
||||
/// <param name="size">字节大小</param>
|
||||
/// <param name="filePath">文件路径</param>
|
||||
/// <returns></returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retval, int size, string filePath);
|
||||
|
||||
/// <summary>
|
||||
/// 获取某个指定节点(Section)中所有KEY和Value
|
||||
/// </summary>
|
||||
/// <param name="lpAppName">节点名称</param>
|
||||
/// <param name="lpReturnedString">返回值的内存地址,每个之间用\0分隔</param>
|
||||
/// <param name="nSize">内存大小(characters)</param>
|
||||
/// <param name="lpFileName">Ini文件</param>
|
||||
/// <returns>内容的实际长度,为0表示没有内容,为nSize-2表示内存大小不够</returns>
|
||||
[DllImport("kernel32")]
|
||||
private static extern int GetPrivateProfileSection(string lpAppName, byte[] lpszReturnBuffer, int nSize, string lpFileName);
|
||||
|
||||
private static string strFilePath = Application.StartupPath + "\\MenuConfig.ini";//获取INI文件路径
|
||||
private static string strSec = ""; //INI文件名
|
||||
|
||||
/// <summary>
|
||||
/// 写入
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public static void Write(string key, string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
//根据INI文件名设置要写入INI文件的节点名称
|
||||
//此处的节点名称完全可以根据实际需要进行配置
|
||||
if (!File.Exists(strFilePath))
|
||||
{
|
||||
File.Create(strFilePath);
|
||||
}
|
||||
strSec = Path.GetFileNameWithoutExtension(strFilePath);
|
||||
WritePrivateProfileString(strSec, key, value, strFilePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static string Read(string key)
|
||||
{
|
||||
string value = string.Empty;
|
||||
try
|
||||
{
|
||||
if (File.Exists(strFilePath))//读取时先要判读INI文件是否存在
|
||||
{
|
||||
strSec = Path.GetFileNameWithoutExtension(strFilePath);
|
||||
value = ContentValue(strSec, key);
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return value;
|
||||
}
|
||||
/// <summary>
|
||||
/// 自定义读取INI文件中的内容方法
|
||||
/// </summary>
|
||||
/// <param name="Section">键</param>
|
||||
/// <param name="key">值</param>
|
||||
/// <returns></returns>
|
||||
private static string ContentValue(string Section, string key)
|
||||
{
|
||||
try
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(1024);
|
||||
GetPrivateProfileString(Section, key, "", temp, 1024, strFilePath);
|
||||
return temp + "";
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:通过Key获取Value值</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-07-22</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns>值</returns>
|
||||
public static string Read(string iniName, string key)
|
||||
{
|
||||
string value = string.Empty;
|
||||
try
|
||||
{
|
||||
//判读INI文件是否存在
|
||||
string filePath = Path.Combine(new string[] { Application.StartupPath+ "\\" + iniName });
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
StringBuilder temp = new StringBuilder(1024);
|
||||
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||
GetPrivateProfileString(fileName, key, "", temp, 1024, filePath);
|
||||
|
||||
return temp + "";
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:写入Ini文件(以键值对的形式存放)</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-07-22</para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="value">值</param>
|
||||
/// <returns></returns>
|
||||
public static void Write(string iniName, string key, string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
//根据INI文件名设置要写入INI文件的节点名称
|
||||
//此处的节点名称完全可以根据实际需要进行配置
|
||||
string filePath = Path.Combine(new string[] { Application.StartupPath + "\\" + iniName });
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
File.Create(filePath);
|
||||
}
|
||||
string fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||
WritePrivateProfileString(fileName, key, value, filePath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取INI文件中指定节点(Section)中的所有条目(key=value形式)
|
||||
/// </summary>
|
||||
/// <param name="iniFile">Ini文件</param>
|
||||
/// <param name="section">节点名称</param>
|
||||
/// <returns>指定节点中的所有项目,没有内容返回string[0]</returns>
|
||||
public static Dictionary<string, string> GetSectionKeys(string iniFile, string category)
|
||||
{
|
||||
Dictionary<string, string> result = new Dictionary<string, string>();
|
||||
try
|
||||
{
|
||||
string filePath = Path.Combine(new string[] { Application.StartupPath + "\\" + iniFile });
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
byte[] buffer = new byte[2048];
|
||||
GetPrivateProfileSection(category, buffer, 2048, filePath);
|
||||
String[] tmp = Encoding.Default.GetString(buffer).Trim('\0').Split('\0');
|
||||
foreach (String entry in tmp)
|
||||
{
|
||||
string[] v = entry.Split('=');
|
||||
result.Add(v[0], v[1]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// 发送手机端消息编码,此类均已16进制存储数据
|
||||
/// </summary>
|
||||
public class JPushMessage
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取员工位置消息
|
||||
/// </summary>
|
||||
public const int Location = 0x3e8;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// 下拉Tag
|
||||
/// </summary>
|
||||
public class LookUpTag
|
||||
{
|
||||
public string Sql { get; set; }
|
||||
public string ColumnName { get; set; }
|
||||
public string DisplayMember { get; set; }
|
||||
public string ValueMember { get; set; }
|
||||
public string unionFields { get; set; }
|
||||
public string unionValue { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{752386CB-FD63-4565-980F-E8F72A520F77}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Lskj.PubUtils</RootNamespace>
|
||||
<AssemblyName>Lskj.PubUtils</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\引用DLL\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="DevExpress.Data.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\publish\DevExpress.Data.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.Utils.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\publish\DevExpress.Utils.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraEditors.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\publish\DevExpress.XtraEditors.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraGrid.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\publish\DevExpress.XtraGrid.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DevExpress.XtraTreeList.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\publish\DevExpress.XtraTreeList.v13.1.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AESUtil.cs" />
|
||||
<Compile Include="ClipboardHelper.cs" />
|
||||
<Compile Include="CommonUtils.cs" />
|
||||
<Compile Include="ControlModelTag.cs" />
|
||||
<Compile Include="ControlType.cs" />
|
||||
<Compile Include="DateFormatType.cs" />
|
||||
<Compile Include="ExportExsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ExportExsForm.Designer.cs">
|
||||
<DependentUpon>ExportExsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GraphicsText.cs" />
|
||||
<Compile Include="INIHelper.cs" />
|
||||
<Compile Include="JPushMessage.cs" />
|
||||
<Compile Include="LookUpTag.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Upload\frmUpload.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Upload\frmUpload.Designer.cs">
|
||||
<DependentUpon>frmUpload.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Upload\UploadFile.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="ExportExsForm.resx">
|
||||
<DependentUpon>ExportExsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\licenses.licx" />
|
||||
<EmbeddedResource Include="Upload\frmUpload.resx">
|
||||
<DependentUpon>frmUpload.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ClassDiagram1.cd" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Lskj.PubUtils")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Lskj.PubUtils")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("1f2efdf7-1b84-417e-944c-7ee5147f1c73")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 内部版本号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,2 @@
|
||||
DevExpress.Patch.InMemoryPatch, DevExpress.Patch.Common, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7fc7bfca2443de66
|
||||
DevExpress.XtraGrid.GridControl, DevExpress.XtraGrid.v13.1, Version=13.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a
|
||||
@@ -0,0 +1,208 @@
|
||||
/******************************
|
||||
* 说明:程序通用方法管理类
|
||||
* 创建人:龚宇超
|
||||
* 创建日期:2017-08-16
|
||||
* 修改人:
|
||||
* 修改日期:
|
||||
* 修改备注:
|
||||
* 版本:1.0.0.0
|
||||
******************************/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace Lskj.Util
|
||||
{
|
||||
/// <summary>
|
||||
/// 程序通用方法管理类
|
||||
/// </summary>
|
||||
public sealed class PubUtil
|
||||
{
|
||||
/// <summary>
|
||||
/// <para>说明:获取应用程序启动目录</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-08-21 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string AbsolutelyPath
|
||||
{
|
||||
get { return Application.StartupPath + "\\"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取应用程序启动目录下的Lib目录
|
||||
/// </summary>
|
||||
/// <value>The absolutely library path.</value>
|
||||
public static string AbsolutelyLibPath
|
||||
{
|
||||
get { return AbsolutelyPath + "Lib/"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取应用程序启动目录下的Browser目录
|
||||
/// </summary>
|
||||
/// <value>The absolutely browser path.</value>
|
||||
public static string AbsolutelyBrowserPath
|
||||
{
|
||||
get { return AbsolutelyPath + "Browser/"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取应用程序启动目录下的小平台目录
|
||||
/// </summary>
|
||||
/// <value>The absolutely small client path.</value>
|
||||
public static string AbsolutelySmallClientPath
|
||||
{
|
||||
get { return AbsolutelyPath + "Client.exe"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取附件下载存放临时目录</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
/// <para>创建日期:2017-11-01 </para>
|
||||
/// <para>修改人:</para>
|
||||
/// <para>修改日期:</para>
|
||||
/// <para>修改备注:</para>
|
||||
/// <para>版本:1.0</para>
|
||||
/// </summary>
|
||||
/// <returns>System.String.</returns>
|
||||
public static string FileDownLoadTempPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string path = AbsolutelyPath + "TempFiles/";
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取打印文件路径
|
||||
/// </summary>
|
||||
/// <value>The print file absolutely path.</value>
|
||||
public static string PrintFileAbsolutelyPath
|
||||
{
|
||||
get { return AbsolutelyPath + "Lib/P_PubPrint.lsp"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取新版打印文件路径
|
||||
/// </summary>
|
||||
/// <value>The print file absolutely path.</value>
|
||||
public static string PrintFileAbsolutelyPath70
|
||||
{
|
||||
get { return AbsolutelyPath + "Lib/p_pubprint70.lsp"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 附件exe文件路径
|
||||
/// </summary>
|
||||
/// <value>The name of the file executable.</value>
|
||||
public static string AbsolutelyFileUploadPath
|
||||
{
|
||||
get { return AbsolutelyPath + "Attach/LSTest.exe"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 主界面模块图片加载路径
|
||||
/// </summary>
|
||||
/// <value>The main menu default image.</value>
|
||||
public static string MainMenuDefaultImage
|
||||
{
|
||||
get { return BitMapPath + "Main/Module/"; }
|
||||
}
|
||||
public static string MesItemImage
|
||||
{
|
||||
get { return BitMapPath + "MesItem/"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 主界面、登录界面、子系统图片存放位置
|
||||
/// </summary>
|
||||
/// <value>The bit map path.</value>
|
||||
public static string BitMapPath
|
||||
{
|
||||
get { return AbsolutelyPath + "Images/"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 身份证阅读器图片存放位置
|
||||
/// </summary>
|
||||
/// <value>The identifier card bit map path.</value>
|
||||
public static string IDCardBitMapPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string filePath = AbsolutelyPath + "Card\\";
|
||||
if (!Directory.Exists(filePath))
|
||||
Directory.CreateDirectory(filePath);
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 模块配置文件存放路径
|
||||
/// </summary>
|
||||
/// <value>The main menu configuration path.</value>
|
||||
public static string MainMenuConfigPath
|
||||
{
|
||||
get { return AbsolutelyPath + "MenuConfig.ini"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Excel模板路径
|
||||
/// </summary>
|
||||
/// <value>The menu excel path.</value>
|
||||
public static string MenuExcelPath
|
||||
{
|
||||
get
|
||||
{
|
||||
string filePath = AbsolutelyPath + "Templete/";
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 打印模板 repx文件存放地址
|
||||
/// </summary>
|
||||
public static string PrintModePath
|
||||
{
|
||||
get
|
||||
{
|
||||
string filePath = AbsolutelyPath + "Reports\\";
|
||||
if (!Directory.Exists(filePath))
|
||||
{
|
||||
Directory.CreateDirectory(filePath);
|
||||
}
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 打印模板语言包存放位置
|
||||
/// </summary>
|
||||
public static string PrintModeResourcePath
|
||||
{
|
||||
get
|
||||
{
|
||||
return AbsolutelyPath + "Localization\\Chinese (Simplified).frl";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 软件升级日志
|
||||
/// </summary>
|
||||
/// <value>The system update log path.</value>
|
||||
public static string SystemUpdateLogPath
|
||||
{
|
||||
get { return AbsolutelyPath + "\\Log.txt"; }
|
||||
}
|
||||
/// <summary>
|
||||
/// WebView2
|
||||
/// </summary>
|
||||
/// <value>The system update log path.</value>
|
||||
public static string WebViewPath
|
||||
{
|
||||
get { return AbsolutelyPath + "\\Browser2\\"; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
class RotateText
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
class StringUtil
|
||||
{
|
||||
|
||||
public bool IsNumber(String strNumber)
|
||||
{
|
||||
Regex objNotNumberPattern=new Regex("[^0-9.-]");
|
||||
Regex objTwoDotPattern=new Regex("[0-9]*[.][0-9]*[.][0-9]*");
|
||||
Regex objTwoMinusPattern=new Regex("[0-9]*[-][0-9]*[-][0-9]*");
|
||||
String strValidRealPattern="^([-]|[.]|[-.]|[0-9])[0-9]*[.]*[0-9]+$";
|
||||
String strValidIntegerPattern="^([-]|[0-9])[0-9]*$";
|
||||
Regex objNumberPattern =new Regex("(" + strValidRealPattern +")|(" + strValidIntegerPattern + ")");
|
||||
|
||||
return !objNotNumberPattern.IsMatch(strNumber) &&
|
||||
!objTwoDotPattern.IsMatch(strNumber) &&
|
||||
!objTwoMinusPattern.IsMatch(strNumber) &&
|
||||
objNumberPattern.IsMatch(strNumber);
|
||||
}
|
||||
|
||||
public static bool IsNumeric(string value)
|
||||
{
|
||||
return Regex.IsMatch(value, @"^[+-]?\d*[.]?\d*$");
|
||||
}
|
||||
public static bool IsInt(string value)
|
||||
{
|
||||
return Regex.IsMatch(value, @"^[+-]?\d*$");
|
||||
}
|
||||
public static bool IsUnsign(string value)
|
||||
{
|
||||
return Regex.IsMatch(value, @"^\d*[.]?\d*$");
|
||||
}
|
||||
public static String arrayToString(String[] values)
|
||||
{
|
||||
if (null == values) return "";
|
||||
|
||||
StringBuilder buffer = new StringBuilder(values.Length);
|
||||
for (int i = 0; i < values.Length; i++)
|
||||
{
|
||||
buffer.Append(values[i]).Append(",");
|
||||
}
|
||||
if (buffer.Length > 0)
|
||||
{
|
||||
return buffer.ToString().Substring(0, buffer.Length - 1);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using Lskj.PubUtils.Upload;
|
||||
|
||||
namespace Lskj.PubUtils
|
||||
{
|
||||
public static class UploadFile
|
||||
{
|
||||
// <summary>
|
||||
/// 将本地文件上传到指定的服务器(HttpWebRequest方法)
|
||||
/// </summary>
|
||||
/// <param name="address">文件上传到的服务器</param>
|
||||
/// <param name="fileNamePath">要上传的本地文件(全路径)</param>
|
||||
/// <param name="saveName">文件上传后的名称</param>
|
||||
/// <param name="progressBar">上传进度条</param>
|
||||
/// <returns>成功返回1,失败返回0</returns>
|
||||
public static int Upload_Request(string address, string fileNamePath, string saveName, ProgressBar progressBar)
|
||||
{
|
||||
int returnValue = 0;
|
||||
|
||||
// 要上传的文件
|
||||
FileStream fs = new FileStream(fileNamePath, FileMode.Open, FileAccess.Read);
|
||||
BinaryReader r = new BinaryReader(fs);
|
||||
|
||||
//时间戳
|
||||
string strBoundary = "----------" + DateTime.Now.Ticks.ToString("x");
|
||||
byte[] boundaryBytes = Encoding.ASCII.GetBytes("/r/n--" + strBoundary + "/r/n");
|
||||
|
||||
//请求头部信息
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("--");
|
||||
sb.Append(strBoundary);
|
||||
sb.Append("/r/n");
|
||||
sb.Append("Content-Disposition: form-data; name=''");
|
||||
sb.Append("file");
|
||||
sb.Append("/'; filename=''");
|
||||
sb.Append(saveName);
|
||||
sb.Append("/r/n");
|
||||
sb.Append("Content-Type: ");
|
||||
sb.Append("application/octet-stream");
|
||||
sb.Append("/r/n");
|
||||
sb.Append("/r/n");
|
||||
string strPostHeader = sb.ToString();
|
||||
byte[] postHeaderBytes = Encoding.UTF8.GetBytes(strPostHeader);
|
||||
|
||||
// 根据uri创建HttpWebRequest对象
|
||||
HttpWebRequest httpReq = (HttpWebRequest)WebRequest.Create(new Uri(address));
|
||||
httpReq.Method = "POST";
|
||||
//httpReq.ContentType="application/octet-stream";
|
||||
//httpReq.ContentLength=fs.Length;
|
||||
|
||||
//对发送的数据不使用缓存
|
||||
httpReq.AllowWriteStreamBuffering = false;
|
||||
|
||||
//设置获得响应的超时时间(300秒)
|
||||
httpReq.Timeout = 300000;
|
||||
httpReq.ContentType = "multipart/form-data; boundary=" + strBoundary;
|
||||
long length = fs.Length + postHeaderBytes.Length + boundaryBytes.Length;
|
||||
long fileLength = fs.Length;
|
||||
httpReq.ContentLength = length;
|
||||
frmUpload upload = new frmUpload();
|
||||
try
|
||||
{
|
||||
upload.Show();
|
||||
progressBar.Maximum = int.MaxValue;
|
||||
progressBar.Minimum = 0;
|
||||
progressBar.Value = 0;
|
||||
|
||||
//每次上传4k
|
||||
int bufferLength = 4096;
|
||||
byte[] buffer = new byte[bufferLength];
|
||||
|
||||
//已上传的字节数
|
||||
long offset = 0;
|
||||
|
||||
//开始上传时间
|
||||
DateTime startTime = DateTime.Now;
|
||||
int size = r.Read(buffer, 0, bufferLength);
|
||||
Stream postStream = httpReq.GetRequestStream();
|
||||
//发送请求头部消息
|
||||
postStream.Write(postHeaderBytes, 0, postHeaderBytes.Length);
|
||||
while (size > 0)
|
||||
{
|
||||
postStream.Write(buffer, 0, size);
|
||||
offset += size;
|
||||
progressBar.Value = (int)(offset * (int.MaxValue / length));
|
||||
TimeSpan span = DateTime.Now - startTime;
|
||||
double second = span.TotalSeconds;
|
||||
upload.eclspeTime = "已用时:" + second.ToString("F2") + "秒";
|
||||
if (second > 0.001)
|
||||
{
|
||||
upload.speed = " 平均速度:" + (offset / 1024 / second).ToString("0.00") + "KB/秒";
|
||||
}
|
||||
else
|
||||
{
|
||||
upload.speed = " 正在连接…";
|
||||
}
|
||||
upload.state = "已上传:" + (offset * 100.0 / length).ToString("F2") + "% "
|
||||
+ (offset / 1048576.0).ToString("F2") + "M/" + (fileLength / 1048576.0).ToString("F2") + "M";
|
||||
upload.setState();
|
||||
Application.DoEvents();
|
||||
size = r.Read(buffer, 0, bufferLength);
|
||||
}
|
||||
//添加尾部的时间戳
|
||||
postStream.Write(boundaryBytes, 0, boundaryBytes.Length);
|
||||
postStream.Close();
|
||||
|
||||
//获取服务器端的响应
|
||||
WebResponse webRespon = httpReq.GetResponse();
|
||||
Stream s = webRespon.GetResponseStream();
|
||||
StreamReader sr = new StreamReader(s);
|
||||
|
||||
//读取服务器端返回的消息
|
||||
String sReturnString = sr.ReadLine();
|
||||
s.Close();
|
||||
sr.Close();
|
||||
if (sReturnString == "Success")
|
||||
{
|
||||
returnValue = 1;
|
||||
}
|
||||
else if (sReturnString == "Error")
|
||||
{
|
||||
returnValue = 0;
|
||||
}
|
||||
|
||||
}
|
||||
catch
|
||||
{
|
||||
returnValue = 0;
|
||||
}
|
||||
finally
|
||||
{
|
||||
fs.Close();
|
||||
r.Close();
|
||||
}
|
||||
|
||||
upload.Close();
|
||||
upload.Dispose();
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
namespace Lskj.PubUtils.Upload
|
||||
{
|
||||
partial class frmUpload
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.lblTime = new System.Windows.Forms.Label();
|
||||
this.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.lblSpeed = new System.Windows.Forms.Label();
|
||||
this.lblState = new System.Windows.Forms.Label();
|
||||
this.lblFile = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblTime
|
||||
//
|
||||
this.lblTime.AutoSize = true;
|
||||
this.lblTime.Location = new System.Drawing.Point(13, 31);
|
||||
this.lblTime.Name = "lblTime";
|
||||
this.lblTime.Size = new System.Drawing.Size(47, 12);
|
||||
this.lblTime.TabIndex = 0;
|
||||
this.lblTime.Text = "已用时:";
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Location = new System.Drawing.Point(13, 98);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(346, 23);
|
||||
this.progressBar1.TabIndex = 1;
|
||||
//
|
||||
// lblSpeed
|
||||
//
|
||||
this.lblSpeed.AutoSize = true;
|
||||
this.lblSpeed.Location = new System.Drawing.Point(13, 53);
|
||||
this.lblSpeed.Name = "lblSpeed";
|
||||
this.lblSpeed.Size = new System.Drawing.Size(59, 12);
|
||||
this.lblSpeed.TabIndex = 2;
|
||||
this.lblSpeed.Text = "平均速度:";
|
||||
//
|
||||
// lblState
|
||||
//
|
||||
this.lblState.AutoSize = true;
|
||||
this.lblState.Location = new System.Drawing.Point(13, 74);
|
||||
this.lblState.Name = "lblState";
|
||||
this.lblState.Size = new System.Drawing.Size(47, 12);
|
||||
this.lblState.TabIndex = 3;
|
||||
this.lblState.Text = "已上传:";
|
||||
//
|
||||
// lblFile
|
||||
//
|
||||
this.lblFile.AutoSize = true;
|
||||
this.lblFile.Location = new System.Drawing.Point(13, 10);
|
||||
this.lblFile.Name = "lblFile";
|
||||
this.lblFile.Size = new System.Drawing.Size(35, 12);
|
||||
this.lblFile.TabIndex = 4;
|
||||
this.lblFile.Text = "文件:";
|
||||
//
|
||||
// frmUpload
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(375, 135);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.lblFile);
|
||||
this.Controls.Add(this.lblState);
|
||||
this.Controls.Add(this.lblSpeed);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.Controls.Add(this.lblTime);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Name = "frmUpload";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "上传进度";
|
||||
this.TopMost = true;
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label lblTime;
|
||||
private System.Windows.Forms.ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Label lblSpeed;
|
||||
private System.Windows.Forms.Label lblState;
|
||||
private System.Windows.Forms.Label lblFile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.PubUtils.Upload
|
||||
{
|
||||
public partial class frmUpload : Form
|
||||
{
|
||||
public frmUpload()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string eclspeTime { get; set; }
|
||||
public string speed { get; set; }
|
||||
public string state { get; set; }
|
||||
|
||||
public void setState()
|
||||
{
|
||||
lblTime.Text = eclspeTime;
|
||||
lblSpeed.Text = speed;
|
||||
lblState.Text = state;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
Reference in New Issue
Block a user