Exemple #1
0
        public override void Create_file(ref string strTargetPath, ref CSetting st)
        {
            if (strTargetPath[strTargetPath.Length - 1] != '\\') //非根目录
            {
                strTargetPath += "\\";
            }
            byte[] write_buf = new byte[32 * 1024];
            long   write_size = refCMPSeniorSetting.ulSize * 1024 * 1024 * 1024;
            int    nIndex = 0, nWriteIndex = 0;
            string strPath = "";

            for (nIndex = 0; nIndex < 32 * 1024; nIndex++)
            {
                write_buf[nIndex] = 0xAA;
            }
            for (nIndex = 0; nIndex < refCMPSeniorSetting.ulSize; nIndex++)
            {
                strPath = nIndex.ToString() + ".rsvdata";
                strPath = strTargetPath + strPath;
                FileStream fs = new FileStream(strPath, FileMode.Append, FileAccess.Write);
                for (nWriteIndex = 0; nWriteIndex < 1024 * 1024 / 32; nWriteIndex++)
                {
                    fs.Write(write_buf, 0, 32 * 1024);
                    fs.Seek(0, SeekOrigin.End);
                }
                fs.Close();
            }
            base.Create_file(ref strTargetPath, ref st);
        }
Exemple #2
0
 public virtual void Create_file(ref string strTargetPath, ref CSetting pSetting)
 {
 }
Exemple #3
0
        protected void Create_Step_File(ref string strOperPath, int nLength, int nTotalNum, ref byte[] valueToFile, long filesize, ref CSetting st)
        {
            if (nLength < nTotalNum)
            {
                int    nFileIndex = 0;
                string strFileName;
                long   lFilePtr = 0;

                for (nFileIndex = nLength + 1; nFileIndex <= nTotalNum; nFileIndex++)
                {
                    strFileName = "\\" + nFileIndex.ToString() + ".srctesttmp";
                    strFileName = strOperPath + "\\" + strFileName;
                    FileStream fstream = File.Create(strFileName);
                    for (lFilePtr = 0; lFilePtr < filesize / 1024; lFilePtr++)
                    {
                        if (valueToFile[0] == 0xFF)
                        {
                            //Write the random value to the file
                            Random ri        = new Random();
                            int    nRndIndex = 0;
                            for (nRndIndex = 1; nRndIndex < 1024; nRndIndex++)
                            {
                                valueToFile[nRndIndex] = (byte)(ri.Next() * ri.Next() * ri.Next());
                            }
                        }
                        fstream.Write(valueToFile, 0, 1024);
                        fstream.Seek(lFilePtr * 1024, SeekOrigin.Begin);
                    }
                    fstream.Close();
                }
            }
        }
Exemple #4
0
        public override void Create_file(ref string strTargetPath, ref CSetting st)
        {
            string strCurPath = System.IO.Directory.GetCurrentDirectory();
            string strBigSize, strMediumSize, strSmallSize;
            string strBigNum, strMediumNum, strSmallNum;

            strBigSize    = st.size_big.ToString();
            strBigNum     = st.num_big.ToString();
            strMediumSize = st.size_medium.ToString();
            strMediumNum  = st.num_medium.ToString();
            strSmallSize  = st.size_small.ToString();
            strSmallNum   = st.num_small.ToString();
            if (strCurPath[strCurPath.Length - 1] != '\\') //非根目录
            {
                strCurPath += "\\";
            }
            string strOperPath  = "";
            string strPathValue = "";

            byte[] valueToFile = new byte[1024];
            switch (st.value_big)
            {
            case 0:
                strPathValue = "0xaa";
                int nIndex = 0;
                for (nIndex = 0; nIndex < 1024; nIndex++)
                {
                    valueToFile[nIndex] = 0xaa;
                }
                break;

            case 1:
                strPathValue = "0x55";
                int nIndex1 = 0;
                for (nIndex1 = 0; nIndex1 < 1024; nIndex1++)
                {
                    valueToFile[nIndex1] = 0x55;
                }
                break;

            case 2:
                strPathValue   = "random value";
                valueToFile[0] = 0xFF;
                break;
            }
            strOperPath = strCurPath + strBigSize + "G" + "\\" + strPathValue;
            if (!Directory.Exists(strCurPath + strBigSize + "G"))
            {
                Directory.CreateDirectory(strCurPath + strBigSize + "G");
            }
            if (!Directory.Exists(strOperPath))
            {
                Directory.CreateDirectory(strOperPath);//创建新路径
            }
            DirectoryInfo di = new DirectoryInfo(strOperPath);

            FileInfo[] fi = di.GetFiles("*.srctesttmp");
            Create_Step_File(ref strOperPath, (int)fi.Length, (int)st.num_big, ref valueToFile, st.size_big * 1024 * 1024 * 1024, ref st);

            switch (st.value_medium)
            {
            case 0:
                strPathValue = "0xaa";
                int nIndex = 0;
                for (nIndex = 0; nIndex < 1024; nIndex++)
                {
                    valueToFile[nIndex] = 0xaa;
                }
                break;

            case 1:
                strPathValue = "0x55";
                int nIndex1 = 0;
                for (nIndex1 = 0; nIndex1 < 1024; nIndex1++)
                {
                    valueToFile[nIndex1] = 0x55;
                }
                break;

            case 2:
                strPathValue   = "random value";
                valueToFile[0] = 0xFF;
                break;
            }
            strOperPath = strCurPath + strMediumSize + "M" + "\\" + strPathValue;
            if (!Directory.Exists(strCurPath + strMediumSize + "M"))
            {
                Directory.CreateDirectory(strCurPath + strMediumSize + "M");
            }
            if (!Directory.Exists(strOperPath))
            {
                Directory.CreateDirectory(strOperPath);//创建新路径
            }
            di = new DirectoryInfo(strOperPath);
            fi = di.GetFiles("*.srctesttmp");
            Create_Step_File(ref strOperPath, (int)fi.Length, (int)st.num_medium, ref valueToFile, st.size_medium * 1024 * 1024, ref st);

            switch (st.value_small)
            {
            case 0:
                strPathValue = "0xaa";
                int nIndex = 0;
                for (nIndex = 0; nIndex < 1024; nIndex++)
                {
                    valueToFile[nIndex] = 0xaa;
                }
                break;

            case 1:
                strPathValue = "0x55";
                int nIndex1 = 0;
                for (nIndex1 = 0; nIndex1 < 1024; nIndex1++)
                {
                    valueToFile[nIndex1] = 0x55;
                }
                break;

            case 2:
                strPathValue   = "random value";
                valueToFile[0] = 0xFF;
                break;
            }
            strOperPath = strCurPath + strSmallSize + "K" + "\\" + strPathValue;
            if (!Directory.Exists(strCurPath + strSmallSize + "K"))
            {
                Directory.CreateDirectory(strCurPath + strSmallSize + "K");
            }
            if (!Directory.Exists(strOperPath))
            {
                Directory.CreateDirectory(strOperPath);//创建新路径
            }
            di = new DirectoryInfo(strOperPath);
            fi = di.GetFiles("*.srctesttmp");
            Create_Step_File(ref strOperPath, (int)fi.Length, (int)st.num_small, ref valueToFile, st.size_small * 1024, ref st);
        }