Example #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("Select * from filepath", conn);


            dr = cmd.ExecuteReader();
            Filetable f;

            while (dr.Read())
            {
                f             = new Filetable();
                Lastid        = f.id = Convert.ToInt32(dr["id"].ToString());
                f.path        = dr["path"].ToString();
                f.modifeddate = dr["modifydate"].ToString();
                filetable.Add(f);
            }
            dr.Close();
        }
Example #2
0
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                Filetable f;

                using (OpenFileDialog of = new OpenFileDialog()
                {
                    Multiselect = true
                })
                {
                    if (of.ShowDialog() == DialogResult.OK)
                    {
                        foreach (string s in of.FileNames)
                        {
                            //string s2 = s;

                            string s2 = s.Replace(@"\", "//");
                            if (!filecheck(s2))
                            {
                                FileInfo finfo = new FileInfo(s2);
                                f             = new Filetable();
                                f.id          = ++Lastid;
                                f.path        = s2;
                                f.modifeddate = finfo.LastWriteTime.ToString();
                                filetable.Add(f);

                                postingList.read_file(s2, Lastid.ToString());
                            }
                            else
                            {
                                MessageBox.Show("file :" + s2 + "\r\n arealdy added.");
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }