Esempio n. 1
0
 public RegionList()
 {
     this.InitializeComponent();
     this.path = System.IO.Path.GetTempPath() + "KBW";
     this.con = new Connection();
     this.jns = "";
     this.wait = new WaitPanel("Wait2", base.Width, base.Height);
     base.Controls.Add(this.wait.getPanel());
     base.Controls[this.wait.getName()].BringToFront();
     this.start = null;
     this.licensepath = "";
 }
Esempio n. 2
0
 public Login()
 {
     this.path = System.IO.Path.GetTempPath() + "KBW";
     this.InitializeComponent();
     this.initialDirectory = this.path + "\\Licenses";
     this.getLicensePanel.Visible = false;
     this.panelNet.Visible = true;
     this.passwordPanel.Visible = false;
     this.user = "";
     this.ou = "";
     this.token = "";
     this.con = new Connection();
     this.step = 0;
     this.LoginNext.KeyDown += new KeyEventHandler(this.Login_KeyDown);
     this.sendPetition.KeyDown += new KeyEventHandler(this.Login_KeyDown);
 }
Esempio n. 3
0
 public RegionList(Start start, string licensepath, string jns)
 {
     this.con = new Connection();
     this.path = System.IO.Path.GetTempPath() + "KBW";
     this.InitializeComponent();
     this.licensepath = licensepath;
     this.jns = jns;
     this.start = start;
     this.Text = this.Text + " (" + Kalkulator1.instalClass.Version.getVersion().ToString() + ")";
     this.wait = new WaitPanel("Wait99", base.Width, base.Height);
     base.Controls.Add(this.wait.getPanel());
     base.Controls[this.wait.getName()].BringToFront();
     this.exit = false;
     this.getRegions(true);
     if (this.exit)
     {
         base.Close();
     }
 }
Esempio n. 4
0
 public ProtocolsList()
 {
     this.InitializeComponent();
     this.path = System.IO.Path.GetTempPath() + "KBW";
     this.con = new Connection();
     this.header = new XmlDocument();
     this.electoralEampaignSave = "";
     this.jns = "";
     this.role = "";
     this.circuit = "";
     this.wait = new WaitPanel("Wait2", base.Width, base.Height);
     base.Controls.Add(this.wait.getPanel());
     base.Controls[this.wait.getName()].BringToFront();
     this.start = null;
     this.licensepath = "";
     this.electionData = new System.DateTime(2014, 8, 27, 7, 0, 0);
     this.send = false;
     this.powiat = false;
     this.erros = false;
 }
Esempio n. 5
0
 private void getLicense_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == this.LicencesTable.Columns["action"].Index)
         {
             try
             {
                 object name = this.LicencesTable.Rows[e.RowIndex].Cells["Licencja"].Value;
                 string filepath = this.path + "\\Licenses\\" + name.ToString();
                 Commit com = new Commit(filepath, this);
                 com.ShowDialog();
                 if (this.goodcertificate)
                 {
                     this.komSend = "";
                     Connection con = new Connection();
                     if (con.IsAvailableNetworkActive())
                     {
                         Eksport ex = new Eksport(this.savePath, true, this, this.licensePath, this.password);
                         try
                         {
                             ex.ShowDialog();
                         }
                         catch (System.Exception)
                         {
                         }
                         if (this.goodcertificate)
                         {
                             try
                             {
                                 System.IO.StreamReader sr = new System.IO.StreamReader(this.savePath);
                                 string file = sr.ReadToEnd();
                                 sr.Close();
                                 file = file.Replace("<status>podpisany</status>", "<status>wysłany</status>");
                                 System.IO.StreamWriter sw = new System.IO.StreamWriter(this.savePath, false);
                                 sw.Write(file);
                                 sw.Close();
                             }
                             catch (System.Exception ex2)
                             {
                                 MessageBox.Show("Protokół został wysłany, ale nie można zmienić jego statusu. " + ex2.Message, "Uwaga");
                                 base.Close();
                             }
                         }
                     }
                     else
                     {
                         this.komSend = "Protokół nie został wysłany na serwer z powodu braku internetu";
                     }
                     MessageBox.Show(this.komSend, "Uwaga");
                     base.Close();
                 }
             }
             catch (System.ArgumentOutOfRangeException)
             {
             }
         }
     }
     catch (System.Exception)
     {
     }
 }
Esempio n. 6
0
 private void setComboBoxHour(string electoralEampaignSave)
 {
     if (!System.IO.Directory.Exists(this.path + "\\Attendance"))
     {
         try
         {
             System.IO.Directory.CreateDirectory(this.path + "\\Attendance");
         }
         catch (System.ArgumentNullException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"Attendance\"", "Error");
         }
         catch (System.ArgumentException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"Attendance\"", "Error");
         }
         catch (System.UnauthorizedAccessException)
         {
             MessageBox.Show("Nie masz uprawnień do tworzenia katalogów. Otwórz aplikacje jako adnimistrator.", "Uwaga");
         }
         catch (System.IO.PathTooLongException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"Attendance\"", "Error");
         }
         catch (System.IO.DirectoryNotFoundException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"Attendance\"", "Error");
         }
         catch (System.NotSupportedException)
         {
             MessageBox.Show("Nieprawidłowy format ścieżki. Nie można utworzyć katalogu \"Attendance\"", "Error");
         }
         catch (System.IO.IOException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"Attendance\"", "Error");
         }
     }
     string uri = "KALK/freq/" + electoralEampaignSave.Replace('_', '/') + "-freq";
     Connection con = new Connection();
     KLKresponse res = con.getRequestKBWKlk(uri, this.path + "\\Attendance\\frekwencja.xml", 0);
     XmlDocument hour = new XmlDocument();
     hour.Load(this.path + "\\Attendance\\frekwencja.xml");
     XmlNode hourRoot = hour.SelectSingleNode("/frekwencja");
     System.Collections.ArrayList AttendanceTime = new System.Collections.ArrayList();
     AttendanceTime.Add(new AttendanceItem("0", ""));
     foreach (XmlNode item in hourRoot)
     {
         XmlNode id = item.Attributes.GetNamedItem("id");
         XmlNode value = item.Attributes.GetNamedItem("value");
         if (id != null && value != null)
         {
             AttendanceTime.Add(new AttendanceItem(id.Value, value.Value));
         }
     }
     this.attendanceHour.DataSource = AttendanceTime;
     this.attendanceHour.DisplayMember = "LongName";
     this.attendanceHour.ValueMember = "ShortName";
 }
Esempio n. 7
0
 private void send_Click(object sender, System.EventArgs e)
 {
     this.obwodList_Validated(this.obwodList, e);
     this.currentLwyb_Validated(this.currentLwyb, e);
     this.attendanceHour_Validated(this.attendanceHour, e);
     this.number_Validated(this.attendanceValue, e);
     if ((!this.errorValue.Visible && !this.errorHour.Visible && !this.errorOBW.Visible && !this.errorCurrentLwyb.Visible) || (!this.errorValue.Visible && !this.errorHour.Visible && !this.errorOBW.Visible && this.errorCurrentLwyb.Visible && this.errorCurrentLwyb.Text == "Liczba wyborców uprawnionych do głosowania jest mniejsza od 110% i większa od 90% szacowanej liczby wyborców (" + (this.obwodList.SelectedItem as AttendanceOBWItem).getLwyb().ToString() + ")."))
     {
         WaitPanel p = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height);
         p.setWaitPanel("Trwa importowanie danych", "Proszę czekać");
         p.setSize(this.FormPanel.Size);
         p.setLocation(this.FormPanel.Location);
         base.Controls.Add(p.getPanel());
         base.Controls[p.getName()].BringToFront();
         p.setVisible(true);
         string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
         xml += "<save>";
         string hour = "";
         try
         {
             if (this.attendanceHour.SelectedItem != null)
             {
                 hour = (this.attendanceHour.SelectedItem as AttendanceItem).getName();
             }
         }
         catch (System.Exception ex)
         {
         }
         string value = "";
         try
         {
             if (this.attendanceValue.Text != null)
             {
                 value = this.attendanceValue.Text;
             }
         }
         catch (System.Exception ex)
         {
         }
         string text = xml;
         xml = string.Concat(new string[]
         {
             text,
             "<attendance><attendanceHour>",
             hour,
             "</attendanceHour><attendanceValue>",
             value,
             "</attendanceValue><currentLwyb>",
             this.currentLwyb.Text,
             "</currentLwyb></attendance>"
         });
         xml += "<header>";
         xml += this.getHeader(this.header);
         xml += "</header>";
         xml += "</save>";
         Commit c = new Commit(this.licensePath, this);
         c.ShowDialog();
         if (this.logged)
         {
             try
             {
                 Certificate cer = new Certificate();
                 cer.SignXmlText(xml, System.IO.Path.GetTempPath() + "KBW\\tmp\\attendance.xml", this.password, this.licensePath);
                 System.IO.StreamReader sr = new System.IO.StreamReader(System.IO.Path.GetTempPath() + "KBW\\tmp\\attendance.xml");
                 xml = sr.ReadToEnd();
                 sr.Close();
                 string uri = "attendances/readval/" + HttpUtility.UrlEncode((this.attendanceHour.SelectedItem as AttendanceItem).getName());
                 string post = "xml=" + HttpUtility.UrlEncode(xml);
                 Connection con = new Connection();
                 Code res = con.postReq(uri, post, 0);
                 MessageBox.Show(res.getText(), "Komunikat");
             }
             catch (System.Exception ex)
             {
                 MessageBox.Show("Błąd utworzenia wiadomości: " + ex.Message, "Uwaga");
             }
         }
         p.setVisible(false);
     }
 }
Esempio n. 8
0
 private void getLicense_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.RowIndex >= 0)
         {
             if (e.ColumnIndex == this.LicencesTable.Columns["action"].Index)
             {
                 try
                 {
                     object name = this.LicencesTable.Rows[e.RowIndex].Cells["Licencja"].Value;
                     string filepath = this.path + "\\Licenses\\" + name.ToString();
                     this.wait.setWaitPanel("Trwa autozapis protokołu", "Prosimy czekać");
                     this.wait.setVisible(true);
                     this.saves(4);
                     this.wait.setWaitPanel("Trwa przygotowanie do podpisania protokołu", "Prosimy czekać");
                     this.wait.setVisible(true);
                     string xmlTMP = this.generateSaves(0);
                     Commit com = new Commit(filepath, this, xmlTMP);
                     com.ShowDialog();
                     if (this.goodcertificate)
                     {
                         this.wait.setWaitPanel("Trwa generowanie kodu kreskowego dla protokołu", "Prosimy czekać");
                         this.wait.setVisible(true);
                         string docXml = "";
                         this.currentStep = 0;
                         string xml = xmlTMP;
                         this.save.LoadXml(xml);
                         XmlNode header = this.save.SelectSingleNode("/save/header");
                         if (header != null)
                         {
                             docXml += header.OuterXml;
                         }
                         XmlNode step = this.save.SelectSingleNode("/save/step");
                         if (step != null)
                         {
                             docXml += step.OuterXml;
                         }
                         XmlNode form = this.save.SelectSingleNode("/save/form");
                         if (form != null)
                         {
                             docXml += form.OuterXml;
                         }
                         XmlNode komisja_sklad = this.save.SelectSingleNode("/save/komisja_sklad");
                         if (komisja_sklad != null)
                         {
                             docXml += komisja_sklad.OuterXml;
                         }
                         XmlNode hardWarningCode = this.save.SelectSingleNode("/save/hardWarningCode");
                         if (hardWarningCode != null)
                         {
                             docXml += hardWarningCode.OuterXml;
                         }
                         XmlNode softError = this.save.SelectSingleNode("/save/softError");
                         if (softError != null)
                         {
                             docXml += softError.OuterXml;
                         }
                         XmlNode hardError = this.save.SelectSingleNode("/save/hardError");
                         if (hardError != null)
                         {
                             docXml += hardError.OuterXml;
                         }
                         XmlNode hardWarning = this.save.SelectSingleNode("/save/hardWarning");
                         if (hardWarning != null)
                         {
                             docXml += hardWarning.OuterXml;
                         }
                         ClassMd5 i = new ClassMd5();
                         string controlSum = i.CreateMD5Hash(docXml);
                         codeBar code = new codeBar();
                         code.generateCode(controlSum);
                         this.codeBarCode = code.getCode();
                         this.codeBarText = code.getTextReadable();
                         this.wait.setWaitPanel("Trwa podpisywanie protokołu", "Prosimy czekać");
                         this.wait.setVisible(true);
                         xml = this.generateSaves(this.currentStep);
                         try
                         {
                             Certificate cer = new Certificate();
                             cer.SignXmlText(xml, this.savePath, this.password, filepath);
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Sign: " + ex.Message, "Uwaga");
                         }
                         try
                         {
                             this.komSend = "";
                             Connection con = new Connection();
                             if (con.IsAvailableNetworkActive())
                             {
                                 this.wait.setWaitPanel("Trwa wysyłanie protokołu", "Prosimy czekać");
                                 this.wait.setVisible(true);
                                 this.goodcertificate = false;
                                 this.error = false;
                                 Eksport ex2 = new Eksport(this.savePath, true, this, filepath, this.password);
                                 try
                                 {
                                     ex2.ShowDialog();
                                 }
                                 catch (System.Exception)
                                 {
                                 }
                                 if (this.goodcertificate)
                                 {
                                     try
                                     {
                                         System.IO.StreamReader sr = new System.IO.StreamReader(this.savePath);
                                         string file = sr.ReadToEnd();
                                         sr.Close();
                                         file = file.Replace("<status>podpisany</status>", "<status>wysłany</status>");
                                         System.IO.StreamWriter sw = new System.IO.StreamWriter(this.savePath, false);
                                         sw.Write(file);
                                         sw.Close();
                                     }
                                     catch (System.Exception ex3)
                                     {
                                         MessageBox.Show("Protokół został wysłany, ale nie można zmienić jego statusu. " + ex3.Message, "Uwaga");
                                     }
                                 }
                                 if (!this.goodcertificate && this.error)
                                 {
                                     this.codeBarCode = "";
                                     this.codeBarText = "";
                                     this.saves(4);
                                 }
                             }
                             else
                             {
                                 this.komSend = "Protokół nie został wysłany na serwer z powodu braku internetu. Z poziomu listy protokołów bedzie można ponowić operacje.";
                             }
                             this.password = "";
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Send: " + ex.Message, "Uwaga");
                         }
                         try
                         {
                             this.wait.setWaitPanel("Trwa zapisywanie protokołu na dysk", "Prosimy czekać");
                             this.wait.setVisible(true);
                             SaveProtocol saveP = new SaveProtocol(this.komSend, this.savePath);
                             saveP.ShowDialog();
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Save: " + ex.Message, "Uwaga");
                         }
                         try
                         {
                             this.wait.setWaitPanel("Trwa przygotowanie protokołu do druku", "Prosimy czekać");
                             this.wait.setVisible(true);
                             this.drukToolStripMenuItem_Click(sender, e);
                             this.wait.setVisible(false);
                         }
                         catch (System.Exception ex)
                         {
                             MessageBox.Show("Print: " + ex.Message, "Uwaga");
                         }
                     }
                 }
                 catch (System.ArgumentOutOfRangeException ex_5C5)
                 {
                 }
             }
         }
     }
     catch (System.Exception ex)
     {
     }
 }
Esempio n. 9
0
 private void getCurrentCommitteeKlk_Click(object sender, System.EventArgs e)
 {
     Connection con = new Connection();
     if (con.IsAvailableNetworkActive())
     {
         this.wait.setWaitPanel("Trwa pobieranie aktualnej listy członków komisji", "Proszę czekać");
         this.wait.setVisible(true);
         string[] s = this.savePath.Split(new char[]
         {
             '\\'
         });
         string[] s2 = s[s.Length - 1].Split(new char[]
         {
             '-'
         });
         string akcja = s2[0].Replace('_', '/');
         string jns = s2[1].Replace("Jns", "");
         string obw = s2[2].Replace("Obw", "");
         string server = "klk/";
         string server2 = "KALK/";
         string uri = string.Concat(new string[]
         {
             server,
             akcja,
             "-",
             jns,
             "-",
             obw,
             ".xml"
         });
         string path = string.Concat(new string[]
         {
             this.path,
             "\\ProtocolsDef\\",
             s2[0],
             "-",
             jns,
             "-",
             obw,
             ".xml"
         });
         uri = string.Concat(new string[]
         {
             server2,
             "integrity/",
             akcja,
             "-",
             jns,
             "-",
             obw
         });
         KLKresponse resHeader = con.getRequestKBWKlk(uri, this.savePath, 0);
         if (!this.currentCommittee)
         {
             if (MessageBox.Show("Czy nadpisać zmodyfikowaną listę członków komisji?", "Aktualizacja członków komisji", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                 DataTable dtCommittee = new DataTable();
                 this.personList.DataSource = dtCommittee;
                 this.personList.Columns.Clear();
                 if (this.personList.Columns["remove"] != null)
                 {
                     this.personList.Columns.Remove("remove");
                 }
                 if (this.personList.Columns["action3"] != null)
                 {
                     this.personList.Columns.Remove("action3");
                 }
                 this.personList.Refresh();
                 int predStep = this.currentStep - 1;
                 this.saves(predStep);
                 this.save.Load(this.savePath);
                 this.committee.Load(path);
                 this.getCommitee();
                 this.personList.Refresh();
                 this.currentCommittee = true;
             }
         }
         else
         {
             MessageBox.Show("Lista członków komisji jest aktualna", "Aktualizacja członków komisji");
         }
         this.wait.setVisible(false);
     }
     else
     {
         MessageBox.Show("Nie masz połaczenia z internetem! Jeśli masz możliwość włącz Internet i ponownie kliknij przycisk \"Pobierz aktualną definicje Komisji\"", "Uwaga");
     }
 }
Esempio n. 10
0
 public ProtocolsList(string filepath, Start start, string licensepath, string version)
 {
     this.InitializeComponent();
     this.start = start;
     start.wait.setWaitPanel("Trwa wczytywanie protokołów", "Proszę czekać");
     start.wait.setVisible(true);
     this.version = version;
     this.licensepath = licensepath;
     this.erros = false;
     this.Text = this.Text + " (" + Kalkulator1.instalClass.Version.getVersion().ToString() + ")";
     this.path = System.IO.Path.GetTempPath() + "KBW";
     this.electionData = new System.DateTime(1, 1, 1, 0, 0, 0);
     DataTable dt = new DataTable();
     this.con = new Connection();
     this.header = new XmlDocument();
     System.Security.Cryptography.X509Certificates.X509Certificate cert = new System.Security.Cryptography.X509Certificates.X509Certificate(filepath);
     string subjectCert = cert.Subject;
     string[] tab = subjectCert.Split(new string[]
     {
         ", "
     }, System.StringSplitOptions.None);
     for (int i = 0; i < tab.Length; i++)
     {
         if (System.Text.RegularExpressions.Regex.IsMatch(tab[i], "^OU="))
         {
             string[] tmp = tab[i].Replace("OU=", "").Split(new char[]
             {
                 '-'
             });
             this.electoralEampaignURL = tmp[0];
             this.electoralEampaignSave = tmp[0].Replace('/', '_');
             this.electoralEampaignSave = this.electoralEampaignSave.Replace(" ", "");
             this.jns = tmp[1];
             this.role = tmp[2];
             if (this.role == "P" || this.role == "Z")
             {
                 this.circuit = tmp[3];
             }
             if (this.role == "O" || this.role == "A")
             {
                 this.panWyszukiwanie.Visible = true;
                 this.txtWyszukaj.Focus();
             }
             break;
         }
     }
     this.powiat = false;
     this.wait = new WaitPanel("Wait2", base.Width, base.Height);
     base.Controls.Add(this.wait.getPanel());
     base.Controls[this.wait.getName()].BringToFront();
     this.protocolsTable.CellClick += new DataGridViewCellEventHandler(this.getProtocol_CellClick);
     if (!System.IO.Directory.Exists(this.path + "\\electoralEampaign"))
     {
         try
         {
             System.IO.Directory.CreateDirectory(this.path + "\\electoralEampaign");
         }
         catch (System.ArgumentNullException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"electoralEampaign\"", "Error");
         }
         catch (System.ArgumentException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"electoralEampaign\"", "Error");
         }
         catch (System.UnauthorizedAccessException)
         {
             MessageBox.Show("Nie masz uprawnień do tworzenia katalogów. Otwórz aplikacje jako adnimistrator.", "Uwaga");
         }
         catch (System.IO.PathTooLongException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"electoralEampaign\"", "Error");
         }
         catch (System.IO.DirectoryNotFoundException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"electoralEampaign\"", "Error");
         }
         catch (System.NotSupportedException)
         {
             MessageBox.Show("Nieprawidłowy format ścieżki. Nie można utworzyć katalogu \"electoralEampaign\"", "Error");
         }
         catch (System.IO.IOException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"electoralEampaign\"", "Error");
         }
     }
     if (!System.IO.Directory.Exists(this.path + "\\ProtocolsDef"))
     {
         try
         {
             System.IO.Directory.CreateDirectory(this.path + "\\ProtocolsDef");
         }
         catch (System.ArgumentNullException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"ProtocolsDef\"", "Error");
         }
         catch (System.ArgumentException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"ProtocolsDef\"", "Error");
         }
         catch (System.UnauthorizedAccessException)
         {
             MessageBox.Show("Nie masz uprawnień do tworzenia katalogów. Otwórz aplikacje jako adnimistrator.", "Uwaga");
         }
         catch (System.IO.PathTooLongException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"ProtocolsDef\"", "Error");
         }
         catch (System.IO.DirectoryNotFoundException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"ProtocolsDef\"", "Error");
         }
         catch (System.NotSupportedException)
         {
             MessageBox.Show("Nieprawidłowy format ścieżki. Nie można utworzyć katalogu \"ProtocolsDef\"", "Error");
         }
         catch (System.IO.IOException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"ProtocolsDef\"", "Error");
         }
     }
     if (!System.IO.Directory.Exists(this.path + "\\saves"))
     {
         try
         {
             System.IO.Directory.CreateDirectory(this.path + "\\saves");
         }
         catch (System.ArgumentNullException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"saves\"", "Error");
         }
         catch (System.ArgumentException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"saves\"", "Error");
         }
         catch (System.UnauthorizedAccessException)
         {
             MessageBox.Show("Nie masz uprawnień do tworzenia katalogów. Otwórz aplikacje jako administrator.", "Uwaga");
         }
         catch (System.IO.PathTooLongException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"saves\"", "Error");
         }
         catch (System.IO.DirectoryNotFoundException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"saves\"", "Error");
         }
         catch (System.NotSupportedException)
         {
             MessageBox.Show("Nieprawidłowy format ścieżki. Nie można utworzyć katalogu \"saves\"", "Error");
         }
         catch (System.IO.IOException)
         {
             MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"saves\"", "Error");
         }
     }
     this.getKLK(true);
     this.getProtocols(true);
     start.wait.setVisible(false);
 }
Esempio n. 11
0
 public Start()
 {
     try
     {
         this.InitializeComponent();
         this.Text = "Kalkulator (" + Kalkulator1.instalClass.Version.getVersion().ToString() + ")";
         Start.listaPlikow.Add("START");
         this.path = System.IO.Path.GetTempPath() + "KBW";
         if (!System.IO.Directory.Exists(this.path))
         {
             try
             {
                 System.IO.Directory.CreateDirectory(this.path);
             }
             catch (System.ArgumentNullException)
             {
                 MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"KBW\"", "Error");
             }
             catch (System.ArgumentException)
             {
                 MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"KBW\"", "Error");
             }
             catch (System.UnauthorizedAccessException)
             {
                 MessageBox.Show("Nie masz uprawnień do tworzenia katalogów. Otwórz aplikacje jako adnimistrator.", "Uwaga");
             }
             catch (System.IO.PathTooLongException)
             {
                 MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"KBW\"", "Error");
             }
             catch (System.IO.DirectoryNotFoundException)
             {
                 MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"KBW\"", "Error");
             }
             catch (System.NotSupportedException)
             {
                 MessageBox.Show("Nieprawidłowy format ścieżki. Nie można utworzyć katalogu \"KBW\"", "Error");
             }
             catch (System.IO.IOException)
             {
                 MessageBox.Show("Nieprawidłowa ścieżka. Nie można utworzyć katalogu \"KBW\"", "Error");
             }
         }
         if (!System.IO.Directory.Exists(this.path + "\\tmp"))
         {
             Instal inst = new Instal(this.path);
         }
         if (System.IO.Directory.Exists(System.IO.Path.GetTempPath() + "KBW\\tmp"))
         {
             if (!System.IO.File.Exists(System.IO.Path.GetTempPath() + "KBW\\tmp\\eksport.xml"))
             {
                 System.IO.File.Create(System.IO.Path.GetTempPath() + "KBW\\tmp\\eksport.xml");
             }
             if (!System.IO.File.Exists(System.IO.Path.GetTempPath() + "KBW\\tmp\\import.xml"))
             {
                 System.IO.File.Create(System.IO.Path.GetTempPath() + "KBW\\tmp\\import.xml");
             }
             if (!System.IO.File.Exists(System.IO.Path.GetTempPath() + "KBW\\tmp\\eksportCode.xml"))
             {
                 System.IO.File.Create(System.IO.Path.GetTempPath() + "KBW\\tmp\\eksportCode.xml");
             }
         }
         this.logged = false;
         this.certificate = new Certificate();
         this.con = new Connection();
         this.LicencesTable.CellClick += new DataGridViewCellEventHandler(this.LicencesTable_CellClick);
         this.waitLicenses.CellClick += new DataGridViewCellEventHandler(this.waitLicenses_CellClick);
         this.wait = new WaitPanel("Wait1", base.Width, base.Height);
         base.Controls.Add(this.wait.getPanel());
         base.Controls[this.wait.getName()].BringToFront();
         this.getActiveLicense();
         this.getOtherLicense();
         if (!Kalkulator1.instalClass.Version.newApp())
         {
             MessageBox.Show("Twoja wersja kalkulatora wyborczego jest nieaktualna.", "Uwaga");
         }
     }
     catch (System.Exception)
     {
     }
 }