Advertisement
KidaCoding

Untitled

Jun 30th, 2024
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.26 KB | Source Code | 0 0
  1. case "ConquerPointsLog":
  2. {
  3.     WindowsAPI.IniFile ini = new WindowsAPI.IniFile("");
  4.     string logFilePath = "C:\\Users\\Administrator\\Desktop\\ConquerPointsLog.txt";
  5.     List<Tuple<string, string, ulong>> conquerPointsList = new List<Tuple<string, string, ulong>>();
  6.  
  7.     foreach (string fname in System.IO.Directory.GetFiles(Program.ServerConfig.DbLocation + "\\Users\\"))
  8.     {
  9.         ini.FileName = fname;
  10.  
  11.         string UID = ini.ReadBigString("Character", "UID", "");
  12.         string Name = ini.ReadBigString("Character", "Name", "");
  13.         ulong ConquerPoints = ini.ReadUInt64("Character", "ConquerPoints", 0);
  14.         if (ConquerPoints > 0)
  15.         {
  16.             conquerPointsList.Add(new Tuple<string, string, ulong>(UID, Name, ConquerPoints));
  17.         }
  18.     }
  19.     conquerPointsList.Sort((x, y) => y.Item3.CompareTo(x.Item3));
  20.  
  21.     using (StreamWriter writer = new StreamWriter(logFilePath))
  22.     {
  23.         foreach (var entry in conquerPointsList)
  24.         {
  25.             string logMessage = string.Format("{0} >> {1} >> ConquerPoints {2:N0}", entry.Item1, entry.Item2, entry.Item3);
  26.             writer.WriteLine(logMessage);
  27.         }
  28.     }
  29.  
  30.     MyConsole.WriteLine("ConquerPoints log saved to " + logFilePath, ConsoleColor.DarkGreen);
  31.     break;
  32. }
  33.  
Tags: MS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement