Resharper code cleanup, including:
- Optimized using statements - Removal of redundant code
This commit is contained in:
parent
3dd7af1a30
commit
37146adb4c
23 changed files with 141 additions and 185 deletions
|
|
@ -17,12 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Community.CsharpSqlite.SQLiteClient;
|
||||
using TShockAPI.DB;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
|
|
@ -63,7 +59,7 @@ namespace TShockAPI.DB
|
|||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
||||
String file2 = Path.Combine(path, "bans.txt");
|
||||
if (!Directory.Exists(path))
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path);
|
||||
if (File.Exists(file2))
|
||||
File.Delete(file2);
|
||||
File.Move(file, file2);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
|
|
@ -55,8 +53,8 @@ namespace TShockAPI.DB
|
|||
return parm;
|
||||
}
|
||||
|
||||
static Dictionary<Type, Func<IDataReader, int, object>> ReadFuncs = new Dictionary<Type, Func<IDataReader, int, object>>()
|
||||
{
|
||||
static Dictionary<Type, Func<IDataReader, int, object>> ReadFuncs = new Dictionary<Type, Func<IDataReader, int, object>>
|
||||
{
|
||||
{typeof(bool), (s, i) => s.GetBoolean(i)},
|
||||
{typeof(byte), (s, i) => s.GetByte(i)},
|
||||
{typeof(Int16), (s, i) => s.GetInt16(i)},
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using Community.CsharpSqlite.SQLiteClient;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
|
|
@ -72,7 +70,7 @@ namespace TShockAPI.DB
|
|||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
||||
String file2 = Path.Combine(path, "groups.txt");
|
||||
if (!Directory.Exists(path))
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path);
|
||||
if (File.Exists(file2))
|
||||
File.Delete(file2);
|
||||
File.Move(file, file2);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using Community.CsharpSqlite.SQLiteClient;
|
||||
using TShockAPI.DB;
|
||||
using System.IO;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
|
|
@ -50,7 +46,7 @@ namespace TShockAPI.DB
|
|||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
||||
String file2 = Path.Combine(path, "itembans.txt");
|
||||
if (!Directory.Exists(path))
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path);
|
||||
if (File.Exists(file2))
|
||||
File.Delete(file2);
|
||||
File.Move(file, file2);
|
||||
|
|
|
|||
|
|
@ -18,17 +18,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using TShockAPI.DB;
|
||||
using Community.CsharpSqlite.SQLiteClient;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
public class RegionManager
|
||||
|
|
@ -171,8 +166,8 @@ namespace TShockAPI.DB
|
|||
int height = reader.Get<int>("height");
|
||||
int width = reader.Get<int>("width");
|
||||
int Protected = reader.Get<int>("Protected");
|
||||
string MergedIDs = DbExt.Get<string>(reader, "UserIds");
|
||||
string name = DbExt.Get<string>(reader, "RegionName");
|
||||
string MergedIDs = reader.Get<string>("UserIds");
|
||||
string name = reader.Get<string>("RegionName");
|
||||
|
||||
string[] SplitIDs = MergedIDs.Split(',');
|
||||
|
||||
|
|
@ -215,8 +210,8 @@ namespace TShockAPI.DB
|
|||
int height = reader.Get<int>("height");
|
||||
int width = reader.Get<int>("width");
|
||||
int Protected = reader.Get<int>("Protected");
|
||||
string MergedIDs = DbExt.Get<string>(reader, "UserIds");
|
||||
string name = DbExt.Get<string>(reader, "RegionName");
|
||||
string MergedIDs = reader.Get<string>("UserIds");
|
||||
string name = reader.Get<string>("RegionName");
|
||||
string[] SplitIDs = MergedIDs.Split(',');
|
||||
|
||||
Region r = new Region(new Rectangle(X1, Y1, width, height), name, Protected != 0, Main.worldID.ToString());
|
||||
|
|
|
|||
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
class SqlTable
|
||||
{
|
||||
|
|
|
|||
|
|
@ -18,12 +18,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Community.CsharpSqlite.SQLiteClient;
|
||||
using System.IO;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
{
|
||||
public class UserManager
|
||||
|
|
@ -82,7 +79,7 @@ namespace TShockAPI.DB
|
|||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
||||
String file2 = Path.Combine(path, "users.txt");
|
||||
if (!Directory.Exists(path))
|
||||
System.IO.Directory.CreateDirectory(path);
|
||||
Directory.CreateDirectory(path);
|
||||
if (File.Exists(file2))
|
||||
File.Delete(file2);
|
||||
File.Move(file, file2);
|
||||
|
|
@ -201,7 +198,7 @@ namespace TShockAPI.DB
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConsoleError("FetchHashedPasswordAndGroup SQL returned an error: " + ex.ToString());
|
||||
Log.ConsoleError("FetchHashedPasswordAndGroup SQL returned an error: " + ex);
|
||||
}
|
||||
return returndata;
|
||||
}
|
||||
|
|
@ -220,7 +217,7 @@ namespace TShockAPI.DB
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConsoleError("FetchHashedPasswordAndGroup SQL returned an error: " + ex.ToString());
|
||||
Log.ConsoleError("FetchHashedPasswordAndGroup SQL returned an error: " + ex);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -244,7 +241,7 @@ namespace TShockAPI.DB
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConsoleError("GetGroupForIP SQL returned an error: " + ex.ToString());
|
||||
Log.ConsoleError("GetGroupForIP SQL returned an error: " + ex);
|
||||
}
|
||||
return Tools.GetGroup("default");
|
||||
}
|
||||
|
|
@ -266,7 +263,7 @@ namespace TShockAPI.DB
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.ConsoleError("GetGroupForIP SQL returned an error: " + ex.ToString());
|
||||
Log.ConsoleError("GetGroupForIP SQL returned an error: " + ex);
|
||||
}
|
||||
return Tools.GetGroup("default");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using Microsoft.Xna.Framework;
|
||||
using System.Xml;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
namespace TShockAPI.DB
|
||||
|
|
@ -111,7 +111,7 @@ namespace TShockAPI.DB
|
|||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
||||
String file2 = Path.Combine(path, "warps.xml");
|
||||
if (!Directory.Exists(path))
|
||||
System.IO.Directory.CreateDirectory(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