Пример #1
0
 public static bool CanExecute(fsEntry ent)
 {
     return (File.a(ent.User, 1) && CurrentUser.Username == ent.Owner) || File.a(ent.Group, 1) || File.a(ent.Global, 1);
 }
Пример #2
0
 private void a(string A_0, int A_1, string A_2)
 {
     A_0 = this.a(A_0);
     byte[] array = new byte[1024];
     this.a.ReadBlock((ulong)((long)A_1), 2u, array);
     BinaryReader binaryReader = new BinaryReader(new MemoryStream(1024));
     binaryReader.BaseStream.Data = array;
     this.prevLoc = A_1;
     int num = binaryReader.ReadInt32();
     if (this.c(A_0, FileSystem.Root.Seperator))
     {
         string text = A_0.Substring(0, this.b(A_0, FileSystem.Root.Seperator));
         for (int i = 0; i < num; i++)
         {
             string text2 = binaryReader.ReadString();
             if (text2 == A_0 && !this.c(A_0, FileSystem.Root.Seperator))
             {
                 break;
             }
             int num2 = binaryReader.ReadInt32();
             int num3 = binaryReader.ReadInt32();
             if (text == text2)
             {
                 A_1 = num2;
                 this.prevLoc = num2;
                 this.a(A_0.Substring(this.b(A_0, FileSystem.Root.Seperator) + 1), A_1, A_2);
                 break;
             }
             byte b = binaryReader.BaseStream.Read();
             byte b2 = binaryReader.BaseStream.Read();
             byte b3 = binaryReader.BaseStream.Read();
             byte b4 = binaryReader.BaseStream.Read();
             string text3 = binaryReader.ReadString();
             string text4 = binaryReader.ReadString();
             int num4 = binaryReader.ReadInt32();
         }
     }
     else
     {
         fsEntry fsEntry = new fsEntry();
         fsEntry.Name = A_0;
         fsEntry.Attributes = 2;
         fsEntry.Length = 2;
         fsEntry.Pointer = this.getWriteAddress();
         byte[] array2 = new byte[1024];
         for (int i = 0; i < 1024; i++)
         {
             array2[i] = 0;
         }
         this.a.WriteBlock((ulong)((long)this.getWriteAddress()), 2u, array2);
         fsEntry.Owner = A_2;
         this.a(2);
         this.a(fsEntry, this.prevLoc);
     }
 }
Пример #3
0
 public override void saveFile(byte[] data, string name, string owner)
 {
     name = this.a(name);
     if (Util.Contains(name, FileSystem.Root.Seperator))
     {
         if (!this.CanWrite(name.Substring(0, Util.LastIndexOf(name, FileSystem.Root.Seperator))))
         {
             throw new Exception("Access denied");
         }
     }
     fsEntry fsEntry = new fsEntry();
     fsEntry.Checksum = Hash.getCRC(data);
     fsEntry.Attributes = 1;
     byte[] array = new byte[data.Length + 4];
     MemoryStream memoryStream = new MemoryStream(array.Length);
     BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
     binaryWriter.Write(data.Length);
     int i;
     for (i = 0; i < data.Length; i++)
     {
         binaryWriter.BaseStream.Write(data[i]);
     }
     binaryWriter.BaseStream.Close();
     data = binaryWriter.BaseStream.Data;
     fsEntry.Name = name;
     int j;
     for (j = 0; j < data.Length; j++)
     {
         byte[] array2 = new byte[512];
         for (i = 0; i < 512; i++)
         {
         }
     }
     fsEntry.Length = j;
     fsEntry.Pointer = this.getWriteAddress();
     fsEntry.Attributes = 1;
     fsEntry.Owner = owner;
     int a_ = 2;
     if (Util.Contains(fsEntry.Name, FileSystem.Root.Seperator))
     {
         a_ = this.getNodeAddress(fsEntry.Name.Substring(0, this.a(fsEntry.Name, FileSystem.Root.Seperator)), 2);
     }
     if (this.c(name, FileSystem.Root.Seperator))
     {
         fsEntry.Name = name.Substring(this.a(name, FileSystem.Root.Seperator) + 1);
     }
     string[] array3 = this.ListFiles(name.Substring(0, this.a(name, FileSystem.Root.Seperator)));
     i = 0;
     while (i < array3.Length)
     {
         if (array3[i] == name.Substring(Util.LastIndexOf(name, FileSystem.Root.Seperator) + 1))
         {
             if (fsEntry.Length * 512 <= j)
             {
                 fsEntry = this.readFromNode(name);
                 this.b(name);
                 if (data.Length < 512)
                 {
                     memoryStream = new MemoryStream(512);
                     for (int k = 0; k < data.Length; k++)
                     {
                         memoryStream.Write(data[k]);
                     }
                     this.a.WriteBlock((ulong)((long)fsEntry.Pointer), 1u, memoryStream.Data);
                     this.a(fsEntry, a_);
                 }
                 else
                 {
                     int l = 0;
                     int num = fsEntry.Pointer;
                     while (l < data.Length)
                     {
                         byte[] array2 = new byte[512];
                         for (int k = 0; k < 512; k++)
                         {
                             array2[k] = data[l];
                             l++;
                         }
                         this.a.WriteBlock((ulong)((long)num), 1u, array2);
                         num++;
                     }
                     this.a(fsEntry, a_);
                 }
                 return;
             }
             fsEntry.Owner = this.readFromNode(name).Owner;
             fsEntry.Group = this.readFromNode(name).Group;
             fsEntry.Global = this.readFromNode(name).Global;
             fsEntry.User = this.readFromNode(name).User;
             this.b(name);
             break;
         }
         else
         {
             i++;
         }
     }
     if (data.Length < 512)
     {
         memoryStream = new MemoryStream(512);
         for (i = 0; i < data.Length; i++)
         {
             memoryStream.Write(data[i]);
         }
         this.a.WriteBlock((ulong)((long)fsEntry.Pointer), 1u, memoryStream.Data);
         this.a(fsEntry, a_);
         this.a(j);
         return;
     }
     int m = 0;
     int num2 = this.getWriteAddress();
     this.a(j);
     while (m < data.Length)
     {
         byte[] array2 = new byte[512];
         for (i = 0; i < 512; i++)
         {
             array2[i] = data[m];
             m++;
         }
         this.a.WriteBlock((ulong)((long)num2), 1u, array2);
         num2++;
     }
     this.a(fsEntry, a_);
 }
Пример #4
0
 private void a(fsEntry A_0, int A_1)
 {
     byte[] array = new byte[1024];
     this.a.ReadBlock((ulong)((long)A_1), 2u, array);
     BinaryReader binaryReader = new BinaryReader(new MemoryStream(1024));
     binaryReader.BaseStream.Data = array;
     int num = binaryReader.ReadInt32() + 1;
     for (int i = 0; i < num - 1; i++)
     {
         string text = binaryReader.ReadString();
         int num2 = binaryReader.ReadInt32();
         int num3 = binaryReader.ReadInt32();
         byte b = binaryReader.BaseStream.Read();
         byte b2 = binaryReader.BaseStream.Read();
         byte b3 = binaryReader.BaseStream.Read();
         byte b4 = binaryReader.BaseStream.Read();
         string text2 = binaryReader.ReadString();
         string text3 = binaryReader.ReadString();
         int num4 = binaryReader.ReadInt32();
     }
     int position = binaryReader.BaseStream.Position;
     BinaryWriter binaryWriter = new BinaryWriter(new MemoryStream(1024));
     binaryWriter.BaseStream.Data = array;
     binaryWriter.Write(num);
     binaryWriter.BaseStream.Position = position;
     binaryWriter.Write(A_0.Name);
     binaryWriter.Write(A_0.Pointer);
     binaryWriter.Write(A_0.Length);
     binaryWriter.BaseStream.Write(A_0.Attributes);
     binaryWriter.Write(A_0.User);
     binaryWriter.Write(A_0.Group);
     binaryWriter.Write(A_0.Global);
     binaryWriter.Write(global::b.b());
     binaryWriter.Write(A_0.Owner);
     binaryWriter.Write(A_0.Checksum);
     binaryWriter.BaseStream.Close();
     this.a.WriteBlock((ulong)((long)A_1), 2u, binaryWriter.BaseStream.Data);
 }
Пример #5
0
 public override fsEntry[] getLongList(string dir)
 {
     if (dir != "" && dir != FileSystem.Root.Seperator.ToString() && !this.CanRead(dir))
     {
         throw new Exception("Access Denied!");
     }
     if (dir == FileSystem.Root.Seperator.ToString())
     {
         dir = "";
     }
     string[] array = this.ListFiles(dir);
     dir = this.a(dir);
     fsEntry[] array2 = new fsEntry[array.Length];
     for (int i = 0; i < array.Length; i++)
     {
         array2[i] = this.readFromNode(Util.cleanName(dir + FileSystem.Root.Seperator.ToString() + array[i]));
     }
     return array2;
 }