Exemple #1
0
 private void button8_Click(object sender, EventArgs e)
 {
     for (ushort i = 1; i < maxFileID; i++)
     {
         string data = GetRandomData(r.Next(10, 100), i.ToString());
         CPUCardWrapper.CreateFile(i, data, out string msg);
     }
 }
Exemple #2
0
        public static bool TestFileNew()
        {
            ushort fileId      = 10;
            string fileContent = "abcdefg";

            if (!CPUCardWrapper.CreateFile(fileId, fileContent, out string msg))
            {
                Console.WriteLine("创建文件失败" + msg);
            }
            return(true);
        }
Exemple #3
0
        private void button11_Click(object sender, EventArgs e)
        {
            string data = GetRandomData(30000);

            CPUCardWrapper.CreateFile(GetCurrentFileID(), data, out string msg);

            CPUCardWrapper.ReadFile(GetCurrentFileID(), out string readData);
            if (data == readData)
            {
                MessageBox.Show("成功");
            }
            else
            {
                Console.WriteLine();
            }
        }
Exemple #4
0
        public static bool TestFileByte(ushort fileId, byte[] fileContent)
        {
            bool     isPass  = true;
            DateTime dtStart = DateTime.Now;

            if (!CPUCardWrapper.CreateFile(fileId, fileContent, out string msg))
            {
                Console.WriteLine("创建文件失败" + msg);
                isPass = false;
            }

            DateTime dtEnd = DateTime.Now;

            TimeSpan ts = dtEnd - dtStart;

            Console.WriteLine();
            dtStart = DateTime.Now;

            byte[] readData = new byte[0];

            if (!CPUCardWrapper.ReadFile(fileId, out readData, out string m3sg))
            {
                Console.WriteLine("读取文件失败" + m3sg);
                isPass = false;
            }
            dtEnd = DateTime.Now;

            ts = dtEnd - dtStart;
            Console.WriteLine();


            if (!compData(fileContent, readData))
            {
                int count = fileContent.Length - m3sg.Length;
                Console.WriteLine("写入文件与读取文件不一致,读取比写入少" + count);
                isPass = false;
            }
            string result = "测试文件{0} ,测试长度{1},测试结果{2}";

            Console.WriteLine(string.Format(result, fileId, fileContent.Length, isPass ? "通过" : "不通过"));
            return(isPass);
        }
Exemple #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     CPUCardWrapper.CreateFile(GetCurrentFileID(), txtInput.Text, out string msg);
     WireLog(msg);
 }