Exemplo n.º 1
0
        private void ProcessORP(CloudORPColor map, JProperty p)
        {
            string regionName = Util.GetRegionNameByColor(map.color);

            if (!onlyEnumeration)
            {
                Util.curModelOutput += regionName == "" ? map.color : regionName + Environment.NewLine;
            }
            List <CloudMaskSpectrum> cms = Model.Cloud.MaskSpectrumGetCoodsByColor(map.color.Trim(), curModelName);
            string coods = cms.Count > 0 ? cms.First().coods : "";

            if (coods != "")
            {
                List <Color> colors     = new List <Color>();
                int          sizeRegion = 0;
                foreach (JArray point in JsonConvert.DeserializeObject <JArray>(coods))
                {
                    if ((int)point[0] >= 0 && (int)point[1] >= 0)
                    {
                        if (bmp.Width <= (int)point[0] || bmp.Height <= (int)point[1])
                        {
                            Util.l($"Chybná maska pro: {curModelName}/{curSubmodelName}");
                            return;
                        }
                        Color c = bmp.GetPixel((int)point[0], (int)point[1]);
                        colors.Add(c);
                        sizeRegion++;
                    }
                }

                Task.Run(() => ProcessORPgetValue(map.color, colors, p, coods, regionName, sizeRegion));
            }
        }
Exemplo n.º 2
0
        public bool ORPColorInsertOrUpdate(CloudORPColor item)
        {
            using (IDbConnection conn = new SqlConnection(Model.ConnStr("Cloud")))
            {
                List <CloudORPColor> records = new List <CloudORPColor>();
                records.Add(item);
                conn.Execute("dbo.ORP_COLOR_InsertOrUpdateData @ID_ORP, @COLOR", records);

                return(true);
            }
        }
Exemplo n.º 3
0
        public void ReadCSVFileORPColor(string filename)
        {
            using (var reader = new StreamReader(filename))
            {
                List <CloudORPColor> listOfRecords = new List <CloudORPColor>();
                var header = reader.ReadLine(); //načte hlavičku
                while (!reader.EndOfStream)
                {
                    var line   = reader.ReadLine();
                    var values = line.Split(';');

                    //CloudORPColor record = new CloudORPColor(values[0], $"#{values[1].Substring(2,6)}");
                    Util.l(values[0]);
                    CloudORPColor record = new CloudORPColor(values[0], values[1]);
                    listOfRecords.Add(record);
                }
                Util.l(header);
                foreach (var r in listOfRecords)
                {
                    Util.l($"{r.id_orp}:{r.color}");
                    Model.Cloud.ORPColorInsertOrUpdate(r);
                }
            }
        }