示例#1
0
        protected bool Equals(CheckpointTag other)
        {
            var leftMode  = GetMode();
            var rightMode = other.GetMode();

            if (leftMode != rightMode)
            {
                return(false);
            }
            UpgradeModes(ref leftMode, ref rightMode);
            switch (leftMode)
            {
            case Mode.Position:
                return(Position == other.Position);

            case Mode.Stream:
                if (Streams.Keys.First() != other.Streams.Keys.First())
                {
                    return(false);
                }
                var result = Streams.Values.First() == other.Streams.Values.First();
                return(result);

            case Mode.MultiStream:
                int rvalue;
                return(Streams.Count == other.Streams.Count &&
                       Streams.All(l => other.Streams.TryGetValue(l.Key, out rvalue) && l.Value == rvalue));

            default:
                throw new NotSupportedException("Checkpoint tag mode is not supported in comparison");
            }
        }
示例#2
0
 private bool Fits(Stream stream)
 {
     // check if stream fits with the current streams
     return(Streams.All(other => !stream.ClashesWith(other)));
 }