本文整理汇总了C#中IExtension.GetDataPath方法的典型用法代码示例。如果您正苦于以下问题:C# IExtension.GetDataPath方法的具体用法?C# IExtension.GetDataPath怎么用?C# IExtension.GetDataPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IExtension
的用法示例。
在下文中一共展示了IExtension.GetDataPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultipleOutputsWindow
public MultipleOutputsWindow(IExtension sender)
{
InitializeComponent();
extension = sender;
while (Api.IsFileLocked(sender.GetDataPath() + "Data.sqlite", FileShare.Read) && File.Exists(sender.GetDataPath() + "Data.sqlite")) if (MessageBox.Show("Multiple Command Outputs' database file is in use, Please close it in order to let ModBot use it.", "Multiple Command Outputs", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) Program.Close();
if (!File.Exists(sender.GetDataPath() + "Data.sqlite")) SQLiteConnection.CreateFile(sender.GetDataPath() + "Data.sqlite");
DB = new SQLiteConnection(@"Data Source=" + sender.GetDataPath() + "Data.sqlite;Version=3;");
DB.Open();
using (SQLiteCommand query = new SQLiteCommand("CREATE TABLE IF NOT EXISTS 'commands' (id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT, command TEXT, data TEXT, output TEXT);", DB)) query.ExecuteNonQuery();
using (SQLiteCommand query = new SQLiteCommand("CREATE TABLE IF NOT EXISTS 'userdata' (id INTEGER PRIMARY KEY AUTOINCREMENT, type TEXT, user TEXT, data TEXT);", DB)) query.ExecuteNonQuery();
using (SQLiteCommand query = new SQLiteCommand("SELECT * FROM 'commands';", DB))
{
using (SQLiteDataReader r = query.ExecuteReader())
{
while (r.Read())
{
CommandsDataGrid.Rows.Add(r["type"].ToString(), r["command"].ToString(), r["data"].ToString(), r["output"].ToString());
}
}
}
CommandsDataGrid_Changed(CommandsDataGrid, null);
CommandsDataGrid.CellValueChanged += new DataGridViewCellEventHandler(CommandsDataGrid_Changed);
CommandsDataGrid.RowsAdded += new DataGridViewRowsAddedEventHandler(CommandsDataGrid_Changed);
CommandsDataGrid.RowsRemoved += new DataGridViewRowsRemovedEventHandler(CommandsDataGrid_Changed);
ModBot.Events.Connected += Events_Connected;
ModBot.Events.OnDisconnect += Events_OnDisconnect;
}