private void button3_Click(object sender, EventArgs e) { try { VsDbDelete.setDelegate(showMess); listBox1.Items.Clear(); string[] data = DBdelete.getFiles(getTime1()); int i = 0; foreach (string str in data) { listBox1.Items.Add(str); i++; if (i > 5000) { break; } } textBox1.Text = " ¨Ó¹Ç¹ä¿Åì : " + data.Length + " ¢¹Ò´¢Í§ä¿ÅìÃÇÁ :" + ((float)DBdelete.getSumOfFileSize(data) / 1048576) + " MB"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
static void Main(string[] args) { if (!LoadSettings()) { Console.WriteLine("can't load Setting configulation!!!"); return; } string mainDbConnStr = "server=" + vsDbHost + " ;user id=" + vsDbUser + "; password="******"; database=" + vsDbDatabase + "; pooling=false; charset=utf8 "; string clientDbConnStr = "server=" + vsDbHost + " ;user id=" + vsDbUser + "; password="******"; database=" + vsDbDatabaseClient + "; pooling=false; charset=utf8 "; DBdelete = new VsDbDelete(mainDbConnStr, clientDbConnStr); VsDbDelete.setDelegate(showMess); if (args.Length == 2) { try { timeDelete = DateTime.Parse(args[1]); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("invalid arg!!"); return; } string cmd = args[0]; Console.WriteLine("command is : " + cmd + " time is " + timeDelete); if (cmd.Equals("delete")) { System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(delete)); thread.Start(); } else if (cmd.Equals("showfile")) { System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ThreadStart(showFile)); thread.Start(); } else { Console.WriteLine("invalid arg!!"); return; } } else { Console.WriteLine("invalid arg!!"); return; } }
public Form1() { InitializeComponent(); //string mainDbConnStr = "server=localhost ;user id=root; password=; database=vsa-main; pooling=false; charset=utf8 "; //string clientDbConnStr = "server=localhost ;user id=root; password=; database=vsa-client; pooling=false; charset=utf8 "; if (!LoadSettings()) { return; } string mainDbConnStr = "server=" + vsDbHost + " ;user id=" + vsDbUser + "; password="******"; database=" + vsDbDatabase + "; pooling=false; charset=utf8 "; string clientDbConnStr = "server=" + vsDbHost + " ;user id=" + vsDbUser + "; password="******"; database=" + vsDbDatabaseClient + "; pooling=false; charset=utf8 "; DBdelete = new VsDbDelete(mainDbConnStr, clientDbConnStr); VsDbDelete.setDelegate(showMess); }
private static void showFile() { try { VsDbDelete.setDelegate(showMess); string[] data = DBdelete.getFiles(timeDelete); foreach (string str in data) { Console.WriteLine(str); } string msg = "\r\n number of file : " + data.Length + " sum of size :" + ((float)DBdelete.getSumOfFileSize(data) / 1048576) + " MB"; Console.WriteLine(msg); } catch (Exception ex) { Console.WriteLine(ex.Message); } }