예제 #1
0
        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;
        }
예제 #2
0
 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;
 }
예제 #3
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);
            }
        }
예제 #4
0
 public void RemoveEntity(Object entity)
 {
     DUtil.DeleteObject(entity);
 }
예제 #5
0
 public void AttachEntity(Object entity)
 {
     DUtil.AttachObject(entity);
 }