private void btnOpen_Click(object sender, EventArgs e) { if (txtURL.Text == null || txtURL.Text == "") { return; } dutil = DUtilFactory.CreateDUtil(txtURL.Text); if (dutil == null) { MessageBox.Show("错误的URL!", "提示"); } try { dutil.SpiderChapters(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误"); return; } taskTree.Nodes.Clear(); checkedListChapters.Items.Clear(); foreach (Chapter chapter in dutil.Chapters) { checkedListChapters.Items.Add(chapter); } tabControl.SelectedIndex = 0; comboRootRule.SelectedIndex = dutil.ChapterNameConfig; comboFileRule.SelectedIndex = dutil.PageNameConfig; }
private void LoadDownloadList(string path) { dutil = new DUtilXML(path); comboRootRule.SelectedIndex = dutil.ChapterNameConfig; comboFileRule.SelectedIndex = dutil.PageNameConfig; try { dutil.SpiderChapters(); } catch (Exception ex) { MessageBox.Show(ex.Message, "错误"); } taskTree.Nodes.Clear(); checkedListChapters.Items.Clear(); foreach (Chapter chapter in dutil.Chapters) { checkedListChapters.Items.Add(chapter, true); } tabControl.SelectedIndex = 0; }
public void PersistEntity(Object entity) { DUtil.AttachObject(entity); Type entityBaseType = entity.GetType(); while (!entityBaseType.BaseType.Equals(typeof(Object))) { entityBaseType = entityBaseType.BaseType; } PropertyInfo propId = entityBaseType.GetProperty(entityBaseType.Name + "Id"); int id = (int)propId.GetValue(entity, null); if (id == 0) { DUtil.AddObject(entity); } else { DUtil.UpdateObject(entity); } }
public void RemoveEntity(Object entity) { DUtil.DeleteObject(entity); }
public void AttachEntity(Object entity) { DUtil.AttachObject(entity); }