From 71b5d632638f0b1b304c0f21a130cf956d7a1e1b Mon Sep 17 00:00:00 2001 From: Lucas Nicodemus Date: Sun, 1 Jan 2012 02:53:37 -0700 Subject: [PATCH] Remove flat file conversion code from user manager --- TShockAPI/DB/UserManager.cs | 47 ------------------------------------- 1 file changed, 47 deletions(-) diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs index bb086174..ecea186e 100644 --- a/TShockAPI/DB/UserManager.cs +++ b/TShockAPI/DB/UserManager.cs @@ -43,53 +43,6 @@ namespace TShockAPI.DB ? (IQueryBuilder) new SqliteQueryCreator() : new MysqlQueryCreator()); creator.EnsureExists(table); - - String file = Path.Combine(TShock.SavePath, "users.txt"); - if (File.Exists(file)) - { - using (StreamReader sr = new StreamReader(file)) - { - String line; - while ((line = sr.ReadLine()) != null) - { - if (line.Equals("") || line.Substring(0, 1).Equals("#")) - continue; - String[] info = line.Split(' '); - String username = ""; - String sha = ""; - String group = ""; - String ip = ""; - - String[] nameSha = info[0].Split(':'); - - if (nameSha.Length < 2) - { - username = nameSha[0]; - ip = nameSha[0]; - group = info[1]; - } - else - { - username = nameSha[0]; - sha = nameSha[1]; - group = info[1]; - } - - string query = (TShock.Config.StorageType.ToLower() == "sqlite") - ? "INSERT OR IGNORE INTO Users (Username, Password, Usergroup, IP) VALUES (@0, @1, @2, @3)" - : "INSERT IGNORE INTO Users SET Username=@0, Password=@1, Usergroup=@2, IP=@3"; - - database.Query(query, username.Trim(), sha.Trim(), group.Trim(), ip.Trim()); - } - } - String path = Path.Combine(TShock.SavePath, "old_configs"); - String file2 = Path.Combine(path, "users.txt"); - if (!Directory.Exists(path)) - Directory.CreateDirectory(path); - if (File.Exists(file2)) - File.Delete(file2); - File.Move(file, file2); - } } ///