private void btnCleanData_Click(object sender, EventArgs e) { numerologyObject = null; personalData = null; InitUI(true); numerologyObject = InitNumerologyObject(); }
public LifeCycles() { InitializeComponent(); InitYears(); numerologyObject = InitNumerologyObject(); openFileDialog1.InitialDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CUSTOMER_FOLDER_NAME); manager = new LifeCycleManager(); manager.Init(); }
public PersonalYearForm(bool isLocal) : base() { local = isLocal; InitializeComponent(); InitUI(); numerologyObject = InitNumerologyObject(); if (!local) { saveForPrint.Visible = false; } }
public ChartForm(bool local) { this.local = local; InitializeComponent(); numerologyObject = InitNumerologyObject(); openFileDialog1.InitialDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CUSTOMER_FOLDER_NAME); if (!local) { button1.Visible = false; } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { openSaved = true; numerologyObject = null; InitUI(); numerologyObject = InitNumerologyObject(); var fullPath = openFileDialog1.FileName; var loaded = numerologyObject.ReadPersonalData(fullPath); var day = loaded.DOB.Day; var month = loaded.DOB.Month; var year = loaded.DOB.Year; cmbDate.SelectedItem = day; cmbMonth.SelectedValue = month; cmbYear.SelectedItem = year; var lang = Language.ENG.ToString(); if (!string.IsNullOrEmpty(loaded.Language)) { lang = loaded.Language; } cmbLang.SelectedItem = lang; txbName.Text = loaded.Name; txbSurname.Text = loaded.Surname; HandleLanguagesDifference((Language)Enum.Parse(typeof(Language), lang) == Language.RUS); txbFathersName.Text = loaded.Fathername; if (!CheckDateOfBirth(day, month, year)) { MessageBox.Show("Несуществующая комбинация дня,месяца и года."); openSaved = false; return; } numerologyObject.DOBObject.SetDate(day, month, year); //numerologyObject.NameObject.SetName((Language)Enum.Parse(typeof(Language), cmbLang.SelectedItem.ToString()), txbName.Text.Trim(), txbSurname.Text.Trim(), numerologyObject.DOBObject.GetLifeWayNumber); numerologyObject.NameObject.SetName((Language)Enum.Parse(typeof(Language), cmbLang.SelectedItem.ToString()), txbName.Text.Trim(), txbSurname.Text.Trim(), (Language)Enum.Parse(typeof(Language), cmbLang.SelectedItem.ToString()) == Language.RUS ? txbFathersName.Text.Trim() : null, numerologyObject.DOBObject.GetLifeWayNumber); SetDOBValuesToUI(); SetNameValuesToUI(); SetMatrixIntersection(Matrix.TwoMatrixAnalisys(numerologyObject.DOBObject.DOBMatrix, numerologyObject.NameObject.NameMatrix)); } finally { openSaved = false; } } }
public CompareForm(bool local) { this.local = local; InitializeComponent(); InitYears(); InitYearsRelationsStart(); InitRelationsPeriod(); numerologyObject = InitNumerologyObject(); openFileDialog1.InitialDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CUSTOMER_FOLDER_NAME); openFileDialog2.InitialDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CUSTOMER_FOLDER_NAME); if (!local) { saveForPrint.Visible = false; } }
public static NumerologyObject InitNumerologyObject() { var numerologyObject = new NumerologyObject(); return(numerologyObject); }
private void clearToolStripMenuItem_Click(object sender, EventArgs e) { numerologyObject = null; InitUI(); numerologyObject = InitNumerologyObject(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!local) { try { var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.ins"); var authDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Auth"); var hash = new HashHandler(); if (files == null || files.Length == 0) { // Check PC name in other directory var di = new DirectoryInfo(authDir); if (!di.Exists) { MessageBox.Show("No license file was provided."); ShutDownForm(); } else { var dirFiles = Directory.GetFiles(authDir, "*.ins"); if (dirFiles == null) { MessageBox.Show("No license file was provided."); ShutDownForm(); } else if (dirFiles.Length == 1) { var text = System.IO.File.ReadAllText(dirFiles[0], Encoding.ASCII); var licensedPC = hash.Decode(text); if (string.IsNullOrEmpty(licensedPC)) { MessageBox.Show("Empty license file."); ShutDownForm(); } else if (!Environment.MachineName.Equals(licensedPC)) { MessageBox.Show("Application was licensed for other PC...WTF, bro?"); ShutDownForm(); } } else if (dirFiles.Length > 1) { MessageBox.Show("More than 1 license file exists...WTF?"); ShutDownForm(); } } } else if (files.Length == 1) { var text = System.IO.File.ReadAllText(files[0], Encoding.ASCII); var result = hash.ConvertFromHash(text); var now = DateTime.Now; if (result == null) { MessageBox.Show("Broken activation file."); ShutDownForm(); } else if (now < result.Start || now > result.End) { MessageBox.Show("You can activate app in this interval of dates only: " + result.Start.ToString("dd.MM.yyyy HH.mm.ss") + " - " + result.End.ToString("dd.MM.yyyy HH.mm.ss")); ShutDownForm(); } else { // App may be activated var di = new DirectoryInfo(authDir); if (!di.Exists) { di.Create(); } else { var dirFiles = di.GetFiles(); for (int i = 0; i < dirFiles.Length; i++) { var f = new FileInfo(dirFiles[i].FullName); f.Delete(); } } var fi = new FileInfo(files[0]); var stringToSave = hash.Encode(Environment.MachineName); File.WriteAllText(Path.Combine(authDir, fi.Name), stringToSave, Encoding.ASCII); File.Delete(files[0]); AppShortcutToDesktop("Numerology"); MessageBox.Show("Successfully activated for : " + Environment.MachineName); } } else if (files.Length > 1) { MessageBox.Show("There are more than 1 .ins file in start directory."); ShutDownForm(); } } catch (Exception exc) { MessageBox.Show("Error, while authentication check: " + exc.Message); ShutDownForm(); } this.Text = "Нумерология (licensed for: " + Environment.MachineName + ")."; } else { // For Yana only this.Text = "Нумерология (private version)."; } if (!isAuthProblem) { InitUI(); numerologyObject = InitNumerologyObject(); var customersFolderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, CUSTOMER_FOLDER_NAME); if (!Directory.Exists(customersFolderPath)) { Directory.CreateDirectory(customersFolderPath); } } }
public PersonalYearForm() { InitializeComponent(); InitUI(); numerologyObject = InitNumerologyObject(); }