本文整理汇总了C#中Tibialyzer.Hunt.GetTableName方法的典型用法代码示例。如果您正苦于以下问题:C# Hunt.GetTableName方法的具体用法?C# Hunt.GetTableName怎么用?C# Hunt.GetTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tibialyzer.Hunt
的用法示例。
在下文中一共展示了Hunt.GetTableName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: saveLog
void saveLog(Hunt h, string logPath)
{
StreamWriter streamWriter = new StreamWriter(logPath);
// we load the data from the database instead of from the stored dictionary so it is ordered properly
SQLiteCommand comm = new SQLiteCommand(String.Format("SELECT message FROM \"{0}\"", h.GetTableName()), lootConn);
SQLiteDataReader reader = comm.ExecuteReader();
while (reader.Read()) {
streamWriter.WriteLine(reader["message"].ToString());
}
streamWriter.Flush();
streamWriter.Close();
}
示例2: HuntTableExists
public static bool HuntTableExists(Hunt h)
{
int value = 0;
object result = ExecuteScalar(String.Format("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='{0}';", h.GetTableName()));
if (result != null && int.TryParse(result.ToString(), out value)) {
return value != 0;
}
return false;
}
示例3: deleteLogMessage
void deleteLogMessage(Hunt h, string logMessage)
{
string timeStamp = logMessage.Substring(0, 5);
bool found = false;
lock (hunts) {
if (h.loot.logMessages.ContainsKey(timeStamp)) {
if (h.loot.logMessages[timeStamp].Contains(logMessage)) {
h.loot.logMessages[timeStamp].Remove(logMessage);
var logMessageItems = ParseLootMessage(logMessage);
Creature cr = logMessageItems.Item1;
if (h.loot.killCount.ContainsKey(cr)) {
h.loot.killCount[cr]--;
if (h.loot.killCount[cr] == 0) {
h.loot.killCount.Remove(cr);
}
}
foreach (Tuple<Item, int> tpl in logMessageItems.Item2) {
if (h.loot.creatureLoot[cr].ContainsKey(tpl.Item1)) {
h.loot.creatureLoot[cr][tpl.Item1] -= tpl.Item2;
if (h.loot.creatureLoot[cr][tpl.Item1] <= 0) {
h.loot.creatureLoot[cr].Remove(tpl.Item1);
}
}
}
found = true;
}
}
}
if (!found) return;
string huntTable = h.GetTableName();
SQLiteCommand comm = new SQLiteCommand(String.Format("SELECT day,hour,minute,message FROM \"{0}\" WHERE message=\"{1}\"", huntTable, logMessage.Replace("\"", "\\\"")), lootConn);
SQLiteDataReader reader = comm.ExecuteReader();
if (reader.Read()) {
comm = new SQLiteCommand(String.Format("DELETE FROM \"{0}\" WHERE day={1} AND hour={2} AND minute={3} AND message=\"{4}\"", huntTable, reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader["message"].ToString()), lootConn);
comm.ExecuteNonQuery();
}
LootChanged();
}
示例4: resetHunt
void resetHunt(Hunt h)
{
lock (hunts) {
h.loot.creatureLoot.Clear();
h.loot.killCount.Clear();
h.loot.logMessages.Clear();
h.totalExp = 0;
h.totalTime = 0;
}
string huntTable = h.GetTableName();
SQLiteCommand comm = new SQLiteCommand(String.Format("DROP TABLE IF EXISTS \"{0}\";", huntTable), lootConn);
comm.ExecuteNonQuery();
comm = new SQLiteCommand(String.Format("CREATE TABLE IF NOT EXISTS \"{0}\"(day INTEGER, hour INTEGER, minute INTEGER, message STRING);", huntTable), lootConn);
comm.ExecuteNonQuery();
LootChanged();
}
示例5: DeleteMessagesBefore
public static void DeleteMessagesBefore(Hunt h, int stamp, int hour, int minute)
{
ExecuteNonQuery(String.Format("DELETE FROM \"{0}\" WHERE day < {1} OR hour < {2} OR (hour == {2} AND minute < {3})", h.GetTableName(), stamp, hour, minute));
}
示例6: initializeHunts
void initializeHunts()
{
//"Name#DBTableID#Track#Time#Exp#SideHunt#AggregateHunt#ClearOnStartup#Creature#Creature#..."
if (!SettingsManager.settingExists("Hunts")) {
SettingsManager.setSetting("Hunts", new List<string>() { "New Hunt#True#0#0#False#True" });
}
hunts.Clear();
int activeHuntIndex = 0, index = 0;
List<int> dbTableIds = new List<int>();
foreach (string str in SettingsManager.getSetting("Hunts")) {
SQLiteCommand command; SQLiteDataReader reader;
Hunt hunt = new Hunt();
string[] splits = str.Split('#');
if (splits.Length >= 7) {
hunt.name = splits[0];
if (!int.TryParse(splits[1].Trim(), out hunt.dbtableid)) continue;
if (dbTableIds.Contains(hunt.dbtableid)) continue;
dbTableIds.Add(hunt.dbtableid);
hunt.totalTime = 0;
hunt.trackAllCreatures = splits[2] == "True";
double.TryParse(splits[3], NumberStyles.Any, CultureInfo.InvariantCulture, out hunt.totalTime);
long.TryParse(splits[4], out hunt.totalExp);
hunt.sideHunt = splits[5] == "True";
hunt.aggregateHunt = splits[6] == "True";
hunt.clearOnStartup = splits[7] == "True";
hunt.temporary = false;
string massiveString = "";
for (int i = 8; i < splits.Length; i++) {
if (splits[i].Length > 0) {
massiveString += splits[i] + "\n";
}
}
hunt.trackedCreatures = massiveString;
// set this hunt to the active hunt if it is the active hunt
if (SettingsManager.settingExists("ActiveHunt") && SettingsManager.getSettingString("ActiveHunt") == hunt.name)
activeHuntIndex = index;
refreshLootCreatures(hunt);
if (hunt.clearOnStartup) {
resetHunt(hunt);
}
// create the hunt table if it does not exist
command = new SQLiteCommand(String.Format("CREATE TABLE IF NOT EXISTS \"{0}\"(day INTEGER, hour INTEGER, minute INTEGER, message STRING);", hunt.GetTableName()), lootConn);
command.ExecuteNonQuery();
// load the data for the hunt from the database
command = new SQLiteCommand(String.Format("SELECT message FROM \"{0}\" ORDER BY day, hour, minute;", hunt.GetTableName()), lootConn);
reader = command.ExecuteReader();
while (reader.Read()) {
string message = reader["message"].ToString();
Tuple<Creature, List<Tuple<Item, int>>> resultList = ParseLootMessage(message);
if (resultList == null) continue;
string t = message.Substring(0, 5);
if (!hunt.loot.logMessages.ContainsKey(t)) hunt.loot.logMessages.Add(t, new List<string>());
hunt.loot.logMessages[t].Add(message);
Creature cr = resultList.Item1;
if (!hunt.loot.creatureLoot.ContainsKey(cr)) hunt.loot.creatureLoot.Add(cr, new Dictionary<Item, int>());
foreach (Tuple<Item, int> tpl in resultList.Item2) {
Item item = tpl.Item1;
int count = tpl.Item2;
if (!hunt.loot.creatureLoot[cr].ContainsKey(item)) hunt.loot.creatureLoot[cr].Add(item, count);
else hunt.loot.creatureLoot[cr][item] += count;
}
if (!hunt.loot.killCount.ContainsKey(cr)) hunt.loot.killCount.Add(cr, 1);
else hunt.loot.killCount[cr] += 1;
}
hunts.Add(hunt);
index++;
}
}
if (hunts.Count == 0) {
Hunt h = new Hunt();
h.name = "New Hunt";
h.dbtableid = 1;
hunts.Add(h);
resetHunt(h);
}
skip_hunt_refresh = true;
huntList.Items.Clear();
foreach (Hunt h in hunts) {
huntList.Items.Add(h.name);
}
activeHunt = hunts[activeHuntIndex];
skip_hunt_refresh = false;
huntList.SelectedIndex = activeHuntIndex;
huntList.ItemsChanged += HuntList_ItemsChanged;
huntList.ChangeTextOnly = true;
huntList.AttemptDeleteItem += HuntList_AttemptDeleteItem;
huntList.AttemptNewItem += HuntList_AttemptNewItem;
logMessageCollection.ReadOnly = true;
logMessageCollection.TextAlign = HorizontalAlignment.Left;
logMessageCollection.AttemptDeleteItem += LogMessageCollection_AttemptDeleteItem;
}
示例7: HuntTableExists
public static bool HuntTableExists(Hunt h)
{
SQLiteCommand command = new SQLiteCommand(String.Format("SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND name='{0}';", h.GetTableName()), lootConn);
int value = int.Parse(command.ExecuteScalar().ToString());
return value != 0;
}
示例8: DeleteHuntTable
public static void DeleteHuntTable(Hunt hunt)
{
ExecuteNonQuery(String.Format("DROP TABLE IF EXISTS \"{0}\";", hunt.GetTableName()));
ExecuteNonQuery(String.Format("DROP TABLE IF EXISTS \"{0}\";", hunt.GetWasteTableName()));
}
示例9: DeleteMessagesBefore
public static void DeleteMessagesBefore(Hunt h, int stamp, int hour, int minute)
{
SQLiteCommand comm = new SQLiteCommand(String.Format("DELETE FROM \"{0}\" WHERE day < {1} OR hour < {2} OR (hour == {2} AND minute < {3})", h.GetTableName(), stamp, hour, minute), lootConn);
comm.ExecuteNonQuery();
}
示例10: GetHuntMessages
public static SQLiteDataReader GetHuntMessages(Hunt hunt)
{
SQLiteCommand command = new SQLiteCommand(String.Format("SELECT message FROM \"{0}\" ORDER BY day, hour, minute;", hunt.GetTableName()), lootConn);
return command.ExecuteReader();
}
示例11: DeleteMessage
public static void DeleteMessage(Hunt hunt, string msg, SQLiteTransaction transaction)
{
SQLiteCommand command = new SQLiteCommand(String.Format("DELETE FROM \"{0}\" WHERE message=\"{1}\"", hunt.GetTableName(), msg.Replace("\"", "\\\"")), lootConn, transaction);
command.ExecuteNonQuery();
}
示例12: DeleteHuntTable
public static void DeleteHuntTable(Hunt hunt)
{
SQLiteCommand comm = new SQLiteCommand(String.Format("DROP TABLE IF EXISTS \"{0}\";", hunt.GetTableName()), lootConn);
comm.ExecuteNonQuery();
}
示例13: CreateHuntTable
public static void CreateHuntTable(Hunt hunt)
{
SQLiteCommand command = new SQLiteCommand(String.Format("CREATE TABLE IF NOT EXISTS \"{0}\"(day INTEGER, hour INTEGER, minute INTEGER, message STRING);", hunt.GetTableName()), lootConn);
command.ExecuteNonQuery();
}
示例14: InsertMessage
public static void InsertMessage(Hunt hunt, int stamp, int hour, int minute, string message)
{
ExecuteNonQuery(String.Format("INSERT INTO \"{4}\" VALUES({0}, {1}, {2}, \"{3}\");", stamp, hour, minute, message.Replace("\"", "\\\""), hunt.GetTableName()));
}
示例15: InsertMessage
public static void InsertMessage(Hunt hunt, int stamp, int hour, int minute, string message)
{
SQLiteCommand command = new SQLiteCommand(String.Format("INSERT INTO \"{4}\" VALUES({0}, {1}, {2}, \"{3}\");", stamp, hour, minute, message.Replace("\"", "\\\""), hunt.GetTableName()), lootConn);
command.ExecuteNonQuery();
}