New Posts  All Forums:Forum Nav:

C# Method Errors

post #1 of 6
Thread Starter 
So I am creating a network based MD5 hash cracker and wish to base the range each client brute forces by two locally inputted ints. So i needed to call the ints in a diferent method. Iddn't know how so asked a firend and got the methods sorted. Fast forward a few hours it's now thowing one error and one caution and I have no idea why:

Error:
Warning: Spoiler! (Click to show)
Code:
Error        1       Program 'C:\\DroneCLI.exe' does not contain a static 'Main' method suitable for an entry point  DroneCLI

Caution: Warning: Spoiler! (Click to show)
Code:
Warning      2       'ConsoleApplication1.Program.Main(int, int)' has the wrong signature to be an entry point       C:\DroneCLI\Program.cs  22      28      DroneCLI


I have holes in my coding knowledge so layman's terms appreciated.

Complete program:
Warning: Spoiler! (Click to show)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;

namespace ConsoleApplication1
{




    class Program
    {



[B]
        public static void Main(int clientID, int totalClients) [/B]
        {
            //int clientID;
            //int totalClients;
            //Int32 clientID, Int32 totalClients
          
            string returnData = null;
            //Int32 clientID = 0;
            string serverIP = null;
            //ng temp1 = null;

            //Local client ID for hash optimisation.
            Console.WriteLine("Please enter the client number");
            //temp1 = Console.ReadLine();
            clientID = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("ClientID Check: " + clientID);

            //Local client total for hash optimisation.
            Console.WriteLine("Please enter the total number of clients: ");
            //temp1 = Console.ReadLine();
            totalClients = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Clienttotal Check: " + totalClients);



            UdpClient udpClient = new UdpClient(8008);
            Byte[] recieveBytes = new Byte[1024]; // buffer to read the data into 1 kilobyte at a time
            IPAddress multicastIpAddress = IPAddress.Parse("225.0.0.1"); // assign the Multicast address
            //join the Multicast group
            udpClient.JoinMulticastGroup(multicastIpAddress);
            //recieve any communcations which are intended for this machine
            IPEndPoint remoteIPEndPoint = new IPEndPoint(IPAddress.Any, 8008);  //open port 8008 on this machine
            Console.WriteLine("Multicast Client is Started");
            //recieve the data from the UDP packet

                //server IP address
                recieveBytes = udpClient.Receive(ref remoteIPEndPoint);
                serverIP = Encoding.ASCII.GetString(recieveBytes);
                Console.WriteLine("Server Ip Address: " + serverIP.TrimEnd());
                
                //Hash Value
                recieveBytes = udpClient.Receive(ref remoteIPEndPoint);
                returnData = Encoding.ASCII.GetString(recieveBytes);
                Console.WriteLine("Input Hash String:\n" + returnData.TrimEnd());
                //Console.WriteLine(returnData);
                //input = returnData;
               [B] checkHash(returnData.TrimEnd(), clientID, totalClients);[/B]


            
                udpClient.Close();

           

            Console.WriteLine("Press any button to exit.");

            //TCP to send data
            //TcpClient


            Console.ReadLine();
            

        
        }
[SPOILER=Warning: Spoiler!]        static void checkHash(string original, int clientID, int totalClients)[/SPOILER]
        {


            int count = 0;
            string tocheck = "";
            
[B]            int range = 0;
            int minRange = 0;
            int maxRange = 0;
            int clientID2 = clientID;
            int totalClients2 = totalClients;
            range = (1000 / totalClients2);
            minRange = ((clientID2 - 1) * range);
            Console.WriteLine("minRange checked" + minRange);
            maxRange = (clientID * range) + 5;[/B]


            //Loop for Hash check
            while (count < 1000)   //2147483647
            {
                tocheck = count.ToString();
                if (original.CompareTo(generateHash(tocheck)) == 0)
                {
                    Console.WriteLine("Found clear text is " + tocheck);
                    count = 2147483646;
   
                }

                if (count % 60000 == 0)
                { 
                    Console.WriteLine("Up to " + tocheck + " checked."); 
                }

                    
                    
                
                count++;
                //Console.WriteLine(count);
            }

            //if count doesn't = max then throw hash error.
            while (count != 2147483647)
            {
                Console.WriteLine("Hash not found.");
                count = 2147483647;

            }

        }


        static string generateHash(string input)
        {
            
            //the method used here to generate the MD5 hash is a standard method provided by Microsoft
            MD5 md5Hasher = MD5.Create();
            byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
            StringBuilder sBuilder = new StringBuilder();
            for (int i = 0; i < data.Length; i++)
                {
                    sBuilder.Append(data[i].ToString("x2"));
                }
                return sBuilder.ToString();
           }



    }        
}


Edited by BritishBob - 3/10/14 at 7:18pm
Don't Push that!
(21 items)
 
 
TheBeast
(10 items)
 
CPUMotherboardGraphicsRAM
3930k ASUS ROG Rampage IV Sapphire 7970 16 GB Samsung DDR3 @ 1600 8-8-8-24 
Hard DriveHard DriveHard DriveHard Drive
Crucial 128GB 2.5" M4 SSD  WD Red 1TB WD Red 1TB WD Red 1TB 
Hard DriveOptical DriveCoolingCooling
WD Red 1TB LiteOn iHAS124-19 24x DVD±RW DL & RAM SATA Optical Silver Arrow Bitfenix Spectre Pro 200mm 
CoolingOSPowerCase
Bitfenix Spectre Pro 230mm Windows 7 Corsair Professional Series AX750 750W Modular PSU Coolermaster HAF X 
MouseAudio
SteelSeries Sensei Laser Gaming Mouse ASUS XONAR DG 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 P5B-Deluxe Radeon HD 5970 Corsair  
CoolingCase
Hyper 212 Modded Cream Tower of Death 
CPUCPUCPUCPU
AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE 
MotherboardGraphicsRAMRAM
H8QM8 560ti Kingston  Kingston  
RAMRAM
Kingston  Kingston  
  hide details  
Reply
Don't Push that!
(21 items)
 
 
TheBeast
(10 items)
 
CPUMotherboardGraphicsRAM
3930k ASUS ROG Rampage IV Sapphire 7970 16 GB Samsung DDR3 @ 1600 8-8-8-24 
Hard DriveHard DriveHard DriveHard Drive
Crucial 128GB 2.5" M4 SSD  WD Red 1TB WD Red 1TB WD Red 1TB 
Hard DriveOptical DriveCoolingCooling
WD Red 1TB LiteOn iHAS124-19 24x DVD±RW DL & RAM SATA Optical Silver Arrow Bitfenix Spectre Pro 200mm 
CoolingOSPowerCase
Bitfenix Spectre Pro 230mm Windows 7 Corsair Professional Series AX750 750W Modular PSU Coolermaster HAF X 
MouseAudio
SteelSeries Sensei Laser Gaming Mouse ASUS XONAR DG 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 P5B-Deluxe Radeon HD 5970 Corsair  
CoolingCase
Hyper 212 Modded Cream Tower of Death 
CPUCPUCPUCPU
AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE 
MotherboardGraphicsRAMRAM
H8QM8 560ti Kingston  Kingston  
RAMRAM
Kingston  Kingston  
  hide details  
Reply
post #2 of 6
In C# the parameter signature for the entry point (i.e. Main) must be void or a string array of command line arguments.
Code:
public static void Main(string[] args)
{
        /* .. */
}

In order to pass parameters to the program on the command line you need to do as follows:
Code:
public static void Main(string[] args)
{
        if ( args.Length == 0 )
        {
                Console.WriteLine( "Invalid parameters." );
                return;
        }

        int clientID;
        int totalClients;

        if ( int.TryParse( args[0], out clientID ) && int.TryParse( args[1], out totalClients ) )
        {
                /* your main code here */
        }       
}

Parameter zero becomes client ID and parameter one becomes totalClients.

For example:
Code:
DroneCLI.exe 489 10
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
post #3 of 6
Thread Starter 
As that stands it activates the first if statement and closes. If I remove the first if then the second one throw an out of bounds.

My understanding of the solution is I have to convert the int to strings to store them in the args array for use in other methods.


I have it working. I removed your code and added the string[] args. Deleted another line and it's working perfectly. All my checks in the other method are showing the correct numbers.


Current working code for referance:
Warning: Spoiler! (Click to show)
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Security.Cryptography;

namespace ConsoleApplication1
{




    class Program
    {




        public static void Main(string[] args) 
        {

            int clientID=0;
            int totalClients;


                string returnData = null;
                //Int32 clientID = 0;
                string serverIP = null;
                //ng temp1 = null;

                //Local client ID for hash optimisation.
                Console.WriteLine("Please enter the client number");
                //temp1 = Console.ReadLine();
                clientID = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("ClientID Check: " + clientID);

                //Local client total for hash optimisation.
                Console.WriteLine("Please enter the total number of clients: ");
                //temp1 = Console.ReadLine();
                totalClients = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Clienttotal Check: " + totalClients);



                UdpClient udpClient = new UdpClient(8008);
                Byte[] recieveBytes = new Byte[1024]; // buffer to read the data into 1 kilobyte at a time
                IPAddress multicastIpAddress = IPAddress.Parse("225.0.0.1"); // assign the Multicast address
                //join the Multicast group
                udpClient.JoinMulticastGroup(multicastIpAddress);
                //recieve any communcations which are intended for this machine
                IPEndPoint remoteIPEndPoint = new IPEndPoint(IPAddress.Any, 8008);  //open port 8008 on this machine
                Console.WriteLine("Multicast Client is Started");
                //recieve the data from the UDP packet

                //server IP address
                recieveBytes = udpClient.Receive(ref remoteIPEndPoint);
                serverIP = Encoding.ASCII.GetString(recieveBytes);
                Console.WriteLine("Server Ip Address: " + serverIP.TrimEnd());

                //Hash Value
                recieveBytes = udpClient.Receive(ref remoteIPEndPoint);
                returnData = Encoding.ASCII.GetString(recieveBytes);
                Console.WriteLine("Input Hash String:\n" + returnData.TrimEnd());
                //Console.WriteLine(returnData);
                //input = returnData;

                checkHash(returnData.TrimEnd(), clientID, totalClients);



                udpClient.Close();



                Console.WriteLine("Press any button to exit.");

                //TCP to send data
                //TcpClient

            
            Console.ReadLine();

        
        
        }
        static void checkHash(string original, int clientID, int totalClients)
        {


            int count = 0;
            string tocheck = "";
            Console.WriteLine(clientID);
            int range = 0;
            int minRange = 0;
            int maxRange = 0;
            int clientID2 = clientID;
            int totalClients2 = totalClients;
            range = (1000 / totalClients2);
            minRange = ((clientID2 - 1) * range);
            Console.WriteLine("minRange checked" + minRange);
            maxRange = (clientID * range) + 5;
            Console.WriteLine("maxRange checked" + maxRange);
            count = minRange;

            //Loop for Hash check
            while (count < maxRange)   //2147483647
            {
                tocheck = count.ToString();
                if (original.CompareTo(generateHash(tocheck)) == 0)
                {
                    Console.WriteLine("Found clear text is " + tocheck);
                    count = 2147483646;
   
                }

                if (count % 50 == 0)  //60000
                { 
                    Console.WriteLine("Up to " + tocheck + " checked."); 
                }

                    
                    
                
                count++;
                //Console.WriteLine(count);
            }

            //if count doesn't = max then throw hash error.
            while (count != 2147483647)
            {
                Console.WriteLine("Hash not found.");
                count = 2147483647;

            }

        }


        static string generateHash(string input)
        {
            
            //the method used here to generate the MD5 hash is a standard method provided by Microsoft
            MD5 md5Hasher = MD5.Create();
            byte[] data = md5Hasher.ComputeHash(Encoding.Default.GetBytes(input));
            StringBuilder sBuilder = new StringBuilder();
            for (int i = 0; i < data.Length; i++)
                {
                    sBuilder.Append(data[i].ToString("x2"));
                }
                return sBuilder.ToString();
           }



    }        
}


Edited by BritishBob - 3/10/14 at 8:12pm
Don't Push that!
(21 items)
 
 
TheBeast
(10 items)
 
CPUMotherboardGraphicsRAM
3930k ASUS ROG Rampage IV Sapphire 7970 16 GB Samsung DDR3 @ 1600 8-8-8-24 
Hard DriveHard DriveHard DriveHard Drive
Crucial 128GB 2.5" M4 SSD  WD Red 1TB WD Red 1TB WD Red 1TB 
Hard DriveOptical DriveCoolingCooling
WD Red 1TB LiteOn iHAS124-19 24x DVD±RW DL & RAM SATA Optical Silver Arrow Bitfenix Spectre Pro 200mm 
CoolingOSPowerCase
Bitfenix Spectre Pro 230mm Windows 7 Corsair Professional Series AX750 750W Modular PSU Coolermaster HAF X 
MouseAudio
SteelSeries Sensei Laser Gaming Mouse ASUS XONAR DG 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 P5B-Deluxe Radeon HD 5970 Corsair  
CoolingCase
Hyper 212 Modded Cream Tower of Death 
CPUCPUCPUCPU
AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE 
MotherboardGraphicsRAMRAM
H8QM8 560ti Kingston  Kingston  
RAMRAM
Kingston  Kingston  
  hide details  
Reply
Don't Push that!
(21 items)
 
 
TheBeast
(10 items)
 
CPUMotherboardGraphicsRAM
3930k ASUS ROG Rampage IV Sapphire 7970 16 GB Samsung DDR3 @ 1600 8-8-8-24 
Hard DriveHard DriveHard DriveHard Drive
Crucial 128GB 2.5" M4 SSD  WD Red 1TB WD Red 1TB WD Red 1TB 
Hard DriveOptical DriveCoolingCooling
WD Red 1TB LiteOn iHAS124-19 24x DVD±RW DL & RAM SATA Optical Silver Arrow Bitfenix Spectre Pro 200mm 
CoolingOSPowerCase
Bitfenix Spectre Pro 230mm Windows 7 Corsair Professional Series AX750 750W Modular PSU Coolermaster HAF X 
MouseAudio
SteelSeries Sensei Laser Gaming Mouse ASUS XONAR DG 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 P5B-Deluxe Radeon HD 5970 Corsair  
CoolingCase
Hyper 212 Modded Cream Tower of Death 
CPUCPUCPUCPU
AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE 
MotherboardGraphicsRAMRAM
H8QM8 560ti Kingston  Kingston  
RAMRAM
Kingston  Kingston  
  hide details  
Reply
post #4 of 6
So are you wanting to pass in the parameters as a command line arguments, or ask that as statements while the program is running? If you want command line arguments Tompsonn is correct with his method. But according to your original code, it looks like you are trying to pass them as command line arguments but you still ask the user to enter them afterwards.

The only reason that I can see that you are bailing after the first 'if' is that you aren't passing any parameters to the executable at run time. (i.e. you run normally from a debugger [visual studio], or you call it from the command line with no parameters[only DroneCLI.exe ]. If you haven't set up your debugger to pass parameters you will most definitely bail in the first if. And if you comment it out, you will for sure get an out of bounds exception (because there are no parameters). If you can answer the question of How do you want the inputs passed in, it would be helpful to point you in the right direction. The options are, from command line inputs (Tompsonn's suggestions) or through user input while the program is running.

Good Luck!

-Ike
Work in Progress
(15 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-8350 BE Vishera GIGABYTE 990FXA SAPPHIRE FleX-2 7950 G.SKILL Ripjaws X Series 
Hard DriveOptical DriveCoolingOS
OCZ Vertex 4 HP 20X DVD±R DVD Burner CORSAIR H100i Windows 8 
MonitorMonitorKeyboardPower
22in Widescreen Samsung 24in Widescreen Asus Microsoft Corsair 650TX 
CaseMouse
Corsair Vengeance C70 in Gunmetal Black Logitech G700 
  hide details  
Reply
Work in Progress
(15 items)
 
  
CPUMotherboardGraphicsRAM
AMD FX-8350 BE Vishera GIGABYTE 990FXA SAPPHIRE FleX-2 7950 G.SKILL Ripjaws X Series 
Hard DriveOptical DriveCoolingOS
OCZ Vertex 4 HP 20X DVD±R DVD Burner CORSAIR H100i Windows 8 
MonitorMonitorKeyboardPower
22in Widescreen Samsung 24in Widescreen Asus Microsoft Corsair 650TX 
CaseMouse
Corsair Vengeance C70 in Gunmetal Black Logitech G700 
  hide details  
Reply
post #5 of 6
Thread Starter 
Quote:
Originally Posted by Ike View Post

Warning: Spoiler! (Click to show)
So are you wanting to pass in the parameters as a command line arguments, or ask that as statements while the program is running? If you want command line arguments Tompsonn is correct with his method. But according to your original code, it looks like you are trying to pass them as command line arguments but you still ask the user to enter them afterwards.

The only reason that I can see that you are bailing after the first 'if' is that you aren't passing any parameters to the executable at run time. (i.e. you run normally from a debugger [visual studio], or you call it from the command line with no parameters[only DroneCLI.exe ]. If you haven't set up your debugger to pass parameters you will most definitely bail in the first if. And if you comment it out, you will for sure get an out of bounds exception (because there are no parameters). If you can answer the question of How do you want the inputs passed in, it would be helpful to point you in the right direction. The options are, from command line inputs (Tompsonn's suggestions) or through user input while the program is running.

Good Luck!

-Ike

Any and all that? redface.gif

Anyway it's working... Now I am just working on making the client send the cracked hash back to the server. The examples on unicast coms that I have been given are a mess as the key areas are without notation... For 4 in the morning it's too much to think about... off to sleep...

Also Ty for the info/ideas/input. thumb.gif
Don't Push that!
(21 items)
 
 
TheBeast
(10 items)
 
CPUMotherboardGraphicsRAM
3930k ASUS ROG Rampage IV Sapphire 7970 16 GB Samsung DDR3 @ 1600 8-8-8-24 
Hard DriveHard DriveHard DriveHard Drive
Crucial 128GB 2.5" M4 SSD  WD Red 1TB WD Red 1TB WD Red 1TB 
Hard DriveOptical DriveCoolingCooling
WD Red 1TB LiteOn iHAS124-19 24x DVD±RW DL & RAM SATA Optical Silver Arrow Bitfenix Spectre Pro 200mm 
CoolingOSPowerCase
Bitfenix Spectre Pro 230mm Windows 7 Corsair Professional Series AX750 750W Modular PSU Coolermaster HAF X 
MouseAudio
SteelSeries Sensei Laser Gaming Mouse ASUS XONAR DG 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 P5B-Deluxe Radeon HD 5970 Corsair  
CoolingCase
Hyper 212 Modded Cream Tower of Death 
CPUCPUCPUCPU
AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE 
MotherboardGraphicsRAMRAM
H8QM8 560ti Kingston  Kingston  
RAMRAM
Kingston  Kingston  
  hide details  
Reply
Don't Push that!
(21 items)
 
 
TheBeast
(10 items)
 
CPUMotherboardGraphicsRAM
3930k ASUS ROG Rampage IV Sapphire 7970 16 GB Samsung DDR3 @ 1600 8-8-8-24 
Hard DriveHard DriveHard DriveHard Drive
Crucial 128GB 2.5" M4 SSD  WD Red 1TB WD Red 1TB WD Red 1TB 
Hard DriveOptical DriveCoolingCooling
WD Red 1TB LiteOn iHAS124-19 24x DVD±RW DL & RAM SATA Optical Silver Arrow Bitfenix Spectre Pro 200mm 
CoolingOSPowerCase
Bitfenix Spectre Pro 230mm Windows 7 Corsair Professional Series AX750 750W Modular PSU Coolermaster HAF X 
MouseAudio
SteelSeries Sensei Laser Gaming Mouse ASUS XONAR DG 
CPUMotherboardGraphicsRAM
Intel Core 2 Quad Q6600 P5B-Deluxe Radeon HD 5970 Corsair  
CoolingCase
Hyper 212 Modded Cream Tower of Death 
CPUCPUCPUCPU
AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE AMD Opteron 8439 SE 
MotherboardGraphicsRAMRAM
H8QM8 560ti Kingston  Kingston  
RAMRAM
Kingston  Kingston  
  hide details  
Reply
post #6 of 6
Quote:
Originally Posted by Ike View Post

So are you wanting to pass in the parameters as a command line arguments, or ask that as statements while the program is running? If you want command line arguments Tompsonn is correct with his method. But according to your original code, it looks like you are trying to pass them as command line arguments but you still ask the user to enter them afterwards.

The only reason that I can see that you are bailing after the first 'if' is that you aren't passing any parameters to the executable at run time. (i.e. you run normally from a debugger [visual studio], or you call it from the command line with no parameters[only DroneCLI.exe ]. If you haven't set up your debugger to pass parameters you will most definitely bail in the first if. And if you comment it out, you will for sure get an out of bounds exception (because there are no parameters). If you can answer the question of How do you want the inputs passed in, it would be helpful to point you in the right direction. The options are, from command line inputs (Tompsonn's suggestions) or through user input while the program is running.

Good Luck!

-Ike

Yeah I thought he wanted to pass via command line. But I did forget to check the array length so my bad.
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
Ol' Sandy
(28 items)
 
"Zeus"
(12 items)
 
Elite Preview
(6 items)
 
CPUMotherboardGraphicsRAM
Intel Xeon E3-1230v3 Gigabyte GA-Z97X-UD5H-BK MSI Gaming GTX 980 Kingston 32GB (4x8) 
Hard DriveHard DriveHard DriveHard Drive
Plextor PX-256M5S 256GB Samsung EVO 1TB Hitachi HDS721010CLA332 Hitachi HDS723020BLA642 
Hard DriveHard DriveHard DriveOptical Drive
Hitachi HDS723020BLA642 Hitachi HUA722010CLA330 WDC WD10EARS-00Z5B1 TSSTcorp CDDVDW SH-S223B 
CoolingCoolingOSMonitor
Phanteks PH-TC14PE with TY-140's Lamptron FCv5 (x2) Windows 8 Pro 64-bit Dell U2412M 
MonitorMonitorMonitorKeyboard
Dell U2412M Dell U2212HM Dell U2713HM Topre Realforce 87UB | Ducky DK9087 G2 Pro 
PowerCaseMouseMouse Pad
Corsair AX-750 Corsair Obsidian 650D Logitech G700 XTRAC Ripper XXL 
AudioAudioAudioAudio
Beyerdynamic DT-770 Pro 250ohm Schiit Bifrost DAC Schiit Asgard 2 HiVi Swan M50W 2.1 
CPUMotherboardRAMHard Drive
Intel Xeon E5-2620 Super Micro X9SRL-F-B 128GB 1333MHz LSI 9271-8i 
OSPowerCase
VMware ESXi 5.5 SeaSonic SS-400FL2 Fractal Define R3 
CPUMotherboardGraphicsRAM
Intel Core i5-3437U HP EliteBook Folio 9470m  Intel HD Graphics 4000  16GB DDR3 SDRAM 
Hard DriveOS
256GB SSD Windows 10 Insider Preview 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming