Beispiel #1
0
        public String Create(long id)
        {
            String path = Path.Combine(mRootDirectory, String.Format("{0}_{1}.blink", mMark, id));

            if (!File.Exists(path))
            {
                CreatePath();
                try
                {
                    FileStream stream = File.Create(path);
                    stream.Dispose();
                    stream.Close();
                }
                catch (Exception e)
                {
                    BlinkLog.V(e.Message);
                }
            }
            if (!File.Exists(path))
            {
                return(null);
            }
            else
            {
                return(path);
            }
        }
Beispiel #2
0
 public void ClearAll()
 {
     try
     {
         Directory.Delete(mRootDirectory, true);
     }
     catch (Exception) { }
     CreatePath();
     BlinkLog.V("Resource cleared path.");
 }
Beispiel #3
0
 private void CreatePath()
 {
     // Create
     if (Directory.Exists(mRootDirectory) == false)
     {
         try
         {
             Directory.CreateDirectory(mRootDirectory);
         }
         catch (Exception e)
         {
             BlinkLog.V(e.Message);
         }
     }
 }
Beispiel #4
0
        public void Clear()
        {
            try
            {
                DirectoryInfo theFolder = new DirectoryInfo(mRootDirectory);
                FileInfo[]    fileInfo  = theFolder.GetFiles();
                //遍历文件夹
                foreach (FileInfo f in fileInfo)
                {
                    if (f.Name.Contains(mMark))
                    {
                        f.Delete();
                    }
                }
            }
            catch (Exception) { }

            BlinkLog.V("Resource cleared with mark: " + mMark);
        }