Exemple #1
0
        private void listView_SelectedIndexChanged(object sender, EventArgs e)
        {
            CCreateSyncItem first = IterateListViewItems(true /*only selected*/).FirstOrDefault();

            if (first == null || !m_bPreview)
            {
                ShowSummary();
            }
            else
            {
                HideSummary();
                StringBuilder sbLeft = new StringBuilder(), sbRight = new StringBuilder();
                GetSelectedDetailsText(sbLeft, sbRight);
                txtSelectedDetailsLeft.Text  = sbLeft.ToString();
                txtSelectedDetailsRight.Text = sbRight.ToString();
            }
        }
Exemple #2
0
        private IEnumerable <CCreateSyncItem> IterateListViewItems(bool onlySelected)
        {
            ICollection lists = listView.Items;

            if (onlySelected)
            {
                lists = listView.SelectedItems;
            }

            foreach (var item in lists)
            {
                ListViewItem lvitem = item as ListViewItem;
                if (lvitem != null && lvitem.Tag != null)
                {
                    CCreateSyncItem syncitem = lvitem.Tag as CCreateSyncItem;
                    if (syncitem != null)
                    {
                        yield return(syncitem);
                    }
                }
            }
        }
Exemple #3
0
        private void ReAddItems()
        {
            CCreateSyncItem.SortFromColumnNumber(m_results.items, m_nSortCol);

            listView.SuspendLayout();
            listView.Items.Clear();
            foreach (var item in m_results.items)
            {
                if (item.status == CCreateSyncItemStatus.Unknown && !m_includeProgress)
                {
                    continue;
                }

                if (item.status == CCreateSyncItemStatus.AddedInDest && !m_results.config.m_mirror && !m_includeProgress)
                {
                    continue;
                }

                listView.Items.Add(item.GetListItem(m_bPreview));
            }

            listView.ResumeLayout();
        }
Exemple #4
0
        private static void TestSyncPreview(string sDirectory, int nThreads)
        {
            var config = GetRealConfig(sDirectory, nThreads);

            string sLogFilename = RunImplementation.GetLogFilename();

            RunImplementation.Go(config, sLogFilename, true /*preview*/, false);
            var results = CCreateSyncResultsSet.ParseFromLogFile(config, sLogFilename, true /*preview*/);

            // the number of skipped dirs is 3 instead of the 2 it used to be, but not important right now
            Utils.AssertEq("Total    Copied   Skipped  Mismatch    Failed    Extras\r\n    Dirs :         5         5         3         0         0         2\r\n   Files :        22         8        14         0         0         2\r\n   Bytes :   632.0 k   126.6 k   505.4 k         0         0    30.7 k", results.sSummary.Trim());
            File.Delete(sLogFilename);

            {
                CCreateSyncItem.SortFromColumnNumber(results.items, 3); // sort by path ascending
                var resultsFilteredStrings = from item in results.items where item.status != CCreateSyncItemStatus.Unknown select item.ToString();

                var sGot      = String.Join("\n", resultsFilteredStrings);
                var sExpected = @"Create		\Images\a.png
Create		\Images\addir\a.PNG
Delete		\Images\new.png
Delete		\Images\remdir\c.png
Create		\Licenses\.weirdext
Update		\Licenses\Apr-License.txt
Update()		\Licenses\Cyrus-Sasl-License.txt
Create		\Licenses\noext
Update()		\Licenses\OpenSsl-License.txt
Update		\Licenses\Serf-License.txt"    .Replace("\r\n", "\n");
                Utils.AssertEq(sExpected, sGot);
            }

            {
                CCreateSyncItem.SortFromColumnNumber(results.items, -3); // sort by path descending
                var resultsFilteredStrings = from item in results.items where item.status != CCreateSyncItemStatus.Unknown select item.ToString();

                var sGot      = String.Join("\n", resultsFilteredStrings);
                var sExpected = @"Update		\Licenses\Serf-License.txt
Update()		\Licenses\OpenSsl-License.txt
Create		\Licenses\noext
Update()		\Licenses\Cyrus-Sasl-License.txt
Update		\Licenses\Apr-License.txt
Create		\Licenses\.weirdext
Delete		\Images\remdir\c.png
Delete		\Images\new.png
Create		\Images\addir\a.PNG
Create		\Images\a.png"    .Replace("\r\n", "\n");
                Utils.AssertEq(sExpected, sGot);
            }

            {
                CCreateSyncItem.SortFromColumnNumber(results.items, 1); // sort by type where Update() != Update
                var resultsFilteredStrings = from item in results.items where item.status != CCreateSyncItemStatus.Unknown select item.ToString();

                var sGot      = String.Join("\n", resultsFilteredStrings);
                var sExpected = @"Create		\Images\a.png
Create		\Images\addir\a.PNG
Create		\Licenses\.weirdext
Create		\Licenses\noext
Delete		\Images\new.png
Delete		\Images\remdir\c.png
Update		\Licenses\Apr-License.txt
Update		\Licenses\Serf-License.txt
Update()		\Licenses\Cyrus-Sasl-License.txt
Update()		\Licenses\OpenSsl-License.txt"        .Replace("\r\n", "\n");
                Utils.AssertEq(sExpected, sGot);
            }

            {
                CCreateSyncItem.SortFromColumnNumber(results.items, 2); // sort by type where Update() == Update
                var resultsFilteredStrings = from item in results.items where item.status != CCreateSyncItemStatus.Unknown select item.ToString();

                var sGot      = String.Join("\n", resultsFilteredStrings);
                var sExpected = @"Create		\Images\a.png
Create		\Images\addir\a.PNG
Create		\Licenses\.weirdext
Create		\Licenses\noext
Delete		\Images\new.png
Delete		\Images\remdir\c.png
Update		\Licenses\Apr-License.txt
Update()		\Licenses\Cyrus-Sasl-License.txt
Update()		\Licenses\OpenSsl-License.txt
Update		\Licenses\Serf-License.txt"    .Replace("\r\n", "\n");
                Utils.AssertEq(sExpected, sGot);
            }
        }