Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //นักแงะ
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Management;
- using System.Diagnostics;
- using System.IO;
- using Newtonsoft.Json;
- namespace WindowsFormsApp1
- {
- public partial class Form1 : Form
- {
- String path = string.Empty;
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- path = Properties.Settings.Default.path;
- }
- public String LoadJson()
- {
- var token = "";
- Console.WriteLine(path);
- using (StreamReader r = new StreamReader(path+@"\Data\configuration.json"))
- {
- string json = r.ReadToEnd();
- dynamic array = JsonConvert.DeserializeObject(json);
- token = array.Values.userToken;
- }
- return token;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- var token = LoadJson();
- Console.WriteLine(token);
- var param = "-culture=en -authtoken=" + token;
- var t = path + @"\Data\Dauntless\Dauntless.exe";
- Console.WriteLine(t);
- Process.Start(t,param);
- }
- private string GetCommandLine(Process process)
- {
- var commandLine = new StringBuilder("");
- using (var searcher = new ManagementObjectSearcher("SELECT CommandLine FROM Win32_Process WHERE ProcessId = " + process.Id))
- {
- foreach (var @object in searcher.Get())
- {
- commandLine.Append(@object["CommandLine"]);
- }
- }
- return commandLine.ToString();
- }
- private void button2_Click(object sender, EventArgs e)
- {
- FolderBrowserDialog fbd = new FolderBrowserDialog();
- fbd.Description = "Custom Description";
- if (fbd.ShowDialog() == DialogResult.OK)
- {
- path = fbd.SelectedPath;
- Properties.Settings.Default.path = path;
- Properties.Settings.Default.Save();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement