Beispiel #1
0
 public static void ioWriteAllLines(eKnownFiles which, string[] contents)
 {
     lockAndProcess(delegate()
     {
         File.WriteAllLines(getFilePath(which), contents);
     });
 }
Beispiel #2
0
 public static void ioAppend(eKnownFiles which, string text)
 {
     lockAndProcess(delegate() {
         using (StreamWriter sw = File.AppendText(getFilePath(which)))
         {
             sw.WriteLine(text);
         }
     });
 }
Beispiel #3
0
        public static string ioReadAllText(eKnownFiles which)
        {
            string r = null;

            lockAndProcess(delegate() {
                r = File.ReadAllText(getFilePath(which));
            });
            return(r);
        }
Beispiel #4
0
        public static long ioSize(eKnownFiles which)
        {
            long size = -1;

            lockAndProcess(delegate() {
                try
                {
                    size = new System.IO.FileInfo(getFilePath(which)).Length;
                }
                catch (Exception) { }
            });
            return(size);
        }
Beispiel #5
0
 public static bool IsKnown(string inName, out eKnownFiles which)
 {
     which = eKnownFiles._end;
     foreach (var x in info)
     {
         if (x.Name == inName)
         {
             which = x.Id;
             return(true);
         }
     }
     return(false);
 }
Beispiel #6
0
 public static string Get(eKnownFiles which)
 {
     return(info[(int)which].Name);
 }
Beispiel #7
0
 private static string getFilePath(eKnownFiles which)
 {
     return(info[(int)which].Path);
 }
Beispiel #8
0
 public eachInfo(eKnownFiles Id, string Path, string Name)
 {
     this.Id   = Id;
     this.Path = Path;
     this.Name = Name;
 }
Beispiel #9
0
 public static void ioDelete(eKnownFiles which)
 {
     lockAndProcess(delegate() {
         File.Delete(getFilePath(which));
     });
 }