Advertisement
Guest User

Untitled

a guest
May 18th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.38 KB | None | 0 0
  1. Console.WriteLine("read file in calc in");
  2. int dc = 0, lastCounts = 0;
  3. if (fsLenght % 104857500 == 0)
  4. dc = (int)((long)(fsLenght / 104857500));
  5. else
  6. {
  7. dc = (int)((long)(fsLenght / 104857500));
  8. lastCounts = (int)((long)(fsLenght - 104857500 * dc));
  9. }
  10. Console.WriteLine("calc out, packs = " + (dc + 1));
  11. long index = 0;
  12. for (int i = 0; i < dc + 1; i++)
  13. {
  14. Console.WriteLine("for in");
  15. if (i != dc)
  16. {
  17. Console.WriteLine((i + 1) + "pack in");
  18. byte[] bytes = new byte[104857500];
  19. using (FileStream fs = new FileStream(@filePath, FileMode.Open, FileAccess.Read))
  20. {
  21. if (fs.CanSeek)
  22. {
  23. index += 104857500;
  24. fs.Seek(index, SeekOrigin.Begin);
  25. fs.Read(bytes, 0, bytes.Length);
  26. BC bC = new BC();
  27. c = bC;
  28. using (FileStream filestream = new FileStream(@folderPath + "\\cfile.nen", FileMode.Append, FileAccess.Write))
  29. {
  30. if (filestream.CanSeek)
  31. {
  32. filestream.Seek(index, SeekOrigin.Begin);
  33. filestream.Write(c.En(mood, _key, bytes), 0, 104857500);
  34. bytes = null;
  35. filestream.Close();
  36. }
  37. }
  38. }
  39. fs.Close();
  40. }
  41. Console.WriteLine((i + 1) + "pack out");
  42. }
  43. else
  44. {
  45. Console.WriteLine((i + 1) + "pack in");
  46. byte[] bytes = new byte[lastCounts];
  47. using (FileStream fs = new FileStream(@filePath, FileMode.Open, FileAccess.Read))
  48. {
  49. if (fs.CanSeek)
  50. {
  51. index += 104857500;
  52. fs.Seek(index, SeekOrigin.Begin);
  53. fs.Read(bytes, 0, lastCounts);
  54. fs.Close();
  55. using (FileStream filestream = new FileStream(@folderPath + "\\cfile.nen", FileMode.Append, FileAccess.Write))
  56. {
  57. char[] splitter = { '\\' };
  58. string[] dir = filePath.Split(splitter);
  59. byte[] format = Encoding.UTF8.GetBytes("*|f*4-sy7d" + dir[dir.Length - 1]);
  60. byte[] array = new byte[bytes.Length + format.Length];
  61. for (int a = 0, s = 0; a < array.Length; a++)
  62. {
  63. if (a < bytes.Length)
  64. {
  65. array[a] = bytes[a];
  66. }
  67. else
  68. {
  69. array[a] = format[s];
  70. s++;
  71. }
  72. }
  73. bytes = null;
  74. BC bC = new BC();
  75. c = bC;
  76. if (filestream.CanSeek)
  77. {
  78. filestream.Seek(index, SeekOrigin.Begin);
  79. filestream.Write(c.En(mood, _key, array), 0, array.Length);
  80. array = null;
  81. filestream.Close();
  82. }
  83. }
  84. }
  85. }
  86. Console.WriteLine((i + 1) + "pack out");
  87. }
  88. Console.WriteLine("for out");
  89. }
  90. Console.WriteLine("read file out");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement