Advertisement
Guest User

updated

a guest
Jun 17th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 26.04 KB | None | 0 0
  1. namespace LFS_External_Client
  2. {
  3.     public class FileInfo
  4.     {
  5.         const string Database = @"Database";
  6.  
  7.         #region ' New Cruiser, Save User and Save Offline '
  8.  
  9.         static public void NewCruiser(string Username, string PlayerName)
  10.         {
  11.             if (System.IO.File.Exists(Database + "\\" + Username + ".txt") == false)
  12.             {
  13.                 System.IO.StreamWriter Sr = new System.IO.StreamWriter(Database + "\\" + Username + ".txt");
  14.                
  15.                 Sr.WriteLine("Cash = 3500");
  16.                 Sr.WriteLine("BBal = 0");
  17.                 Sr.WriteLine("Licence = 1500");
  18.                 Sr.WriteLine("Cars = XFG");
  19.                 Sr.WriteLine("Distance = -1");
  20.                 Sr.WriteLine("Health = 100");
  21.                 Sr.WriteLine("JobsDone = 0");
  22.  
  23.                 Sr.WriteLine("GUIX = 3");
  24.                 Sr.WriteLine("GUIY = 131");
  25.  
  26.                 Sr.WriteLine("GUIX2 = 3");
  27.                 Sr.WriteLine("GUIY2 = 121");
  28.  
  29.                 Sr.WriteLine("GUIStyle = 1");
  30.  
  31.                 Sr.WriteLine("Goods1 = 0");
  32.                 Sr.WriteLine("Goods2 = 0");
  33.  
  34.                 Sr.WriteLine("Member = 0");
  35.                 Sr.WriteLine("Support = 0");
  36.                 Sr.WriteLine("Officer = 0");
  37.                 Sr.WriteLine("Cadet = 0");
  38.                 Sr.WriteLine("TowTruck = 0");
  39.  
  40.                 Sr.WriteLine("Raffle = 0");
  41.                 Sr.WriteLine("Lotto = 0");
  42.  
  43.                 Sr.WriteLine("Panel = 1");
  44.  
  45.                 Sr.WriteLine("Renting = 0");
  46.                 Sr.WriteLine("Rented = 0");
  47.                 Sr.WriteLine("Renter = 0");
  48.                 Sr.WriteLine("Renterr = 0");
  49.                 Sr.WriteLine("Rentee = 0");
  50.  
  51.                 Sr.WriteLine("RegInfo = " + PlayerName);
  52.  
  53.                 Sr.WriteLine("//// " + System.DateTime.Now + " New Cruiser");
  54.                 Sr.Flush();
  55.                 Sr.Close();
  56.  
  57.                
  58.             }
  59.         }
  60.  
  61.         static public void SaveUser(clsConnection C)
  62.         {
  63.             StreamWriter Sw = new StreamWriter(Database + "\\" + C.Username + ".txt");
  64.             Sw.WriteLine("Cash = " + C.Cash);
  65.             Sw.WriteLine("BBal = " + C.BankBalance);
  66.             Sw.WriteLine("Licence = " + C.Licence);
  67.             Sw.WriteLine("Cars = " + C.Cars);
  68.             Sw.WriteLine("Distance = " + C.TotalDistance);
  69.             Sw.WriteLine("Health = " + C.TotalHealth);
  70.             Sw.WriteLine("JobsDone = " + C.TotalJobsDone);
  71.  
  72.             Sw.WriteLine("GUIX = " + C.GIUX);
  73.             Sw.WriteLine("GUIY = " + C.GIUY);
  74.  
  75.             Sw.WriteLine("GUIX2 = " + C.GIUX2);
  76.             Sw.WriteLine("GUIY2 = " + C.GIUY2);
  77.  
  78.             Sw.WriteLine("GUIStyle = " + C.GUIStyle);
  79.  
  80.             Sw.WriteLine("Goods1 = " + C.Electronics);
  81.             Sw.WriteLine("Goods2 = " + C.Furniture);
  82.  
  83.             Sw.WriteLine("Member = " + C.IsModerator);
  84.             Sw.WriteLine("Support = " + C.IsSupporter);
  85.             Sw.WriteLine("Officer = " + C.CanBeOfficer);
  86.             Sw.WriteLine("Cadet = " + C.CanBeCadet);
  87.             Sw.WriteLine("TowTruck = " + C.CanBeTowTruck);
  88.  
  89.             Sw.WriteLine("Raffle = " + C.LastRaffle);
  90.             Sw.WriteLine("Lotto = " + C.LastLotto);
  91.             Sw.WriteLine("Casino = " + C.LastCasino);
  92.  
  93.             Sw.WriteLine("Panel = " + C.CopPanel);
  94.  
  95.             Sw.WriteLine("Renting = " + C.Renting);
  96.             Sw.WriteLine("Rented = " + C.Rented);
  97.             Sw.WriteLine("Renter = " + C.Renter);
  98.             Sw.WriteLine("Renterr = " + C.Renterr);
  99.             Sw.WriteLine("Rentee = " + C.Rentee);
  100.  
  101.             Sw.WriteLine("RegInfo = " + C.PlayerName);
  102.  
  103.             Sw.WriteLine("//// " + System.DateTime.Now);
  104.             Sw.Flush();
  105.             Sw.Close();
  106.         }
  107.  
  108.         static public void SaveOfflineUser(string Username, string PlayerName, int Cash, int BankBalance, string Cars, int Licence, byte TotalHealth, int TotalDistance, long Gold, int TotalJobsDone, byte Electronics, byte Furniture, byte IsModerator, byte IsSupporter, byte CanBeOfficer, byte CanBeCadet, byte CanBeTowTruck, int LastRaffle, int LastLotto, int LastCasino, byte Interface1, byte Interface2, byte Speedo, byte Odometer, byte Counter, byte CopPanel, byte Renting, byte Rented, string Renter, string Rentee, string Renterr)
  109.         {
  110.             StreamWriter Sw = new StreamWriter(Database + "\\" + Username + ".txt");
  111.             Sw.WriteLine("Cash = " + Cash);
  112.             Sw.WriteLine("BBal = " + BankBalance);
  113.             Sw.WriteLine("Gold = " + Gold);
  114.             Sw.WriteLine("Licence= " + Licence);
  115.             Sw.WriteLine("Cars = " + Cars);
  116.             Sw.WriteLine("Distance = " + TotalDistance);
  117.             Sw.WriteLine("Health = " + TotalHealth);
  118.             Sw.WriteLine("JobsDone = " + TotalJobsDone);
  119.  
  120.             Sw.WriteLine("Goods1 = " + Electronics);
  121.             Sw.WriteLine("Goods2 = " + Furniture);
  122.  
  123.             Sw.WriteLine("Member = " + IsModerator);
  124.             Sw.WriteLine("Support = " + IsSupporter);
  125.             Sw.WriteLine("Officer = " + CanBeOfficer);
  126.             Sw.WriteLine("Cadet = " + CanBeCadet);
  127.             Sw.WriteLine("TowTruck = " + CanBeTowTruck);
  128.  
  129.             Sw.WriteLine("Raffle = " + LastRaffle);
  130.             Sw.WriteLine("Lotto = " + LastLotto);
  131.             Sw.WriteLine("Casino = " + LastCasino);
  132.  
  133.             Sw.WriteLine("Intrfc1 = " + Interface1);
  134.             Sw.WriteLine("Intrfc2 = " + Interface2);
  135.             Sw.WriteLine("Speedo = " + Speedo);
  136.             Sw.WriteLine("Odometer = " + Odometer);
  137.             Sw.WriteLine("Counter = " + Counter);
  138.             Sw.WriteLine("Panel = " + CopPanel);
  139.  
  140.             Sw.WriteLine("Renting = " + Renting);
  141.             Sw.WriteLine("Rented = " + Rented);
  142.             Sw.WriteLine("Renter = " + Renter);
  143.             Sw.WriteLine("Renterr = " + Renterr);
  144.             Sw.WriteLine("Rentee = " + Rentee);
  145.  
  146.             Sw.WriteLine("RegInfo = " + PlayerName);
  147.  
  148.             Sw.WriteLine("//// " + System.DateTime.Now);
  149.             Sw.Flush();
  150.             Sw.Close();
  151.         }
  152. #region ' Player Stats '
  153.  
  154.         static public int GetUserCash(string Username)
  155.         {
  156.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  157.  
  158.             string line = null;
  159.             while ((line = Sr.ReadLine()) != null)
  160.             {
  161.                 if (line.Substring(0, 4) == "Cash")
  162.                 {
  163.                     string[] Msg = line.Split('=');
  164.                     Sr.Close();
  165.                     return int.Parse(Msg[1].Trim());
  166.                 }
  167.             }
  168.             Sr.Close();
  169.             return 0;
  170.         }
  171.  
  172.         static public int GetUserLicence(string Username)
  173.         {
  174.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  175.  
  176.             string line = null;
  177.             while ((line = Sr.ReadLine()) != null)
  178.             {
  179.                 if (line.Substring(0, 7) == "Licence")
  180.                 {
  181.                     string[] Msg = line.Split('=');
  182.                     Sr.Close();
  183.                     return int.Parse(Msg[1].Trim());
  184.                 }
  185.             }
  186.             Sr.Close();
  187.             return 0;
  188.         }
  189.  
  190.         static public int GetUserBank(string Username)
  191.         {
  192.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  193.  
  194.             string line = null;
  195.             while ((line = Sr.ReadLine()) != null)
  196.             {
  197.                 if (line.Substring(0, 4) == "BBal")
  198.                 {
  199.                     string[] Msg = line.Split('=');
  200.                     Sr.Close();
  201.                     return int.Parse(Msg[1].Trim());
  202.                 }
  203.             }
  204.             Sr.Close();
  205.             return 0;
  206.         }
  207.  
  208.         static public string GetUserCars(string Username)
  209.         {
  210.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  211.  
  212.             string line = null;
  213.             while ((line = Sr.ReadLine()) != null)
  214.             {
  215.                 if (line.Substring(0, 4) == "Cars")
  216.                 {
  217.                     string[] Msg = line.Split('=');
  218.                     Sr.Close();
  219.                     return Msg[1].Trim();
  220.                 }
  221.             }
  222.             Sr.Close();
  223.             return "";
  224.         }
  225.  
  226.         static public byte GetUserHealth(string Username)
  227.         {
  228.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  229.  
  230.             string line = null;
  231.             while ((line = Sr.ReadLine()) != null)
  232.             {
  233.                 if (line.Substring(0, 6) == "Health")
  234.                 {
  235.                     string[] Msg = line.Split('=');
  236.                     Sr.Close();
  237.                     return byte.Parse(Msg[1].Trim());
  238.                 }
  239.             }
  240.             Sr.Close();
  241.             return 0;
  242.         }
  243.  
  244.         static public byte GetUserGUIX(string Username)
  245.         {
  246.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  247.  
  248.             string line = null;
  249.             while ((line = Sr.ReadLine()) != null)
  250.             {
  251.                 if (line.Substring(0, 4) == "GUIX")
  252.                 {
  253.                     string[] Msg = line.Split('=');
  254.                     Sr.Close();
  255.                     return byte.Parse(Msg[1].Trim());
  256.                 }
  257.             }
  258.             Sr.Close();
  259.             return 0;
  260.         }
  261.  
  262.         static public byte GetUserGUIY(string Username)
  263.         {
  264.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  265.  
  266.             string line = null;
  267.             while ((line = Sr.ReadLine()) != null)
  268.             {
  269.                 if (line.Substring(0, 4) == "GUIY")
  270.                 {
  271.                     string[] Msg = line.Split('=');
  272.                     Sr.Close();
  273.                     return byte.Parse(Msg[1].Trim());
  274.                 }
  275.             }
  276.             Sr.Close();
  277.             return 0;
  278.         }
  279.  
  280.         static public byte GetUserGUIX2(string Username)
  281.         {
  282.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  283.  
  284.             string line = null;
  285.             while ((line = Sr.ReadLine()) != null)
  286.             {
  287.                 if (line.Substring(0, 5) == "GUIX2")
  288.                 {
  289.                     string[] Msg = line.Split('=');
  290.                     Sr.Close();
  291.                     return byte.Parse(Msg[1].Trim());
  292.                 }
  293.             }
  294.             Sr.Close();
  295.             return 0;
  296.         }
  297.  
  298.         static public byte GetUserGUIY2(string Username)
  299.         {
  300.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  301.  
  302.             string line = null;
  303.             while ((line = Sr.ReadLine()) != null)
  304.             {
  305.                 if (line.Substring(0, 5) == "GUIY2")
  306.                 {
  307.                     string[] Msg = line.Split('=');
  308.                     Sr.Close();
  309.                     return byte.Parse(Msg[1].Trim());
  310.                 }
  311.             }
  312.             Sr.Close();
  313.             return 0;
  314.         }
  315.  
  316.         static public int GetUserGUIStyle(string Username)
  317.         {
  318.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  319.  
  320.             string line = null;
  321.             while ((line = Sr.ReadLine()) != null)
  322.             {
  323.                 if (line.Substring(0, 8) == "GUIStyle")
  324.                 {
  325.                     string[] Msg = line.Split('=');
  326.                     Sr.Close();
  327.                     return int.Parse(Msg[1].Trim());
  328.                 }
  329.             }
  330.             Sr.Close();
  331.             return 0;
  332.         }
  333.  
  334.         static public int GetUserDistance(string Username)
  335.         {
  336.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  337.  
  338.             string line = null;
  339.             while ((line = Sr.ReadLine()) != null)
  340.             {
  341.                 if (line.Substring(0, 8) == "Distance")
  342.                 {
  343.                     string[] Msg = line.Split('=');
  344.                     Sr.Close();
  345.                     return int.Parse(Msg[1].Trim());
  346.                 }
  347.             }
  348.             Sr.Close();
  349.             return 0;
  350.         }
  351.  
  352.         static public int GetUserJobsDone(string Username)
  353.         {
  354.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  355.  
  356.             string line = null;
  357.             while ((line = Sr.ReadLine()) != null)
  358.             {
  359.                 if (line.Substring(0, 8) == "JobsDone")
  360.                 {
  361.                     string[] Msg = line.Split('=');
  362.                     Sr.Close();
  363.                     return int.Parse(Msg[1].Trim());
  364.                 }
  365.             }
  366.             Sr.Close();
  367.             return 0;
  368.         }
  369.  
  370.         static public byte GetUserElectronics(string Username)
  371.         {
  372.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  373.  
  374.             string line = null;
  375.             while ((line = Sr.ReadLine()) != null)
  376.             {
  377.                 if (line.Substring(0, 6) == "Goods1")
  378.                 {
  379.                     string[] Msg = line.Split('=');
  380.                     Sr.Close();
  381.                     return byte.Parse(Msg[1].Trim());
  382.                 }
  383.             }
  384.             Sr.Close();
  385.             return 0;
  386.         }
  387.  
  388.  
  389.         static public byte GetUserFurniture(string Username)
  390.         {
  391.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  392.  
  393.             string line = null;
  394.             while ((line = Sr.ReadLine()) != null)
  395.             {
  396.                 if (line.Substring(0, 6) == "Goods2")
  397.                 {
  398.                     string[] Msg = line.Split('=');
  399.                     Sr.Close();
  400.                     return byte.Parse(Msg[1].Trim());
  401.                 }
  402.             }
  403.             Sr.Close();
  404.             return 0;
  405.         }
  406.  
  407.         static public int GetUserLastRaffle(string Username)
  408.         {
  409.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  410.  
  411.             string line = null;
  412.             while ((line = Sr.ReadLine()) != null)
  413.             {
  414.                 if (line.Substring(0, 6) == "Raffle")
  415.                 {
  416.                     string[] Msg = line.Split('=');
  417.                     Sr.Close();
  418.                     return int.Parse(Msg[1].Trim());
  419.                 }
  420.             }
  421.             Sr.Close();
  422.             return 0;
  423.         }
  424.  
  425.         static public int GetUserLastLotto(string Username)
  426.         {
  427.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  428.  
  429.             string line = null;
  430.             while ((line = Sr.ReadLine()) != null)
  431.             {
  432.                 if (line.Substring(0, 5) == "Lotto")
  433.                 {
  434.                     string[] Msg = line.Split('=');
  435.                     Sr.Close();
  436.                     return int.Parse(Msg[1].Trim());
  437.                 }
  438.             }
  439.             Sr.Close();
  440.             return 0;
  441.         }
  442.  
  443.         static public int GetUserLastCasino(string Username)
  444.         {
  445.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  446.  
  447.             string line = null;
  448.             while ((line = Sr.ReadLine()) != null)
  449.             {
  450.                 if (line.Substring(0, 6) == "Casino")
  451.                 {
  452.                     string[] Msg = line.Split('=');
  453.                     Sr.Close();
  454.                     return int.Parse(Msg[1].Trim());
  455.                 }
  456.             }
  457.             Sr.Close();
  458.             return 0;
  459.         }
  460.  
  461.         #endregion
  462.  
  463.         #region ' Player Status '
  464.  
  465.         public static byte CanBeOfficer(string Username)
  466.         {
  467.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  468.  
  469.             string line = null;
  470.             while ((line = Sr.ReadLine()) != null)
  471.             {
  472.                 if (line.Substring(0, 7) == "Officer")
  473.                 {
  474.                     string[] Msg = line.Split('=');
  475.                     Sr.Close();
  476.                     return byte.Parse(Msg[1].Trim());
  477.                 }
  478.             }
  479.             Sr.Close();
  480.             return 0;
  481.         }
  482.  
  483.         public static byte CanBeCadet(string Username)
  484.         {
  485.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  486.  
  487.             string line = null;
  488.             while ((line = Sr.ReadLine()) != null)
  489.             {
  490.                 if (line.Substring(0, 5) == "Cadet")
  491.                 {
  492.                     string[] Msg = line.Split('=');
  493.                     Sr.Close();
  494.                     return byte.Parse(Msg[1].Trim());
  495.                 }
  496.             }
  497.             Sr.Close();
  498.             return 0;
  499.         }
  500.  
  501.         public static byte CanBeTowTruck(string Username)
  502.         {
  503.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  504.  
  505.             string line = null;
  506.             while ((line = Sr.ReadLine()) != null)
  507.             {
  508.                 if (line.Substring(0, 8) == "TowTruck")
  509.                 {
  510.                     string[] Msg = line.Split('=');
  511.                     Sr.Close();
  512.                     return byte.Parse(Msg[1].Trim());
  513.                 }
  514.             }
  515.             Sr.Close();
  516.             return 0;
  517.         }
  518.  
  519.         public static byte IsMember(string Username)
  520.         {
  521.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  522.  
  523.             string line = null;
  524.             while ((line = Sr.ReadLine()) != null)
  525.             {
  526.                 if (line.Substring(0, 6) == "Member")
  527.                 {
  528.                     string[] Msg = line.Split('=');
  529.                     Sr.Close();
  530.                     return byte.Parse(Msg[1].Trim());
  531.                 }
  532.             }
  533.             Sr.Close();
  534.             return 0;
  535.         }
  536.  
  537.         public static byte IsSupporter(string Username)
  538.         {
  539.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  540.  
  541.             string line = null;
  542.             while ((line = Sr.ReadLine()) != null)
  543.             {
  544.                 if (line.Substring(0, 6) == "Support")
  545.                 {
  546.                     string[] Msg = line.Split('=');
  547.                     Sr.Close();
  548.                     return byte.Parse(Msg[1].Trim());
  549.                 }
  550.             }
  551.             Sr.Close();
  552.             return 0;
  553.         }
  554.  
  555.         #endregion
  556.  
  557.         #region ' User Settings '
  558.  
  559.  
  560.         public static byte GetCopPanel(string Username)
  561.         {
  562.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  563.  
  564.             string line = null;
  565.             while ((line = Sr.ReadLine()) != null)
  566.             {
  567.                 if (line.Substring(0, 5) == "Panel")
  568.                 {
  569.                     string[] Msg = line.Split('=');
  570.                     Sr.Close();
  571.                     return byte.Parse(Msg[1].Trim());
  572.                 }
  573.             }
  574.             Sr.Close();
  575.             return 0;
  576.         }
  577.  
  578.         #endregion
  579.  
  580.         #region ' Player Renting '
  581.  
  582.         static public byte GetUserRenting(string Username)
  583.         {
  584.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  585.  
  586.             string line = null;
  587.             while ((line = Sr.ReadLine()) != null)
  588.             {
  589.                 if (line.Substring(0, 7) == "Renting")
  590.                 {
  591.                     string[] Msg = line.Split('=');
  592.                     Sr.Close();
  593.                     return byte.Parse(Msg[1].Trim());
  594.                 }
  595.             }
  596.             Sr.Close();
  597.             return 0;
  598.         }
  599.        
  600.         static public byte GetUserRented(string Username)
  601.         {
  602.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  603.  
  604.             string line = null;
  605.             while ((line = Sr.ReadLine()) != null)
  606.             {
  607.                 if (line.Substring(0, 6) == "Rented")
  608.                 {
  609.                     string[] Msg = line.Split('=');
  610.                     Sr.Close();
  611.                     return byte.Parse(Msg[1].Trim());
  612.                 }
  613.             }
  614.             Sr.Close();
  615.             return 0;
  616.         }
  617.        
  618.         static public string GetUserRentee(string Username)
  619.         {
  620.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  621.  
  622.             string line = null;
  623.             while ((line = Sr.ReadLine()) != null)
  624.             {
  625.                 if (line.Substring(0, 6) == "Rentee")
  626.                 {
  627.                     string[] Msg = line.Split('=');
  628.                     Sr.Close();
  629.                     return Msg[1].Trim();
  630.                 }
  631.             }
  632.             Sr.Close();
  633.             return "";
  634.         }
  635.        
  636.         static public string GetUserRenter(string Username)
  637.         {
  638.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  639.  
  640.             string line = null;
  641.             while ((line = Sr.ReadLine()) != null)
  642.             {
  643.                 if (line.Substring(0, 6) == "Renter")
  644.                 {
  645.                     string[] Msg = line.Split('=');
  646.                     Sr.Close();
  647.                     return Msg[1].Trim();
  648.                 }
  649.             }
  650.             Sr.Close();
  651.             return "";
  652.         }
  653.        
  654.         static public string GetUserRenterr(string Username)
  655.         {
  656.             StreamReader Sr = new StreamReader(Database + "\\" + Username + ".txt");
  657.  
  658.             string line = null;
  659.             while ((line = Sr.ReadLine()) != null)
  660.             {
  661.                 if (line.Substring(0, 7) == "Renterr")
  662.                 {
  663.                     string[] Msg = line.Split('=');
  664.                     Sr.Close();
  665.                     return Msg[1].Trim();
  666.                 }
  667.             }
  668.             Sr.Close();
  669.             return "";
  670.         }
  671.        
  672.         #endregion
  673.  
  674.         static public byte GetUserAdmin(string Username)
  675.         {
  676.             StreamReader Sr = new StreamReader("Files/SuperAdmin.ucadmn");
  677.  
  678.             string line = null;
  679.             while ((line = Sr.ReadLine()) != null)
  680.             {
  681.                 if (line.Substring(0, 5) == "Admin")
  682.                 {
  683.                     string[] Msg = line.Split('=');
  684.                     if (Msg[1].Trim() == Username)
  685.                     {
  686.                         Sr.Close();
  687.                         return 1;
  688.                     }
  689.                 }
  690.             }
  691.             Sr.Close();
  692.             return 0;
  693.         }
  694.  
  695.         static public string GetVersion(string InsimVer)
  696.         {
  697.             StreamReader Sr = new StreamReader("Files/Version.ucis");
  698.  
  699.             string line = null;
  700.             while ((line = Sr.ReadLine()) != null)
  701.             {
  702.                 if (line.Substring(0, 7) == "Version")
  703.                 {
  704.                     string[] Msg = line.Split('=');
  705.                     Sr.Close();
  706.                     return Msg[1].Trim();
  707.                 }
  708.             }
  709.             Sr.Close();
  710.             return "";
  711.         }
  712.  
  713.         static public string HouseName(string HName)
  714.         {
  715.             StreamReader Sr = new StreamReader("Files/HouseName.ucis");
  716.  
  717.             string line = null;
  718.             while ((line = Sr.ReadLine()) != null)
  719.             {
  720.                 if (line.Substring(0, 7) == "Name")
  721.                 {
  722.                     string[] Msg = line.Split('=');
  723.                     Sr.Close();
  724.                     return Msg[1].Trim();
  725.                 }
  726.             }
  727.             Sr.Close();
  728.             return "";
  729.         }
  730.  
  731.  
  732.         static public byte GetUserPermBan(string Username)
  733.         {
  734.             StreamReader Sr = new StreamReader("Files/BanList.ucis");
  735.  
  736.             string line = null;
  737.             while ((line = Sr.ReadLine()) != null)
  738.             {
  739.                 if (line.Substring(0, 3) == "Ban")
  740.                 {
  741.                     string[] Msg = line.Split('=');
  742.                     if (Msg[1].Trim().ToLower() == Username)
  743.                     {
  744.                         Sr.Close();
  745.                         return 1;
  746.                     }
  747.                 }
  748.             }
  749.             Sr.Close();
  750.             return 0;
  751.         }
  752.  
  753.         static public string AddBanList(string Username)
  754.         {
  755.             StreamReader ApR = new StreamReader("Files/BanList.ucis");
  756.             string TempAPR = ApR.ReadToEnd();
  757.             ApR.Close();
  758.             StreamWriter Ap = new StreamWriter("Files/BanList.ucis");
  759.             Ap.WriteLine(TempAPR + "Ban = " + Username);
  760.             Ap.Flush();
  761.             Ap.Close();
  762.             return "";
  763.         }
  764.  
  765.  
  766.         static public byte SwearFilter(string SwearFilter)
  767.         {
  768.             StreamReader Sr = new StreamReader("Swears.txt");
  769.             string line = null;
  770.             while ((line = Sr.ReadLine()) != null)
  771.             {
  772.                 if (line.Substring(0, 5) == "Swear")
  773.                 {
  774.                     string[] Msg = line.Split('=');
  775.                     if (Msg[1].Trim() == SwearFilter)
  776.                     {
  777.                         Sr.Close();
  778.                         return 1;
  779.                     }
  780.                 }
  781.             }
  782.             Sr.Close();
  783.             return 0;
  784.         }
  785.  
  786.  
  787.         static public string GetPm(string pm)
  788.         {
  789.             StreamReader Sr = new StreamReader("Files/PrivMsgLog.txt");
  790.  
  791.             string line = null;
  792.             while ((line = Sr.ReadLine()) != null)
  793.             {
  794.                 if (line.Substring(0, 7) == "PrivateMP")
  795.                 {
  796.                     string[] Msg = line.Split('=');
  797.                     Sr.Close();
  798.                     return Msg[1].Trim();
  799.                 }
  800.             }
  801.             Sr.Close();
  802.             return "";
  803.         }
  804.  
  805.  
  806.  
  807.         static public string AddVersion(int InsimVer)
  808.         {
  809.             StreamReader ApR = new StreamReader("Files/Version.ucis");
  810.             string TempAPR = ApR.ReadLine();
  811.             ApR.Close();
  812.             StreamWriter Ap = new StreamWriter("Files/Version.ucis");
  813.             Ap.WriteLine(TempAPR + InsimVer);
  814.             Ap.Flush();
  815.             Ap.Close();
  816.             return "";
  817.         }
  818.    
  819.     }
  820. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement