简介

之前捣鼓过一个通过csv配置游戏多语言支持的小工具,但是发现使用过程中,通过notepad++去进行转码很不方便,并且直接将配置的csv不加密的放在游戏中心里感觉不是很踏实

于是乎~~

新的方案

1.在PC/MAC平台上解析多语言配置,也就是editor运行环境中解析csv或者excel

2.通过在Editor运行过程中生成多个语言对象,然后序列化并加密存盘

3.在使用端(移动端)通过resources加载加密之后的文件

4.读取对应的语言序列化文件并实例化加载到游戏中进行使用

使用方法

由于不想让csv文件被打包入游戏工程中,所以选择与Assets文件夹并列的路径文件:

PS:当然路径可以自己指定



然后里面存放多语言csv



然后代码中是调用是这样的:

代码实现

序列化反序列化工具


using Newtonsoft.Json;
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text; public static class SaveHelper
{ private const string M_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; public static bool IsFileExist(string filePath)
{
return File.Exists(filePath);
} public static bool IsDirectoryExists(string filePath)
{
return Directory.Exists(filePath);
} public static void CreateFile(string fileName, string content)
{
StreamWriter streamWriter = File.CreateText(fileName);
streamWriter.Write(content);
streamWriter.Close();
} public static void CreateDirectory(string filePath)
{
if (IsDirectoryExists(filePath))
{
return;
}
Directory.CreateDirectory(filePath);
} private static string SerializeObject(object pObject)
{
string serializedString = string.Empty;
serializedString = JsonConvert.SerializeObject(pObject);
return serializedString;
} private static object DeserializeObject(string pString, Type pType)
{
object deserializedObject = null;
deserializedObject = JsonConvert.DeserializeObject(pString, pType);
return deserializedObject;
} private static string RijndaelEncrypt(string pString, string pKey)
{
byte[] keyArray = UTF8Encoding.UTF8.GetBytes(pKey);
byte[] toEncryptArray = UTF8Encoding.UTF8.GetBytes(pString);
RijndaelManaged rDel = new RijndaelManaged();
rDel.Key = keyArray;
rDel.Mode = CipherMode.ECB;
rDel.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = rDel.CreateEncryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
return Convert.ToBase64String(resultArray, 0, resultArray.Length);
} private static String RijndaelDecrypt(string pString, string pKey)
{
byte[] keyArray = UTF8Encoding.UTF8.GetBytes(pKey);
byte[] toEncryptArray = Convert.FromBase64String(pString);
RijndaelManaged rDel = new RijndaelManaged();
rDel.Key = keyArray;
rDel.Mode = CipherMode.ECB;
rDel.Padding = PaddingMode.PKCS7;
ICryptoTransform cTransform = rDel.CreateDecryptor();
byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length);
return UTF8Encoding.UTF8.GetString(resultArray);
} public static void SaveData(string fileName, object pObject)
{
// 如果文件已存在,则删除
if (File.Exists(fileName))
{
File.Delete(fileName);
}
string toSave = SerializeObject(pObject);
toSave = RijndaelEncrypt(toSave, M_KEY);
StreamWriter streamWriter = File.CreateText(fileName);
streamWriter.Write(toSave);
streamWriter.Close();
} public static object ReadData(string str, Type pType, bool isFile = true)
{
string data;
if (isFile)
{
// 如果文件不存在,则返回空
if (!File.Exists(str))
{
return null;
}
StreamReader streamReader = File.OpenText(str);
data = streamReader.ReadToEnd();
streamReader.Close();
}
else
{
data = str;
} data = RijndaelDecrypt(data, M_KEY);
return DeserializeObject(data, pType);
}
}

CSV解析器

using System.Collections.Generic;
using System.IO;
using System.Text; // col是竖行,row是横排,防止我忘了
public class LTCSVLoader
{ private TextReader inStream = null; private List<string> vContent; private List<List<string>> table; /// <summary>
/// 只支持GBK2312的编码(WPS直接保存的编码支持,仅提供给Windows使用)
/// </summary>
/// <param name="fileName"></param>
public void ReadFile(string fileName)
{
inStream = new StreamReader(fileName, Encoding.GetEncoding("GBK"));
table = new List<List<string>>();
List<string> temp = this.getLineContentVector();
while (null != temp)
{
List<string> tempList = new List<string>();
for (int i = 0; i < temp.Count; ++i)
{
tempList.Add(temp[i]);
}
table.Add(tempList);
temp = this.getLineContentVector();
}
} /// <summary>
/// 目前只支持UTF-8的编码(WPS直接保存的编码不支持)
/// </summary>
/// <param name="str"></param>
public void ReadMultiLine(string str)
{
inStream = new StringReader(str); table = new List<List<string>>();
List<string> temp = this.getLineContentVector();
while (null != temp)
{
List<string> tempList = new List<string>();
for (int i = 0; i < temp.Count; ++i)
{
tempList.Add(temp[i]);
}
table.Add(tempList);
temp = this.getLineContentVector();
}
} private int containsNumber(string parentStr, string parameter)
{
int containNumber = 0;
if (parentStr == null || parentStr.Equals(""))
{
return 0;
}
if (parameter == null || parameter.Equals(""))
{
return 0;
}
for (int i = 0; i < parentStr.Length; i++)
{
i = parentStr.IndexOf(parameter, i);
if (i > -1)
{
i = i + parameter.Length;
i--;
containNumber = containNumber + 1;
}
else
{
break;
}
}
return containNumber;
} private bool isQuoteAdjacent(string p_String)
{
bool ret = false;
string temp = p_String;
temp = temp.Replace("\"\"", "");
if (temp.IndexOf("\"") == -1)
{
ret = true;
}
return ret;
} private bool isQuoteContained(string p_String)
{
bool ret = false;
if (p_String == null || p_String.Equals(""))
{
return false;
}
if (p_String.IndexOf("\"") > -1)
{
ret = true;
}
return ret;
} private string[] readAtomString(string lineStr)
{
string atomString = "";// 要读取的原子字符串
string orgString = "";// 保存第一次读取下一个逗号时的未经任何处理的字符串
string[] ret = new string[2];// 要返回到外面的数组
bool isAtom = false;// 是否是原子字符串的标志
string[] commaStr = lineStr.Split(new char[] { ',' });
while (!isAtom)
{
foreach (string str in commaStr)
{
if (!atomString.Equals(""))
{
atomString = atomString + ",";
}
atomString = atomString + str;
orgString = atomString;
if (!isQuoteContained(atomString))
{
// 如果字符串中不包含引号,则为正常,返回
isAtom = true;
break;
}
else
{
if (!atomString.StartsWith("\""))
{
// 如果字符串不是以引号开始,则表示不转义,返回
isAtom = true;
break;
}
else if (atomString.StartsWith("\""))
{
// 如果字符串以引号开始,则表示转义
if (containsNumber(atomString, "\"") % 2 == 0)
{
// 如果含有偶数个引号
string temp = atomString;
if (temp.EndsWith("\""))
{
temp = temp.Replace("\"\"", "");
if (temp.Equals(""))
{
// 如果temp为空
atomString = "";
isAtom = true;
break;
}
else
{
// 如果temp不为空,则去掉前后引号
temp = temp.Substring(1, temp.LastIndexOf("\""));
if (temp.IndexOf("\"") > -1)
{
// 去掉前后引号和相邻引号之后,若temp还包含有引号
// 说明这些引号是单个单个出现的
temp = atomString;
temp = temp.Substring(1);
temp = temp.Substring(0, temp.IndexOf("\""))
+ temp.Substring(temp.IndexOf("\"") + 1);
atomString = temp;
isAtom = true;
break;
}
else
{
// 正常的csv文件
temp = atomString;
temp = temp.Substring(1, temp.LastIndexOf("\""));
temp = temp.Replace("\"\"", "\"");
atomString = temp;
isAtom = true;
break;
}
}
}
else
{
// 如果不是以引号结束,则去掉前两个引号
temp = temp.Substring(1, temp.IndexOf('\"', 1))
+ temp.Substring(temp.IndexOf('\"', 1) + 1);
atomString = temp;
isAtom = true;
break;
}
}
else
{
// 如果含有奇数个引号
if (!atomString.Equals("\""))
{
string tempAtomStr = atomString.Substring(1);
if (!isQuoteAdjacent(tempAtomStr))
{
// 这里做的原因是,如果判断前面的字符串不是原子字符串的时候就读取第一个取到的字符串
// 后面取到的字符串不计入该原子字符串
tempAtomStr = atomString.Substring(1);
int tempQutoIndex = tempAtomStr.IndexOf("\"");
// 这里既然有奇数个quto,所以第二个quto肯定不是最后一个
tempAtomStr = tempAtomStr.Substring(0, tempQutoIndex)
+ tempAtomStr.Substring(tempQutoIndex + 1);
atomString = tempAtomStr;
isAtom = true;
break;
}
}
}
}
}
}
}
// 先去掉之前读取的原字符串的母字符串
if (lineStr.Length > orgString.Length)
{
lineStr = lineStr.Substring(orgString.Length);
}
else
{
lineStr = "";
}
// 去掉之后,判断是否以逗号开始,如果以逗号开始则去掉逗号
if (lineStr.StartsWith(","))
{
if (lineStr.Length > 1)
{
lineStr = lineStr.Substring(1);
}
else
{
lineStr = "";
}
}
ret[0] = atomString;
ret[1] = lineStr;
return ret;
} private bool readCSVNextRecord()
{
// 如果流未被初始化则返回false
if (inStream == null)
{
return false;
}
// 如果结果向量未被初始化,则初始化
if (vContent == null)
{
vContent = new List<string>();
}
// 移除向量中以前的元素
vContent.Clear();
// 声明逻辑行
string logicLineStr = "";
// 用于存放读到的行
StringBuilder strb = new StringBuilder();
// 声明是否为逻辑行的标志,初始化为false
bool isLogicLine = false;
while (!isLogicLine)
{
string newLineStr = inStream.ReadLine();
if (newLineStr == null)
{
strb = null;
vContent = null;
isLogicLine = true;
break;
}
if (newLineStr.StartsWith("#"))
{
// 去掉注释
continue;
}
if (!strb.ToString().Equals(""))
{
strb.Append("\r\n");
}
strb.Append(newLineStr);
string oldLineStr = strb.ToString();
if (oldLineStr.IndexOf(",") == -1)
{
// 如果该行未包含逗号
if (containsNumber(oldLineStr, "\"") % 2 == 0)
{
// 如果包含偶数个引号
isLogicLine = true;
break;
}
else
{
if (oldLineStr.StartsWith("\""))
{
if (oldLineStr.Equals("\""))
{
continue;
}
else
{
string tempOldStr = oldLineStr.Substring(1);
if (isQuoteAdjacent(tempOldStr))
{
// 如果剩下的引号两两相邻,则不是一行
continue;
}
else
{
// 否则就是一行
isLogicLine = true;
break;
}
}
}
}
}
else
{
// quotes表示复数的quote
string tempOldLineStr = oldLineStr.Replace("\"\"", "");
int lastQuoteIndex = tempOldLineStr.LastIndexOf("\"");
if (lastQuoteIndex == 0)
{
continue;
}
else if (lastQuoteIndex == -1)
{
isLogicLine = true;
break;
}
else
{
tempOldLineStr = tempOldLineStr.Replace("\",\"", "");
lastQuoteIndex = tempOldLineStr.LastIndexOf("\"");
if (lastQuoteIndex == 0)
{
continue;
}
if (tempOldLineStr[lastQuoteIndex - 1] == ',')
{
continue;
}
else
{
isLogicLine = true;
break;
}
}
}
}
if (strb == null)
{
// 读到行尾时为返回
return false;
}
// 提取逻辑行
logicLineStr = strb.ToString();
if (logicLineStr != null)
{
// 拆分逻辑行,把分离出来的原子字符串放入向量中
while (!logicLineStr.Equals(""))
{
string[] ret = readAtomString(logicLineStr);
string atomString = ret[0];
logicLineStr = ret[1];
vContent.Add(atomString);
}
}
return true;
} private List<string> getLineContentVector()
{
if (this.readCSVNextRecord())
{
return this.vContent;
}
return null;
} private List<string> getVContent()
{
return this.vContent;
} public int GetRow()
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
return table.Count;
} public int GetCol()
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
if (table.Count == 0)
{
throw new System.Exception("table内容为空");
}
return table[0].Count;
} public int GetFirstIndexAtCol(string str, int col)
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
if (table.Count == 0)
{
throw new System.Exception("table内容为空");
}
if (col >= table[0].Count)
{
throw new System.Exception("参数错误:col大于最大行");
}
for (int i = 0; i < table.Count; ++i)
{
if (table[i][col].Equals(str))
{
return i;
}
}
return -1;
} public int GetFirstIndexAtRow(string str, int row)
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
if (table.Count == 0)
{
throw new System.Exception("table内容为空");
}
if (row >= table.Count)
{
throw new System.Exception("参数错误:cow大于最大列");
}
int tempCount = table[0].Count;
for (int i = 0; i < tempCount; ++i)
{
if (table[row][i].Equals(str))
{
return i;
}
}
return -1;
} public int[] GetIndexsAtCol(string str, int col)
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
if (table.Count == 0)
{
throw new System.Exception("table内容为空");
}
if (col >= table[0].Count)
{
throw new System.Exception("参数错误:col大于最大行");
}
List<int> tempList = new List<int>();
for (int i = 0; i < table.Count; ++i)
{
if (table[i][col].Equals(str))
{
// 增加
tempList.Add(i);
}
}
return tempList.ToArray();
} public int[] GetIndexsAtRow(string str, int row)
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
if (table.Count == 0)
{
throw new System.Exception("table内容为空");
}
if (row >= table.Count)
{
throw new System.Exception("参数错误:cow大于最大列");
}
int tempCount = table[0].Count;
List<int> tempList = new List<int>();
for (int i = 0; i < tempCount; ++i)
{
if (table[row][i].Equals(str))
{
tempList.Add(i);
}
}
return tempList.ToArray();
} public string GetValueAt(int col, int row)
{
if (null == table)
{
throw new System.Exception("table尚未初始化,请检查是否成功读取");
}
if (table.Count == 0)
{
throw new System.Exception("table内容为空");
}
if (row >= table.Count)
{
throw new System.Exception("参数错误:row大于最大列");
}
if (col >= table[0].Count)
{
throw new System.Exception("参数错误:col大于最大行");
}
return table[row][col];
} }

多语言实现类

using UnityEngine;
using System.Collections.Generic; public class LTLocalization
{ public const string LANGUAGE_ENGLISH = "EN";
public const string LANGUAGE_CHINESE = "CN";
public const string LANGUAGE_JAPANESE = "JP";
public const string LANGUAGE_FRENCH = "FR";
public const string LANGUAGE_GERMAN = "GE";
public const string LANGUAGE_ITALY = "IT";
public const string LANGUAGE_KOREA = "KR";
public const string LANGUAGE_RUSSIA = "RU";
public const string LANGUAGE_SPANISH = "SP"; private const string KEY_CODE = "KEY";
private const string FILE_PATH = "LTLocalization/localization"; private SystemLanguage language = SystemLanguage.Chinese;
private Dictionary<string, string> textData = new Dictionary<string, string>(); private static LTLocalization mInstance; private LTLocalization()
{
} private static string GetLanguageAB(SystemLanguage language)
{
switch (language)
{
case SystemLanguage.Afrikaans:
case SystemLanguage.Arabic:
case SystemLanguage.Basque:
case SystemLanguage.Belarusian:
case SystemLanguage.Bulgarian:
case SystemLanguage.Catalan:
return LANGUAGE_ENGLISH;
case SystemLanguage.Chinese:
case SystemLanguage.ChineseTraditional:
case SystemLanguage.ChineseSimplified:
return LANGUAGE_CHINESE;
case SystemLanguage.Czech:
case SystemLanguage.Danish:
case SystemLanguage.Dutch:
case SystemLanguage.English:
case SystemLanguage.Estonian:
case SystemLanguage.Faroese:
case SystemLanguage.Finnish:
return LANGUAGE_ENGLISH;
case SystemLanguage.French:
return LANGUAGE_FRENCH;
case SystemLanguage.German:
return LANGUAGE_GERMAN;
case SystemLanguage.Greek:
case SystemLanguage.Hebrew:
case SystemLanguage.Icelandic:
case SystemLanguage.Indonesian:
return LANGUAGE_ENGLISH;
case SystemLanguage.Italian:
return LANGUAGE_ITALY;
case SystemLanguage.Japanese:
return LANGUAGE_JAPANESE;
case SystemLanguage.Korean:
return LANGUAGE_KOREA;
case SystemLanguage.Latvian:
case SystemLanguage.Lithuanian:
case SystemLanguage.Norwegian:
case SystemLanguage.Polish:
case SystemLanguage.Portuguese:
case SystemLanguage.Romanian:
return LANGUAGE_ENGLISH;
case SystemLanguage.Russian:
return LANGUAGE_RUSSIA;
case SystemLanguage.SerboCroatian:
case SystemLanguage.Slovak:
case SystemLanguage.Slovenian:
return LANGUAGE_ENGLISH;
case SystemLanguage.Spanish:
return LANGUAGE_SPANISH;
case SystemLanguage.Swedish:
case SystemLanguage.Thai:
case SystemLanguage.Turkish:
case SystemLanguage.Ukrainian:
case SystemLanguage.Vietnamese:
case SystemLanguage.Unknown:
return LANGUAGE_ENGLISH;
}
return LANGUAGE_CHINESE;
} private static string GetWinReadPath(string fileName)
{
return Application.dataPath + "/../" + fileName + ".csv";
} private static string GetWinSavePath(string fileName)
{
return Application.dataPath + "/Resources/LTLocalization/" + fileName + ".txt";
} private void ReadData()
{
#if UNITY_EDITOR
// 在Windows平台下读取语言配置文件
string CSVFilePath = GetWinReadPath(FILE_PATH);
LTCSVLoader loader = new LTCSVLoader();
loader.ReadFile(CSVFilePath);
// 将配置文件序列化为多个语言类
int csvRow = loader.GetRow();
int csvCol = loader.GetCol();
Debug.Log("row:" + csvRow + "col:" + csvCol);
for (int tempCol = 1; tempCol < csvCol; ++tempCol)
{
LTLocalizationData languageData = new LTLocalizationData();
// 获取第一行数据(语言类型)
languageData.LanguageType = loader.GetValueAt(tempCol, 0);
// 遍历生成变量
languageData.LanguageData = new Dictionary<string, string>();
for (int tempRow = 1; tempRow < csvRow; ++tempRow)
{
languageData.LanguageData.Add(loader.GetValueAt(0, tempRow), loader.GetValueAt(tempCol, tempRow));
}
// 将语言对象序列化存档
SaveHelper.SaveData(GetWinSavePath(languageData.LanguageType), languageData); if (GetLanguageAB(language).Equals(languageData.LanguageType))
{
textData = languageData.LanguageData;
}
}
#else
// 读取对应的语言对象
TextAsset tempAsset = (TextAsset)Resources.Load("LTLocalization/" + GetLanguageAB(language), typeof(TextAsset));
if (null == tempAsset)
{
tempAsset = (TextAsset)Resources.Load("LTLocalization/" + "EN", typeof(TextAsset));
}
if (null == tempAsset)
{
Debug.LogError("未检测到语言配置文件");
}
else
{
string saveData = tempAsset.text;
LTLocalizationData currentLanguageData = (LTLocalizationData)SaveHelper.ReadData(saveData, typeof(LTLocalizationData), false);
textData = currentLanguageData.LanguageData;
}
#endif
} private void SetLanguage(SystemLanguage language)
{
this.language = language;
} public static void Init()
{
mInstance = new LTLocalization();
mInstance.SetLanguage(Application.systemLanguage);
mInstance.ReadData();
} public static void ManualSetLanguage(SystemLanguage setLanguage)
{
if (null == mInstance)
{
mInstance = new LTLocalization();
}
mInstance.SetLanguage(setLanguage);
mInstance.ReadData();
} public static string GetText(string key)
{
if (null == mInstance)
{
Init();
}
if (mInstance.textData.ContainsKey(key))
{
return mInstance.textData[key];
}
return "[NoDefine]" + key;
} }

多语言数据对象

using UnityEngine;
using System.Collections.Generic; public class LTLocalizationData
{ public string LanguageType; public Dictionary<string, string> LanguageData; public override string ToString()
{
string result = "LanguageType:" + LanguageType;
List<string> tempKeys = new List<string>(LanguageData.Keys);
for (int i = 0; i < tempKeys.Count; ++i)
{
result += "\nKey:[" + tempKeys[i] + "]|Value:[" + LanguageData[tempKeys[i]] + "]";
}
return result;
} }

总结

感觉比上一个版本好了很多

1.不用考虑csv编码的问题了

2.反序列化速度比读取csv更快

3.加了密更可靠

4.不同语言分开读取,占用内存更小

缺点嘛,暂时觉得还不错~~继续先用着,有问题再改

Unity多语言本地化改进版的更多相关文章

  1. unity多语言本地化

    简介 嗯...一般来说做游戏啥的都不会只发一个国家,但是每个国家语言不同,就存在多语言本地化的问题,然后直接用过一个通过xml完成本地化的东东,然后策划反馈不会修改xml,扔给我一个excel让我自己 ...

  2. 黄聪:让WordPress主题支持语言本地化(使用poedit软件实现中文翻译功能)

    如果你的WordPress主题要提交到WordPress官方主题库,使用者来自世界各地的多种语言,那么,你就要让你的WordPress主题支持语言本地化,方便使用者进行语言翻译和制作语言包. 让Wor ...

  3. IOS应用程序多语言本地化解决方案

    最近要对一款游戏进行多语言本地化,在网上找了一些方案,加上自己的一点点想法整理出一套方案和大家分享! 多语言在应用程序中一般有两种做法:一.程序中提供给用户自己选择的机会:二.根据当前用户当前移动设备 ...

  4. [Abp 源码分析]十三、多语言(本地化)处理

    0.简介 如果你所开发的需要走向世界的话,那么肯定需要针对每一个用户进行不同的本地化处理,有可能你的客户在日本,需要使用日语作为显示文本,也有可能你的客户在美国,需要使用英语作为显示文本.如果你还是一 ...

  5. iOS - 实现语言本地化/国际化

      实现iOS语言本地化/国际化(图文详解) 前言 语言本地化,又叫做语言国际化.是指根据用户操作系统的语言设置,自动将应用程序的语言设置为和用户操作系统语言一致的语言.往往一些应用程序需要提供给多个 ...

  6. [转]IOS应用程序多语言本地化解决方案

    最近要对一款游戏进行多语言本地化,在网上找了一些方案,加上自己的一点点想法整理出一套方案和大家分享! 多语言在应用程序中一般有两种做法:一.程序中提供给用户自己选择的机会:二.根据当前用户当前移动设备 ...

  7. 3分钟实现iOS语言本地化/国际化(图文详解)

    前言 语言本地化,又叫做语言国际化. 是指根据用户操作系统的语言设置,自动将应用程序的语言设置为和用户操作系统语言一致的语言. 往往一些应用程序需要提供给多个国家的人群使用,或者一个国家有多种语言,这 ...

  8. iOS语言本地化,中文显示

    尽管一直相信xcode肯定提供有语言本地化的设置地方,可是一直也没凑着去改.非常多的汉化,还是使用代码去控制:比方navagition的return使用代码改动为"返回"! 近期在 ...

  9. 【转】iOS多语言本地化(国际化)设置

    原文网址:http://www.jianshu.com/p/2b7743ae9c90 讨论的iOS应用中的多语言设置,Ok 一般是两种情况: 1.根据当前设备语言自动切换显示 2.在应用中可进行语言设 ...

随机推荐

  1. 计算空间直线与平面的交点 (C#)

    public class NGlbVec3d    {// 三维点        public double x, y, z;        public NGlbVec3d()        {   ...

  2. jquery获取元素的值,获取当前对象的父对象等等

    jsp代码: <span><input type="hidden" value="1" id="newInfo">& ...

  3. android studio出现Error:compileSdkVersion android-x requires compiling with JDK 7问题

    初装Android studio的童鞋可能或多或少会存在一些问题,比如出现Error:compileSdkVersion android-x requires compiling with JDK 7 ...

  4. ZipInputStream的用法

    package com.example.io; import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.ev ...

  5. Show in Finder OC代码

    [[NSWorkspace sharedWorkspace] activateFileViewerSelectingURLs:urls]; /* Activate the Finder, and op ...

  6. check member function

    template<typename T> struct has_member_foo11 { private: template<typename U> static auto ...

  7. post 的body json要使用双引号,而不是单引号

      string parse error , JS eval error {'name' : 'wade' }   http://json.parser.online.fr/ string parse ...

  8. 新一代服务器性能测试工具Gatling

    新一代服务器性能测试工具Gatlinghttp://automationqa.com/forum.php?mod=viewthread&tid=2898&fromuid=2

  9. ping: sendto: Network is unreachable

    在我的板子上ping路由上的IP的时候可以ping通,但是ping外网的IP的时候提示"ping: sendto: Network is unreachable" 后来使用rout ...

  10. shell Builtin variables(shell内建变量)

    内容来自:abs-guide $BASH The path to the Bash binary itself bash$ echo $BASH /bin/bash $BASH_ENV An envi ...