コード例 #1
0
ファイル: Learn_XML.cs プロジェクト: YellowTulipShow/CSharp
        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);
        }
コード例 #2
0
ファイル: Test_ini.cs プロジェクト: YellowTulipShow/CSharp
        public Test_ini()
        {
            this.chars = new char[] { };
            this.chars = CommonData.ASCII_WordText();

            string fp = this.GetFilePath();

            if (File.Exists(fp))
            {
                File.Delete(fp);
            }
            this.ini = new IniFile(fp);
            this.dic = this.GetTestCase();

            NameSign = @"ini配置文件";
            SonCases = new CaseModel[] {
                Func_WriteString(),
                Func_ReadString(),
                Func_GetKeys(),
                Func_GetSections(),
                Func_GetKeyValues(),
                Func_ClearSection(),
                Func_DeleteKey(),
                Func_IsExistsValue(),
            };
        }
コード例 #3
0
 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());
         },
     });
 }