示例#1
0
 public bool Remove(string key)
 {
     return(Comparisons.Remove(key));
 }
示例#2
0
 public bool TryGetValue(string key, out Time value)
 {
     return(Comparisons.TryGetValue(key, out value));
 }
示例#3
0
        void _copyViewer_OnSynchronizePlusAction(EventArgs e)
        {
            Administrator.Reset();
            _copyViewer.EnableControls(false);
            _overallProgress                    = new ProgressLink();
            _copyViewer.OverallProgress         = _overallProgress;
            _currentActivityProgress            = new ProgressLink();
            _copyViewer.CurrentActivityProgress = _currentActivityProgress;

            //Validate all fields.
            int errorCount = ValidateFields();

            if (errorCount > 0)
            {
                return;
            }

            //Save Parameters.
            _profileManager.UserSettings.Select(_currentKey);
            _profileManager.Interrupt.Reason = "OK";
            SaveParameters();
            RefreshCombo();

            //Use directory engine to scan both directories to determine the differences.
            DateTime startAllDateTime = Administrator.Now;

            _directoryEngine                      = new DirectoryEngine();
            _directoryEngine.Interrupt            = _profileManager.Interrupt;
            _directoryEngine.EventBeginProgress  += new Copy8.EventDelegate(_directoryEngine_OnBeginDirectoryScan);
            _directoryEngine.EventUpdateProgress += new Copy8.EventDelegate(_directoryEngine_OnUpdateDirectoryScan);
            _directoryEngine.EventEndOfProgress  += new Copy8.EventDelegate(_directoryEngine_OnEndOfDirectoryScan);
            _directoryEngine.MonitoredTypesOnly   = _profileManager.UserSettings.SelectedItem.MonitoredTypesOnly;
            _directoryEngine.Interrupt            = _profileManager.Interrupt;
            _processingNew       = true;
            _NewDirectoryListing = _directoryEngine.DirList(_profileManager.UserSettings.SelectedItem.NewBaseDir, ref mnNewFilesEstimate);
            _TotalBytes          = mnNewFilesEstimate;
            //Delete log files older that the specified number of days.
            DeleteOldLogFiles();
            _processingNew = false;
            string targetDirectory = _profileManager.UserSettings.SelectedItem.OldBaseDir;

            if (!Directory.Exists(targetDirectory))
            {
                Directory.CreateDirectory(targetDirectory);
            }
            _directoryEngine.TargetHlq = targetDirectory;
            mnOldFilesEstimate         = mnNewFilesEstimate;
            // Instead of scanning the target directory.
            // Load the previously synchronized snapshot to compare against.
            if (File.Exists(getSnapshotFileSpec(targetDirectory)))
            {
                _OldDirectoryListing = new DirectoryEntries();
                _OldDirectoryListing.Load(getSnapshotFileSpec(targetDirectory), DirectoryEntries.InterpretationEnum.Target);
            }
            else
            {
                _OldDirectoryListing = _directoryEngine.DirList(targetDirectory, ref mnOldFilesEstimate);
            }
            _directoryEngine.Compare(ref _OldDirectoryListing, ref _NewDirectoryListing);
            _directoryEngine.Changes(_OldDirectoryListing, _NewDirectoryListing, ref _ChangedDirectoryListing, ref mnChgFilesEstimate);
            _comparisons          = _directoryEngine.Comparisons;
            _copyEngine.Interrupt = _profileManager.Interrupt;

            //Use the Synchronize engine to perform the synchronize.
            //TODO: Move the directory engine calls inside the Synchronize engine.
            _synchronizeEngine = new SynchronizeEngine();
            _synchronizeEngine.OnBeginSynchronize  += new SynchronizeEngine.BeginSynchronizeHandler(_SynchronizeEngine_OnBeginSynchronize);
            _synchronizeEngine.OnUpdateSynchronize += new SynchronizeEngine.UpdateSynchronizeHandler(_SynchronizeEngine_OnUpdateSynchronize);
            _synchronizeEngine.OnEndOfSynchronize  += new SynchronizeEngine.EndOfSynchronizeHandler(_SynchronizeEngine_OnEndOfSynchronize);
            _synchronizeEngine.CopyRule             = _profileManager.UserSettings.SelectedItem.CopyRule;
            _synchronizeEngine.MonitoredTypesOnly   = _profileManager.UserSettings.SelectedItem.MonitoredTypesOnly;
            _synchronizeEngine.Interrupt            = _profileManager.Interrupt;

            try
            {
                _synchronizeEngine.Process(_comparisons, startAllDateTime);
                //After synchronization the target directory is synchronized with the source directory.
                _NewDirectoryListing.Save(getSnapshotFileSpec(targetDirectory));
                Administrator.View();
            }
            catch (ParameterException pe)
            {
                _copyViewer.SetFieldError(pe.Parameter, pe.Message);
                //_copyViewer.DisplayMessageBox(ae.Message, _copyViewer.Caption, MsgButtons.OK, MsgIcon.Error);
            }
            finally
            {
                _copyViewer.EnableControls(true);
            }
        }
示例#4
0
 public IEnumerator <KeyValuePair <string, Time> > GetEnumerator()
 {
     return(Comparisons.GetEnumerator());
 }
示例#5
0
 public bool Remove(KeyValuePair <string, Time> item)
 {
     return(Comparisons.Remove(item));
 }
 protected abstract string GetComprisonString(Comparisons comparison, string[] names);
示例#7
0
 public override double payoff(double S1, double S2)
 {
     return(Comparisons.Max(w * ((I1 / S1) - (I2 / S2)) - w * K, 0.0));
 }
示例#8
0
 public bool Contains(KeyValuePair <string, Time> item)
 {
     return(Comparisons.Contains(item));
 }
示例#9
0
    public override double payoff(double S1, double S2)
    {
        double sum = a * S1 + b * S2;

        return(Comparisons.Max(w * (sum - K), 0.0));
    }
示例#10
0
 public override double payoff(double S1, double S2)
 {
     return(Comparisons.Max(w1 * (S1 - K1), w2 * (S2 - K2), 0.0));
 }
示例#11
0
 public override double payoff(double S1, double S2)
 {
     return(fer * Comparisons.Max(w * S1 - w * Kf, 0.0));
 }
示例#12
0
		/// <summary>
		///     Equal to
		/// </summary>
		/// <param name="property">property as Property, enum or string</param>
		/// <param name="value">Value to compare</param>
		/// <param name="comparison">Comparisons to specify how to compare</param>
		/// <returns>Query</returns>
		public Query Where(Property property, Value value, Comparisons comparison)
		{
			var propertyEqual = new PropertyComparison(property, value, comparison, this);
			_elements.Add(propertyEqual);
			return this;
		}
示例#13
0
 /// <summary>
 /// Sorts the specified list using an insertion sort algorithm and the specified comparer.
 /// </summary>
 /// <remarks>
 /// Insertion sort is a O(n²) time complexity algorithm and should not be used on arbitrary lists.
 /// However, it has a best case time complexity of O(n) for lists that are already sorted and is quite fast when used on nearly sorted input.
 /// </remarks>
 public static void InsertionSort <T>(this IList <T> ts, IComparer <T> comparer)
 {
     InsertionSort(ts, Comparisons <T> .ToComparison(comparer));
 }
示例#14
0
 public void Add(KeyValuePair <string, Time> item)
 {
     Comparisons.Add(item);
 }
示例#15
0
    public override double payoff(double S1, double S2)
    {
        double max = Comparisons.Max(S1, S2);

        return(Comparisons.Max(w * (max - K), 0.0));
    }
示例#16
0
 public void Clear()
 {
     Comparisons.Clear();
 }
示例#17
0
    public override double payoff(double S1, double S2)
    {
        double min = Comparisons.Min(S1, S2);

        return(Comparisons.Max(w * (n1 * S1 + n2 * S2 - K), 0.0));
    }
示例#18
0
 public void CopyTo(KeyValuePair <string, Time>[] array, int arrayIndex)
 {
     Comparisons.CopyTo(array, arrayIndex);
 }
示例#19
0
 public override double payoff(double S1, double S2)
 {
     return(Comparisons.Max(S1 - S2, 0.0));              // a1S1 - a2S2 in general
 }
 public bool CanHandle(Comparisons comparison, Member member)
 {
     return(member.Type == typeof(string));
 }
示例#21
0
 protected abstract string GenerateFilterConditionFor(Comparisons comparison, T value);
		internal PropertyComparison(Property property, Value value = null, Comparisons comparison = Comparisons.EqualTo, Query parent = null) : base(parent)
		{
			Comparison = comparison;
			Property = property;
			Value = value;
		}
示例#23
0
 internal PropertyComparison(Property property, Value value = null, Comparisons comparison = Comparisons.EqualTo, Query parent = null) : base(parent)
 {
     Comparison = comparison;
     Property   = property;
     Value      = value;
 }