<commit_before>﻿// <copyright file="MainWindow.xaml.cs" company="MNet">
//     Copyright (c) <NAME> All rights reserved.
// </copyright>
// <author><NAME></author>
//-----------------------------------------------------------------------

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Xml;
using Microsoft.Win32;
using MNet.SLOTaxService;
using MNet.SLOTaxService.Messages;
using MNet.SLOTaxService.Services;

namespace MNet.SLOTaxGuiTest
{
  public partial class MainWindow : Window, INotifyPropertyChanged
  {
    public ObservableCollection<Tuple<string, string>> FursEndPoints { get; set; }
    public ObservableCollection<X509Certificate2> Certificates { get; set; }
    public ObservableCollection<string> Timeouts { get; set; }

    public MainWindow()
    {
      this.InitializeComponent();

      this.init();

      this.DataContext = this;
    }

    private void init()
    {
      this.FursEndPoints = new ObservableCollection<Tuple<string, string>>();
      this.FursEndPoints.Add(new Tuple<string, string>("TEST / TEST (https://blagajne-test.fu.gov.si:9002/v1/cash_registers)", @"https://blagajne-test.fu.gov.si:9002/v1/cash_registers"));
      this.FursEndPoints.Add(new Tuple<string, string>("Produkcija / Production (https://blagajne.fu.gov.si:9003/v1/cash_registers)", @"https://blagajne.fu.gov.si:9003/v1/cash_registers"));

      Certificates cert = new Certificates();
      this.Certificates = new ObservableCollection<X509Certificate2>();
      foreach (var certificate in cert.GetAllFursCertificates())
        this.Certificates.Add(certificate);

      this.Timeouts = new ObservableCollection<string>();
      for (int i = 1; i < 11; i++)
        this.Timeouts.Add(string.Format("{0} sec", i));

      this.cbType.SelectedIndex = 0;
      this.cbCertificates.SelectedIndex = 0;
      this.cbTimeout.SelectedIndex = 1;
      this.showExample(this.btnEcho);
      this.showResults(null);
    }

    private Stream getResource(string name)
    {
      return typeof(MainWindow).Assembly.GetManifestResourceStream(@"MNet.SLOTaxGuiTest.Resources." + name);
    }

    private string prettyXml(Stream stream)
    {
      using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
      {<commit_msg>Add new (temporary production port 9009)<commit_after>﻿// <copyright file="MainWindow.xaml.cs" company="MNet">
//     Copyright (c) <NAME> All rights reserved.
// </copyright>
// <author><NAME></author>
//-----------------------------------------------------------------------

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Windows;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Xml;
using Microsoft.Win32;
using MNet.SLOTaxService;
using MNet.SLOTaxService.Messages;
using MNet.SLOTaxService.Services;

namespace MNet.SLOTaxGuiTest
{
  public partial class MainWindow : Window, INotifyPropertyChanged
  {
    public ObservableCollection<Tuple<string, string>> FursEndPoints { get; set; }
    public ObservableCollection<X509Certificate2> Certificates { get; set; }
    public ObservableCollection<string> Timeouts { get; set; }

    public MainWindow()
    {
      this.InitializeComponent();

      this.init();

      this.DataContext = this;
    }

    private void init()
    {
      this.FursEndPoints = new ObservableCollection<Tuple<string, string>>();
      this.FursEndPoints.Add(new Tuple<string, string>("TEST / TEST (https://blagajne-test.fu.gov.si:9002/v1/cash_registers)", @"https://blagajne-test.fu.gov.si:9002/v1/cash_registers"));
      this.FursEndPoints.Add(new Tuple<string, string>("Produkcija / Production (https://blagajne.fu.gov.si:9003/v1/cash_registers)", @"https://blagajne.fu.gov.si:9003/v1/cash_registers"));
      this.FursEndPoints.Add(new Tuple<string, string>("Začasna Produkcija / Temporary production (https://blagajne.fu.gov.si:9009/v1/cash_registers)", @"https://blagajne.fu.gov.si:9009/v1/cash_registers"));

      Certificates cert = new Certificates();
      this.Certificates = new ObservableCollection<X509Certificate2>();
      foreach (var certificate in cert.GetAllFursCertificates())
        this.Certificates.Add(certificate);

      this.Timeouts = new ObservableCollection<string>();
      for (int i = 1; i < 11; i++)
        this.Timeouts.Add(string.Format("{0} sec", i));

      this.cbType.SelectedIndex = 0;
      this.cbCertificates.SelectedIndex = 0;
      this.cbTimeout.SelectedIndex = 1;
      this.showExample(this.btnEcho);
      this.showResults(null);
    }

    private Stream getResource(string name)
    {
      return typeof(MainWindow).Assembly.GetManifestResourceStream(@"MNet.SLOTaxGuiTest.Resources." + name);
    }

    private string prettyXml(Stream stream)
    {
      using (StreamReader reader = new StreamReader(stream, Encoding.UTF8))
      {
{'fraction_non_alphanumeric': 0.1511956317077763, 'fraction_numerical': 0.018075691960082848, 'mean_word_length': 3.587219343696028, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 36, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5366017', 'n_tokens_mistral': 1664, 'n_tokens_neox': 1589, 'n_words': 305}