コード例 #1
0
        public async Task <ProblemsDto> GetProblemsV2Async(IEnumerable <WithOrWithout <ProblemFields> > fields = null, string nextPageKey = null, int?pageSize = null,
                                                           Timeframe from = null, Timeframe to = null, ProblemSelector problemSelector = null, EntitySelector entitySelector = null, IEnumerable <AscendingOrDescending <ProblemSorts> > sort = null,
                                                           CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(fields)] = string.Join(",", (fields ?? Enumerable.Empty <WithOrWithout <ProblemFields> >())
                                               .Distinct()
                                               .Select(x => $"+{x.ToString().ToCamelCase()}")),
                [nameof(nextPageKey)]     = nextPageKey,
                [nameof(pageSize)]        = pageSize,
                [nameof(from)]            = from?.ToString(),
                [nameof(to)]              = to?.ToString(),
                [nameof(problemSelector)] = problemSelector?.ToString(),
                [nameof(entitySelector)]  = entitySelector?.ToString(),
                [nameof(sort)]            = string.Join(",", sort ?? Enumerable.Empty <AscendingOrDescending <ProblemSorts> >())
                                            .Distinct()
                                            .Select(x => x.ToString().ToCamelCase())
            };

            var response = await GetProblemsV2Url()
                           .SetQueryParams(queryParamValues)
                           .GetJsonWithErrorCheckingAsync <ProblemsDto>(cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
コード例 #2
0
        public async Task <Slo> GetServiceLevelObjectiveAsync(string id, Timeframe from = null, Timeframe to = null, CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(from)] = from?.ToString(),
                [nameof(to)]   = to?.ToString()
            };

            var response = await GetServiceLevelObjectivesUrl()
                           .AppendPathSegment(id)
                           .SetQueryParams(queryParamValues)
                           .GetJsonWithErrorCheckingAsync <Slo>(cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
コード例 #3
0
        public async Task <Entity> GetMonitoredEntityV2Async(string entityId, Timeframe from     = null, Timeframe to = null, IEnumerable <WithOrWithout <ProblemFields> > fields = null,
                                                             CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(from)]   = from?.ToString(),
                [nameof(to)]     = to?.ToString(),
                [nameof(fields)] = string.Join(",", (fields ?? Enumerable.Empty <WithOrWithout <ProblemFields> >())
                                               .Distinct()
                                               .Select(x => $"+{x.ToString().ToCamelCase()}"))
            };

            var response = await GetMonitoredEntitiesV2Url()
                           .AppendPathSegment(entityId)
                           .SetQueryParams(queryParamValues)
                           .GetJsonWithErrorCheckingAsync <Entity>(cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
コード例 #4
0
        public async Task <UpdateJobList> GetAutoUpdateJobsAsync(string agId, Timeframe from         = null, Timeframe to = null, VersionCompareTypes?startVersionCompareType = null, string startVersion = null,
                                                                 AutoUpdateJobUpdateTypes?updateType = null, VersionCompareTypes?targetVersionCompareType = null, string targetVersion = null, CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(from)] = from?.ToString(),
                [nameof(to)]   = to?.ToString(),
                [nameof(startVersionCompareType)] = s_versionCompareTypesConverter.ConvertToString(startVersionCompareType),
                [nameof(startVersion)]            = startVersion,
                [nameof(updateType)] = s_autoUpdateJobUpdateTypesConverter.ConvertToString(updateType),
                [nameof(targetVersionCompareType)] = s_versionCompareTypesConverter.ConvertToString(targetVersionCompareType),
                [nameof(targetVersion)]            = targetVersion
            };

            var response = await GetActiveGatesAutoUpdateJobsUrl(agId)
                           .SetQueryParams(queryParamValues)
                           .GetJsonWithErrorCheckingAsync <UpdateJobList>(cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
コード例 #5
0
        public async Task <MetricDescriptorCollection> GetAllAvailableMetricsV2Async(MetricResultFormats?resultFormat = null, string nextPageKey            = null, int?pageSize = null, IEnumerable <string> metricSelector = null,
                                                                                     string text = null, IEnumerable <WithOrWithout <MetricFields> > fields = null, Timeframe writtenSince = null,
                                                                                     CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(nextPageKey)]    = nextPageKey,
                [nameof(pageSize)]       = pageSize,
                [nameof(metricSelector)] = string.Join(",", metricSelector ?? Enumerable.Empty <string>()),
                [nameof(text)]           = text,
                [nameof(fields)]         = string.Join(",", (fields ?? Enumerable.Empty <WithOrWithout <MetricFields> >())
                                                       .Distinct()),
                [nameof(writtenSince)] = writtenSince?.ToString()
            };

            var response = await GetMetricsV2Url()
                           .WithHeader("Accept", s_metricResultFormatsConverter.ConvertToString(resultFormat ?? MetricResultFormats.ApplicationJson))
                           .SetQueryParams(queryParamValues)
                           .GetJsonWithErrorCheckingAsync <MetricDescriptorCollection>(cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
コード例 #6
0
        public async Task <SloList> GetAllServiceLevelObjectivesAsync(string nextPageKey = null, int?pageSize     = null, Timeframe from = null, Timeframe to = null, string sloSelector = null, bool?sortAscending = null,
                                                                      bool?demo          = null, string timeFrame = null, bool?evaluate  = null, CancellationToken cancellationToken = default)
        {
            var queryParamValues = new Dictionary <string, object>
            {
                [nameof(nextPageKey)] = nextPageKey,
                [nameof(pageSize)]    = pageSize,
                [nameof(from)]        = from?.ToString(),
                [nameof(to)]          = to?.ToString(),
                [nameof(sloSelector)] = sloSelector,
                ["sort"]            = sortAscending == true ? "name" : "-name",
                [nameof(demo)]      = demo,
                [nameof(timeFrame)] = timeFrame,
                [nameof(evaluate)]  = evaluate
            };

            var response = await GetServiceLevelObjectivesUrl()
                           .SetQueryParams(queryParamValues)
                           .GetJsonIfNotEmptyAsync(new SloList(), cancellationToken)
                           .ConfigureAwait(false);

            return(response);
        }
コード例 #7
0
ファイル: NF1_v12.cs プロジェクト: ivan-petrov-ubk/CS
//===============  END History ===============================================================================
//===============  Read conf   ===============================================================================
        protected void InitFile()
        {
            trueInitPath = PathToLogFile + "\\" + BuyFileName + ".csv";
            LogSW        = new StreamReader(File.Open(trueInitPath, FileMode.Open, FileAccess.Read, FileShare.Read));

            if (LogSW != null)
            {
                st = "";
                string line;
                while ((line = LogSW.ReadLine()) != null)
                {
                    k2 = 0; name2 = "";
                    for (int j = 0; j < line.Length; j++)
                    {
                        if (line[j] == ';')
                        {
                            k2++;
                            if (k2 == 2)
                            {
                                name2 = st;
                            }                                                          //Print("{0} - {1}",Instrument.Name,st); }
                            if (name2 == Instrument.Name)
                            {
                                if (k2 == 2)
                                {
                                    name = st;
                                }                                                              // Print("{0} - {1}",k2,st ); }
                                if (k2 == 3)
                                {
                                    kl = Convert.ToInt32(st);
                                }                                                                             //Print("{0} - {1}",k2,st ); }
                                if (k2 == 4)
                                {
                                    if (st == "1")
                                    {
                                        tu = true;
                                    }
                                    if (st == "2")
                                    {
                                        td = true;
                                    }
                                }                                                                                               //Print("{0} - {1}",k2,st ); }
                                if (k2 == 5)
                                {
                                    if (st == "1")
                                    {
                                        nu = true;
                                    }
                                    if (st == "2")
                                    {
                                        nd = true;
                                    }
                                }                                                                                               // Print("{0} - {1}",k2,st ); }
                                if (k2 == 6)
                                {
                                    if (st == "0")
                                    {
                                        n2 = false;
                                    }
                                    if (st == "1")
                                    {
                                        n2 = true;
                                    }
                                }                                                                                               // Print("{0} - {1}",k2,st ); }
                                if (k2 == 7)
                                {
                                    NKZ = Convert.ToInt32(st);
                                }
                                if (k2 == 8)
                                {
                                    TP2 = Convert.ToInt32(st);
                                }
                                if (k2 == 9)
                                {
                                    lot = Convert.ToDouble(st);
                                }
                                if (k2 == 10)
                                {
                                    SL1 = Convert.ToInt32(st);
                                }
                                if (k2 == 11)
                                {
                                    dl = Convert.ToInt32(st);
                                }
                                if (k2 == 12)
                                {
                                    frac = Convert.ToInt32(st);
                                }
                                if (k2 == 13)
                                {
                                    kof = Convert.ToInt32(st);
                                }
                            }
                            st = "";
                        }
                        else
                        {
                            st = st + line[j];
                        }
                    }
                }
                if (Timeframe.ToString() == "M30")
                {
                    kl = kl * 2;
                }
                if (Timeframe.ToString() == "M15")
                {
                    kl = kl * 4;
                }
                if (Timeframe.ToString() == "M5")
                {
                    kl = kl * 12;
                }


                Print("{14} - File INIT name={0} - kl={1} tu={2} td={3} nu={4} nd={5} n2={6} NKZ={7} TP2={8} lot={9} SL1={10} dl={11} frac={12} kof={13}", name, kl, tu, td, nu, nd, n2, NKZ, TP2, lot, SL1, dl, frac, kof, Instrument.Name);
                LogSW.Close();
            }
        }
コード例 #8
0
ファイル: NF7.cs プロジェクト: ivan-petrov-ubk/CS
//===============  Read conf   ===============================================================================
        protected void InitFile()
        {
            trueInitPath = PathToLogFile + "\\m.csv";
            LogSW        = new StreamReader(File.Open(trueInitPath, FileMode.Open, FileAccess.Read, FileShare.Read));
            if (LogSW != null)
            {
                st = "";
                string line;
                while ((line = LogSW.ReadLine()) != null)
                {
                    k2 = 0; name2 = "";
                    for (int j = 0; j < line.Length; j++)
                    {
                        if (line[j] == ';')
                        {
                            k2++;
                            if (k2 == 2)
                            {
                                name2 = st;
                            }                                                          //Print("{0} - {1}",Instrument.Name,st); }
                            if (name2 == Instrument.Name)
                            {
                                if (k2 == 2)
                                {
                                    name = st;
                                }                                                               //Print("{0} - {1}",k2,st ); }
                                if (k2 == 3)
                                {
                                    kl = Convert.ToInt32(st);
                                }                                                                              //Print("----------------- {0} - {1}",k2,st ); }
                                if (k2 == 4)
                                {
                                    if (st == "1")
                                    {
                                        tu = true; td = false;
                                    }
                                    if (st == "2")
                                    {
                                        td = true; tu = false;
                                    }
                                }                                                                                                                          //Print("----------------- {0} - {1}",k2,st ); }
                                if (k2 == 5)
                                {
                                    if (st == "1")
                                    {
                                        nu = true;
                                    }
                                    if (st == "2")
                                    {
                                        nd = true;
                                    }
                                }                                                                                                //Print("----------------- {0} - {1}",k2,st ); }
                                if (k2 == 6)
                                {
                                    if (st == "0")
                                    {
                                        n2 = false;
                                    }
                                    if (st == "1")
                                    {
                                        n2 = true;
                                    }
                                }                                                                                                //Print("----------------- {0} - {1}",k2,st ); }
                                if (k2 == 7)
                                {
                                    NKZ = Convert.ToInt32(st);
                                }                                                                               //Print("----------------- {0} - {1} - {2}",k2,st,NKZ ); }
                                if (k2 == 8)
                                {
                                    if (st == "1")
                                    {
                                        torg = true;
                                    }
                                    if (st == "0")
                                    {
                                        torg = false;
                                    }
                                }
                                if (k2 == 9)
                                {
                                    tp2 = Convert.ToDouble(st);
                                }
                            }
                            st = "";
                        }
                        else
                        {
                            st = st + line[j];
                        }
                    }
                }
                if (Timeframe.ToString() == "M30")
                {
                    kl = kl * 2;
                }
                if (Timeframe.ToString() == "M15")
                {
                    kl = kl * 4;
                }
                if (Timeframe.ToString() == "M5")
                {
                    kl = kl * 12;
                }

                XXPrint("{0} INIT name={1} - kl={2} tu={3} td={4} nu={5} nd={6} n2={7} NKZ={8}", DTime, name, kl, tu, td, nu, nd, n2, NKZ);
                LogSW.Close();
            }
        }
コード例 #9
0
 internal static string ToDescriptionString(this Timeframe val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val.GetType().GetField(val.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }