static void Main(string[] args) { //Console.WriteLine(JwtKeyGenerator.GenerateJwtKey()); string name = "libor"; string n = PasswordHelper.Base64Encode(name); Console.WriteLine(n); string r = PasswordHelper.Base64Decode(n); Console.WriteLine(r); Console.WriteLine(DateTime.Now.ToString("MMM dd, yyyy hh:mm:ss tt", CultureInfo.GetCultureInfo("en"))); int?num = null; num++; //string values = "Reviewed;Under construction;"; //string[] columns = values.Split(';'); string url = string.Empty; //url = "https://158.196.141.113/rs/query/6/dataservice?report=6&limit=-1&basicAuthenticationEnabled=true"; //number - vice //url = "https://158.196.141.113/rs/query/1/dataservice?report=1&limit=-1&basicAuthenticationEnabled=true"; //number - jedno //url = "https://158.196.141.113/rs/query/7/dataservice?report=7&limit=-1&basicAuthenticationEnabled=true"; //coverage - vice druhu (HWRS, SWRS, SYRS) //NUMBER //url = "https://158.196.141.113/rs/query/6/dataservice?report=6&limit=-1&basicAuthenticationEnabled=true"; //prvni //url = "https://158.196.141.113/rs/query/1/dataservice?report=1&limit=-1&basicAuthenticationEnabled=true"; //treti //url = "https://158.196.141.113/rs/query/110/dataservice?report=102&limit=-1&basicAuthenticationEnabled=true"; //ctvrta //url = "https://158.196.141.113/rs/query/5/dataservice?report=5&limit=-1&basicAuthenticationEnabled=true"; //pata //url = "https://158.196.141.113/rs/query/3/dataservice?report=3&limit=-1&basicAuthenticationEnabled=true"; //sesta //url = "https://158.196.141.113/rs/query/4/dataservice?report=4&limit=-1&basicAuthenticationEnabled=true"; //desata //COVERAGE //url = "https://158.196.141.113/rs/query/17/dataservice?report=17&limit=-1&basicAuthenticationEnabled=true"; //url = "https://158.196.141.113/rs/query/8/dataservice?report=8&limit=-1&basicAuthenticationEnabled=true"; //url = "https://158.196.141.113/rs/query/15/dataservice?report=15&limit=-1&basicAuthenticationEnabled=true"; //url = "https://158.196.141.113/rs/query/2/dataservice?report=2&limit=-1&basicAuthenticationEnabled=true"; //url = "https://158.196.141.113/rs/query/16/dataservice?report=16&limit=-1&basicAuthenticationEnabled=true"; url = "https://158.196.141.113/rs/query/7/dataservice?report=7&limit=-1&basicAuthenticationEnabled=true"; JazzService jazz = new JazzService(); //var task = jazz.CreateSnapshot(url, "mprikryl", "heslo"); //task.Wait(); //Console.WriteLine(task.Result); //int[] values = new int[] { /*1, 2, 3, 4, 5, 6, 7, 8,*/ 9 }; int[] values = new int[] { 1, 2, 3, 5, 4, 3 }; var lastThreeValues = values.Skip(Math.Max(values.Length - 3, 0)).ToArray(); for (int i = 1; i < lastThreeValues.Length; i++) { if (lastThreeValues[i] >= lastThreeValues[i - 1]) { Console.WriteLine("ne"); } } Console.WriteLine("ano"); Console.WriteLine("\nEND"); Console.ReadKey(); }
/// <summary> /// vytvori snapshot dane projektove metriky /// </summary> /// <param name="projectMetric">projektova metrika</param> /// <returns></returns> public async Task CreateSnapshot(ProjectMetric projectMetric) { _suffix = 0; string xml = await GetDataFromJazzReportingService(projectMetric.DataUrl, projectMetric.DataUsername, PasswordHelper.Base64Decode(projectMetric.DataPassword)); if (!string.IsNullOrEmpty(xml)) { _document = new XmlDocument(); _document.LoadXml(xml); XmlNode schemaLocationAttribute = _document.DocumentElement.SelectSingleNode("//@*[local-name()='schemaLocation']"); //je nutne nacist schema, jinak nejde vybirat prvky pomoci xpath if (schemaLocationAttribute != null) { _namespaces = new XmlNamespaceManager(_document.NameTable); _namespaces.AddNamespace("ns", schemaLocationAttribute.Value.Split(null)[0]); List <string> names = new List <string>(); //vyber nazvu skupin pozadavku do { if (names.Count > 0) { _suffix++; //prochazi se po indexech vyse names.Clear(); } foreach (XmlNode name in _document.SelectNodes($"/ns:results/ns:result/ns:NAME{Suffix}[text()]", _namespaces)) { names.Add(name.InnerText); } } while (names.Any(n => n.Length > 4)); //dokud nejsou jen ctyrmistne (HWRS atd.) XmlNodeList results = null; if (names.Distinct().Count() == 1) //jen jedna skupina { results = _document.SelectNodes("/ns:results/ns:result", _namespaces); } else //vice skupin, nacte se tedy jen ta jedna specifikovana { results = _document.SelectNodes($"/ns:results/ns:result[ns:NAME{Suffix}='{projectMetric.Metric.RequirementGroup}']", _namespaces); } if (results.Count > 0) { if (projectMetric.Metric.MetricType.NumberMetric) { ParseXmlForNumberMetric(projectMetric, results); } else if (projectMetric.Metric.MetricType.CoverageMetric) { ParseXmlForCoverageMetric(projectMetric, results); } else { projectMetric.ProjectMetricLog.Add(new ProjectMetricLog($"Metric #{projectMetric.MetricId} has unknown metric type {projectMetric.Metric.MetricType.Name}!")); } projectMetric.LastUpdateDate = DateTime.Now; } else { projectMetric.ProjectMetricLog.Add(new ProjectMetricLog($"Project metric #{projectMetric.Id} data XML does not have proper format (results(1) > result(1..X))!")); } } else { projectMetric.ProjectMetricLog.Add(new ProjectMetricLog($"Project metric #{projectMetric.Id} data XML does not have proper format (XML schmema or namespace is missing)!")); } } else { projectMetric.ProjectMetricLog.Add(new ProjectMetricLog($"Project metric #{projectMetric.Id} data XML is empty, propably bad URL.")); } }