Advertisement
Guest User

Untitled

a guest
Apr 28th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. class Variables
  2. {
  3. public static string ModName = "Tricky.ExtraStorageHoppers";
  4. public static string ModVersion = "5";
  5. public static bool ModDebug = true;
  6. public static string FCEModPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/ProjectorGames/FortressCraft/Mods/" + ModName + "/" + ModVersion + "/";
  7. public static void Log(object debug)
  8. {
  9. if (ModDebug)
  10. {
  11. debug = debug.ToString();
  12. string str = "[" + ModName + "]V" + ModVersion + "|***LOG***: " + debug;
  13. WriteStringToFile(str);
  14. }
  15.  
  16. }
  17. public static void LogPlain(object debug)
  18. {
  19. if (ModDebug)
  20. {
  21. string str = debug.ToString();
  22. WriteStringToFile(str);
  23. }
  24.  
  25. }
  26.  
  27. public static void LogError(object debug)
  28. {
  29. if (ModDebug)
  30. {
  31. debug = debug.ToString();
  32. string str = "[" + ModName + "]V" + ModVersion + "|***ERROR LOG***: " + debug;
  33. WriteStringToFile(str);
  34. }
  35.  
  36. }
  37.  
  38. public static void LogValue(object ValueText, object Value)
  39. {
  40. if (ModDebug)
  41. {
  42. ValueText = ValueText.ToString();
  43. Value = Value.ToString();
  44. string str = "[" + ModName + "]V" + ModVersion + "|***VALUE LOG***: " + ValueText + " = " + Value;
  45. WriteStringToFile(str);
  46. }
  47.  
  48. }
  49. public static void PrintLine()
  50. {
  51. WriteStringToFile("*******************************************************************************************");
  52. }
  53. public static void LogValue(object ValueText, object Value, bool Error)
  54. {
  55. if (ModDebug)
  56. {
  57. ValueText = ValueText.ToString();
  58. Value = Value.ToString();
  59. string str = "[" + ModName + "]V" + ModVersion + "|***VALUE LOG***: " + ValueText + " = " + Value;
  60. string str2 = "[" + ModName + "]V" + ModVersion + "|***VALUE LOG***: " + ValueText + " = " + Value;
  61. if (Error)
  62. {
  63. WriteStringToFile(str);
  64. }
  65. else
  66. {
  67. WriteStringToFile(str2);
  68. }
  69. }
  70. }
  71.  
  72. public static void WriteStringToFile(string ValueText)
  73. {
  74. using (FileStream fs = new FileStream(FCEModPath + "ModLog.log", FileMode.Append, FileAccess.Write))
  75. using (StreamWriter sw = new StreamWriter(fs))
  76. {
  77. sw.WriteLine(ValueText);
  78. sw.Close();
  79. fs.Close();
  80. }
  81.  
  82. }
  83.  
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement