Remove yet another flat file converter from yet another constructor
This commit is contained in:
parent
4709093553
commit
2ac5ea929b
1 changed files with 0 additions and 39 deletions
|
|
@ -39,45 +39,6 @@ namespace TShockAPI.DB
|
||||||
"ban,unban,whitelist,causeevents,spawnboss,spawnmob,managewarp,time,tp,pvpfun,kill,logs,immunetokick,tphere");
|
"ban,unban,whitelist,causeevents,spawnboss,spawnmob,managewarp,time,tp,pvpfun,kill,logs,immunetokick,tphere");
|
||||||
AddGroup("trustedadmin", "admin", "maintenance,cfg,butcher,item,heal,immunetoban,usebanneditem,manageusers");
|
AddGroup("trustedadmin", "admin", "maintenance,cfg,butcher,item,heal,immunetoban,usebanneditem,manageusers");
|
||||||
AddGroup("vip", "default", "reservedslot");
|
AddGroup("vip", "default", "reservedslot");
|
||||||
|
|
||||||
String file = Path.Combine(TShock.SavePath, "groups.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("#"))
|
|
||||||
{
|
|
||||||
String[] info = line.Split(' ');
|
|
||||||
String comms = "";
|
|
||||||
int size = info.Length;
|
|
||||||
for (int i = 1; i < size; i++)
|
|
||||||
{
|
|
||||||
if (!comms.Equals(""))
|
|
||||||
comms = comms + ",";
|
|
||||||
comms = comms + info[i].Trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
string query = "";
|
|
||||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
|
||||||
query = "INSERT OR IGNORE INTO GroupList (GroupName, Commands) VALUES (@0, @1);";
|
|
||||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
|
||||||
query = "INSERT IGNORE INTO GroupList SET GroupName=@0, Commands=@1;";
|
|
||||||
|
|
||||||
db.Query(query, info[0].Trim(), comms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
|
||||||
String file2 = Path.Combine(path, "groups.txt");
|
|
||||||
if (!Directory.Exists(path))
|
|
||||||
Directory.CreateDirectory(path);
|
|
||||||
if (File.Exists(file2))
|
|
||||||
File.Delete(file2);
|
|
||||||
File.Move(file, file2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue