Exemplo n.º 1
0
        public string GetAlpacaFormData()
        {
            //var InvC = new CultureInfo("");
            var normalmeantemps = new JsonNOAASettingsNormalMeanTemps()
            {
                jan = Math.Round(cumulus.NOAAconf.TempNorms[1], cumulus.TempDPlaces),
                feb = Math.Round(cumulus.NOAAconf.TempNorms[2], cumulus.TempDPlaces),
                mar = Math.Round(cumulus.NOAAconf.TempNorms[3], cumulus.TempDPlaces),
                apr = Math.Round(cumulus.NOAAconf.TempNorms[4], cumulus.TempDPlaces),
                may = Math.Round(cumulus.NOAAconf.TempNorms[5], cumulus.TempDPlaces),
                jun = Math.Round(cumulus.NOAAconf.TempNorms[6], cumulus.TempDPlaces),
                jul = Math.Round(cumulus.NOAAconf.TempNorms[7], cumulus.TempDPlaces),
                aug = Math.Round(cumulus.NOAAconf.TempNorms[8], cumulus.TempDPlaces),
                sep = Math.Round(cumulus.NOAAconf.TempNorms[9], cumulus.TempDPlaces),
                oct = Math.Round(cumulus.NOAAconf.TempNorms[10], cumulus.TempDPlaces),
                nov = Math.Round(cumulus.NOAAconf.TempNorms[11], cumulus.TempDPlaces),
                dec = Math.Round(cumulus.NOAAconf.TempNorms[12], cumulus.TempDPlaces)
            };

            var normalrain = new JsonNOAASettingsNormalRain()
            {
                jan = Math.Round(cumulus.NOAAconf.RainNorms[1], cumulus.RainDPlaces),
                feb = Math.Round(cumulus.NOAAconf.RainNorms[2], cumulus.RainDPlaces),
                mar = Math.Round(cumulus.NOAAconf.RainNorms[3], cumulus.RainDPlaces),
                apr = Math.Round(cumulus.NOAAconf.RainNorms[4], cumulus.RainDPlaces),
                may = Math.Round(cumulus.NOAAconf.RainNorms[5], cumulus.RainDPlaces),
                jun = Math.Round(cumulus.NOAAconf.RainNorms[6], cumulus.RainDPlaces),
                jul = Math.Round(cumulus.NOAAconf.RainNorms[7], cumulus.RainDPlaces),
                aug = Math.Round(cumulus.NOAAconf.RainNorms[8], cumulus.RainDPlaces),
                sep = Math.Round(cumulus.NOAAconf.RainNorms[9], cumulus.RainDPlaces),
                oct = Math.Round(cumulus.NOAAconf.RainNorms[10], cumulus.RainDPlaces),
                nov = Math.Round(cumulus.NOAAconf.RainNorms[11], cumulus.RainDPlaces),
                dec = Math.Round(cumulus.NOAAconf.RainNorms[12], cumulus.RainDPlaces)
            };

            var site = new JsonNOAASettingsSite()
            {
                sitename = cumulus.NOAAconf.Name,
                city     = cumulus.NOAAconf.City,
                state    = cumulus.NOAAconf.State
            };

            var files = new JsonNOAASettingsOutput()
            {
                monthfileformat = cumulus.NOAAconf.MonthFile,
                yearfileformat  = cumulus.NOAAconf.YearFile
            };

            var options = new JsonNOAASettingsOptions()
            {
                timeformat = cumulus.NOAAconf.Use12hour ? 1 : 0,
                utf8       = cumulus.NOAAconf.UseUtf8,
                dotdecimal = cumulus.NOAAconf.UseDotDecimal,
                minmaxavg  = cumulus.NOAAconf.UseMinMaxAvg
            };

            var ftp = new JsonNOAASettingsFtpCopy()
            {
                autotransfer = cumulus.NOAAconf.AutoFtp,
                dstfolder    = cumulus.NOAAconf.FtpFolder
            };

            var copy = new JsonNOAASettingsFtpCopy()
            {
                autotransfer = cumulus.NOAAconf.AutoCopy,
                dstfolder    = cumulus.NOAAconf.CopyFolder
            };

            var thresh = new JsonNOAASettingsThresholds()
            {
                heatingthreshold = Math.Round(cumulus.NOAAconf.HeatThreshold, cumulus.TempDPlaces),
                coolingthreshold = Math.Round(cumulus.NOAAconf.CoolThreshold, cumulus.TempDPlaces),
                maxtempcomp1     = Math.Round(cumulus.NOAAconf.MaxTempComp1, cumulus.RainDPlaces),
                maxtempcomp2     = Math.Round(cumulus.NOAAconf.MaxTempComp2, cumulus.RainDPlaces),
                mintempcomp1     = Math.Round(cumulus.NOAAconf.MinTempComp1, cumulus.RainDPlaces),
                mintempcomp2     = Math.Round(cumulus.NOAAconf.MinTempComp2, cumulus.RainDPlaces),
                raincomp1        = Math.Round(cumulus.NOAAconf.RainComp1, cumulus.RainDPlaces),
                raincomp2        = Math.Round(cumulus.NOAAconf.RainComp2, cumulus.RainDPlaces),
                raincomp3        = Math.Round(cumulus.NOAAconf.RainComp3, cumulus.RainDPlaces)
            };

            var data = new JsonNOAASettingsData()
            {
                accessible = cumulus.ProgramOptions.EnableAccessibility,
                autosave   = cumulus.NOAAconf.Create,

                sitedetails     = site,
                outputfiles     = files,
                options         = options,
                ftp             = ftp,
                copy            = copy,
                thresholds      = thresh,
                normalmeantemps = normalmeantemps,
                normalrain      = normalrain
            };

            return(data.ToJson());
        }
Exemplo n.º 2
0
        public string GetNoaaAlpacaFormData()
        {
            //var InvC = new CultureInfo("");
            var normalmeantemps = new JsonNOAASettingsNormalMeanTemps()
            {
                jan = Math.Round(cumulus.NOAATempNorms[1], cumulus.TempDPlaces),
                feb = Math.Round(cumulus.NOAATempNorms[2], cumulus.TempDPlaces),
                mar = Math.Round(cumulus.NOAATempNorms[3], cumulus.TempDPlaces),
                apr = Math.Round(cumulus.NOAATempNorms[4], cumulus.TempDPlaces),
                may = Math.Round(cumulus.NOAATempNorms[5], cumulus.TempDPlaces),
                jun = Math.Round(cumulus.NOAATempNorms[6], cumulus.TempDPlaces),
                jul = Math.Round(cumulus.NOAATempNorms[7], cumulus.TempDPlaces),
                aug = Math.Round(cumulus.NOAATempNorms[8], cumulus.TempDPlaces),
                sep = Math.Round(cumulus.NOAATempNorms[9], cumulus.TempDPlaces),
                oct = Math.Round(cumulus.NOAATempNorms[10], cumulus.TempDPlaces),
                nov = Math.Round(cumulus.NOAATempNorms[11], cumulus.TempDPlaces),
                dec = Math.Round(cumulus.NOAATempNorms[12], cumulus.TempDPlaces)
            };

            var normalrain = new JsonNOAASettingsNormalRain()
            {
                jan = Math.Round(cumulus.NOAARainNorms[1], cumulus.RainDPlaces),
                feb = Math.Round(cumulus.NOAARainNorms[2], cumulus.RainDPlaces),
                mar = Math.Round(cumulus.NOAARainNorms[3], cumulus.RainDPlaces),
                apr = Math.Round(cumulus.NOAARainNorms[4], cumulus.RainDPlaces),
                may = Math.Round(cumulus.NOAARainNorms[5], cumulus.RainDPlaces),
                jun = Math.Round(cumulus.NOAARainNorms[6], cumulus.RainDPlaces),
                jul = Math.Round(cumulus.NOAARainNorms[7], cumulus.RainDPlaces),
                aug = Math.Round(cumulus.NOAARainNorms[8], cumulus.RainDPlaces),
                sep = Math.Round(cumulus.NOAARainNorms[9], cumulus.RainDPlaces),
                oct = Math.Round(cumulus.NOAARainNorms[10], cumulus.RainDPlaces),
                nov = Math.Round(cumulus.NOAARainNorms[11], cumulus.RainDPlaces),
                dec = Math.Round(cumulus.NOAARainNorms[12], cumulus.RainDPlaces)
            };

            var site = new JsonNOAASettingsSite()
            {
                sitename = cumulus.NOAAname,
                city     = cumulus.NOAAcity,
                state    = cumulus.NOAAstate
            };

            var files = new JsonNOAASettingsOutput()
            {
                monthfileformat = cumulus.NOAAMonthFileFormat,
                yearfileformat  = cumulus.NOAAYearFileFormat
            };

            var options = new JsonNOAASettingsOptions()
            {
                timeformat = cumulus.NOAA12hourformat ? 1 : 0,
                utf8       = cumulus.NOAAUseUTF8,
                dotdecimal = cumulus.NOAAUseDotDecimal
            };

            var ftp = new JsonNOAASettingsFtp()
            {
                autoftp      = cumulus.NOAAAutoFTP,
                ftpdirectory = cumulus.NOAAFTPDirectory
            };

            var thresh = new JsonNOAASettingsThresholds()
            {
                heatingthreshold = Math.Round(cumulus.NOAAheatingthreshold, cumulus.TempDPlaces),
                coolingthreshold = Math.Round(cumulus.NOAAcoolingthreshold, cumulus.TempDPlaces),
                maxtempcomp1     = Math.Round(cumulus.NOAAmaxtempcomp1, cumulus.RainDPlaces),
                maxtempcomp2     = Math.Round(cumulus.NOAAmaxtempcomp2, cumulus.RainDPlaces),
                mintempcomp1     = Math.Round(cumulus.NOAAmintempcomp1, cumulus.RainDPlaces),
                mintempcomp2     = Math.Round(cumulus.NOAAmintempcomp2, cumulus.RainDPlaces),
                raincomp1        = Math.Round(cumulus.NOAAraincomp1, cumulus.RainDPlaces),
                raincomp2        = Math.Round(cumulus.NOAAraincomp2, cumulus.RainDPlaces),
                raincomp3        = Math.Round(cumulus.NOAAraincomp3, cumulus.RainDPlaces)
            };

            var data = new JsonNOAASettingsData()
            {
                autosave = cumulus.NOAAAutoSave,

                sitedetails     = site,
                outputfiles     = files,
                options         = options,
                ftp             = ftp,
                thresholds      = thresh,
                normalmeantemps = normalmeantemps,
                normalrain      = normalrain
            };

            return(data.ToJson());
        }