Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7. using System.Globalization;
  8.  
  9. namespace Pro_Generator
  10. {
  11. class WriteTextFile
  12. {
  13. static void Main()
  14. {
  15.  
  16. int i;
  17. int a = 100; // number of characters with multiple attires
  18. int b = 10; // number of attires per character in list
  19. int c = 100; // CH to start at
  20.  
  21. using (Stream fileStream = new FileStream(@"0005.cos", FileMode.OpenOrCreate, FileAccess.Write))
  22. using (BinaryWriter writer = new BinaryWriter(fileStream))
  23. {
  24. string str = "43 4F 53 00 01 00 00 00";
  25. List<string> parts = new List<string>(str.Split(' '));
  26. byte[] bytesToWrite = parts.Select(s => byte.Parse(s, NumberStyles.HexNumber)).ToArray();
  27. writer.Write(bytesToWrite);
  28.  
  29. writer.Write(BitConverter.GetBytes(a));
  30.  
  31. for (i = c; i <= (c + a - 1); i++) // How many to generate from c to c + a
  32. {
  33. writer.Write(BitConverter.GetBytes(i));
  34. writer.Write(BitConverter.GetBytes(b));
  35.  
  36. string str2 = "39 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  37. if (b > 1) str2 += " 3A 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  38. if (b > 2) str2 += " 3B 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  39. if (b > 3) str2 += " 3C 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  40. if (b > 4) str2 += " 3D 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  41. if (b > 5) str2 += " 3E 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  42. if (b > 6) str2 += " 3F 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  43. if (b > 7) str2 += " 40 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  44. if (b > 8) str2 += " 41 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  45. if (b > 9) str2 += " 42 4A 00 00 FF FF FF FF 00 00 00 00 FF 00 00 00";
  46. List<string> parts2 = new List<string>(str2.Split(' '));
  47. byte[] bytesToWrite2 = parts2.Select(s => byte.Parse(s, NumberStyles.HexNumber)).ToArray();
  48. writer.Write(bytesToWrite2);
  49.  
  50. }
  51.  
  52. }
  53. }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement