forked from Coosu/OSharp.Storyboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SituationEventArgs.cs
77 lines (73 loc) · 3.67 KB
/
SituationEventArgs.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using OSharp.Storyboard.Events;
using System;
using System.Collections.Generic;
namespace OSharp.Storyboard
{
public class SituationEventArgs : CompressorEventArgs
{
public SituationType SituationType { get; }
public Element Element { get; set; }
public EventContainer Container { get; set; }
public CommonEvent[] Events { get; set; }
public override bool Continue { get; set; } = true;
public SituationEventArgs(Guid compressorGuid, SituationType situationType) : base(compressorGuid)
{
SituationType = situationType;
Message = situationType.GetDescription();
}
}
public enum SituationType
{
ThisLastSingleInLastObsoleteToFixTail,
ThisLastSingleInLastObsoleteToFixEndTime,
ThisLastInLastObsoleteToRemove,
NextHeadAndThisInObsoleteToRemove,
ThisFirstSingleIsStaticAndDefaultToRemove,
ThisFirstIsStaticAndSequentWithNextHeadToRemove,
MoveSingleIsStaticToRemoveAndChangeInitial,
MoveSingleEqualsInitialToRemove,
InitialToZero,
ThisPrevIsStaticAndSequentToCombine,
ThisIsStaticAndSequentWithPrevToCombine,
PrevIsStaticAndTimeOverlapWithThisStartTimeToRemove,
}
public static class SituationExtension
{
public static string GetDescription(this SituationType situationType)
{
switch (situationType)
{
case SituationType.ThisLastSingleInLastObsoleteToFixTail:
return "The only event for its category in the obsolete range which range equals to the element's end time " +
"can be optimized when string value of end parameters is longer than the start parameters. ";
case SituationType.ThisLastSingleInLastObsoleteToFixEndTime:
return "The only event for its category in the obsolete range which range equals to the element's end time " +
"can be optimized when string value of end time is longer than the start time. ";
case SituationType.ThisLastInLastObsoleteToRemove:
return "The event in the obsolete range which range's end time equals to the element's end time " +
"is useless and can be safely removed.";
case SituationType.NextHeadAndThisInObsoleteToRemove:
return "When one event is in an obsolete range and the next event's start time is in the same obsolete range, " +
"the event is useless and can be safely removed.";
case SituationType.ThisFirstSingleIsStaticAndDefaultToRemove:
return "no description.";
case SituationType.ThisFirstIsStaticAndSequentWithNextHeadToRemove:
return "no description.";
case SituationType.MoveSingleIsStaticToRemoveAndChangeInitial:
return "no description.";
case SituationType.MoveSingleEqualsInitialToRemove:
return "no description.";
case SituationType.InitialToZero:
return "no description.";
case SituationType.ThisPrevIsStaticAndSequentToCombine:
return "no description.";
case SituationType.ThisIsStaticAndSequentWithPrevToCombine:
return "no description.";
case SituationType.PrevIsStaticAndTimeOverlapWithThisStartTimeToRemove:
return "no description.";
default:
throw new ArgumentOutOfRangeException(nameof(situationType), situationType, null);
}
}
}
}