public static void Test() { foreach (QuestInfo questInfo in HeroesContentsLoader.GetTable <QuestInfo>()) { Log <HeroesContentsLoader> .Logger.InfoFormat("{0} {1}", questInfo.ID, questInfo.Level); } }
static HeroesContentsLoader() { string path = Path.Combine(Environment.CurrentDirectory, (IntPtr.Size == 4) ? "x86\\System.Data.SQLite.DLL" : "x64\\System.Data.SQLite.DLL"); HeroesContentsLoader.DataFileName = ServiceCoreSettings.Default.heroesContentsDB3; HeroesContentsLoader.LocalizedTextFileName = ServiceCoreSettings.Default.localizedTextDB3; Log <HeroesContentsLoader> .Logger.InfoFormat("HeroesContentsLoader in {0}bit", (IntPtr.Size == 4)? 32 : 64); HeroesContentsLoader.Assembly_Sqlite = Assembly.LoadFile(path); HeroesContentsLoader.Type_SQLiteConnection = HeroesContentsLoader.Assembly_Sqlite.GetType("System.Data.SQLite.SQLiteConnection"); HeroesContentsLoader.Type_SQLiteCommand = HeroesContentsLoader.Assembly_Sqlite.GetType("System.Data.SQLite.SQLiteCommand"); HeroesContentsLoader.Type_SQLiteDataReader = HeroesContentsLoader.Assembly_Sqlite.GetType("System.Data.SQLite.SQLiteDataReader"); HeroesContentsLoader.Method_Conn_Open = HeroesContentsLoader.Type_SQLiteConnection.GetMethod("Open"); HeroesContentsLoader.Method_Conn_Close = HeroesContentsLoader.Type_SQLiteConnection.GetMethod("Close"); HeroesContentsLoader.Method_Conn_CreateCommand = HeroesContentsLoader.Type_SQLiteConnection.GetMethod("CreateCommand"); HeroesContentsLoader.Method_Cmd_ExecuteReader = HeroesContentsLoader.Type_SQLiteCommand.GetMethod("ExecuteReader", new Type[0]); HeroesContentsLoader.Method_Reader_Read = HeroesContentsLoader.Type_SQLiteDataReader.GetMethod("Read"); HeroesContentsLoader.Method_Reader_GetValue = HeroesContentsLoader.Type_SQLiteDataReader.GetMethod("GetValue", new Type[] { typeof(int) }); HeroesContentsLoader.Method_Reader_GetOrdinal = HeroesContentsLoader.Type_SQLiteDataReader.GetMethod("GetOrdinal", new Type[] { typeof(string) }); HeroesContentsLoader.Method_Reader_GetString = HeroesContentsLoader.Type_SQLiteDataReader.GetMethod("GetString", new Type[] { typeof(int) }); HeroesContentsLoader.Method_Reader_GetName = HeroesContentsLoader.Type_SQLiteDataReader.GetMethod("GetName", new Type[] { typeof(int) }); HeroesContentsLoader.Method_Reader_Close = HeroesContentsLoader.Type_SQLiteDataReader.GetMethod("Close"); HeroesContentsLoader.Property_Cmd_CommandText = HeroesContentsLoader.Type_SQLiteCommand.GetProperty("CommandText"); HeroesContentsLoader.Property_Cmd_CommandType = HeroesContentsLoader.Type_SQLiteCommand.GetProperty("CommandType"); HeroesContentsLoader.Property_Reader_Item = HeroesContentsLoader.Type_SQLiteDataReader.GetProperty("Item", new Type[] { typeof(int) }); HeroesContentsLoader.Property_Reader_FieldCount = HeroesContentsLoader.Type_SQLiteDataReader.GetProperty("FieldCount"); string fullPath = Path.GetFullPath(ServiceCoreSettings.Default.heroesContentsDB3); string directoryName = Path.GetDirectoryName(fullPath); HeroesContentsLoader.FileSystemWatcher = new FileSystemWatcher { Path = directoryName, NotifyFilter = (NotifyFilters.Size | NotifyFilters.LastWrite), Filter = "*.db3", IncludeSubdirectories = false, EnableRaisingEvents = true }; HeroesContentsLoader.FileSystemWatcher.Changed += delegate(object _, FileSystemEventArgs __) { Scheduler.Schedule(JobProcessor.Current, Job.Create(delegate { if (HeroesContentsLoader.DB3Changed != null) { HeroesContentsLoader.DB3Changed(); } }), 3000); }; }
public static void TestConnection() { HeroesContentsLoader.GetGameCode(); }