I need help with executing second project

sajmonekk

New member
Joined
Apr 7, 2021
Messages
3
Programming Experience
Beginner
Hello i need help, i am new with C# could someone help me with executing second project Console application after clicking on button without this full way C:\Users\sajmo\source\repos\VoidSharp\VoidSharp ?


screenshot: Screenshot
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
2,892
Location
Chesapeake, VA
Programming Experience
10+
Please post the relevant code in code tags, not screenshots.

Anyway, Process.Start() can take relative paths. You don't have to pass an absolute path to the other executable. Also, if the other executable is in the PATH search, ask you need to do is pass in the executable name, and not have to specify an absolute or relative path.
 

sajmonekk

New member
Joined
Apr 7, 2021
Messages
3
Programming Experience
Beginner
thanks for respond, relative path ? how to do it ? can you help me please ?

Form1.cs:
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 LCUAPI.API.Models;
using System.Net;
using RestSharp;
using LCUAPI.API;
using Newtonsoft.Json;
using ClassicDarkTheme.Dark;
using System.Diagnostics;
using System.Threading;
using System.Windows.Input;
using System.Runtime.InteropServices;

namespace VoidSharp
{
    public partial class Form1 : Form
    {

        SummonerObject.Summoner summoner = new SummonerObject.Summoner();
        Matchmaking.ReadyCheck readyCheck = new Matchmaking.ReadyCheck();
        LolStore.Wallet wallet = new LolStore.Wallet();
        ChampionSummary champSummary = new ChampionSummary();
        SummonerProfile summonerProfile = new SummonerProfile();

        public const int WM_NCLBUTTONDOWN = 0xA1;
        public const int HT_CAPTION = 0x2;

        [System.Runtime.InteropServices.DllImport("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
        [System.Runtime.InteropServices.DllImport("user32.dll")]
        public static extern bool ReleaseCapture();

        bool mouseDown;
        private Point offset;
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }

        private void label2_Click(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Minimized;
        }

        private void label4_Click(object sender, EventArgs e)
        {

        }

        private void label4_MouseDown(object sender, MouseEventArgs e)
        {
            offset.X = e.X;
            offset.Y = e.Y;
            mouseDown = true;
        }

        private void label4_MouseMove(object sender, MouseEventArgs e)
        {
            if (mouseDown == true)
            {
                Point currentScreenPos = PointToScreen(e.Location);
                Location = new Point(currentScreenPos.X - offset.X, currentScreenPos.Y - offset.Y);
            }
        }

        private void label4_MouseUp(object sender, MouseEventArgs e)
        {
            mouseDown = false;
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (lblName.Text == "TurboVirgin69")
            {
                lblAdmin.Show();
                lblprem.Hide();
                lblTester.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "TakeLanternOrDie")
            {
                lblprem.Show();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUser.Hide();
                lblUnknown.Hide();
            }
            else if (lblName.Text == "eSuka Ratafack")
            {
                lblprem.Show();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Ozzák Pacovký")
            {
                lblprem.Show();
                lblTester.Hide();
                lblUnknown.Hide();
                lblAdmin.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Oyotlhvw")
            {
                lblTester.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Pornhub Admin")
            {
                lblTester.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "AlexVdits")
            {
                lblTester.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Unknown")
            {
                lblUnknown.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUser.Hide();
            }
            else
            {
                lblUser.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUnknown.Hide();
            }


            Process[] p = Process.GetProcessesByName("LeagueClientUx");
            if (p.Length != 0)
            {
                string showUx = LCU.GetRequest(RestSharp.Method.POST, "/riotclient/ux-show");


                string output = LCU.GetRequest(RestSharp.Method.GET, "/lol-summoner/v1/current-summoner", RestSharp.DataFormat.Json);
                Console.WriteLine(output);
                summoner = JsonConvert.DeserializeObject<SummonerObject.Summoner>(output);
                pbAvatar.ImageLocation = "http://ddragon.leagueoflegends.com/cdn/10.24.1/img/profileicon/" + summoner.ProfileIconId + ".png";
                lblName.Text = summoner.DisplayName;
                lblLevel.Text = Convert.ToString(summoner.SummonerLevel);
                lblLevel2.Text = Convert.ToString(summoner.SummonerLevel);

                //level vyvářenost

                if (Convert.ToInt32(lblLevel.Text) < 100)
                {
                    lblLevel.Show();
                }
                else if (Convert.ToInt32(lblLevel2.Text) > 100)
                {
                    lblLevel2.Show();
                }           
                else
                {

                }

            }

        }
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            Environment.Exit(0);
        }

        private static bool AutoAccept = false;
        private static bool AutoSkinBoost = false;
        private static bool autoSkinDo = false;
        string phase = string.Empty;

        private void LCUTimer_Tick(object sender, EventArgs e)
        {
            Process[] p = Process.GetProcessesByName("LeagueClientUx");
            if (p.Length != 0)
            {
                try
                {
                    string JsonReadyCheck = LCU.GetRequest(RestSharp.Method.GET, "/lol-matchmaking/v1/ready-check");
                    readyCheck = JsonConvert.DeserializeObject<Matchmaking.ReadyCheck>(JsonReadyCheck);
                    if (readyCheck.State == "InProgress" && AutoAccept)
                    {
                        LCU.GetRequest(RestSharp.Method.POST, "/lol-matchmaking/v1/ready-check/accept");
                        //API.LCU.GetRequest(RestSharp.Method.POST, "/lol-matchmaking/v1/ready-check/decline");
                    }

                    string gameflowPhase = LCU.GetRequest(RestSharp.Method.GET, "/lol-gameflow/v1/gameflow-phase");
                    if (phase != gameflowPhase)
                    {
                        phase = gameflowPhase;
                        Console.WriteLine(gameflowPhase);

                        if (phase.Contains("ChampSelect") && AutoSkinBoost && !autoSkinDo)
                        {
                            Sleep(1000);
                            autoSkinDo = true;
                            var skinboost = LCUAPI.API.LCU.GetRequest(Method.POST, "lol-champ-select/v1/team-boost/purchase");
                            Console.WriteLine(skinboost);
                            TeamBoost myDeserializedClass = JsonConvert.DeserializeObject<TeamBoost>(skinboost);
                        }
                        else if (!phase.Contains("ChampSelect"))
                        {
                            autoSkinDo = false;
                        }
                    }
                }
                catch { }
            }
        }

        private void AutoUpdate_Tick(object sender, EventArgs e)
        {

            if (lblName.Text == "TurboVirgin69")
            {
                lblAdmin.Show();
                lblprem.Hide();
                lblTester.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "TakeLanternOrDie")
            {
                lblprem.Show();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUser.Hide();
                lblUnknown.Hide();
            }
            else if (lblName.Text == "eSuka Ratafack")
            {
                lblprem.Show();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Ozzák Pacovký")
            {
                lblprem.Show();
                lblTester.Hide();
                lblUnknown.Hide();
                lblAdmin.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Oyotlhvw")
            {
                lblTester.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Pornhub Admin")
            {
                lblTester.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "AlexVdits")
            {
                lblTester.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblUnknown.Hide();
                lblUser.Hide();
            }
            else if (lblName.Text == "Unknown")
            {
                lblUnknown.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUser.Hide();
            }
            else
            {
                lblUser.Show();
                lblprem.Hide();
                lblAdmin.Hide();
                lblTester.Hide();
                lblUnknown.Hide();
            }

            Process[] p = Process.GetProcessesByName("LeagueClientUx");
            if (p.Length != 0)
            {
                string output = LCU.GetRequest(RestSharp.Method.GET, "/lol-summoner/v1/current-summoner", RestSharp.DataFormat.Json);
                Console.WriteLine(output);
                summoner = JsonConvert.DeserializeObject<SummonerObject.Summoner>(output);
                pbAvatar.ImageLocation = "http://ddragon.leagueoflegends.com/cdn/10.24.1/img/profileicon/" + summoner.ProfileIconId + ".png";
                lblName.Text = summoner.DisplayName;
                lblLevel.Text = Convert.ToString(summoner.SummonerLevel);
                lblLevel2.Text = Convert.ToString(summoner.SummonerLevel);
                if (Convert.ToInt32(lblLevel.Text) < 100)
                {
                    lblLevel.Show();
                }
                else if (Convert.ToInt32(lblLevel2.Text) > 100)
                {
                    lblLevel2.Show();
                }
                else
                {

                }
            }
            else
            {
                
            }
        }
        public static async void Sleep(double msec)
        {
            for (var since = DateTime.Now; (DateTime.Now - since).TotalMilliseconds < msec;)
                await Task.Delay(TimeSpan.FromTicks(10));
        }

        private void cbAutoAccept_CheckedChanged(object sender, EventArgs e)
        {
            AutoAccept = cbAutoAccept.Checked;
        }

        private void btnAramSkinBoost_Click(object sender, EventArgs e)
        {
            Process.Start("");
        }

        private void pictureBox2_Click(object sender, EventArgs e)
        {
            
        }

        private void label6_Click(object sender, EventArgs e)
        {
            Info a = new Info();
            a.Show();
        }

        private void darkButton1_Click(object sender, EventArgs e)
        {
            if (EnablePremium.Checked)
            {
                Accounts d = new Accounts();
                d.Show();
            }
        }

        private void label7_Click(object sender, EventArgs e)
        {
            Voidinfo b = new Voidinfo();
            b.Show();
        }

        private void EnablePremium_CheckedChanged(object sender, EventArgs e)
        {
            if (lblAdmin.Visible == true)
            {

            }
            else if (lblprem.Visible == true)
            {

            }
            else if (lblTester.Visible == true)
            {

            }
            else
            {
                EnablePremium.Checked = false;
                messagebox c = new messagebox();
                c.Show();
            }
        }
    }
}
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
2,892
Location
Chesapeake, VA
Programming Experience
10+
There is some serious disconnect if you know how to do P/Invoke calls, insert Windows messages, and find running processes in the code above, but you don't even know what a relative path is.
 

sajmonekk

New member
Joined
Apr 7, 2021
Messages
3
Programming Experience
Beginner
There is some serious disconnect if you know how to do P/Invoke calls, insert Windows messages, and find running processes in the code above, but you don't even know what a relative path is.
Ohhh i know now thanks for info i´ll try it you made my day :) <3
 
Top Bottom