|
@@ -8,7 +8,7 @@ using WingServerCommon.Config.Parameters;
|
|
|
namespace WingServerCommon.Interfaces.FileTransfer
|
|
|
{
|
|
|
/// <summary>
|
|
|
- /// 文件帮助��
|
|
|
+ /// 文件帮助类
|
|
|
/// </summary>
|
|
|
public class FileHelper
|
|
|
{
|
|
@@ -627,7 +627,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
|
|
|
}
|
|
|
var storageServer = ConfigurationManager.GetParammeter<StringParameter>("Storage", "StorageServer").Value;
|
|
|
var serverType = storageServer == "VCS" ? StorageServerEnum.Vinno : StorageServerEnum.Tencent;
|
|
|
- //表示自建服务��
|
|
|
+ //表示自建服务器
|
|
|
var newFileName = string.Empty;
|
|
|
if (!isRechristen)
|
|
|
{
|
|
@@ -918,7 +918,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 针对单个value,则只需满足 URLAllowChars 不需要编码即��
|
|
|
+ /// 针对单个value,则只需满足 URLAllowChars 不需要编码即可
|
|
|
/// urlEncode: 转为一个byte -> 转为两个16进制 -> 前面加上 %
|
|
|
/// </summary>
|
|
|
/// <param name="value"></param>
|
|
@@ -926,7 +926,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
|
|
|
/// <returns></returns>
|
|
|
public static string Encode(string value, Encoding encoding)
|
|
|
{
|
|
|
- //只有字母和数字[0-9a-zA-Z]、一些特殊符�_.!*~',以及某些保留字,才可以不经过编码直接用于URL地址
|
|
|
+ //只有字母和数字[0-9a-zA-Z]、一些特殊符串_.!*~',以及某些保留字,才可以不经过编码直接用于URL地址
|
|
|
string URLAllowChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~";
|
|
|
if (String.IsNullOrEmpty(value))
|
|
|
{
|
|
@@ -956,7 +956,7 @@ namespace WingServerCommon.Interfaces.FileTransfer
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 对象转XML字符��
|
|
|
+ /// 对象转XML字符串
|
|
|
/// </summary>
|
|
|
public static string XMLSerialize<T>(T t)
|
|
|
{
|
|
@@ -993,5 +993,30 @@ namespace WingServerCommon.Interfaces.FileTransfer
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 反序列化
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="T"></typeparam>
|
|
|
+ /// <param name="str"></param>
|
|
|
+ /// <param name="encode"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static T DeserializeXML<T>(string xmlString) where T : class
|
|
|
+ {
|
|
|
+ T result = null;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ XmlSerializer serializer = new XmlSerializer(typeof(T));
|
|
|
+ using (StringReader reader = new StringReader(xmlString))
|
|
|
+ {
|
|
|
+ result = (T)serializer.Deserialize(reader);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ Console.WriteLine(ex.Message);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|
|
|
}
|