예제 #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            //per https://docs.microsoft.com/en-us/aspnet/core/migration/22-to-30?view=aspnetcore-3.1&tabs=visual-studio#routing-startup-code
            // static files should be called before UseRouting
            StaticFiles.Configure(app, env);

            app.UseRouting();
            Cors.Configure(app, env);
            Authentication.Configure(app, env);


            app.UseEndpoints(endpoints => {
                endpoints.MapControllers();
                endpoints.MapHub <ChatHub>("/chathub");
                endpoints.MapHub <NotificationHub>("/notificationhub");
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHttpsRedirection();
                app.UseDeveloperExceptionPage();
                app.UseHsts();
            }

            MVC.Configure(app, env);

            SPA.Configure(app, env);
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            Authentication.Configure(app, env);

            Cors.Configure(app, env);

            //app.UseSignalR(routes =>
            //{
            //    routes.MapHub<ChatHub>("/chathub");
            //});

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseHttpsRedirection();
                app.UseDeveloperExceptionPage();
                app.UseHsts();
            }

            MVC.Configure(app, env);

            SPA.Configure(app, env);

            StaticFiles.Configure(app, env);
        }
        private string ReadLastConcurrentInfo()
        {
            DirectoryInfo   dir           = new DirectoryInfo(DataStoreDirectory);
            List <FileInfo> lXMLFilesInfo =
                dir.GetFiles(ConventionalTransitions.ImageConcurrentDataFilesNamesPattern(), SearchOption.AllDirectories)
                .ToList();

            lXMLFilesInfo.Sort((finfo1, finfo2) => finfo1.CreationTimeUtc.CompareTo(finfo2.CreationTimeUtc));

            Dictionary <string, object> dictReadXMLfileData =
                ServiceTools.ReadDictionaryFromXML(lXMLFilesInfo.Last().FullName);

            DateTime utcNow = DateTime.UtcNow;
            DateTime concurrentDataDateTime = DateTime.Parse(dictReadXMLfileData["DateTime"] as string);

            concurrentDataDateTime = concurrentDataDateTime.ToUniversalTime();

            string strDataToReport = "Current server date/time UTC: " + utcNow.ToString("dd.MM.yyyy HH:mm:ss") +
                                     Environment.NewLine;

            strDataToReport += "Concurrent data date/time UTC: " +
                               concurrentDataDateTime.ToString("dd.MM.yyyy HH:mm:ss") +
                               Environment.NewLine;
            strDataToReport += "time elapsed since last shot: " +
                               Math.Round((utcNow - concurrentDataDateTime).TotalSeconds) + "s" + Environment.NewLine;


            GPSdata gps = new GPSdata((string)dictReadXMLfileData["GPSdata"], GPSdatasources.CloudCamArduinoGPS,
                                      concurrentDataDateTime);

            strDataToReport += "GPS: " + gps.HRString(2) + Environment.NewLine;
            SPA spaCalcObject        = null;
            AzimuthZenithAngle angle = gps.SunZenithAzimuth(out spaCalcObject);


            DateTime  dtSunriseUTC  = utcNow;
            TimeOfDay todSunriseUTC = new TimeOfDay(spaCalcObject.spa.sunrise);

            dtSunriseUTC = new DateTime(dtSunriseUTC.Year, dtSunriseUTC.Month, dtSunriseUTC.Day, todSunriseUTC.hour,
                                        todSunriseUTC.minute, todSunriseUTC.second, DateTimeKind.Utc);


            // TimeZoneInfo mowTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Russian Standard Time");
            TimeZoneInfo mowTimeZone  = TimeZoneInfo.Local;
            DateTime     dtSunriseMOW = TimeZoneInfo.ConvertTimeFromUtc(dtSunriseUTC, mowTimeZone);

            strDataToReport += "Sunrise Moscow time: " + (dtSunriseMOW.TimeOfDay.ToString()) + Environment.NewLine;

            DateTime  dtSunsetUTC  = utcNow;
            TimeOfDay todSunsetUTC = new TimeOfDay(spaCalcObject.spa.sunset);

            dtSunsetUTC = new DateTime(dtSunsetUTC.Year, dtSunsetUTC.Month, dtSunsetUTC.Day, todSunsetUTC.hour,
                                       todSunsetUTC.minute, todSunsetUTC.second, DateTimeKind.Utc);
            DateTime dtSunsetMOW = TimeZoneInfo.ConvertTimeFromUtc(dtSunsetUTC, mowTimeZone);

            strDataToReport += "Sunset Moscow time: " + (dtSunsetMOW.TimeOfDay.ToString()) + Environment.NewLine;

            return(strDataToReport);
        }
예제 #4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ConfigureAppSettings(services);

            DependencyInjection.ConfigureServices(services, Configuration);

            Cors.ConfigureServices(services);

            Authentication.ConfigureServices(services, Configuration);

            MVC.ConfigureServices(services);

            SPA.ConfigureServices(services);
        }
예제 #5
0
        public string TratarDadosRetorno()
        {
            Console.WriteLine("    Factory SPA :: Transforma Dados entre Webhook -> Bereau");
            SPA modelo = new SPA();

            Console.WriteLine("    Factory SPA  :: Instanciando Business Especifica");
            SPABusiness _bussines = new SPABusiness();


            Console.WriteLine("    Factory SPA :: Salvando Dados");
            _bussines.Salvar(modelo);

            return("Dados Tratados com sucesso");
        }
예제 #6
0
파일: SPA.cs 프로젝트: hawksprite/PK_Bash
 void Awake()
 {
     if (_instance == null)
     {
         //If I am the first instance, make me the Singleton
         _instance = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         //If a Singleton already exists and you find
         //another reference in scene, destroy it!
         if (this != _instance)
             Destroy(this.gameObject);
     }
 }
예제 #7
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseDeveloperExceptionPage();
                app.UseHsts();
            }

            app.UseHttpsRedirection();

            Cors.Configure(app, env);

            Authentication.Configure(app, env);

            MVC.Configure(app, env);

            SPA.Configure(app, env);

            StaticFiles.Configure(app, env);
        }
예제 #8
0
 /// <summary>Sets this fontface up as a bitmap font.</summary>
 public void SetupBitmapFont(SPA spa)
 {
     // Apply BFD:
     BitmapFontData = spa;
     RequiresLoad   = false;
 }
        private void btnProcess_Click(object sender, EventArgs e)
        {
            string fName = richTextBox1.Text;

            if (!File.Exists(fName))
            {
                theLogWindow = ServiceTools.LogAText(theLogWindow, "couldn`t find a file: " + fName);
                return;
            }

            try
            {
                xlApp         = new Microsoft.Office.Interop.Excel.Application();
                xlApp.Visible = true;
                wb            = xlApp.Workbooks.Open(fName, Type.Missing, false);
                ws            = wb.Sheets[1];
            }
            catch (Exception)
            {
                CloseAll();
            }


            List <Tuple <int, SunElevationTestDataRecord> > lRecords = new List <Tuple <int, SunElevationTestDataRecord> >();
            int    rowIdx        = 2;
            double dDataTimeRead = 0.0d;

            while (true)
            {
                DateTime dtVal;
                SunElevationTestDataRecord currRec = new SunElevationTestDataRecord();

                System.Windows.Forms.Application.DoEvents();

                try
                {
                    Range rngDT = ws.Cells[rowIdx, 1];
                    var   dDataTimeReadValue = rngDT.Value2;
                    if (dDataTimeReadValue == null)
                    {
                        theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                             "date-time value at row " + rowIdx + " is empty. Stopping reading.");
                        CloseAll();
                        break;
                    }
                    dDataTimeRead = (double)(dDataTimeReadValue);
                    if (dDataTimeRead == 0.0d)
                    {
                        theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                             "date-time value at row " + rowIdx + " is empty. Stopping reading.");
                        CloseAll();
                        break;
                    }
                }
                catch (Exception ex)
                {
                    //CloseAll();
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                         ex.Message + Environment.NewLine + "for date-time value at row " + rowIdx);
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    lRecords.Add(new Tuple <int, SunElevationTestDataRecord>(rowIdx, currRec));
                    rowIdx++;
                    continue;
                }
                dtVal      = DateTime.FromOADate(dDataTimeRead);
                currRec.Dt = dtVal;



                double latVal = 0.0d;
                try
                {
                    Range rngLat    = ws.Cells[rowIdx, 2];
                    var   rngLatVal = rngLat.Value2;
                    if (rngLatVal == null)
                    {
                        theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                             "latitude value at row " + rowIdx + " is empty");
                        //rowIdx++;
                        //continue;
                    }
                    else
                    {
                        latVal         = (double)(rngLatVal);
                        currRec.latDec = latVal;
                    }
                }
                catch (Exception ex)
                {
                    //CloseAll();
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                         ex.Message + Environment.NewLine + "for latitude value at row " + rowIdx);
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    lRecords.Add(new Tuple <int, SunElevationTestDataRecord>(rowIdx, currRec));
                    rowIdx++;
                    continue;
                }



                double lonVal = 0.0d;
                try
                {
                    Range rngLon    = ws.Cells[rowIdx, 3];
                    var   rngLonVal = rngLon.Value2;
                    if (rngLonVal == null)
                    {
                        theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                             "longitude value at row " + rowIdx + " is empty");
                        //rowIdx++;
                        //continue;
                    }
                    else
                    {
                        lonVal         = (double)(rngLonVal);
                        currRec.lonDec = lonVal;
                    }
                }
                catch (Exception ex)
                {
                    //CloseAll();
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                         ex.Message + Environment.NewLine + "for longitude value at row " + rowIdx);
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    lRecords.Add(new Tuple <int, SunElevationTestDataRecord>(rowIdx, currRec));
                    rowIdx++;
                    continue;
                }



                double sunAltTestVal = 0.0d;
                try
                {
                    Range rngSunAltTest    = ws.Cells[rowIdx, 4];
                    var   rngSunAltTestVal = rngSunAltTest.Value2;
                    if (rngSunAltTestVal == null)
                    {
                        theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                             "testing sun elevation value at row " + rowIdx + " is empty");
                        //rowIdx++;
                        //continue;
                    }
                    else
                    {
                        sunAltTestVal       = (double)(rngSunAltTestVal);
                        currRec.SunElevTest = sunAltTestVal;
                    }
                }
                catch (Exception ex)
                {
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    theLogWindow = ServiceTools.LogAText(theLogWindow,
                                                         ex.Message + Environment.NewLine + "for read sun elevation value at row " + rowIdx);
                    theLogWindow = ServiceTools.LogAText(theLogWindow, "=====================");
                    //CloseAll();
                    lRecords.Add(new Tuple <int, SunElevationTestDataRecord>(rowIdx, currRec));
                    rowIdx++;
                    continue;
                }



                ThreadSafeOperations.SetText(lblLoadingStatus, "loading " + rowIdx + " row", false);

                lRecords.Add(new Tuple <int, SunElevationTestDataRecord>(rowIdx, currRec));

                rowIdx++;
            }



            List <double> lDeviations = new List <double>();
            string        outFName    = Path.GetDirectoryName(fName) + "\\" + Path.GetFileNameWithoutExtension(fName) + "-output.txt";

            ServiceTools.logToTextFile(outFName, SunElevationTestDataRecord.TableFieldsHeader() + Environment.NewLine, true);

            foreach (Tuple <int, SunElevationTestDataRecord> tpl in lRecords)
            {
                rowIdx = tpl.Item1;
                SunElevationTestDataRecord currRec = tpl.Item2;

                if (currRec.WhetherAllValuesHasBeenRead)
                {
                    SPA spaCalc = new SPA(currRec.Dt.Year, currRec.Dt.Month, currRec.Dt.Day, currRec.Dt.Hour,
                                          currRec.Dt.Minute, currRec.Dt.Second, (float)currRec.lonDec, (float)currRec.latDec,
                                          (float)SPAConst.DeltaT(currRec.Dt));
                    int res = spaCalc.spa_calculate();
                    AzimuthZenithAngle sunPositionSPAext = new AzimuthZenithAngle(spaCalc.spa.azimuth,
                                                                                  spaCalc.spa.zenith);
                    currRec.SunElevCalc = sunPositionSPAext.ElevationAngle;

                    lDeviations.Add(currRec.SunElevCalc - currRec.SunElevTest);

                    ServiceTools.logToTextFile(outFName, currRec.ToString() + Environment.NewLine, true);
                }
                else
                {
                    ServiceTools.logToTextFile(outFName, currRec.ToString() + Environment.NewLine, true);
                }
            }


            HistogramDataAndProperties histData = new HistogramDataAndProperties(DenseVector.OfEnumerable(lDeviations), 20);
            HistogramCalcAndShowForm   histForm = new HistogramCalcAndShowForm("", defaultProperties);

            histForm.HistToRepresent = histData;
            histForm.Show();
            histForm.Represent();


            CloseAll();
        }
예제 #10
0
        public void Load(Reader reader)
        {
            // Read the header:
            reader.ReadString(6);

            Width  = reader.ReadInt16();
            Height = reader.ReadInt16();

            if (HostSPA == null)
            {
                // Create the host SPA (default 100fps):
                HostSPA = new SPA(Width, Height, 100);
            }

            // Apply parent:
            HostSPA.ParentGif = this;

            byte packed = (byte)reader.ReadByte();

            bool colorTableFlag = ((packed & 0x80) >> 7) == 1;

            ColorResolution = (byte)((packed & 0x60) >> 5);
            SortFlags       = ((byte)(packed & 0x10)) >> 4;

            // Background index (unused):
            byte bgIndex = (byte)reader.ReadByte();

            PixelAspect = (byte)reader.ReadByte();

            Color32[] globalColorTable = null;
            BackgroundColour = new Color32(0, 0, 0, 0);

            if (colorTableFlag)
            {
                int colorTableSize = ((int)2) << (packed & 7);

                globalColorTable = LoadPalette(reader.ReadBytes(colorTableSize * 3));

                if (bgIndex < globalColorTable.Length)
                {
                    BackgroundColour = globalColorTable[bgIndex];
                }
            }

            byte nextFlag   = (byte)reader.ReadByte();
            int  frameCount = 0;
            int  gcbCount   = 0;

            Color32[]        previousFrame = null;
            List <SPASprite> spaFrames     = new List <SPASprite>();
            List <GifFrame>  frames        = new List <GifFrame>();

            while (nextFlag != GifBlocks.Terminator)
            {
                if (nextFlag == GifBlocks.ImageLabel)
                {
                    GifFrame frame;

                    if (frames.Count <= frameCount)
                    {
                        // Create the frame now:
                        frame = new GifFrame(this, frameCount);
                        frames.Add(frame);
                    }
                    else
                    {
                        // Load it:
                        frame = frames[frameCount];
                    }

                    // Drop zero-delay frames from the output.
                    // - This makes "full colour" GIFs work.
                    if (frame.Delay != 0f || spaFrames.Count == 0)
                    {
                        spaFrames.Add(frame);
                    }

                    previousFrame = ReadFrame(previousFrame, frame, reader, globalColorTable);
                    frameCount++;
                }
                else if (nextFlag == GifBlocks.ExtensionIntroducer)
                {
                    int gcl = reader.ReadByte();

                    switch (gcl)
                    {
                    case GifBlocks.GraphicControlLabel:

                        int blockSize = reader.ReadByte();

                        if (blockSize != 4)
                        {
                            throw new Exception("A graphic extension block had the wrong size in a GIF stream.");
                        }

                        byte gPacked          = (byte)reader.ReadByte();
                        bool transparencyFlag = (gPacked & 0x01) == 1;
                        int  disposalMethod   = (gPacked & 0x1C) >> 2;

                        // Frame delay in seconds:
                        float delay = (float)reader.ReadInt16() / 100f;

                        byte transparencyIndex = (byte)reader.ReadByte();

                        // Terminal 0:
                        reader.ReadByte();

                        GifFrame frame;

                        if (frames.Count <= gcbCount)
                        {
                            // Create the frame now:
                            frame = new GifFrame(this, gcbCount);
                            frames.Add(frame);
                        }
                        else
                        {
                            // Load it:
                            frame = frames[gcbCount];
                        }

                        // Apply delay:
                        frame.Delay          = delay;
                        frame.DisposalMethod = disposalMethod;

                        if (transparencyFlag)
                        {
                            frame.TransparencyIndex = transparencyIndex;
                        }
                        else
                        {
                            frame.TransparencyIndex = -1;
                        }

                        gcbCount++;

                        break;

                    case GifBlocks.CommentLabel:

                        CommentBlock commentBlock = new CommentBlock();
                        commentBlock.Load(reader);
                        Blocks.Add(commentBlock);

                        break;

                    case GifBlocks.ApplicationExtensionLabel:

                        ApplicationExtensionBlock appBlock = new ApplicationExtensionBlock();
                        appBlock.Load(reader);
                        Blocks.Add(appBlock);

                        break;

                    case GifBlocks.PlainTextLabel:

                        PlainTextBlock texBlock = new PlainTextBlock();
                        texBlock.Load(reader);
                        Blocks.Add(texBlock);

                        break;
                    }
                }
                else if (nextFlag == GifBlocks.EndIntroducer)
                {
                    break;
                }

                nextFlag = reader.ReadByte();
            }

            Frames = frames.ToArray();

            // Apply the frames to the host SPA:
            HostSPA.Sprites = spaFrames.ToArray();
        }