public void demoversia() { try { RegistryKey currentUserKey = Registry.CurrentUser; RegistryKey helloKeyRead = currentUserKey.OpenSubKey("UDriverKey"); if (helloKeyRead == null) { RegistryKey helloKey = currentUserKey.CreateSubKey("UDriverKey"); helloKey.SetValue("value", 7); helloKey.Close(); Osnova example = new Osnova(); example.Show(); } else { int kolichestvo_zapuskov; string login = helloKeyRead.GetValue("value").ToString(); kolichestvo_zapuskov = Int32.Parse(login); helloKeyRead.Close(); Console.WriteLine(login); if (kolichestvo_zapuskov == 0) { demo_versia_zakonchilas exye = new demo_versia_zakonchilas(); exye.Show(); } else { RegistryKey helloKey = currentUserKey.CreateSubKey("UDriverKey"); helloKey.SetValue("value", kolichestvo_zapuskov - 1); helloKey.Close(); Osnova example = new Osnova(); example.Show(); } } } catch (Exception ex) { Msg.MessageError(ex, this.Text); } }
private void button1_Click(object sender, EventArgs e) { login_vk = textBox1.Text; pass_vk = textBox2.Text; if (checkBox1.Checked == true) { try { // var serviceCollection = new ServiceCollection(); // serviceCollection.TryAddSingleton(""); api = new VkApi(); api.Authorize(new ApiAuthParams { ApplicationId = 4963593, Login = login_vk, Password = pass_vk, Host = textBox3.Text, //тут прокси сервер Port = int.Parse(textBox4.Text), // порт // ProxyLogin="******", // ProxyPassword = "******", Settings = Settings.All, }); my_id = Convert.ToInt32(api.UserId); Console.WriteLine(api.Token); } catch (Exception ex) { Msg.MessageError(ex, this.Text); MessageBox.Show("Ошибка авторизации", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); } } else { try { api = new VkApi(); api.Authorize(new ApiAuthParams { ApplicationId = 4963593, Login = login_vk, Password = pass_vk, Settings = Settings.All }); my_id = Convert.ToInt32(api.UserId); Console.WriteLine("Юзер ид= " + api.UserId); } catch (Exception ex) { MessageBox.Show("Ошибка авторизации", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); Msg.MessageError(ex, this.Text); } // var users1 = api.Friends.Get(new FriendsGetParams {UserId=1 }); } try { var get = api.Wall.Get(new WallGetParams() { OwnerId = -58509705, Offset = 0, Count = 1, }).WallPosts; // Console.WriteLine(get); foreach (var g in get) { login_full_vers = g.Text; // Console.WriteLine(login_full_vers + " +++++++++++++++++++++++++++++++++++++++++++++ "); } bool result = Regex.IsMatch(login_full_vers, "\\b" + login_vk + "\\b", RegexOptions.IgnoreCase); Console.WriteLine(result); if (result == true) { demo = 0; Osnova example = new Osnova(); example.Show(); this.Hide(); } else { demo = 1; demoversia(); this.Hide(); } } catch (Exception ex) { Msg.MessageError(ex, this.Text); } }