private XmlNode CreateRandomNode(XmlDocument xmldocument) { char[] ISBN_Sour = new List <char>(CommonData.ASCII_Number()) { '-' }.ToArray(); char[] Ascii_words = CommonData.ASCII_WordText(); char[] Ascii_lowerenglish = CommonData.ASCII_LowerEnglish(); XmlElement book = xmldocument.CreateElement(@"book"); Dictionary <string, string> Dic_Attrs = new Dictionary <string, string>() { { @"Type", RandomData.GetChineseString(2) + @"课" }, { @"ISBN", RandomData.GetString(ISBN_Sour, RandomData.GetInt(4, 13)) } }; foreach (KeyValuePair <string, string> item in Dic_Attrs) { book.SetAttributeNode(XmlHelper.CreateNewAttribute(xmldocument, item.Key, item.Value)); } Dictionary <string, string> Dic_Nodes = new Dictionary <string, string>() { { @"title", RandomData.GetString(Ascii_words, RandomData.GetInt(4, 10)) }, { @"author", RandomData.GetString(Ascii_lowerenglish, RandomData.GetInt(2, 4)) }, { @"price", RandomData.GetDouble().ToString() }, }; foreach (KeyValuePair <string, string> item in Dic_Nodes) { book.AppendChild(XmlHelper.CreateNewElement(xmldocument, item.Key, item.Value)); } return(book); }
private char[] Get_wechatno_chararray() { List <char> chars = new List <char>() { '_', '-' }; chars.AddRange(CommonData.ASCII_Number()); chars.AddRange(CommonData.ASCII_UpperEnglish()); chars.AddRange(CommonData.ASCII_LowerEnglish()); return(chars.ToArray()); }
/// <summary> /// 创建一个新的字符串SID标识值 /// </summary> /// <returns>字符串标识</returns> public string CreateNewSID() { List <char> char_list = new List <char>(); char_list.AddRange(CommonData.ASCII_Number()); char_list.AddRange(CommonData.ASCII_LowerEnglish()); char[] chars = char_list.ToArray(); string first_step = RandomData.GetString(chars, 27); // 创建几个计算方法, 随机选择一个与 first_step 计算得到新的记录 EnumInfo enum_info = EnumInfo.AnalysisItem(GetUseCode()); return(string.Format("{0}-{1}", enum_info.IntValue.ToString(), first_step)); }
private CaseModel ExeEvent_Section_ASCII_String() { return(new CaseModel() { NameSign = @"部分的 ASCII 码字符", ExeEvent = () => { PrintMethod(@"所有常用字符:", CommonData.ASCII_ALL()); PrintMethod(@"常用文本字符", CommonData.ASCII_WordText()); PrintMethod(@"特殊字符:", CommonData.ASCII_Special()); PrintMethod(@"阿拉伯数字:", CommonData.ASCII_Number()); PrintMethod(@"小写英文:", CommonData.ASCII_LowerEnglish()); PrintMethod(@"大写英文:", CommonData.ASCII_UpperEnglish()); }, }); }