c# - Checking who accessed a directory last time -


main purpose

i'm trying create program defends user personal files being accessed hacker.

programming environment

  • c#
  • microsoft visual studio 2013

concept

  1. the program loops through directories of file system continously.
  2. checks file accessed it
  3. if none of users accessed modified or read, sounds alarm

my question

how check accessed file last time?

my ideas

i tought maybe check through

  • directory security
  • fileinfo class

thanks in advice

solution

hi all, have solution, thank answers. here's code if needs in his/her project:

 public static string getspecificfileproperties(string file, params int[] indexes)     {         string filename = path.getfilename(file);         string foldername = path.getdirectoryname(file);         shell32.shell shell = new shell32.shell();         shell32.folder objfolder;         objfolder = shell.namespace(foldername);         stringbuilder sb = new stringbuilder();          foreach (shell32.folderitem2 item in objfolder.items())         {             if (filename == item.name)             {                 (int = 0; < indexes.length; i++)                 {                     thread.sleep(100);                     sb.append(objfolder.getdetailsof(item, indexes[i]) + ",");                 }                  break;             }         }          string result = sb.tostring().trim();         //protection no results causing exception on `substring` method         if (result.length == 0)         {             return string.empty;         }         return result.substring(0, result.length - 1);     } 

resource: here's link


Comments

Popular posts from this blog

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -