示例#1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Id.GetHashCode();
         hashCode = (hashCode * 397) ^ (Code != null ? Code.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Value.GetHashCode();
         hashCode = (hashCode * 397) ^ EndsAt.GetHashCode();
         hashCode = (hashCode * 397) ^ StartsAt.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ UsageLimit.GetHashCode();
         hashCode = (hashCode * 397) ^ AppliesToId.GetHashCode();
         hashCode = (hashCode * 397) ^ (DiscountType != null ? DiscountType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AppliesTo != null ? AppliesTo.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (AppliesToResource != null ? AppliesToResource.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ TimesUsed.GetHashCode();
         hashCode = (hashCode * 397) ^ (Duration != null ? Duration.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ DurationUsageLimit.GetHashCode();
         hashCode = (hashCode * 397) ^ (AppliesToProductType != null ? AppliesToProductType.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ CreatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UpdatedAt.GetHashCode();
         hashCode = (hashCode * 397) ^ OncePerCustomer.GetHashCode();
         return(hashCode);
     }
 }
 protected Behaviour(BehaviourName name, string type, string displayName, string description, EndsAt endsAt)
 {
     Name        = name;
     Type        = type;
     DisplayName = displayName;
     Description = description;
     EndsAt      = endsAt;
 }
 public Wait(
     BehaviourName name,
     string displayName,
     string description,
     EndsAt endsAt,
     BehaviourName?nextBehaviour = null) : base(name, $"{nameof(Behaviour)}.{nameof(Wait)}", displayName, description, endsAt)
 {
     NextBehaviour = nextBehaviour;
 }
示例#4
0
        public override int GetHashCode()
        {
            int hashCode = 955995587;

            hashCode = hashCode * -1521134295 + StartsAt.GetHashCode();
            hashCode = hashCode * -1521134295 + EndsAt.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(FilePath);

            return(hashCode);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = StartsAt.GetHashCode();
         hashCode = (hashCode * 397) ^ UsageLimit.GetHashCode();
         hashCode = (hashCode * 397) ^ (Status != null ? Status.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ EndsAt.GetHashCode();
         return(hashCode);
     }
 }
示例#6
0
        /// <summary>
        /// Ermittelt die Ersetzungsmuster für Dateinamen gemäß den Daten dieser Aufzeichnung.
        /// </summary>
        /// <returns>Die konkreten Ersetzungswertes für diesen Auftrag.</returns>
        public Dictionary <string, string> GetReplacementPatterns()
        {
            // Pattern map static parts
            var localNow = DateTime.Now;
            var patterns =
                new Dictionary <string, string>
            {
                { "%ScheduleIdentifier%", ScheduleUniqueID.GetValueOrDefault().ToString("N").ToUpper() },
                { "%JobIdentifier%", JobUniqueID.GetValueOrDefault().ToString("N").ToUpper() },
                { "%End%", EndsAt.ToLocalTime().ToString("dd-MM-yyyy HH-mm-ss") },
                { "%UniqueIdentifier%", Guid.NewGuid().ToString("N").ToUpper() },
                { "%SortableStart%", localNow.ToString("yyyy-MM-dd HH-mm-ss") },
                { "%Start%", localNow.ToString("dd-MM-yyyy HH-mm-ss") },
                { "%SortableDate%", localNow.ToString("yyyy-MM-dd") },
                { "%Date%", localNow.ToString("dd-MM-yyyy") },
                { "%Time%", localNow.ToString("HH-mm-ss") },
                { "%Year%", localNow.ToString("yyyy") },
                { "%Minute%", localNow.ToString("mm") },
                { "%Second%", localNow.ToString("ss") },
                { "%Month%", localNow.ToString("MM") },
                { "%Hour%", localNow.ToString("HH") },
                { "%Day%", localNow.ToString("dd") },
                { "%Transponder%", string.Empty },
                { "%StationFull%", string.Empty },
                { "%AllAudio%", string.Empty },
                { "%Profile%", string.Empty },
                { "%Station%", string.Empty },
                { "%Service%", string.Empty },
                { "%DVBSub%", string.Empty },
                { "%Audio%", string.Empty },
                { "%AC3%", string.Empty },
                { "%TTX%", string.Empty },
            };

            // Fill it
            if (RelatedSchedule != null)
            {
                patterns["%Schedule%"] = RelatedSchedule.Name;
            }
            if (RelatedJob != null)
            {
                patterns["%Job%"] = RelatedJob.Name;
            }

            // Duration
            var start = PhysicalStart;
            var end   = EndsAt;

            if (start.HasValue)
            {
                patterns["%Duration%"] = ((int)(end - start.Value).TotalMinutes).ToString();
            }
            else if (StartsAt.HasValue)
            {
                patterns["%Duration%"] = ((int)(end - StartsAt.Value).TotalMinutes).ToString();
            }

            // Check station
            var source = CurrentSource;

            if (source != null)
            {
                // Attach to the station
                var station = (Station)source.Source;

                // Copy over
                patterns["%Transponder%"] = station.Provider;
                patterns["%StationFull%"] = station.FullName;
                patterns["%Profile%"]     = source.ProfileName;
                patterns["%Station%"]     = station.Name;
            }
            else if (Source != null)
            {
                // Copy over
                if (!string.IsNullOrEmpty(Source.DisplayName))
                {
                    // Pseudo-Source
                    patterns["%StationFull%"] = Source.DisplayName;
                    patterns["%Station%"]     = Source.DisplayName;
                }
                if (!string.IsNullOrEmpty(Source.ProfileName))
                {
                    patterns["%Profile%"] = Source.ProfileName;
                }
            }

            // Check streams
            if (Streams != null)
            {
                // Videotext
                if (Streams.Videotext)
                {
                    patterns["%TTX%"] = "TTX";
                }

                // Check MP2
                switch (Streams.MP2Tracks.LanguageMode)
                {
                case LanguageModes.Selection: if (Streams.MP2Tracks.Languages.Count == 1)
                    {
                        patterns["%Audio%"] = Streams.MP2Tracks.Languages[0];
                    }
                    break;

                case LanguageModes.All: patterns["%AllAudio%"] = "MultiLang"; break;

                case LanguageModes.Primary: break;
                }

                // Check AC3
                bool usesAC3 = false;
                switch (Streams.AC3Tracks.LanguageMode)
                {
                case LanguageModes.Selection: usesAC3 = (Streams.AC3Tracks.Languages.Count > 0); break;

                case LanguageModes.Primary: usesAC3 = true; break;

                case LanguageModes.All: usesAC3 = true; break;
                }

                // Store
                if (usesAC3)
                {
                    patterns["%AC3%"] = "AC3";
                }

                // Check DVB Subtitles
                bool usesSUB = false;
                switch (Streams.SubTitles.LanguageMode)
                {
                case LanguageModes.Selection: usesSUB = (Streams.SubTitles.Languages.Count > 0); break;

                case LanguageModes.Primary: usesSUB = true; break;

                case LanguageModes.All: usesSUB = true; break;
                }

                // Store
                if (usesSUB)
                {
                    patterns["%DVBSub%"] = "DVBSUB";
                }
            }

            // Report
            return(patterns);
        }