public static void SynDatabase(formSyncDatabase parent) { String folder = AppSettings.GetAppSettings().load_folder; Int32 total = Directory.GetFiles(folder).Count(); Int32 count = 0; foreach (String filecomplete in Directory.GetFiles(folder)) { if (filecomplete.EndsWith(".xml") && !filecomplete.EndsWith("index.xml")) { String Content = Archive.ReadFile(filecomplete); XmlSerializer serializer = new XmlSerializer(typeof(Idx)); using (TextReader reader = new StringReader(Content)) { DumpJson dump = DumpJson.Get(); try { Idx result = (Idx)serializer.Deserialize(reader); result.Persist(dump); count++; parent.RunWithInvoke(count, total); parent.UpdateLabelWithInvoke(count, total); }catch (Exception ex) { } } } } }
private void ribbonButton3_Click(object sender, EventArgs e) { formSyncDatabase formSync = new formSyncDatabase(); formSync.ShowDialog(); }