Guest User

Untitled

a guest
Nov 24th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.45 KB | None | 0 0
  1. using System;
  2. using System.Diagnostics;
  3. namespace Tibia
  4. {
  5.     public partial class Version
  6.     {
  7.         public static ushort CurrentVersion = 910;
  8.         public static string CurrentVersionString = "9.10";
  9.  
  10.         public static string VersionToString(ushort version)
  11.         {
  12.             int main = version / 100;
  13.             int secondary = version - main * 100;
  14.             return String.Format("{0}.{1:00}", main, secondary);
  15.         }
  16.  
  17.         public static ushort StringToVersion(string versionString)
  18.         {
  19.             string[] split = versionString.Split('.');
  20.             int main = int.Parse(split[0]);
  21.             int secondary = int.Parse(split[1]);
  22.             return (ushort)(main * 100 + secondary);
  23.         }
  24.  
  25.         public static void Set(string version,Process p)
  26.             {
  27.  
  28.             CurrentVersion = StringToVersion(version);
  29.             CurrentVersionString = version;
  30.             switch (version)
  31.             {
  32.                 case "9.10":
  33.                     SetVersion910(p);
  34.                     break;
  35.                 case "9.00":
  36.                     SetVersion900();
  37.                     break;
  38.                 case "8.74":
  39.                     SetVersion874();
  40.                     break;
  41.                 case "8.72":
  42.                     SetVersion872();
  43.                     break;
  44.                 case "8.71":
  45.                     SetVersion871();
  46.                     break;
  47.                 case "8.70":
  48.                     SetVersion870();
  49.                     break;
  50.                 case "8.62":
  51.                     SetVersion862();
  52.                     break;
  53.                 case "8.61":
  54.                     SetVersion861();
  55.                     break;
  56.                 case "8.60":
  57.                     SetVersion860();
  58.                     break;
  59.                 case "8.57":
  60.                     SetVersion857();
  61.                     break;
  62.                 case "8.55":
  63.                     SetVersion855();
  64.                     break;
  65.                 case "8.54":
  66.                     SetVersion854();
  67.                     break;
  68.                 case "8.53":
  69.                     SetVersion853();
  70.                     break;
  71.                 case "8.52":
  72.                     SetVersion852();
  73.                     break;
  74.                 case "8.50":
  75.                     SetVersion850();
  76.                     break;
  77.                 case "8.42":
  78.                     SetVersion842();
  79.                     break;
  80.                 case "8.41":
  81.                     SetVersion841();
  82.                     break;
  83.                 case "8.40":
  84.                     SetVersion840();
  85.                     break;
  86.                 case "8.31":
  87.                     SetVersion831();
  88.                     break;
  89.                 case "8.22":
  90.                     SetVersion822();
  91.                     break;
  92.                 case "8.21":
  93.                     SetVersion821();
  94.                     break;
  95.                 case "8.20":
  96.                     SetVersion820();
  97.                     break;
  98.                 case "8.10":
  99.                 case "8.11":
  100.                     SetVersion810and811();
  101.                     break;
  102.                 case "8.00":
  103.                     SetVersion800();
  104.                     break;
  105.                 default:
  106.                     throw new Exceptions.VersionNotSupportedException("Tibia version " + CurrentVersionString + " is not supported by TibiaAPI.");
  107.             }
  108.  
  109.         }
  110.  
  111.     }
  112. }
Add Comment
Please, Sign In to add comment