public int RegisterVideo(int videoStretchMode, bool loop, string videoFilename) { var id = _nextId; var v = new VideoDef { Loop = loop, VideoFilename = videoFilename }; switch (videoStretchMode) { case 0: v.Scaling = Scaling.Stretch; v.Alignment = Alignment.Center; break; case 1: v.Scaling = Scaling.FillX; v.Alignment = Alignment.Top; break; case 2: v.Scaling = Scaling.FillX; v.Alignment = Alignment.Center; break; case 3: v.Scaling = Scaling.FillX; v.Alignment = Alignment.Bottom; break; } _preloads[id] = v; _nextId++; return(id); }
public int RegisterVideo(int videoStretchMode, bool loop, string videoFilename) { var v = new VideoDef { Loop = loop, VideoFilename = videoFilename }; switch (videoStretchMode) { case 0: v.Scaling = Scaling.Stretch; v.Alignment = Alignment.Center; break; case 1: v.Scaling = Scaling.FillX; v.Alignment = Alignment.Top; break; case 2: v.Scaling = Scaling.FillX; v.Alignment = Alignment.Center; break; case 3: v.Scaling = Scaling.FillX; v.Alignment = Alignment.Bottom; break; } foreach (KeyValuePair <int, object> pair in _preloads) { if (EqualityComparer <object> .Default.Equals(pair.Value, v)) { return(pair.Key); } } var id = _nextId; _preloads[id] = v; _nextId++; return(id); }