示例#1
0
        static void initMyTempDir()
        {
            try
            {
                deleteUnusedTempDir();
            }
            catch
            {
            }

            int num = 0;

            while (true)
            {
                byte[] rand = Secure.Rand(2);
                string tmp2 = Str.ByteToStr(rand);

                string tmp = Path.Combine(Env.tempDir, "NET_" + tmp2);

                if (IO.IsDirExists(tmp) == false && IO.MakeDir(tmp))
                {
                    Env.myTempDir = tmp;

                    break;
                }

                if ((num++) >= 100)
                {
                    throw new SystemException();
                }
            }

            string lockFileName = Path.Combine(Env.myTempDir, "LockFile.dat");

            lockFile = IO.FileCreate(lockFileName);
        }