예제 #1
0
파일: Env.cs 프로젝트: lc11535/SoftEtherVPN
        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);
        }
예제 #2
0
 public static IO CreateTempFile(string name)
 {
     return(IO.FileCreate(CreateTempFileName(name)));
 }
예제 #3
0
 public static IO CreateTempFileByExt(string ext)
 {
     return(IO.FileCreate(CreateTempFileNameByExt(ext)));
 }