public void BuildMoniteeList()
        {
            XMLDataList.Clear();
            XMLDataList.Load(text);
            int size = XMLDataList.Length;

            Assert.AreEqual(length, size);
            XMLDataListEntry current = XMLDataList.Head;

            while (current != null)
            {
                Assert.IsNotNull(MoniteeList.FindMonitee(current.Data.MoniteePath));
                current = current.Next;
            }

            MoniteeListEntry current2 = MoniteeList.Head;

            while (current2 != null)
            {
                Assert.IsNotNull(current2.Data.Destinations);
                Assert.IsNotNull(current2.Data.Name);
                Assert.IsNotNull(current2.Data.Type);
                current2 = current2.Next;
            }
        }
        public void TestBackup()
        {
            XMLDataList.Load(text);
            int size = XMLDataList.Length;

            Assert.AreEqual(length, size);
            XMLDataListEntry current = XMLDataList.Head;

            while (current != null)
            {
                Assert.IsNotNull(MoniteeList.FindMonitee(current.Data.MoniteePath));
                current = current.Next;
            }

            XMLDataList.BackUpData();
            Assert.IsTrue(System.IO.File.Exists("MonitoredFolders.bkup"));
            XmlDocument xdoc = new XmlDocument();

            try
            {
                xdoc.Load("MonitoredFolders.bkup");
            }
            catch (Exception e)
            {
                throw;
            }
        }
Beispiel #3
0
        void RemoveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                int increment = 0;

                if ((destinationList.Items.Count > 0) && (destinationList.SelectedIndices.Count > 0))
                {
                    var selectedItems = new ListViewItem[destinationList.SelectedIndices.Count];

                    if ((MessageBox.Show(
                             "Are you sure you want to remove this entry?\nIt cannot be reversed.",
                             "Warning!",
                             MessageBoxButtons.YesNo,
                             MessageBoxIcon.Question) == DialogResult.Yes))
                    {
                        var iEnum = destinationList.SelectedIndices.GetEnumerator();

                        while (iEnum.MoveNext())
                        {
                            selectedItems[increment] = destinationList.Items[(Int32.Parse(iEnum.Current.ToString()))];
                            increment += 1;
                            XMLDataList.RemoveFile(destinationList.Items[(Int32.Parse(iEnum.Current.ToString()))].Text);
                        }
                        foreach (var list in selectedItems)
                        {
                            destinationList.Items.Remove(list);
                            MoniteeList.RemoveDestination(MoniteeList.FindMonitee(monitee.Name), list.Text);
                        }
                        if (destinationList.Items.Count == 0)
                        {
                            destinationList.Items.Clear();
                        }
                        MonitorListView.HasChanged = true;
                    }
                }
                else
                {
                    Exceptions.Exception("unselectedremove");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Having problems removing item\n" + ex,
                                "Error!",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Beispiel #4
0
 private void LoadDestinations()
 {
     if (monitee == null || MoniteeList.FindMonitee(monitee.Name) == null)
     {
         return;
     }
     this.Text = monitee.Name;
     foreach (string destination in monitee.Destinations)
     {
         if (destination != null)
         {
             destinationList.Items.Add(destination);
         }
     }
 }
Beispiel #5
0
        public void DumpDataTest()
        {
            XMLDataList.Load(text);
            int size = XMLDataList.Length;

            Assert.AreEqual(length, size);
            XMLDataListEntry current = XMLDataList.Head;

            while (current != null)
            {
                Assert.IsNotNull(MoniteeList.FindMonitee(current.Data.MoniteePath));
                current = current.Next;
            }

            XMLDataList.DumpAll();

            Assert.IsTrue(System.IO.File.Exists("monitoredfolder.dump"));
        }
        /// <summary>
        /// Opens the destination viewer dialog; sends monitee data to display.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        void destinationViewBtn_Click(object sender, System.EventArgs e)
        {
            if ((this.Lists.Items.Count > 0) && (this.Lists.SelectedIndices.Count > 0))
            {
                System.Collections.IEnumerator iEnum = this.Lists.SelectedIndices.GetEnumerator();
                this.Lists.SelectedItems[0].Checked = true;
                while (iEnum.MoveNext())
                {
                    Monitees.Monitee  mon      = MoniteeList.FindMonitee(this.Lists.Items[(Int32.Parse(iEnum.Current.ToString()))].Text);
                    DestinationViewUI destView = new DestinationViewUI(mon);

                    destView.ShowDialog();
                }
            }
            else
            {
                Exceptions.Exception("selectmonitee");
            }
        }