예제 #1
0
 /// <summary>
 /// 发送消息之前必须先设置解码器
 /// </summary>
 /// <param name="type"></param>
 public void SetDecoder(byte type)
 {
     if (Decoders.ContainsKey(type))
     {
         Decoder = Decoders[type];
     }
 }
예제 #2
0
        /// <summary>
        /// Handles final process after initialization.
        /// </summary>
        protected virtual void PostInitialize()
        {
            Dependencies.CacheAs <IInputManager>(inputManager = InputManager.Create(
                                                     rootMain.Resolution,
                                                     Application.isMobilePlatform ? 0 : 2,
                                                     Application.isMobilePlatform ? 5 : 0
                                                     ));

            // Some default system settings.
            Screen.sleepTimeout         = SleepTimeout.NeverSleep;
            Application.targetFrameRate = 60;

            // Load environment
            envConfiguration.Load("Configurations/Env");

            // Apply accelerator to input manager
            // inputManager.Accelerator = (Application.isMobilePlatform ? (IAccelerator)new DeviceAccelerator() : (IAccelerator)new CursorAccelerator());
            inputManager.Accelerator = new CursorAccelerator();

            // Register decoders.
            Decoders.AddDecoder <OriginalMap>(
                "osu file format v",
                (header) => new OsuBeatmapDecoder(ParseUtils.ParseInt(header.Split('v').Last(), OsuBeatmapDecoder.LatestVersion))
                );

            // Set default font
            fontManager.DefaultFont.Value = new ResourceFont("Fonts/Montserrat");
        }
예제 #3
0
        private void Initialize()
        {
            SiteManager = new SiteManager();
            Favorites   = new Favorites();

            Decoders.AddDecoder <GifDecoder>();
        }
 /// <summary>
 /// Registers this decoder to the Decoder provider.
 /// </summary>
 public static void RegisterDecoder()
 {
     Decoders.AddDecoder <OriginalMap>(
         "osu file format v",
         (header) => new OsuBeatmapDecoder(ParseUtils.ParseInt(header.Split('v').Last(), LatestVersion))
         );
 }
예제 #5
0
        public Mapset Parse(DirectoryInfo directory, Mapset mapset)
        {
            mapset.Maps.Clear();
            mapset.Files.Clear();
            mapset.Files.AddRange(directory.GetFiles());

            // Search for map files in the directory.
            foreach (var file in mapset.Files)
            {
                // If a valid beatmap file extension
                if (file.Extension.Equals(".osu"))
                {
                    // Open stream for read
                    using (var stream = file.OpenText())
                    {
                        // Get decoder.
                        var decoder = Decoders.GetDecoder <OriginalMap>(stream);
                        if (decoder != null)
                        {
                            // Decode file into beatmap.
                            OriginalMap map = decoder.Decode(stream);
                            if (map != null)
                            {
                                // Store file info.
                                map.Detail.MapFile = file;

                                // Assign beatmap set id.
                                if (!mapset.MapsetId.HasValue)
                                {
                                    mapset.MapsetId = map.Detail.MapsetId;
                                }

                                // Assign beatmap set.
                                map.Detail.Mapset = mapset;
                                // Add beatmap to beatmap set.
                                mapset.Maps.Add(map);
                            }
                        }
                    }
                }
            }

            // If there is no map included, this is an invalid map.
            if (mapset.Maps.Count == 0)
            {
                Logger.LogWarning($"OsuMapsetParser - No map file found for directory: {directory.FullName}");
                return(null);
            }

            foreach (var map in mapset.Maps)
            {
                // Prepare converted maps for different modes.
                map.CreatePlayable(modeManager);

                // Calculate beatmap file hash.
                map.Detail.Hash = FileUtils.GetHash(map.Detail.MapFile);
            }

            return(mapset);
        }
예제 #6
0
        public void Initialize()
        {
            if (_codecList == null)
            {
                Decoders.AddDecoder <JpegDecoder>();
                Decoders.AddDecoder <PngDecoder>();
                Decoders.AddDecoder <BmpDecoder>();
                Decoders.AddDecoder <GifDecoder>();

                _codecList = new RegisteredCodec();
                _codecList.Add(new ImageToolsCodec("jpg"));
                _codecList.Add(new ImageToolsCodec("png"));
                _codecList.Add(new ImageToolsCodec("bmp"));
                _codecList.Add(new ImageToolsCodec("gif"));

                _codecList.Add(new UnsupportedImageToolsCodec("tga"));
                _codecList.Add(new UnsupportedImageToolsCodec("RT"));

                foreach (var i in _codecList)
                {
                    if (!CodecManager.Instance.IsCodecRegistered(i.Type))
                    {
                        CodecManager.Instance.RegisterCodec(i);
                    }
                }
            }
        }
예제 #7
0
        public PostView()
        {
            InitializeComponent();

            Decoders.AddDecoder <GifDecoder>();

            Loaded += new RoutedEventHandler(PostView_Loaded);
        }
예제 #8
0
        //Listview selection changed
        private void objectListView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Thimble == null || Thimble.BundleFiles.Count == 0 || objectListView1.SelectedIndex == -1)
            {
                return;
            }

            EnableDisableControlsContextDependant();

            int index = Thimble.BundleFiles.IndexOf((BundleEntry)objectListView1.SelectedObject);

            switch (Thimble.BundleFiles[index].FileType)
            {
            case BundleEntry.FileTypes.Image:
                panelImage.BringToFront();
                using (MemoryStream ms = new MemoryStream())
                {
                    //Release resources from old image
                    var oldImage = pictureBoxPreview.Image as Bitmap;
                    if (oldImage != null)
                    {
                        ((IDisposable)oldImage).Dispose();
                    }

                    Thimble.SaveFileToStream(index, ms);
                    var image = Image.FromStream(ms);
                    pictureBoxPreview.Image = image;

                    //Set scaling mode depending on whether image is larger or smaller than the picturebox. From https://stackoverflow.com/questions/41188806/fit-image-to-picturebox-if-picturebox-is-smaller-than-picture
                    var imageSize = pictureBoxPreview.Image.Size;
                    var fitSize   = pictureBoxPreview.ClientSize;
                    pictureBoxPreview.SizeMode = imageSize.Width > fitSize.Width || imageSize.Height > fitSize.Height ? PictureBoxSizeMode.Zoom : PictureBoxSizeMode.CenterImage;
                }
                break;

            case BundleEntry.FileTypes.Sound:
                panelAudio.BringToFront();
                break;

            case BundleEntry.FileTypes.Text:
                panelText.BringToFront();
                using (MemoryStream ms = new MemoryStream())
                {
                    Thimble.SaveFileToStream(index, ms);

                    string[] tempArray = new string[] { };     //initialise an empty array of strings
                    if (Decoders.ExtractText(ms, out tempArray) == true)
                    {
                        textBoxPreview.Lines = tempArray;
                    }
                }
                break;

            default:
                panelBlank.BringToFront();
                break;
            }
        }
예제 #9
0
        public RandomPage()
        {
            InitializeComponent();
            Decoders.AddDecoder <GifDecoder>();
            var WebClient = new WebClient();

            WebClient.DownloadStringCompleted += new DownloadStringCompletedEventHandler(WebClient_DownloadStringCompleted);
            WebClient.DownloadStringAsync(new Uri(Constants.RandomAdress, UriKind.Absolute));
        }
예제 #10
0
        private void Load(Stream stream)
        {
            Contract.Requires(stream != null);

            try
            {
                if (!stream.CanRead)
                {
                    throw new NotSupportedException("Cannot read from the stream.");
                }

                if (!stream.CanSeek)
                {
                    throw new NotSupportedException("The stream does not support seeking.");
                }

                var decoders = Decoders.GetAvailableDecoders();

                if (decoders.Count > 0)
                {
                    int maxHeaderSize = decoders.Max(x => x.HeaderSize);
                    if (maxHeaderSize > 0)
                    {
                        byte[] header = new byte[maxHeaderSize];

                        stream.Read(header, 0, maxHeaderSize);
                        stream.Position = 0;

                        var decoder = decoders.FirstOrDefault(x => x.IsSupportedFileFormat(header));
                        if (decoder != null)
                        {
                            decoder.Decode(this, stream);
                            IsLoading = false;
                        }
                    }
                }

                if (IsLoading)
                {
                    IsLoading = false;

                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine("Image cannot be loaded. Available decoders:");

                    foreach (IImageDecoder decoder in decoders)
                    {
                        stringBuilder.AppendLine("-" + decoder);
                    }

                    throw new UnsupportedImageFormatException(stringBuilder.ToString());
                }
            }
            finally
            {
                stream.Dispose();
            }
        }
예제 #11
0
        public RadarPageViewModel()
        {
            if (IsInDesignMode == false)
            {
                Decoders.AddDecoder <GifDecoder>();

                this.ImageSource = new Uri(AppSettings.RadarAnimation, UriKind.Absolute);
            }
        }
예제 #12
0
        private LaserBaseResponse GetLaserBaseResponse()
        {
            LaserBaseResponse br = null;

            if (Decoders.ContainsValue(Decoder))
            {
                br = Decoders.FirstOrDefault(d => d.Value.Type == Decoder.Type).Value;
            }
            return(br);
        }
예제 #13
0
        private byte GetMsgType()
        {
            byte type = 0x00;

            if (Decoders.ContainsValue(Decoder))
            {
                type = Decoders.FirstOrDefault(d => d.Value.Type == Decoder.Type).Key;
            }
            return(type);
        }
예제 #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="App"/> class.
        /// </summary>
        /// <remarks>Registers all available image decoders that can be
        /// used in the whole application.</remarks>
        public App()
        {
            Startup += Application_Startup;

            UnhandledException += this.Application_UnhandledException;

            Decoders.AddDecoder <PngDecoder>();
            Decoders.AddDecoder <JpegDecoder>();
            Decoders.AddDecoder <BmpDecoder>();
            Decoders.AddDecoder <GifDecoder>();

            InitializeComponent();
        }
 public XmlReceiveVariant2()
 {
     Description = "XML receive micro pipeline.";
     Version     = new Version(1, 0);
     Decoders
     .Add(new FailedMessageRoutingEnablerComponent {
         SuppressRoutingFailureReport = false
     })
     .Add(new MicroPipelineComponent {
         Enabled = true
     });
     Disassemblers
     .Add(new XmlDasmComp());
 }
예제 #16
0
 public override bool Equals(object?obj)
 {
     try
     {
         return((obj is SessionConfiguration configuration) &&
                Encoders.SequenceEqual(configuration.Encoders) &&
                Decoders.SequenceEqual(configuration.Decoders) &&
                RecordingDirectory.Equals(configuration.RecordingDirectory));
     }
     catch (ArgumentNullException)
     {
         return(false);
     }
 }
        public void TestDecode()
        {
            using (var stream = GetStream())
            {
                var decoder = Decoders.GetDecoder <JObject>(stream);
                Assert.IsNotNull(decoder);
                Assert.AreEqual(typeof(JsonDecoder), decoder.GetType());

                var json = decoder.Decode(stream);
                Assert.AreEqual(1, json["A"].Value <int>());
                Assert.AreEqual("Lol", json["B"].ToString());
                Assert.IsTrue(json["C"].Value <bool>());
            }
        }
 public TrackingXmlReceiveVariant2()
 {
     Description = "XML receive pipeline with tracking.";
     Version     = new Version(1, 0);
     Decoders
     .Add(
         new FailedMessageRoutingEnablerComponent {
         SuppressRoutingFailureReport = false
     })
     .Add(
         new ActivityTrackerComponent {
         TrackingModes = ActivityTrackingModes.Context
     });
     Disassemblers
     .Add(new XmlDasmComp());
 }
예제 #19
0
 // Code to execute when the application is activated (brought to foreground)
 // This code will not execute when the application is first launched
 private void Application_Activated(object sender, ActivatedEventArgs e)
 {
     if (!e.IsApplicationInstancePreserved)
     {
         setCorrectLanguage();
         ThreadPool.QueueUserWorkItem(delegate
         {
             Decoders.AddDecoder <BmpDecoder>();
             Decoders.AddDecoder <PngDecoder>();
             Decoders.AddDecoder <GifDecoder>();
             Decoders.AddDecoder <JpegDecoder>();
         });
         ApplicationState.Current = ApplicationState.LoadState();
         PagesState.Current       = PagesState.LoadState();
         PicturesCache.Load();
     }
 }
예제 #20
0
        // Code to execute when the application is launching (eg, from Start)
        // This code will not execute when the application is reactivated
        private void Application_Launching(object sender, LaunchingEventArgs e)
        {
            setCorrectLanguage();

            //NonLinearNavigationService.Instance.Initialize(RootFrame);
            Settings.RunsCount++;
            ThreadPool.QueueUserWorkItem(delegate
            {
                Decoders.AddDecoder <BmpDecoder>();
                Decoders.AddDecoder <PngDecoder>();
                Decoders.AddDecoder <GifDecoder>();
                Decoders.AddDecoder <JpegDecoder>();
            });

            PagesState.Current = new PagesState();
            PicturesCache.Load();
        }
예제 #21
0
        public LaserBaseResponse LaserBaseResponse(byte[] sendData, byte[] recData)
        {
            LaserBaseResponse responseList = null;

            if (recData != null)
            {
                if (Decoders.ContainsKey(sendData[1]))
                {
                    Decoder = Decoders[sendData[1]];
                    if (Decoder != null)
                    {
                        responseList = Decoder.Decode(new OriginalBytes(DateTime.Now, recData));
                    }
                }
            }
            return(responseList);
        }
예제 #22
0
        public override object Process(object input)
        {
            var list = input as object[];
            var dets = list.First(z => z is DetectionInfo[]) as DetectionInfo[];

            var bb = dets.Select(z => new float[] { z.Rect.X, z.Rect.Y, z.Rect.X + z.Rect.Width, z.Rect.Y + z.Rect.Height, z.Conf }).ToArray();

            var ret = Decoders.nms(bb.ToList(), NmsThreshold);
            List <DetectionInfo> rr = new List <DetectionInfo>();

            for (int i = 0; i < ret.Length; i++)
            {
                rr.Add(dets[ret[i]]);
            }

            return(rr.ToArray());
        }
예제 #23
0
        public MainViewModel()
        {
            Decoders.AddDecoder <GifDecoder>();
            Uri           uri   = new Uri("Gif/explosion.gif", UriKind.Relative);
            ExtendedImage image = new ExtendedImage();

            // either of these two method work.
            // Just remove the first / to switch
            //*
            image.LoadingCompleted +=
                (o, e) => Dispatcher.BeginInvoke(() => AnimationImage = image);
            image.UriSource = uri;

            /*/
             * Stream stream = Application.GetResourceStream(uri).Stream;
             * GifDecoder decoder = new GifDecoder();
             * decoder.Decode(image, stream);
             * AnimationImage = image;
             * /**/
        }
예제 #24
0
        public void Load(Stream stream)
        {
            //Contract.Requires(stream != null);

            try
            {
                if (!stream.CanRead)
                {
                    throw new NotSupportedException("Cannot read from the stream.");
                }

                if (!stream.CanSeek)
                {
                    throw new NotSupportedException("The stream does not support seeking.");
                }

                List <IImageDecoder> decoders = Decoders.GetAvailableDecoders();

                if (decoders.Count > 0)
                {
                    int maxHeaderSize = FindMax(decoders);
                    if (maxHeaderSize > 0)
                    {
                        //temp header...
                        byte[] header = new byte[maxHeaderSize];
                        stream.Read(header, 0, maxHeaderSize);
                        stream.Position = 0;

                        var decoder = FindFirstSupport(decoders, header); //decoders.FirstOrDefault(x => x.IsSupportedFileFormat(header));
                        if (decoder != null)
                        {
                            decoder.Decode(this, stream);
                        }
                    }
                }
            }
            finally
            {
                stream.Dispose();
            }
        }
예제 #25
0
#pragma warning disable CS8618 // Non-nullable field is uninitialized. Consider declaring as nullable.
        public SessionManager(FilePath configurationPath,
                              IBootstrapper bootstrapper,
                              IConfigurationManager configurationManager,
                              IModuleManager moduleManager,
                              IFileSystem fileSystem)
        {
            this.moduleManager        = moduleManager;
            this.configurationManager = configurationManager;
            this.fileSystem           = fileSystem;

            GlobalHook.Initialize();

            bootstrapper.ComposeImports(this);
            bootstrapper.ComposeImports(configurationManager);
            bootstrapper.ComposeImports(moduleManager);

            configurationManager.LoadConfiguration(configurationPath);

            encoders = Encoders.Where(x => Configuration.Encoders.Contains(x.GetType()));
            decoders = Decoders.Where(x => Configuration.Decoders?.Contains(x.GetType()) ?? false);
        }
예제 #26
0
        public UVIndexPageViewModel()
        {
            Decoders.AddDecoder <GifDecoder>();

            if (IsInDesignMode == false)
            {
                this.ImageSource = new Uri("http://www.dmi.dk/dmi/1daymap.gif", UriKind.Absolute);

                UVIndexProvider.GetUVIndex((result) =>
                {
                    SmartDispatcher.BeginInvoke(() =>
                    {
                        NorthJytland         = result[0];
                        MiddleAndWestJytland = result[1];
                        EastJytland          = result[2];
                        SouthJytland         = result[3];
                        Fyn = result[4];
                        SouthAndWestZealand = result[5];
                        Copenhagen          = result[6];
                        Bornholm            = result[7];
                    });
                });
            }
        }
예제 #27
0
        private void ProcessSTAR(Decoders.STAR decoder, RadioLog.Common.SignalCode sigCode, uint unitID, uint tag, uint status, uint message)
        {
            Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "STAR: {0} on stream {1}", unitID, _sourceName);

            _silenceHelper.ClearSilenceStats();

            if (_sigDelegate != null)
            {
                string desc;
                if (!string.IsNullOrWhiteSpace(LastValidStreamTitle))
                {
                    desc = string.Format("Unit: {0}, Tag: {1}, Status: {2}, Message: {3}, Stream Title: {4}", unitID, tag, status, message, LastValidStreamTitle);
                }
                else
                {
                    desc = string.Format("Unit: {0}, Tag: {1}, Status: {2}, Message: {3}", unitID, tag, status, message);
                }
                RadioLog.Common.RadioSignalingItem sigItem = new Common.RadioSignalingItem(Common.SignalingSourceType.Streaming, _sourceName, RadioLog.Common.SignalingNames.STAR, sigCode, unitID.ToString(), desc, DateTime.Now, _recorder.CurrentFileName);
                _sigDelegate(sigItem);
            }
        }
예제 #28
0
 static ThemedImage()
 {
     Decoders.AddDecoder <BmpDecoder>();
     Decoders.AddDecoder <PngDecoder>();
     Decoders.AddDecoder <GifDecoder>();
 }
예제 #29
0
        public static ObjectDetectionInfo[] yoloBoxesDecode(Nnet net, int w, int h, float nms_tresh, double threshold, string[] allowedClasses = null)
        {
            List <ObjectDetectionInfo> ret = new List <ObjectDetectionInfo>();
            var f1 = net.Nodes.FirstOrDefault(z => z.Dims.Last() == 4);
            var f2 = net.Nodes.FirstOrDefault(z => z.Dims.Last() > 4);

            if (f1 == null || f2 == null)
            {
                return(null);
            }
            var nms   = Helpers.ReadResource("coco.names").Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToArray();
            var rets1 = net.OutputDatas[f2.Name] as float[];
            var rets3 = net.OutputDatas[f1.Name] as float[];
            var dims  = net.Nodes.First(z => z.IsInput).Dims;

            List <int>    indexes = new List <int>();
            List <double> confs   = new List <double>();
            List <int>    classes = new List <int>();
            Dictionary <int, List <int> >   perClassIndexes = new Dictionary <int, List <int> >();
            Dictionary <int, List <float> > perClassConfs   = new Dictionary <int, List <float> >();
            int pos = 0;
            var cnt = f2.Dims.Last();

            for (int i = 0; i < rets1.Length; i += cnt, pos++)
            {
                int    maxind = -1;
                double maxv   = double.NaN;
                for (int j = 0; j < cnt; j++)
                {
                    if (allowedClasses != null && !allowedClasses.Contains(nms[j]))
                    {
                        continue;
                    }

                    if (maxind == -1 || rets1[i + j] > maxv)
                    {
                        maxv   = rets1[i + j];
                        maxind = j;
                    }
                }
                if (maxind != -1 && maxv > threshold)
                {
                    confs.Add(maxv);
                    classes.Add(maxind);
                    indexes.Add(pos);
                    if (!perClassIndexes.ContainsKey(maxind))
                    {
                        perClassIndexes.Add(maxind, new List <int>());
                        perClassConfs.Add(maxind, new List <float>());
                    }
                    perClassIndexes[maxind].Add(pos);
                    perClassConfs[maxind].Add((float)maxv);
                }
            }



            List <int> res = new List <int>();

            foreach (var item in perClassIndexes)
            {
                List <float[]> boxes = new List <float[]>();
                for (int i = 0; i < item.Value.Count; i++)
                {
                    var box = rets3.Skip(item.Value[i] * 4).Take(4).ToArray();
                    boxes.Add(new float[] { box[0], box[1], box[2], box[3], (float)perClassConfs[item.Key][i] });
                }
                var res2 = Decoders.nms(boxes, nms_tresh);
                res.AddRange(res2.Select(z => item.Value[z]));
            }



            for (int i = 0; i < indexes.Count; i++)
            {
                if (!res.Contains(indexes[i]))
                {
                    continue;
                }
                int offset = indexes[i] * 4;
                //var box = rets3.Skip(indexes[i] * 4).Take(4).ToArray();
                ret.Add(new ObjectDetectionInfo()
                {
                    Class = classes[i],
                    Conf  = (float)confs[i],
                    Rect  = new Rect((int)(rets3[0 + offset] * w),
                                     (int)(rets3[1 + offset] * h),
                                     (int)((rets3[2 + offset] - rets3[0 + offset]) * w),
                                     (int)((rets3[3 + offset] - rets3[1 + offset]) * h)),
                    Label = nms[classes[i]]
                });
            }

            return(ret.ToArray());
        }
예제 #30
0
 public P25Message(RadioLog.Common.SafeBitArray message, Decoders.P25.Reference.DataUnitID duid)
     : base()
 {
     mMessage = message;
     mDUID = duid;
 }
예제 #31
0
 public GifViewer()
 {
     Decoders.AddDecoder <GifDecoder>();
     InitializeComponent();
 }
예제 #32
0
        //---------------------------------------------------------------------------------------------------------



        //Alle vorinstallierten Styles wiederherstellen
        //---------------------------------------------------------------------------------------------------------
        private void Restore_Click(object sender, RoutedEventArgs e)
        {
            //Abfrage ob wiederhergestellt werden soll
            if (MessageBox.Show(Lockscreen_Swap.AppResx.Z04_RestoreNote, Lockscreen_Swap.AppResx.Notification, MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                //Styles wiederherstellen
                for (int i = 1; i <= 9; i++)
                {
                    //Prüfen ob Style vorhanden ist
                    if (!file.FileExists("Styles/000000" + i + ".txt"))
                    {
                        //Style kopieren
                        using (Stream input = Application.GetResourceStream(new Uri("Styles/" + i + ".txt", UriKind.Relative)).Stream)
                        {
                            // Create a stream for the new file in the local folder.
                            using (filestream = file.CreateFile("Styles/000000" + i + ".txt"))
                            {
                                // Initialize the buffer.
                                byte[] readBuffer = new byte[4096];
                                int    bytesRead  = -1;

                                // Copy the file from the installation folder to the local folder.
                                while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0)
                                {
                                    filestream.Write(readBuffer, 0, bytesRead);
                                }
                            }
                        }

                        //Bilder in Styles Images kppieren
                        var tempImage = new WriteableBitmap(1, 1);

                        //Bild kopieren
                        using (Stream input = Application.GetResourceStream(new Uri("Images/StylesImages/" + i + ".png", UriKind.Relative)).Stream)
                        {
                            // Create a stream for the new file in the local folder.
                            using (filestream = file.CreateFile("StylesImages/000000" + i + ".1.png"))
                            {
                                // Initialize the buffer.
                                byte[] readBuffer = new byte[4096];
                                int    bytesRead  = -1;

                                // Copy the file from the installation folder to the local folder.
                                while ((bytesRead = input.Read(readBuffer, 0, readBuffer.Length)) > 0)
                                {
                                    filestream.Write(readBuffer, 0, bytesRead);
                                }
                            }
                        }
                        //Bild laden
                        byte[]       tempData;
                        MemoryStream tempMs;
                        using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
                        {
                            using (IsolatedStorageFileStream isfs = isf.OpenFile("StylesImages/000000" + i + ".1.png", FileMode.Open, FileAccess.Read))
                            {
                                tempData = new byte[isfs.Length];
                                isfs.Read(tempData, 0, tempData.Length);
                                isfs.Close();
                            }
                        }
                        tempMs = new MemoryStream(tempData);
                        tempImage.SetSource(tempMs);

                        //Bild Spiegeln
                        tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Vertical);

                        //Bild speichern
                        Decoders.AddDecoder <PngDecoder>();
                        var img     = tempImage.ToImage();
                        var encoder = new PngEncoder();
                        using (var stream = new IsolatedStorageFileStream("StylesImages/000000" + i + ".2.png", FileMode.Create, file))
                        {
                            encoder.Encode(img, stream);
                            stream.Close();
                        }

                        //Bild Spiegeln
                        tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Horizontal);

                        //Bild speichern
                        Decoders.AddDecoder <PngDecoder>();
                        img     = tempImage.ToImage();
                        encoder = new PngEncoder();
                        using (var stream = new IsolatedStorageFileStream("StylesImages/000000" + i + ".3.png", FileMode.Create, file))
                        {
                            encoder.Encode(img, stream);
                            stream.Close();
                        }
                        //Bild Spiegeln
                        tempImage = tempImage.Flip(WriteableBitmapExtensions.FlipMode.Vertical);

                        //Bild speichern
                        Decoders.AddDecoder <PngDecoder>();
                        img     = tempImage.ToImage();
                        encoder = new PngEncoder();
                        using (var stream = new IsolatedStorageFileStream("StylesImages/000000" + i + ".4.png", FileMode.Create, file))
                        {
                            encoder.Encode(img, stream);
                            stream.Close();
                        }
                    }

                    //Style in InstalledStyles schreiben
                    InstalledStyles += "000000" + i + ".txt;";
                    InstalledStyles  = InstalledStyles.Trim(new char[] { '\r', '\n' });
                    //Installierte Styles speichern
                    filestream = file.CreateFile("Settings/InstalledStyles.txt");
                    sw         = new StreamWriter(filestream);
                    sw.WriteLine(InstalledStyles);
                    sw.Flush();
                    filestream.Close();
                }

                //Bilderliste neu erstellen
                ActionIfSelect = false;
                try
                {
                    LBInstalled.SelectedIndex = -1;
                }
                catch
                {
                }
                CreateImages();
                ActionIfSelect = true;
                SelectImages();

                //Online Styles neu erstellen
                if (Source != "")
                {
                    CreateOnlineImages();
                }
            }
        }
예제 #33
0
 private static void MDCDelegate(Decoders.MDC1200 decoder, RadioLog.Common.SignalCode sigCode, int frameCount, byte op, byte arg, ushort unitID, byte extra0, byte extra1, byte extra2, byte extra3, string opMsg)
 {
     //
 }
예제 #34
0
        private void ProcessMDC1200(Decoders.MDC1200 decoder, RadioLog.Common.SignalCode sigCode, int frameCount, byte op, byte arg, ushort unitID, byte extra0, byte extra1, byte extra2, byte extra3, string opMsg)
        {
            Common.ConsoleHelper.ColorWriteLine(ConsoleColor.Magenta, "MDC: {0} on stream {1}", opMsg, _sourceName);

            _silenceHelper.ClearSilenceStats();

            if (_sigDelegate != null)
            {
                string desc = opMsg;
                if (!string.IsNullOrWhiteSpace(LastValidStreamTitle))
                {
                    desc += ", Stream Title=" + LastValidStreamTitle;
                }
                RadioLog.Common.RadioSignalingItem sigItem = new Common.RadioSignalingItem(Common.SignalingSourceType.Streaming, _sourceName, RadioLog.Common.SignalingNames.MDC, sigCode, string.Format("{0:X4}", unitID), desc, DateTime.Now, _recorder.CurrentFileName);
                _sigDelegate(sigItem);
            }
        }
예제 #35
0
 public PDUMessage(RadioLog.Common.SafeBitArray message, Decoders.P25.Reference.DataUnitID duid) : base(message, duid) { }