Exemple #1
0
        /// <summary>
        /// Create new STempoCodes
        /// </summary>
        /// <param name="FrameID">4 Characters tag identifier</param>
        /// <param name="Flags">2 Bytes flags identifier</param>
        /// <param name="Data">Contain Data for this frame</param>
        /// <param name="Length"></param>
        public SynchronisedTempoFrame(string FrameID, FrameFlags Flags, int Length, Stream FS)
            : base(FrameID, Flags, FS)
        {
            _TempoCodes = new FrameCollection <TempoCode>("Temnpo Codes");
            TStream     = new BreadPlayer.Tags.TagStreamUWP(FS);
            _TimeStamp  = (TimeStamps)TStream.ReadByte(FS);
            if (IsValidEnumValue(_TimeStamp, ExceptionLevels.Error, FrameID))
            {
                return;
            }

            int  Tempo;
            uint Time;

            while (Length > 4)
            {
                Tempo = TStream.ReadByte(FS);
                Length--;

                if (Tempo == 0xFF)
                {
                    Tempo += TStream.ReadByte(FS);
                    Length--;
                }

                Time    = TStream.ReadUInt(4);
                Length -= 4;

                _TempoCodes.Add(FrameID, new TempoCode(Tempo, Time));
            }
        }
Exemple #2
0
        /// <summary>
        /// Create new Equalisation frame
        /// </summary>
        /// <param name="FrameID">4 characters frame identifer of current Frame class</param>
        /// <param name="Flags">Frame Flags</param>
        /// <param name="Data">TagStream to read frame from</param>
        /// <param name="Length">Maximum length to read frame</param>
        public Equalisation(string FrameID, FrameFlags Flags, int Length, Stream FS)
            : base(FrameID, Flags, FS)
        {
            _Frequensies    = new FrameCollection <FrequencyAdjustmentFrame>("Frequency Adjustment");
            TStream         = new BreadPlayer.Tags.TagStreamUWP(FS);
            _AdjustmentBits = TStream.ReadByte(FS);
            Length--;

            if (_AdjustmentBits == 0)
            {
                ExceptionOccured(new ID3Exception("Adjustment bit of Equalisation is zero. this frame is invalid", FrameID, ExceptionLevels.Error));
                return;
            }

            if (_AdjustmentBits % 8 != 0 || _AdjustmentBits > 32)
            {
                ExceptionOccured(new ID3Exception("AdjustmentBit of Equalisation Frame is out of supported range of this program", FrameID, ExceptionLevels.Error));
                return;
            }

            int AdLen = _AdjustmentBits / 8;

            int  FreqBuf;
            uint AdjBuf;

            while (Length > 3)
            {
                FreqBuf = Convert.ToInt32(TStream.ReadUInt(2));

                AdjBuf = TStream.ReadUInt(AdLen);
                _Frequensies.Add(FrameID, new FrequencyAdjustmentFrame(FreqBuf, AdjBuf));

                Length -= 2 + AdLen;
            }
        }
Exemple #3
0
        /// <summary>
        /// Create new SynchronisedTempoFrame from TimeStamps
        /// </summary>
        /// <param name="Flags">FrameFlags</param>
        /// <param name="TimeStamp">TimeStamps for current SynchronisedTempoFrame</param>
        public SynchronisedTempoFrame(FrameFlags Flags, TimeStamps TimeStamp, Stream FS)
            : base("SYTC", Flags, FS)
        {
            _TempoCodes = new FrameCollection <TempoCode>("Tempo Codes");

            this.TimeStampFormat = TimeStamp;
        }
Exemple #4
0
        public AnimationScreen(SpriteBatch b)
            : base(b, Color.DarkRed)
        {
            Name = "AnimatedScreen";

            //SpriteSheet: Allows for animation with a single sprite sheet
            //FrameCollection: A collection of frames
            animated = new SpriteSheet(Vector2.Zero, b,
                                       FrameCollection.FromSpriteSheet(GLibXNASampleGame.Instance.Content.Load <Texture2D>("TestSpritesheet"),
                                                                       new Rectangle(99, 11, 45, 44),
                                                                       new Rectangle(150, 9, 45, 46),
                                                                       new Rectangle(198, 9, 45, 45),
                                                                       new Rectangle(252, 8, 45, 44),
                                                                       new Rectangle(303, 9, 45, 46),
                                                                       new Rectangle(351, 7, 45, 46),
                                                                       new Rectangle(396, 8, 45, 46),
                                                                       new Rectangle(444, 9, 45, 46),
                                                                       new Rectangle(495, 8, 45, 45),
                                                                       new Rectangle(552, 7, 45, 45)));

            animated.UseCenterAsOrigin = true;
            animated.Position          = animated.GetCenterPosition(b.GraphicsDevice.Viewport);
            //FrameTime: The amount of time to spend on each frame
            animated.Frames.SetTimeAll(TimeSpan.FromMilliseconds(50));
            //FrameChanged: An event fired upon frame change
            animated.FrameChanged += new EventHandler(animated_FrameChanged);

            AdditionalSprites.Add(new HitboxVisualizer(animated, b));
            Sprites.Add(animated);
        }
Exemple #5
0
        /// <summary>
        /// Create new Equalisation Frame
        /// </summary>
        /// <param name="Flags">Frame Flags</param>
        /// <param name="AdjustmentBits">AdjustmentBit of current </param>
        public Equalisation(FrameFlags Flags, byte AdjustmentBits, Stream FS)
            : base("EQUA", Flags, FS)
        {
            this.AdjustmentLength = AdjustmentBits;

            _Frequensies = new FrameCollection <FrequencyAdjustmentFrame>("FrequencyAdjustment");
        }
Exemple #6
0
        private async Task StopOperationAsync()
        {
            Stopwatch.Stop();
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                CaptureElement.Source = null;
            });

            FrameReader.FrameArrived -= FrameReader_FrameArrived;

            try
            {
                await MediaCapture.StopPreviewAsync();
            }
            catch (Exception e) when(e.HResult == unchecked ((int)0xc00dabe4) &&
                                     MediaCapture.PreviewMediaCapture.CameraStreamState != CameraStreamState.Streaming)
            {
                // StopPreview is not idempotent, silence exception when camera is not streaming
            }

            await FrameReader.StopAsync();

            FrameCollection.Dispose();
            CollectedColorFrames.AsParallel().ForAll(frame => frame.Dispose());
            CollectedNonIlluminatedInfraredFrames.AsParallel().ForAll(frame => frame.Dispose());
            CollectedIlluminatedInfraredFrames.AsParallel().ForAll(frame => frame.Dispose());
            CollectedColorFrames.Clear();
            CollectedNonIlluminatedInfraredFrames.Clear();
            CollectedIlluminatedInfraredFrames.Clear();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, DispatcherTimer.Stop);
        }
        public void TestEquals90()
        {
            FrameCollection frames = new FrameCollection();

            Repeat(() =>
                {
                    frames.Add(new Frame("9", "-"));
                }, 10);

            Assert.IsTrue(frames.Score() == 90);
        }
Exemple #8
0
        public FrameInfo(FrameCollection _frames)
        {
            this.InitializeComponent();
            SummaryTable.FilterApplied            += new ApplyFilterEventHandler(ApplyFilterToEventTree);
            SummaryTable.DescriptionFilterApplied += new ApplyDescriptionFilterEventHandler(ApplyDescriptionFilterToEventTree);
            SummaryTable.DescriptionFilterApplied += new ApplyDescriptionFilterEventHandler(ApplyDescriptionFilterToFramesTimeLine);

            EventTreeView.SelectedItemChanged += new RoutedPropertyChangedEventHandler <object>(EventTreeView_SelectedItemChanged);

            frames = _frames;
        }
Exemple #9
0
    public void LoadData(FrameCollection <SingleValueFrame> data)
    {
        float time = 0;

        for (int i = 0; i < data.Frames.Length; i++)
        {
            _lineChart.AddData(0, time, data.Frames[i].Value);
            _lineChart.AddXAxisData(DateTimeHelper.GetTimelineLabelFromTime(time));
            time = data.Frames[i].Timestamp;
        }
        _lineChart.RefreshChart();
    }
        public void TestEquals150()
        {
            FrameCollection frames = new FrameCollection();

            Repeat(() =>
            {
                frames.Add(new Frame("5", "/"));
            }, 10);

            frames.Add(new Frame(5));

            Assert.IsTrue(frames.Score() == 155);
        }
Exemple #11
0
        /// <summary>
        /// New Synchronised Text
        /// </summary>
        /// <param name="Flags">Frame Flags</param>
        /// <param name="TextEncoding">TextEncoding use for texts</param>
        /// <param name="Lang">Language of texts</param>
        /// <param name="TimeStamp">TimeStamps that use for times</param>
        /// <param name="ContentType">ContentType</param>
        /// <param name="ContentDescriptor">Descriptor of Contents</param>
        public SynchronisedText(FrameFlags Flags,
                                TextEncodings TextEncoding, string Lang, TimeStamps TimeStamp,
                                ContentTypes ContentType, string ContentDescriptor, Stream FS)
            : base("SYLT", Flags, FS)
        {
            _Syllables = new FrameCollection <Syllable>("Syllables");

            this.ContentType  = ContentType;
            this.TimeStamp    = TimeStamp;
            this.TextEncoding = TextEncoding;
            Language          = new Language(Lang);
            this.Text         = ContentDescriptor;
        }
        public void TestEquals300()
        {
            FrameCollection frames = new FrameCollection();

            Repeat(() =>
                {
                    frames.Add(new Frame(10,0));
                },10);

            frames.Add(new Frame(10, true));
            frames.Add(new Frame(10, true));

            Assert.IsTrue(frames.Score() == 300);
        }
Exemple #13
0
        public void CanPushAndPop()
        {
            var s = new FrameCollection(NullLoggerFactory.GetLogger());

            s.PushFrame(new StackFrame(0x55FF, 2, 1));
            s.Locals[0] = 22;
            s.RoutineStack.Push(42);

            var frame = s.PopFrame();

            Assert.Equal(0x55FF, frame.ReturnPC);
            Assert.Equal(22, frame.Locals[0]);
            Assert.Equal(42, frame.RoutineStack.Pop());
        }
Exemple #14
0
        private void ExportTags(EventNode node, FrameCollection frames)
        {
            var option = new ArchiveOption
            {
                Mode    = ArchiveMode.Save,
                Sources = new List <IArchiveSource>
                {
                    new NodeArchiveSource(node),
                    new FrameArchiveSource(frames)
                },
                ArchiveType = ArchiveSourceType.Tag
            };

            ArchiveFactory.Instance().Archive(ref option);
        }
Exemple #15
0
        /// <summary>
        /// New SynchronisedText
        /// </summary>
        /// <param name="FrameID">FrameID</param>
        /// <param name="Flags">Frame Flag</param>
        /// <param name="Data">FileStream contain current frame data</param>
        /// <param name="Length">Maximum availabel length for this frame</param>
        public SynchronisedText(string FrameID, FrameFlags Flags, int Length, Stream FS)
            : base(FrameID, Flags, FS)
        {
            _Syllables   = new FrameCollection <Syllable>("Syllables");
            TStream      = new BreadPlayer.Tags.TagStreamUWP(FS);
            TextEncoding = (TextEncodings)TStream.ReadByte(FS);
            if (!IsValidEnumValue(TextEncoding, ExceptionLevels.Error, FrameID))
            {
                return;
            }

            Length--;

            Language = new Language(TStream.FS);
            Length  -= 3;

            _TimeStamp = (TimeStamps)TStream.ReadByte(FS);
            if (!IsValidEnumValue(_TimeStamp, ExceptionLevels.Error, FrameID))
            {
                return;
            }

            Length--;

            _ContentType = (ContentTypes)TStream.ReadByte(FS);
            if (!IsValidEnumValue(_ContentType))
            {
                _ContentType = ContentTypes.Other;
            }
            Length--;

            // use Text variable for descriptor property
            Text = TStream.ReadText(Length, TextEncoding, ref Length, true);

            string tempText;
            uint   tempTime;

            while (Length > 5)
            {
                tempText = TStream.ReadText(Length, TextEncoding, ref Length, true);
                tempTime = TStream.ReadUInt(4);

                _Syllables.Add(FrameID, new Syllable(tempTime, tempText));

                Length -= 4;
            }
        }
Exemple #16
0
        public Tag(Byte[] bytes, int offset)
        {
            List<Byte> byteList = bytes.ToList<Byte>();
            TagHeader header = new TagHeader(byteList.GetRange(offset, 10).ToArray<Byte>());
            tagBytes = byteList.GetRange(offset + 10, header.Size).ToArray<Byte>();

            int i = 0;
            FrameCollection collection = new FrameCollection();

            while (i < tagBytes.Length)
            {
                Frame f = new Frame(tagBytes, i);
                i += f.Length;

                collection.AddFrame(f);
            }
        }
        private void OnMenuItemClick_Export(object sender, RoutedEventArgs e)
        {
            FrameCollection frames = new FrameCollection();

            frames.Add(frameList.SelectedItem as Frame);
            var option = new ArchiveOption
            {
                Mode    = ArchiveMode.Save,
                Sources = new List <IArchiveSource>
                {
                    new FrameArchiveSource(frames)
                },
                ArchiveType = ArchiveSourceType.Frame
            };

            ArchiveFactory.Instance().Archive(ref option);
        }
Exemple #18
0
        private void MenuExportFrameTags(object sender, RoutedEventArgs e)
        {
            if (e.Source is FrameworkElement)
            {
                FrameworkElement item = e.Source as FrameworkElement;

                Application.Current.Dispatcher.Invoke(new Action(() =>
                {
                    if (item.DataContext is EventNode)
                    {
                        var frames = new FrameCollection {
                            ((EventFrame)frame).Parent
                        };
                        ExportTags(item.DataContext as EventNode, frames);
                    }
                }));
            }
        }
Exemple #19
0
        private void FrameReader_FrameArrived(ExampleMediaFrameReader sender, ExampleMediaFrameArrivedEventArgs args)
        {
            try
            {
                // Access the latest frame
                // More information:
                // https://docs.microsoft.com/en-us/windows/uwp/audio-video-camera/process-media-frames-with-mediaframereader#handle-the-frame-arrived-event
                // ExampleMediaFrameReference interface is based on Windows.Media.Core.FaceDetectionEffect.FaceDetected
                // https://docs.microsoft.com/en-us/uwp/api/windows.media.capture.frames.multisourcemediaframereference

                using (var mediaFrameReference = sender.TryAcquireLatestFrameBySourceKind(args.SourceKind))
                {
                    FrameCollection.Add(mediaFrameReference);
                }
            }
            catch (ObjectDisposedException) { }
            finally { }
        }
Exemple #20
0
        /// <summary>
        /// Load spefic frame information
        /// </summary>
        /// <param name="FrameID">FrameID to load</param>
        /// <param name="FileAddress">FileAddress to read tag from</param>
        private void LoadFrameFromFile(string FrameID, string FileAddress)
        {
            ID3v2 LinkedInfo = new ID3v2(false, TStream.FS);

            LinkedInfo.Filter.Add(FrameID);
            LinkedInfo.FilterType = FilterTypes.LoadFiltersOnly;
            LinkedInfo.Load();

            if (LinkedInfo.HaveError)
            {
                foreach (ID3Exception IE in LinkedInfo.Errors)
                {
                    _Errors.Add(new ID3Exception("In Linked Info(" +
                                                 FileAddress + "): " + IE.Message, IE.FrameID, IE.Level));
                }
            }

            foreach (FrameCollectionBase Coll in LinkedInfo._CollectionFrames)
            {
                if (Coll.Name == CollectionIndex.Link.ToString())
                {
                    continue;
                }

                foreach (Frame Fr in Coll)
                {
                    FrameCollection <Frame> Temp =
                        (FrameCollection <Frame>)_CollectionFrames[
                            Enum.Parse(typeof(CollectionIndex), Coll.Name)];

                    Temp.Add(Fr.FrameID, Fr);
                }
            }

            foreach (Frame In in (Frame[])LinkedInfo._SingleFrames.Values)
            {
                if (_SingleFrames.ContainsKey(In.FrameID))
                {
                    _SingleFrames.Remove(In);
                }

                _SingleFrames.Add(In.FrameID, LinkedInfo._SingleFrames[In]);
            }
        }
        private bool TryFindHighlightsFrame(FrameCollection frames, out TextFrame highlightFrame)
        {
            foreach (TextFrame textFrame in frames?.OfType <TextFrame>() ?? Enumerable.Empty <TextFrame>())
            {
                highlightFrame = textFrame;

                if (textFrame.FrameId == "TXXX")
                {
                    return(true);
                }
                if (textFrame.Text.StartsWith(highlightsKey))
                {
                    return(true);
                }
            }

            highlightFrame = null;
            return(false);
        }
Exemple #22
0
        /// <summary>
        /// Create new EventTimingCodeFrame
        /// </summary>
        /// <param name="FrameID">FrameID</param>
        /// <param name="Flags">Flags of frame</param>
        /// <param name="Data">TagStream to read data from</param>
        /// <param name="Length">Maximum available length</param>
        public EventTimingCodeFrame(string FrameID, FrameFlags Flags, int Length, Stream FS)
            : base(FrameID, Flags, FS)
        {
            _Events    = new FrameCollection <EventCode>("EventCode");
            TStream    = new BreadPlayer.Tags.TagStreamUWP(FS);
            _TimeStamp = (TimeStamps)TStream.ReadByte(FS);
            if (!IsValidEnumValue(_TimeStamp, ExceptionLevels.Error, FrameID))
            {
                return;
            }

            Length--;

            while (Length >= 5)
            {
                _Events.Add(FrameID, new EventCode(TStream.ReadByte(FS), TStream.ReadUInt(4)));

                Length -= 5;
            }
        }
Exemple #23
0
        static void Main(string[] args)
        {
            FrameCollection frames = new FrameCollection();

            int count = 0;

            do
            {
                count++;
                Console.WriteLine("In frame {0}, Please enter the pins knowked down...", count);
                Console.Write("...on the first throw:");
                string first = Console.ReadLine();
                string second = "0";
                if (first != "10" && first !="X" && first != "x")
                {
                    Console.Write("...on the second throw:");
                    second = Console.ReadLine();
                }
                frames.Add(new Frame(first,second));
            } while (count < 10);

            if (frames[9].IsStrike || frames[9].IsSpare)
            {
                Console.WriteLine("Bonus frame #1!");
                Console.Write("Enter pins knocked down on 1st bonus frame:");
                string bonusScore1 = Console.ReadLine();
                Frame bonus1 = new Frame(bonusScore1,true);
                frames.Add(bonus1);
                if (bonus1.IsStrike && frames[9].IsStrike)
                {
                    Console.WriteLine("Bonus frame #2!");
                    Console.Write("Enter pins knocked down on 2nd bonus frame:");
                    string bonusScore2 = Console.ReadLine();
                    frames.Add(new Frame(bonusScore2,true));
                }

            }

            Console.WriteLine("The final score was: {0}", frames.Score());
            Console.ReadLine();
        }
Exemple #24
0
        private void Initializer()
        {
            _Filter = new FilterCollection();

            _CollectionFrames = new Hashtable();
            _SingleFrames     = new Hashtable();

            _FilterType = FilterTypes.NoFilter;
            _Errors     = new ExceptionCollection();


            FrameCollection <TextFrame>             TextFrames               = new FrameCollection <TextFrame>(CollectionIndex.Text.ToString());
            FrameCollection <UserTextFrame>         UserTextFrames           = new FrameCollection <UserTextFrame>(CollectionIndex.UserText.ToString());
            FrameCollection <PrivateFrame>          PrivateFrames            = new FrameCollection <PrivateFrame>(CollectionIndex.Private.ToString());
            FrameCollection <TextWithLanguageFrame> TextWithLangFrames       = new FrameCollection <TextWithLanguageFrame>(CollectionIndex.TextWithLanguage.ToString());
            FrameCollection <SynchronisedText>      SynchronisedTextFrames   = new FrameCollection <SynchronisedText>(CollectionIndex.SynchronisedText.ToString());
            FrameCollection <AttachedPictureFrame>  AttachedPictureFrames    = new FrameCollection <AttachedPictureFrame>(CollectionIndex.AttachedPicture.ToString());
            FrameCollection <GeneralFileFrame>      EncapsulatedObjectFrames = new FrameCollection <GeneralFileFrame>(CollectionIndex.EncapsulatedObject.ToString());
            FrameCollection <PopularimeterFrame>    PopularimeterFrames      = new FrameCollection <PopularimeterFrame>(CollectionIndex.Popularimeter.ToString());
            FrameCollection <AudioEncryptionFrame>  AudioEncryptionFrames    = new FrameCollection <AudioEncryptionFrame>(CollectionIndex.AudioEncryption.ToString());
            FrameCollection <LinkFrame>             LinkFrames               = new FrameCollection <LinkFrame>(CollectionIndex.Link.ToString());
            FrameCollection <TermOfUseFrame>        TermOfUseFrames          = new FrameCollection <TermOfUseFrame>(CollectionIndex.TermOfUse.ToString());
            FrameCollection <DataWithSymbolFrame>   DataWithSymbolFrames     = new FrameCollection <DataWithSymbolFrame>(CollectionIndex.DataWithSymbol.ToString());
            FrameCollection <BinaryFrame>           UnknownFrames            = new FrameCollection <BinaryFrame>(CollectionIndex.Unknown.ToString());

            _CollectionFrames.Add(CollectionIndex.Text, TextFrames);
            _CollectionFrames.Add(CollectionIndex.UserText, UserTextFrames);
            _CollectionFrames.Add(CollectionIndex.Private, PrivateFrames);
            _CollectionFrames.Add(CollectionIndex.TextWithLanguage, TextWithLangFrames);
            _CollectionFrames.Add(CollectionIndex.SynchronisedText, SynchronisedTextFrames);
            _CollectionFrames.Add(CollectionIndex.AttachedPicture, AttachedPictureFrames);
            _CollectionFrames.Add(CollectionIndex.EncapsulatedObject, EncapsulatedObjectFrames);
            _CollectionFrames.Add(CollectionIndex.Popularimeter, PopularimeterFrames);
            _CollectionFrames.Add(CollectionIndex.AudioEncryption, AudioEncryptionFrames);
            _CollectionFrames.Add(CollectionIndex.Link, LinkFrames);
            _CollectionFrames.Add(CollectionIndex.TermOfUse, TermOfUseFrames);
            _CollectionFrames.Add(CollectionIndex.DataWithSymbol, DataWithSymbolFrames);
            _CollectionFrames.Add(CollectionIndex.Unknown, UnknownFrames);

            Version = new Version(2, 3, 0, 0);
        }
Exemple #25
0
    /// <summary>
    /// Populates the values for a dropdown.
    /// Find a control is a bit tricky for DataLists since you have
    /// to loop through each item (row in the table) and find the
    /// control there.
    /// </summary>
    private void PopulateFrameDropdown()
    {
        FrameCollection fc = new FrameCollection();

        fc.FetchAll();
        DropDownList dd = null;
        int          i  = 0;

        foreach (ArtWork aw in ArtInTheCart)
        {
            dd = (DropDownList)listCart.Items[i].FindControl("drpFrame");
            foreach (Frame f in fc)
            {
                string   drpText = f.Title + String.Format(" - {0:c}", f.Price);
                ListItem li      = new ListItem(drpText, f.Price.ToString());
                dd.Items.Add(li);
            }
            dd.SelectedIndex = 0;
            i++;
        }
    }
Exemple #26
0
    private void OnDataLoaded(DriveData driveData)
    {
        if (driveData.PositionFrames == null)
        {
            return;
        }

        _frames = driveData.PositionFrames;

        Vector3[] positions = new Vector3[driveData.PositionFrames.Frames.Length];

        for (int i = 0; i < positions.Length; i++)
        {
            positions[i] = driveData.PositionFrames.Frames[i].Point.ToVector();
        }

        splineBuilder = new SplineBuilder(positions);
        EventBus.Instance.OnSplineBuilderInitialized.Invoke(splineBuilder);
        EventBus.Instance.OnWaypointsUpdate.Invoke(splineBuilder.GetSplinePoints(splineStep));
        EventBus.Instance.OnCurrentWaypointChange.Invoke(positions[0]);
    }
Exemple #27
0
        //SpriteSheet drawnSpriteSheetAnimate = null;

        void arrow_Updated(object sender, EventArgs e)
        {
            MouseState current = Mouse.GetState();

            if (!old.HasValue)
            {
                old = Mouse.GetState();
            }
            if (!isSelecting)
            {
                //((Sprite)sender).Rotation.Degrees += 0.5f;
                ((Sprite)sender).FollowMouse();
            }
            else
            {
                Sprite     active = ((Sprite)sender);
                MouseState ms     = Mouse.GetState();
                active.Rotation          = new SpriteRotation();
                active.Position          = new Vector2(25);
                active.UseCenterAsOrigin = false;
                Vector2 mousePos = new Vector2(ms.X, ms.Y);
                if (active.ClickCheck(ms) && !relativeSelectStart.HasValue)
                {
                    relativeSelectStart = mousePos;
                    arrows.AddNewSprite(relativeSelectStart.Value, Content.Load <Texture2D>("dot"));
                }
                if (active.Intersects(mousePos) && relativeSelectStart.HasValue && old.Value.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed && current.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Released)
                {
                    Texture2D use = arrows[0].Texture;
                    arrows.Clear();
                    arrows.Add(new SpriteSheet(new Vector2(25), spriteBatch, FrameCollection.FromSpriteSheet(use, new Point(Convert.ToInt32(mousePos.X - relativeSelectStart.Value.X), Convert.ToInt32(mousePos.Y - relativeSelectStart.Value.Y)))));
                    arrows[0].Updated          += new EventHandler(arrow_Updated);
                    arrows[0].UseCenterAsOrigin = true;
                    isSelecting = false;
                }
            }
            old = Mouse.GetState();
        }
Exemple #28
0
        private async Task StopOperationAsync()
        {
            MediaCapture.FaceDetected -= MediaCapture_FaceDetected;
            FrameReader.FrameArrived  -= FrameReader_FrameArrived;

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                CaptureElement.Source = null;
            });

            await MediaCapture.StopPreviewAsync();

            await FrameReader.StopAsync();

            FrameCollection.Dispose();
            ColorFrameEpochs.Clear();
            IlluminatedInfraredFrameEpochs.Clear();
            NonIlluminatedInfraredFrameEpochs.Clear();

            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, DispatcherTimer.Stop);

            FrameReaderStopTrigger.Stop();
        }
Exemple #29
0
        /// <summary>Processes raw data to populate the resource</summary>
        /// <param name="raw">Raw byte data</param>
        /// <param name="containsHeader">Whether or not <i>raw</i> contains the resource Header information</param>
        /// <exception cref="ArgumentException">Header-defined <see cref="Type"/> is not <see cref="Resource.ResourceType.Anim"/></exception>
        public override void DecodeResource(byte[] raw, bool containsHeader)
        {
            _decodeResource(raw, containsHeader);
            if (_type != ResourceType.Anim)
            {
                throw new ArgumentException("Raw header is not for an Anim resource");
            }
            //System.Diagnostics.Debug.WriteLine("decoding...");
            short numberOfFrames = BitConverter.ToInt16(_rawData, 0);

            _frames = new FrameCollection(this);
            for (int i = 0; i < numberOfFrames; i++)
            {
                _frames.Add(new Frame(this));
            }
            int frameLength;
            int offset = 2;

            for (int i = 0; i < NumberOfFrames; i++)
            {
                //System.Diagnostics.Debug.WriteLine("frame " + i + ", offset " + offset);
                frameLength = BitConverter.ToInt32(_rawData, offset);
                byte[] delt = new byte[frameLength];
                ArrayFunctions.TrimArray(_rawData, offset + 4, delt);
                //System.Diagnostics.Debug.WriteLine("Frame offset: " + offset);
                _frames[i]._delt.DecodeResource(delt, false);
                if (HasDefinedPalette)
                {
                    _frames[i]._delt.Palette = _palette;
                }
                offset += frameLength + 4;
            }
            _recalculateDimensions();
            //System.Diagnostics.Debug.WriteLine("Anim LTWH: " + _left + ", " + _top + ", " + _width + ", " + _height);
            //System.Diagnostics.Debug.WriteLine("... complete");
        }
Exemple #30
0
 /// <summary>Creates a blank resource</summary>
 public Anim()
 {
     _type = ResourceType.Anim;
     _frames = new FrameCollection(this);
 }
Exemple #31
0
 /// <summary>Creates a new Act image from bitmap</summary>
 /// <remarks><see cref="FilePath"/> defaults to <b>"NewImage.act"</b>, <see cref="Frames"/> is initialized as a single <see cref="Frame"/> using <i>image</i>.<br/>
 /// <see cref="Center"/> defaults to the center pixel of <i>image</i>.</remarks>
 /// <param name="image">Initial <see cref="PixelFormat.Format8bppIndexed"/> image to be used</param>
 /// <exception cref="Idmr.Common.BoundaryException"><i>image</i> exceeds allowable size</exception>
 public ActImage(Bitmap image)
 {
     _frames = new FrameCollection(this);
     _frames.Add(new Frame(this, image));
     _filePath = "NewImage.act";
     _center = new Point(Width/2, Height/2);
     _frames[0].Location = new Point(-Center.X, -Center.Y);
 }
 public FrameArchiveSource(FrameCollection frames)
 {
     Frames = frames;
 }
Exemple #33
0
 /// <summary>Populates the Act object from the raw byte data</summary>
 /// <param name="raw">Entire contents of an *.ACT file</param>
 /// <exception cref="ArgumentException">Data validation failure</exception>
 public void DecodeFile(byte[] raw)
 {
     ArrayFunctions.TrimArray(raw, 0, _header);
     if (BitConverter.ToInt32(_header, 0x10) != _fileHeaderLength) throw new ArgumentException(_validationErrorMessage, "raw");
     _center = new Point(BitConverter.ToInt32(_header, 0x24), BitConverter.ToInt32(_header, 0x28));
     int numFrames = BitConverter.ToInt32(_header, 0x18);
     int[] frameOffsets = new int[numFrames];
     System.Diagnostics.Debug.WriteLine("Frames: " + numFrames);
     ArrayFunctions.TrimArray(raw, _fileHeaderLength, frameOffsets);
     _frames = new FrameCollection(this);
     // Frames
     for (int f = 0; f < numFrames; f++)
     {
         // FrameHeader
         byte[] rawFrame = new byte[BitConverter.ToInt32(raw, frameOffsets[f])];
         ArrayFunctions.TrimArray(raw, frameOffsets[f], rawFrame);
         _frames.Add(new Frame(this, rawFrame));
     }
     // EOF
 }
Exemple #34
0
 private Browser(IntPtr handle)
     : base(typeof (CefBrowser))
 {
     Frames = new FrameCollection(this);
     Handle = handle;
 }
Exemple #35
0
        private static readonly byte[] Id3TagV2Signature = {0x49, 0x44, 0x33}; // ID3

        #endregion Fields

        #region Constructors

        public Id3Tagv2()
        {
            Frames = new FrameCollection();
        }
Exemple #36
0
 /// <summary>Creates a blank resource</summary>
 public Anim()
 {
     _type   = ResourceType.Anim;
     _frames = new FrameCollection(this);
 }
Exemple #37
0
 /// <summary>Processes raw data to populate the resource</summary>
 /// <param name="raw">Raw byte data</param>
 /// <param name="containsHeader">Whether or not <i>raw</i> contains the resource Header information</param>
 /// <exception cref="ArgumentException">Header-defined <see cref="Type"/> is not <see cref="ResourceType.Anim"/></exception>
 public override void DecodeResource(byte[] raw, bool containsHeader)
 {
     _decodeResource(raw, containsHeader);
     if (_type != ResourceType.Anim) throw new ArgumentException("Raw header is not for an Anim resource");
     //System.Diagnostics.Debug.WriteLine("decoding...");
     short numberOfFrames = BitConverter.ToInt16(_rawData, 0);
     _frames = new FrameCollection(this);
     for (int i = 0; i < numberOfFrames; i++) _frames.Add(new Frame(this));
     int frameLength;
     int offset = 2;
     for (int i = 0; i < NumberOfFrames; i++)
     {
         //System.Diagnostics.Debug.WriteLine("frame " + i + ", offset " + offset);
         frameLength = BitConverter.ToInt32(_rawData, offset);
         byte[] delt = new byte[frameLength];
         ArrayFunctions.TrimArray(_rawData, offset + 4, delt);
         //System.Diagnostics.Debug.WriteLine("Frame offset: " + offset);
         _frames[i]._delt.DecodeResource(delt, false);
         if (HasDefinedPalette) _frames[i]._delt.Palette = _palette;
         offset += frameLength + 4;
     }
     _recalculateDimensions();
     //System.Diagnostics.Debug.WriteLine("Anim LTWH: " + _left + ", " + _top + ", " + _width + ", " + _height);
     //System.Diagnostics.Debug.WriteLine("... complete");
 }
Exemple #38
0
		/// <summary>
		/// Implementation of the <see cref="IDisposable"/> pattern.
		/// </summary>
		/// <param name="disposing">True if disposing, false if finalizing.</param>
		protected override void Dispose(bool disposing)
		{
			base.Dispose(disposing);

			if (disposing)
			{
				lock(_syncLock)
				{
					if (_frames != null)
					{
						foreach (Frame frame in _frames)
							(frame as IDisposable).Dispose();

						_frames = null;
					}
				}
			}
		}
        // Decodes Frames and uploads them to blob storage
        public static FrameCollection[] DecodeFrames(String videoName, String blobPrefix, String accountName, String accountKey, String containerName, DecodeInterval[] decodeIntervals)
        {
            IntPtr res;
            int    size;

            int[] decodeIntervalsFlat = new int[decodeIntervals.Length * 2];
            int   flatIndex           = 0;

            for (int i = 0; i < decodeIntervals.Length; ++i)
            {
                decodeIntervalsFlat[flatIndex] = decodeIntervals[i].startMs;
                flatIndex++;
                decodeIntervalsFlat[flatIndex] = decodeIntervals[i].endMs;
                flatIndex++;
            }
            int[] shotIndexes = new int[decodeIntervalsFlat.Length];
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                // 0 här är hårdkodat ingen rotation! när vi har rotations data från app lägg till float parameter med vinkeln och lägga till här
                res = decodeFramesWin(videoName, blobPrefix, out size, accountName, accountKey, containerName, decodeIntervalsFlat, decodeIntervals.Length, shotIndexes, 0);
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                // 0 här är hårdkodat ingen rotation! när vi har rotations data från app lägg till float parameter med vinkeln och lägga till här
                res = decodeFramesLinux(videoName, blobPrefix, out size, accountName, accountKey, containerName, decodeIntervalsFlat, decodeIntervals.Length, shotIndexes, 0);
            }
            else
            {
                throw new System.PlatformNotSupportedException();
            }
            if (size == 0)
            {
                Console.WriteLine("zero size");
            }
            if (res == IntPtr.Zero)
            {
                throw new System.ArgumentException("Server Internal error: Pointer 'res' in DecodeFrames was 0.");
            }
            FrameCollection[] decodedFrames = new FrameCollection[decodeIntervals.Length];
            flatIndex = 0;

            unsafe // NICE!
            {
                byte **ptrs = (byte **)res.ToPointer();
                for (int i = 0; i < decodedFrames.Length; i++)
                {
                    int start = shotIndexes[flatIndex];
                    flatIndex++;
                    int end = shotIndexes[flatIndex];
                    flatIndex++;
                    decodedFrames[i]      = new FrameCollection();
                    decodedFrames[i].Shot = i;
                    String[] uris = new String[end - start];
                    for (int k = 0; k < uris.Length; ++k)
                    {
                        IntPtr ptr = new IntPtr((void *)(*ptrs));
                        uris[k] = Marshal.PtrToStringUTF8(ptr);
                        ptrs   += 1;
                    }
                    decodedFrames[i].Uris = uris;
                }
            }
            return(decodedFrames);
        }