public static ClipEvent Create(ClipEventType typeId, EventHandler handler, uint size)
        {
            switch ((uint)typeId)
            {
            case 3:
                return(new ClipEventSound(0, handler));

            case 4:
                return(new ClipEventScript(0, handler, typeId, size));

            case 5:
                return(new ClipEventEffect(0, handler));

            case 12:
                return(new ClipEventSNAP(0, handler, typeId, size));

            case 14:
                return(new ClipEventDoubleModifierSound(0, handler));

            case 19:
                return(new ClipEventCensor(0, handler));

            default:
                return(new ClipEventUnknown(0, handler, typeId, size));
            }
        }
 protected ClipEvent(int APIversion, EventHandler handler, ClipEventType type, uint unknown1, uint unknown2, float timecode)
     : base(APIversion, handler)
 {
     this.typeId   = type;
     this.unknown1 = unknown1;
     this.unknown2 = unknown2;
     this.timecode = timecode;
 }
 /// <summary>
 /// Creates a new instance of ClipEventLog.
 /// </summary>
 /// <param name="clipEventType">The type of clip event that occurred.</param>
 /// <param name="position">The position of playback on the main media when the event occurred.</param>
 /// <param name="source">The source of the clip (if available).</param>
 public ClipEventLog(ClipEventType clipEventType, TimeSpan position, Uri source)
 {
     TimeStamp     = DateTimeOffset.Now;
     Type          = EventTypes.ClipEvent;
     ClipEventType = clipEventType;
     Position      = position;
     Source        = source;
     Id            = Guid.NewGuid();
     ExtraData     = new Dictionary <string, object>();
 }
 /// <summary>
 /// Creates a new instance of ClipEventLog.
 /// </summary>
 /// <param name="clipEventType">The type of clip event that occurred.</param>
 /// <param name="position">The position of playback on the main media when the event occurred.</param>
 /// <param name="source">The source of the clip (if available).</param>
 public ClipEventLog(ClipEventType clipEventType, TimeSpan position, Uri source)
 {
     TimeStamp = DateTimeOffset.Now;
     Type = EventTypes.ClipEvent;
     ClipEventType = clipEventType;
     Position = position;
     Source = source;
     Id = Guid.NewGuid();
     ExtraData = new Dictionary<string, object>();
 }
        void Parse(Stream s)
        {
            var br = new BinaryReader(s);

            this.version        = br.ReadUInt32();
            this.flags          = br.ReadUInt32();
            this.duration       = br.ReadSingle();
            this.initialOffsetQ = new Quaternion(RecommendedApiVersion, OnResourceChanged, s);
            this.initialOffsetT = new Vector3(RecommendedApiVersion, OnResourceChanged, s);
            if (version >= 5)
            {
                this.referenceNamespaceHash = br.ReadUInt32();
            }
            if (version >= 10)
            {
                this.surfaceNamespaceHash = br.ReadUInt32();
                this.surfaceJointNameHash = br.ReadUInt32();
            }

            if (version >= 11)
            {
                this.surfacechildNamespaceHash = br.ReadUInt32();
            }
            if (version >= 7)
            {
                this.clip_name = br.ReadString32();
            }
            this.rigNameSpace = br.ReadString32();
            if (version >= 4)
            {
                explicitNamespaces = new ExplicitNameSpaceList(OnResourceChanged, s);
            }
            this.slot_assignments = new IkConfiguration(OnResourceChanged, s);
            uint clipEventLength = br.ReadUInt32();
            var  events          = new List <ClipEvent>();

            for (int i = 0; i < clipEventLength; i++)
            {
                ClipEventType clipType = (ClipEventType)br.ReadUInt32();
                uint          size     = br.ReadUInt32();
                ClipEvent     evt      = ClipEvent.Create(clipType, this.OnResourceChanged, size);
                evt.Parse(s);
                events.Add(evt);
            }
            this.clip_events = new ClipEventList(this.OnResourceChanged, events);
            uint codecDataLength = br.ReadUInt32();

            if (codecDataLength > 0)
            {
                this.codecData = new S3CLIP(RecommendedApiVersion, OnResourceChanged, s);
            }
        }
 public ClipEvent(ClipModel source, ClipEventType eventType)
 {
     Source    = source;
     EventType = eventType;
 }
 protected ClipEvent(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s)
     : this(apiVersion, handler, typeId)
 {
     Parse(s);
 }
 protected ClipEvent(int apiVersion, EventHandler handler, ClipEventType typeId)
     : this(apiVersion, handler, typeId, 0, 0, 0)
 {
 }
 public ClipEventUnknown(int apiVersion, EventHandler handler, ClipEventType typeId, uint size)
     : base(apiVersion, handler, typeId)
 {
     this.data = new byte[size - 4 * 3];
 }
 public ClipEventCensor(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s)
     : base(apiVersion, handler, typeId, s)
 {
 }
 public ClipEventDoubleModifierSound(int apiVersion, EventHandler handler, ClipEventType typeId, Stream s)
     : base(apiVersion, handler, typeId, s)
 {
 }