Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 18th, 2018 65 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. public class Vehicles
  2. {
  3.     public int Hash { get; set; }
  4.     public string HashStr { get; set; }
  5.     public string DisplayName { get; set; }
  6.     public string ActualDisplayName { get; set; }
  7.     public string Name { get; set; }
  8.     public string CreatorName { get; set; }
  9.     public string ActualCreatorName { get; set; }
  10.     public string WheelTypeName { get; set; }
  11.     public string ActualWheelTypeName { get; set; }
  12.     public double MaxSpeed { get; set; }
  13.     public double MaxBraking { get; set; }
  14.     public double MaxTraction { get; set; }
  15.     public double MaxAcceleration { get; set; }
  16.     public double _0xBFBA3BA79CFF7EBF { get; set; }
  17.     public double _0x53409B5163D5B846 { get; set; }
  18.     public double _0xC6AD107DDC9054CC { get; set; }
  19.     public double _0x5AA3F878A178C4FC { get; set; }
  20.     public int MaxPassengers { get; set; }
  21.     public int MaxOccupants { get; set; }
  22.     public int VehicleClass { get; set; }
  23.     public int WheelType { get; set; }
  24.     public bool IsConvertible { get; set; }
  25.     public bool IsElectric { get; set; }
  26.     public bool IsTrailer { get; set; }
  27.     public bool HasNeon { get; set; }
  28. }
  29.  
  30. public class DebugCommands
  31. {
  32.     public DebugCommands()
  33.     {
  34.         List<Vehicles> vehicleData = new List<Vehicles>();
  35.  
  36.         Console.WriteLine("-- Reading from file...");
  37.         string json;
  38.         using (StreamReader r = new StreamReader(@"C:\GT-MP Server\server_real\server\vehicleInfofull.json"))
  39.         {
  40.             json = r.ReadToEnd();
  41.         }
  42.  
  43.         Console.WriteLine("-- Using magical RegEx powers to find correct hash numbers...");
  44.         MatchCollection ma = Regex.Matches(json, @"(-?\d\d\d+?)\W:{");
  45.         foreach (Match m in ma)
  46.         {
  47.             Vehicles v = new Vehicles();
  48.             v.Hash = Convert.ToInt32(m.Groups[1].Value);
  49.             v.HashStr = m.Groups[1].Value;
  50.  
  51.             vehicleData.Add(v);
  52.         }
  53.  
  54.         Console.WriteLine("-- Reading into JSON objects now and completing the list...");
  55.         using (StreamReader r = new StreamReader(@"C:\GT-MP Server\server_real\server\vehicleInfofull.json"))
  56.         using (JsonTextReader reader = new JsonTextReader(r))
  57.         {
  58.             while (reader.Read())
  59.             {
  60.                 if (reader.TokenType == JsonToken.StartObject)
  61.                 {
  62.                     JObject obj = JObject.Load(reader);
  63.                        
  64.                     foreach (Vehicles v in vehicleData)
  65.                     {
  66.                         var hash = v.HashStr;
  67.  
  68.                         v.DisplayName = obj[hash]["displayName"].ToString();
  69.                         v.ActualDisplayName = obj[hash]["localizedName"].ToString();
  70.                         v.Name = obj[hash]["name"].ToString();
  71.                         v.CreatorName = obj[hash]["manufacturerName"].ToString();
  72.                         v.ActualCreatorName = obj[hash]["localizedManufacturer"].ToString();
  73.                         v.WheelTypeName = obj[hash]["wheelTypeName"].ToString();
  74.                         v.ActualWheelTypeName = obj[hash]["localizedWheelTypeName"].ToString();
  75.                         v.MaxSpeed = Convert.ToDouble(obj[hash]["maxSpeed"]);
  76.                         v.MaxBraking = Convert.ToDouble(obj[hash]["maxBraking"]);
  77.                         v.MaxTraction = Convert.ToDouble(obj[hash]["maxTraction"]);
  78.                         v.MaxAcceleration = Convert.ToDouble(obj[hash]["maxAcceleration"]);
  79.                         v._0xBFBA3BA79CFF7EBF = Convert.ToDouble(obj[hash]["_0xBFBA3BA79CFF7EBF"]);
  80.                         v._0x53409B5163D5B846 = Convert.ToDouble(obj[hash]["_0x53409B5163D5B846"]);
  81.                         v._0xC6AD107DDC9054CC = Convert.ToDouble(obj[hash]["_0xC6AD107DDC9054CC"]);
  82.                         v._0x5AA3F878A178C4FC = Convert.ToDouble(obj[hash]["_0x5AA3F878A178C4FC"]);
  83.                         v.MaxPassengers = Convert.ToInt32(obj[hash]["naxNumberOfPassengers"]);
  84.                         v.MaxOccupants = Convert.ToInt32(obj[hash]["maxOccupants"]);
  85.                         v.VehicleClass = Convert.ToInt32(obj[hash]["vehicleClass"]);
  86.                         v.WheelType = Convert.ToInt32(obj[hash]["wheelType"]);
  87.                         v.IsConvertible = Convert.ToBoolean(obj[hash]["convertible"]);
  88.                         v.IsElectric = Convert.ToBoolean(obj[hash]["electric"]);
  89.                         v.IsTrailer = Convert.ToBoolean(obj[hash]["trailer"]);
  90.                         v.HasNeon = Convert.ToBoolean(obj[hash]["neon"]);
  91.                     }
  92.                 }
  93.             }
  94.         }
  95.  
  96.         Console.WriteLine("-- Writing into \"vehicleinfo.txt\" now...");
  97.         using (StreamWriter sw = new StreamWriter("vehicleinfo.txt"))
  98.         {
  99.             int counter = 0;
  100.             foreach (Vehicles v in vehicleData)
  101.             {
  102.                 sw.WriteLine("VehicleInformation v" + counter + " = new VehicleInformation();");
  103.                 sw.WriteLine("v" + counter + ".Hash = " + v.Hash + ";");
  104.                 sw.WriteLine("v" + counter + ".HashStr = \"" + v.HashStr + "\";");
  105.                 sw.WriteLine("v" + counter + ".DisplayName = \"" + v.DisplayName + "\";");
  106.                 sw.WriteLine("v" + counter + ".ActualDisplayName = \"" + v.ActualDisplayName + "\";");
  107.                 sw.WriteLine("v" + counter + ".Name = \"" + v.Name + "\";");
  108.                 sw.WriteLine("v" + counter + ".CreatorName = \"" + v.CreatorName + "\";");
  109.                 sw.WriteLine("v" + counter + ".ActualCreatorName = \"" + v.ActualCreatorName + "\";");
  110.                 sw.WriteLine("v" + counter + ".WheelType = " + v.WheelType + ";");
  111.                 sw.WriteLine("v" + counter + ".WheelTypeName = \"" + v.WheelTypeName + "\";");
  112.                 sw.WriteLine("v" + counter + ".ActualWheelTypeName = \"" + v.ActualWheelTypeName + "\";");
  113.                 sw.WriteLine("v" + counter + ".MaxSpeed = " + v.MaxSpeed + ";");
  114.                 sw.WriteLine("v" + counter + ".MaxBraking = " + v.MaxBraking + ";");
  115.                 sw.WriteLine("v" + counter + ".MaxTraction = " + v.MaxTraction + ";");
  116.                 sw.WriteLine("v" + counter + ".MaxAcceleration = " + v.MaxAcceleration + ";");
  117.                 sw.WriteLine("v" + counter + "._0xBFBA3BA79CFF7EBF = " + v._0xBFBA3BA79CFF7EBF + ";");
  118.                 sw.WriteLine("v" + counter + "._0x53409B5163D5B846 = " + v._0x53409B5163D5B846 + ";");
  119.                 sw.WriteLine("v" + counter + "._0xC6AD107DDC9054CC = " + v._0xC6AD107DDC9054CC + ";");
  120.                 sw.WriteLine("v" + counter + "._0x5AA3F878A178C4FC = " + v._0x5AA3F878A178C4FC + ";");
  121.                 sw.WriteLine("v" + counter + ".MaxPassengers = " + v.MaxPassengers + ";");
  122.                 sw.WriteLine("v" + counter + ".MaxOccupants = " + v.MaxOccupants + ";");
  123.                 sw.WriteLine("v" + counter + ".VehicleClass = " + v.VehicleClass + ";");
  124.                 sw.WriteLine("v" + counter + ".IsConvertible = " + v.IsConvertible.ToString().ToLower() + ";");
  125.                 sw.WriteLine("v" + counter + ".IsElectric = " + v.IsElectric.ToString().ToLower() + ";");
  126.                 sw.WriteLine("v" + counter + ".IsTrailer = " + v.IsTrailer.ToString().ToLower() + ";");
  127.                 sw.WriteLine("v" + counter + ".HasNeon = " + v.HasNeon.ToString().ToLower() + ";");
  128.  
  129.                 sw.WriteLine("_vehicleInfo.Add(v" + counter + ");");
  130.  
  131.                 sw.WriteLine();
  132.                 sw.WriteLine();
  133.                 counter++;
  134.             }
  135.         }
  136.         Console.WriteLine("-- Completed everything master!");
  137.     }
  138. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top