private void MainForm_Load(object sender, EventArgs e) { String version = FileVersionInfo.GetVersionInfo(System.Windows.Forms.Application.ExecutablePath).FileVersion; string title = MysqlService.getNamever(); Text = String.Format("{0} v{1}", title, version); }
static void Main(string[] args) { string connStr = ""; string tableName = ""; var mysql = new MysqlService(connStr, tableName); string entitystr = mysql.BuildEntityStr(); string selectstr = mysql.BuildSelectStr(); string insertstr = mysql.BuildInsertStr(); }
private void buttonImportAppend_Click(object sender, EventArgs e) { OpenFileDialog sfd = new OpenFileDialog(); sfd.Title = "选择文件"; sfd.InitialDirectory = "F://"; sfd.FileName = packName; sfd.Filter = "Csv files (*.csv)|*.csv|All files (*.*)|*.*"; sfd.RestoreDirectory = true; if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { pack.ImportPackData(sfd.FileName, false); MysqlService.GetAllBiData(packName); MessageBox.Show("导入完成!"); Close(); } sfd.Dispose(); }
public static List <String> GetAllFileName(String montherpath, String ext) { int nlenth = montherpath.Length; string urlstr = montherpath.Substring(4, nlenth - 4); string httpPath = MysqlService.getResPath(); string path = string.Format("{0}{1}", httpPath, urlstr); List <String> names = new List <string>(); WebPage page = new WebPage(path); foreach (Link lk in page.Links) { if (lk.Text.EndsWith(ext)) { names.Add(lk.Text); } } return(names); }
public static Image GetNetImage(string url) { int nlenth = url.Length; string urlstr = url.Substring(4, nlenth - 4); string httpPath = MysqlService.getResPath(); WebResponse response = null; Stream stream = null; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}{1}", httpPath, urlstr)); try { response = request.GetResponse(); stream = response.GetResponseStream(); } catch { return(Image.FromFile("icons/blank.jpg")); } return(new Bitmap(stream)); }
public static Stream GetNetStream(string url) { string httpPath = MysqlService.getResPath(); Stream stream = null; int nlenth = url.Length; string urlstr = url.Substring(4, nlenth - 4); try { WebResponse response = null; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}{1}", httpPath, urlstr)); response = request.GetResponse(); stream = response.GetResponseStream(); } catch { } return(stream); }
private static async Task MapUsingMySql (AppSettings appSettings, CommandOption sqlHostOption, CommandOption sqlUserOption, CommandOption sqlSchemaOption, CommandOption sqlPasswordOption, CommandOption sqlPortOption, string elasticUrl) { var sqlHost = appSettings.SqlHost; var sqlUser = appSettings.SqlUser; var sqlSchema = appSettings.SqlSchema; var sqlPassword = appSettings.SqlPassword; var sqlPort = appSettings.SqlPort; if (sqlHostOption.HasValue()) { sqlHost = sqlHostOption.Value(); } else if (string.IsNullOrWhiteSpace(sqlHost)) { Console.WriteLine("You must set a host address, you can do this in appsettings.json or command" + " line argument --sqlHost"); } if (sqlUserOption.HasValue()) { sqlUser = sqlUserOption.Value(); } else if (string.IsNullOrWhiteSpace(sqlUser)) { Console.WriteLine("You must set a MySql user, you can do this in appsettings.json or command" + " line argument --sqlUser"); } if (sqlSchemaOption.HasValue()) { sqlSchema = sqlSchemaOption.Value(); } else if (string.IsNullOrWhiteSpace(sqlSchema)) { Console.WriteLine("You must set a MySql Schema/Databse, you can do this in appsettings.json or " + "command line argument --sqlSchema"); } if (sqlPasswordOption.HasValue()) { sqlPassword = sqlPasswordOption.Value(); Console.WriteLine("Try not to use the MySql password as a command line parameter for security " + "reasons.\nYou can always set it in appsettings.json"); } else if (string.IsNullOrWhiteSpace(sqlPassword)) { Console.WriteLine("You must set a MySql passwor, you can do this in appsettings.json or command"); } if (sqlPortOption.HasValue()) { sqlPort = sqlPortOption.Value(); } else if (string.IsNullOrWhiteSpace(sqlPort)) { Console.WriteLine("You must set a port, you can do this in appsettings.json or " + "command line argument --sqlPort"); } Console.WriteLine("MySql Host: " + sqlHost); Console.WriteLine("MySql User: "******"MySql Schema/Database: " + sqlSchema); var mySqlService = new MysqlService(sqlHost, sqlUser, sqlSchema, sqlPassword, sqlPort); await mySqlService.GetAllTablesAsync(elasticUrl); }