Exemplo n.º 1
0
        private void RenameListsButton_Click(object sender, EventArgs e)
        {
            Excel excel = OpenFileAt(1);

            output.WriteLine("Rename Lists : Coordinates | Current Name | Rename ");

            for (int i = 2; i < Program.GetMax(); i++)
            {
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 6)))
                {
                    output.Write(excel.ReadCellString(i, 6) + " | "); //location
                }
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 7)))
                {
                    output.Write(excel.ReadCellString(i, 7) + " | ");//before
                }
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 8)))
                {
                    output.Write("/namecolony " + excel.ReadCellString(i, 8));//after
                }
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 6)) || !string.IsNullOrEmpty(excel.ReadCellString(i, 7)) || !string.IsNullOrEmpty(excel.ReadCellString(i, 8)))
                {
                    output.WriteLine("");
                }
            }
            output.Flush();
            excel.Close();

            MessageBox.Show("Rename lists added to Output.txt", "Completed");
        }
Exemplo n.º 2
0
        private void ParadisesButton_Click(object sender, EventArgs e)
        {
            int.TryParse(numberTextBox.Text, out int temp);

            if (temp > 0)
            {
                int planetNumber = Int32.Parse(numberTextBox.Text);
                Excel excel = OpenFileAt(8);
                string planet = excel.ReadCellString(planetNumber, 2); //read row planet number column c
                excel.Close();//dellocate
                numberTextBox.Text = planet;
                RetrievePicture("IGP", planetNumber);
            }
            else
            {
                Excel excel = OpenFileAt(8);
                int planet = (int)excel.ReadCellDouble(1, 8); //amount of planets

                output.WriteLine("Paradises: ");
                for (int i = 1; i <= planet; i++)
                {
                    WriteAllPlanetInfo(i, excel);
                }
                output.Flush();
                excel.Close();

                MessageBox.Show("Paradises added to " + outputPath, "Completed");
            }
        }
Exemplo n.º 3
0
        private void DoubleDomeListButton_Click(object sender, EventArgs e)
        {
            Excel excel = OpenFileAt(1);

            output.WriteLine("Double Domes Lists: Candidates | Double Domes: ");

            for (int i = 2; i < Program.GetMax(); i++)
            {
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 18)))
                {
                    output.Write(excel.ReadCellString(i, 18) + " | "); //Candidates
                }
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 19)))
                {
                    output.Write(excel.ReadCellString(i, 19) + " | ");//double doems
                }
                if (!string.IsNullOrEmpty(excel.ReadCellString(i, 18)) || !string.IsNullOrEmpty(excel.ReadCellString(i, 19)))
                {
                    output.WriteLine("");
                }
            }
            output.Flush();
            excel.Close();

            MessageBox.Show("Double Domes list added to Output.txt", "Completed");
        }
Exemplo n.º 4
0
        /// <summary>
        /// Finds and compares the number and outprints all the planet info if true
        /// </summary>
        /// <param name="find"></param>
        /// <param name="column"></param>
        private void WriteAllPlanetInfoIf(int compare, int column, bool greaterThan, bool lessThan, bool equalTo)
        {
            for (int j = 2; j <= 10; j++) // goes through each sheet
            {
                Excel excel = OpenFileAt(j);

                int planet = (int)excel.ReadCellDouble(1, 8);
                for (int i = 1; i <= planet; i++) // goes through the planet list
                {
                    double temp = excel.ReadCellDouble(planet, column);
                    if (temp < compare && lessThan)
                    {
                        WriteAllPlanetInfo(planet, excel);
                    }
                    else if (temp > compare && greaterThan)
                    {
                        WriteAllPlanetInfo(planet, excel);
                    }
                    else if (temp == compare && equalTo)
                    {
                        WriteAllPlanetInfo(planet, excel);
                    }
                }

                excel.Close();
            }
        }
Exemplo n.º 5
0
        private void ClearBuildsButton_Click(object sender, EventArgs e)
        {
            Excel excel = OpenFileAt(11);

            Clearer.ClearBuildList(excel);
            MessageBox.Show("Build List Cleared!", "Message");
            excel.Close();
        }
Exemplo n.º 6
0
        private void SortBuildsButton_Click(object sender, EventArgs e)
        {
            Excel excel       = OpenFileAt(11);
            int   totalBuilds = excel.ReadCellInt(1, 15); //amount of builds num

            string[,] planets = new string[totalBuilds, 8];
            Console.WriteLine(planets.GetLength(0) + " " + planets.GetLength(1));

            for (int i = 1; i <= planets.GetLength(0); i++) //establish the array
            {
                bool tempBools = false;
                //Console.WriteLine(i);
                planets[i - 1, 0] = excel.ReadCellString(i, 2);
                planets[i - 1, 1] = excel.ReadCellString(i, 3);
                planets[i - 1, 2] = excel.ReadCellString(i, 4);

                tempBools         = excel.ReadCellBool(i, 5);
                planets[i - 1, 3] = tempBools.ToString();

                tempBools         = excel.ReadCellBool(i, 6);
                planets[i - 1, 4] = tempBools.ToString();

                tempBools         = excel.ReadCellBool(i, 7);
                planets[i - 1, 5] = tempBools.ToString();

                tempBools         = excel.ReadCellBool(i, 8);
                planets[i - 1, 6] = tempBools.ToString();

                int tempInt = excel.ReadCellInt(i, 9);
                planets[i - 1, 7] = tempInt.ToString();
            }
            //Clearer.ClearBuildList(excel);

            Coordinates origin;

            origin = Algorithms.GetCoordinates("(0,0)");

            ColonyInfo[] colInfo = Algorithms.SortPlanetsByXAndY(planets, origin, Algorithms.GetCoordinates(planets[totalBuilds - 1, 0])); //get the sorted array

            Clearer.ClearBuildList(excel);

            Console.WriteLine("This algorithm is bad its making tons of duplicates"); /*
                                                                                       * for (int i = 0; i < planets.GetLength(0); i++)
                                                                                       * {
                                                                                       * for (int j = 0; j < planets.GetLength(0); j++)
                                                                                       * {
                                                                                       * Coordinates oldList = Algorithms.GetCoordinates(planets[j, 0]);
                                                                                       * if ((colInfo[i].coords.x == oldList.x) && (colInfo[i].coords.y == oldList.y))
                                                                                       * {
                                                                                       * //Console.WriteLine(planets[i, 0] + " ");
                                                                                       * Adder.AddToBuilds(excel, planets[j, 0], planets[j, 1], planets[j, 2], planets[j, 3], planets[j, 4], planets[j, 5], planets[j, 6], planets[j, 7]);
                                                                                       * }
                                                                                       * }
                                                                                       * }
                                                                                       */
            excel.Close();
            MessageBox.Show("Build List Sorted by System", "Completed");
        }
Exemplo n.º 7
0
        private void NeedsDefensesButton_Click(object sender, EventArgs e)
        {
            Excel excel = OpenFileAt(1);

            output.WriteLine("Needs Defense List: ");
            for (int i = 2; i < Program.GetMax(); i++)
            {
                output.WriteLine(excel.ReadCellString(i, 14)); //needs defense column
            }
            output.Flush();
            excel.Close();

            MessageBox.Show("Needs Defense List added to Output.txt", "Completed");
        }
Exemplo n.º 8
0
        public static string ReplacePlanetMethod(int sheet, int row, string newPlanetName)
        {
            Excel excel = OpenFileAt(sheet);

            if (excel.ReadCellString(row, 2).Equals("") || excel.ReadCellString(row, 2).Equals(null)) // if the box was empty
            {
                excel.WriteToCell(row, 2, newPlanetName);                                             //planet in box
                excel.WriteToCell(row, 1, row.ToString());                                            // update number next to it

                if (row > excel.ReadCellDouble(1, 8))                                                 //if the new numbeer is greater than the total
                {
                    excel.WriteToCell(1, 8, row.ToString());                                          //update number

                    excel.Close();
                    return(newPlanetName + " added to" + " slot " + row + " on sheet " + sheet + " Totals updated to " + row);
                }
                else
                {
                    excel.Close();
                    return(newPlanetName + " added to" + " slot " + row + " on sheet " + sheet);
                }
            }
            else if (excel.ReadCellString(row, 2).Equals(newPlanetName))
            {
                excel.Close();
                return("Identitcal planet found! Nothing has been added");
            }
            else
            {
                string oldPlanetName = excel.ReadCellString(row, 2);
                excel.WriteToCell(row, 2, newPlanetName); //put the planet in the box

                excel.Close();
                return(newPlanetName + " replaced " + oldPlanetName + " in slot " + row + " on" + " sheet " + sheet);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Finds and outputs the planet info if the string matches
        /// </summary>
        /// <param name="find"></param>
        /// <param name="column"></param>
        private void WriteAllPlanetInfoIf(string find, int column)
        {
            for (int j = 2; j <= 10; j++) // goes through each sheet
            {
                Excel excel = OpenFileAt(j);

                int planet = (int)excel.ReadCellDouble(1, 8);
                for (int i = 1; i <= planet; i++) // goes through the planet list
                {
                    if (excel.ReadCellString(planet, column).Equals(find))
                    {
                        WriteAllPlanetInfo(planet, excel);
                    }
                }

                excel.Close();
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// OBSOLETE USE REPLACER.REPLACEPLANET
        /// </summary>
        /// <param name="sheet"></param>
        /// <param name="planetName"></param>
        public static void AddPlanet(int sheet, string planetName)
        {
            Excel excel = OpenFileAt(sheet);

            int planet = excel.ReadCellInt(1, 8);        //read p Tally
            int temp   = planet + 1;                     //get it ot the next row

            excel.WriteToCell(temp, 1, temp.ToString()); //updates the number next to the cell
            excel.WriteToCell(temp, 2, planetName);      //put the planet in the box

            if (excel.ReadCellInt(1, 8) < temp)
            {
                excel.WriteToCell(1, 8, temp.ToString()); //updates the planet number
            }

            //MessageBox.Show(planetName + " added to row " + temp + " sheet " + sheet, "Completed");

            excel.Close();
        }
Exemplo n.º 11
0
        private void SameSystemListButton_Click(object sender, EventArgs e)
        {
            Coordinates system = Algorithms.GetCoordinates(numberTextBox.Text);

            for (int j = 2; j <= 10; j++) // goes through each sheet
            {
                Excel excel = OpenFileAt(j);

                int planet = (int)excel.ReadCellDouble(1, 8);
                for (int i = 1; i <= planet; i++) // goes through the planet list
                {
                    string planetName = excel.ReadCellString(i, 2);
                    Coordinates planetCoords = Algorithms.GetCoordinates(planetName);
                    if (system.x == planetCoords.x && system.y == planetCoords.y)
                    {
                        output.WriteLine(planetName);
                    }
                }
                excel.Close();
            }

            output.Flush();
            MessageBox.Show("Colonies in the Same System to output", "Message");
        }
Exemplo n.º 12
0
        public static string BuildZoundsDestroy(string colonyInfo, bool resources, bool defended)
        {
            Excel        excel  = OpenFileAt(11); // build list
            StringReader reader = new StringReader(colonyInfo);
            string       line;

            string planetType  = null;
            string coordinates = null; // C
            string planetName  = null; // D
            string colonyName  = null; // E
            string discoveries = null; // K
            int    research    = -1;   // J

            bool[] buildableHolder = new bool[4];

            bool zoundsable   = false;
            bool medium       = false;
            bool questionable = false;
            bool deconstruct  = false;// F , G, H, I

            buildableHolder[0] = zoundsable;
            buildableHolder[1] = medium;
            buildableHolder[2] = questionable;
            buildableHolder[3] = deconstruct;

            for (int i = 0; i < colonyInfo.Length; i++)
            {
                line = reader.ReadLine();

                if (line != null)
                {
                    if (i == 0)
                    {
                        colonyName = line;
                        Console.WriteLine(line);
                    }
                    else if (i == 3)
                    {
                        string[] temp = line.Split(':');
                        planetType = temp[1];
                        planetType = RemoveSpaces(planetType);
                    }
                    else if (i == 4)
                    {
                        string[] temp = line.Split(':');
                        temp        = temp[1].Split('(');
                        planetName  = temp[0];
                        coordinates = temp[1];
                        coordinates = "(" + coordinates;
                    }
                    else if (i == 40)
                    {
                        string[] temp = line.Split('/');
                        temp[0]  = RemoveLetters(temp[0]);
                        temp[0]  = RemoveParenthesisColonComma(temp[0]);
                        research = int.Parse(temp[0]);
                    }
                    else if (i >= 41)
                    {
                        discoveries = discoveries + '\n' + line;
                    }
                }
            }

            bool noDuplicate = true;

            for (int i = 1; i <= excel.ReadCellInt(1, 15); i++)
            {
                if (planetName.Equals(excel.ReadCellString(i, 3)))
                {
                    noDuplicate = false;
                    excel.Close();
                    return("Duplicate Found");
                }
            }

            if (research >= 1 && noDuplicate)
            {
                buildableHolder = Checkers.Buildable(discoveries, planetType);
                zoundsable      = buildableHolder[0];
                medium          = buildableHolder[1];
                questionable    = buildableHolder[2];
                deconstruct     = buildableHolder[3];

                int totalBuilds = excel.ReadCellInt(1, 15);
                totalBuilds += 1;
                Console.WriteLine(totalBuilds);
                //excel.WriteToCell(1, 15, totalBuilds.ToString());

                //excel.WriteToCell(totalBuilds, 1, totalBuilds.ToString());
                excel.WriteToCell(totalBuilds, 2, coordinates);
                excel.WriteToCell(totalBuilds, 3, planetName);
                excel.WriteToCell(totalBuilds, 4, colonyName);
                excel.WriteToCell(totalBuilds, 5, zoundsable.ToString());
                excel.WriteToCell(totalBuilds, 6, medium.ToString());
                excel.WriteToCell(totalBuilds, 7, questionable.ToString());
                excel.WriteToCell(totalBuilds, 8, deconstruct.ToString());
                excel.WriteToCell(totalBuilds, 9, research.ToString());
                excel.WriteToCell(totalBuilds, 10, resources.ToString());
                excel.WriteToCell(totalBuilds, 11, defended.ToString());

                excel.Close();
                return("build added");
            }
            else
            {
                Console.WriteLine(colonyName + " is Not Finished Researching.");
                excel.Close();
                return(colonyName + " is Not Finished Researching.");
            }
        }
Exemplo n.º 13
0
        public static string AddColonyInfo(int sheet, string info, int planetNum)
        {
            Excel excel = OpenFileAt(sheet);

            string colonyName   = null;
            string planetName   = null;  //K
            int    pop          = -1;    //L Population
            int    morale       = 9999;  // M
            string gov          = null;  //N government
            int    treasury     = -1;    //O
            int    hourlyIncome = 0;     //P
            string taxRate;              // Q
            string pollution     = null; //R
            int    disastas      = 0;    // S
            string pollutionRate = null; //T
            string construction  = null; //U
            string research      = null; //V
            string military      = null; //W
            string harvesting    = null; //X
            string building      = null; //Y
            int    metal         = -1;   // Z
            int    anae          = -1;   // AA
            int    meds          = -1;   // AB
            int    orgs          = -1;   // AC
            int    oil           = -1;   // AD
            int    uri           = -1;   // AE
            int    equi          = -1;   // AF
            int    spice         = -1;   // AG
            int    nukes         = -1;   // AH
            int    cMines        = -1;   // AI
            int    lasers        = -1;   // AJ
            int    solarShots    = -1;   // AK
            int    solarRate     = -1;   //AL
            string discovered    = null; //AM

            //StringBuilder stringBuilder = new StringBuilder();
            //stringBuilder.AppendLine("");
            StringReader reader = new StringReader(info);
            string       line;

            //string firstLine = reader.ReadLine();

            for (int i = 0; i < info.Length; i++)
            {
                line = reader.ReadLine();
                if (line != null)
                {
                    if (i == 0)
                    {
                        colonyName = line;
                        Console.WriteLine(line);
                    }
                    if (i == 4)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 7); //takes everything after the colon
                            }
                            else if (line[j].Equals('('))
                            {
                                line = line.Substring(0, j); //removes everything after the parenthesis
                            }
                        }
                        planetName = line;
                        Console.WriteLine(planetName);
                    }
                    else if (i == 8)
                    {
                        string[] temp = line.Split(':');
                        temp    = temp[1].Split('('); //temp[1] is the growth rate
                        temp[0] = RemoveSpaces(temp[0]);
                        temp[0] = RemoveParenthesisColonComma(temp[0]);
                        Console.WriteLine(temp[0]);

                        pop = int.Parse(temp[0]);
                    }
                    else if (i == 9)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals('('))
                            {
                                line = line.Substring(0, j);
                            }
                        }
                        line = RemoveParenthesisColonComma(line);
                        line = RemoveLetters(line);
                        Console.WriteLine(line);
                        morale = int.Parse(line);
                    }
                    else if (i == 10)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 5); //takes everything after the colon
                            }
                        }
                        gov = RemoveSpaces(line);
                        Console.WriteLine(gov);
                    }
                    else if (i == 11)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 7); //takes everything after the colon
                            }
                        }
                        string[] temp = line.Split('(');

                        temp[0]  = RemoveParenthesisColonComma(temp[0]);
                        temp[0]  = RemoveSpaces(temp[0]);
                        treasury = int.Parse(temp[0]);

                        temp[1] = RemoveParenthesisColonComma(temp[1]);
                        temp[1] = RemoveLetters(temp[1]);
                        if (temp[1].Equals(null) || temp[1].Equals(""))
                        {
                        }
                        else
                        {
                            hourlyIncome = int.Parse(temp[1]);
                        }

                        Console.WriteLine(temp[0] + " " + temp[1] + "/hr");
                    }
                    else if (i == 12)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 6); //takes everything after the colon
                            }
                        }

                        string[] temp = line.Split('(');
                        pollution = temp[0];

                        if (temp.Length > 2)
                        {
                            string trim = RemoveParenthesisColonComma(temp[1]);
                            disastas      = int.Parse(trim);
                            pollutionRate = temp[2];
                        }
                        else
                        {
                            pollutionRate = temp[1];
                        }
                        pollutionRate = RemoveLetters(pollutionRate);
                        pollutionRate = RemoveParenthesisColonComma(pollutionRate);
                        pollutionRate = RemoveSlashes(pollutionRate);

                        Console.WriteLine(pollution + " " + disastas);
                        Console.WriteLine(pollutionRate);
                    }
                    else if (i == 15)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 3); //takes everything after the colon
                            }
                        }
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals('('))
                            {
                                line = line.Substring(0, j); //removes everything after the parenthesis
                            }
                        }
                        Console.WriteLine(line);
                        line         = RemoveSpaces(line);
                        construction = line;
                    }
                    else if (i == 16)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 7); //takes everything after the colon
                            }
                        }
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals('('))
                            {
                                line = line.Substring(0, j); //removes everything after the parenthesis
                            }
                        }
                        Console.WriteLine(line);
                        line     = RemoveSpaces(line);
                        research = line;
                    }
                    else if (i == 17)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 7); //takes everything after the colon
                            }
                        }
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals('('))
                            {
                                line = line.Substring(0, j); //removes everything after the parenthesis
                            }
                        }
                        Console.WriteLine(line);
                        line     = RemoveSpaces(line);
                        military = line;
                    }
                    else if (i == 18)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 5); //takes everything after the colon
                            }
                        }
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals('('))
                            {
                                line = line.Substring(0, j); //removes everything after the parenthesis
                            }
                        }
                        Console.WriteLine(line);
                        line       = RemoveSpaces(line);
                        harvesting = line;
                    }
                    else if (i == 20)
                    {
                        for (int j = 0; j < line.Length; j++)
                        {
                            if (line[j].Equals(':'))
                            {
                                line = line.Substring(j + 7); //takes everything after the colon
                            }
                        }
                        building = line;
                        Console.WriteLine(building);
                    }
                    else if (i == 30)
                    {
                        //metal and anae on thsir ow
                        string[] temp = line.Split(':');
                        temp[1] = RemoveLetters(temp[1]);
                        temp[2] = RemoveSpaces(temp[2]);
                        metal   = int.Parse(temp[1]);
                        anae    = int.Parse(temp[2]);
                        Console.WriteLine(temp[1] + '\n' + temp[2]);
                    }
                    else if (i == 31)
                    {
                        //meds & orgs
                        string[] temp = line.Split(':');
                        temp[1] = RemoveLetters(temp[1]);
                        temp[2] = RemoveSpaces(temp[2]);
                        meds    = int.Parse(temp[1]);
                        orgs    = int.Parse(temp[2]);
                        Console.WriteLine(temp[1] + '\n' + temp[2]);
                    }
                    else if (i == 32)
                    {
                        //oil and uri
                        string[] temp = line.Split(':');
                        temp[1] = RemoveLetters(temp[1]);
                        temp[2] = RemoveSpaces(temp[2]);
                        oil     = int.Parse(temp[1]);
                        uri     = int.Parse(temp[2]);
                        Console.WriteLine(temp[1] + '\n' + temp[2]);
                    }
                    else if (i == 33)
                    {
                        //equi and spice
                        string[] temp = line.Split(':');
                        temp[1] = RemoveLetters(temp[1]);
                        temp[2] = RemoveSpaces(temp[2]);
                        equi    = int.Parse(temp[1]);
                        spice   = int.Parse(temp[2]);
                        Console.WriteLine(temp[1] + '\n' + temp[2]);
                    }
                    else if (i == 36)
                    {
                        if (line.Equals("No weapons factory present."))
                        {
                            for (int j = i; j < info.Length; j++)
                            {
                                if (line != null)
                                {
                                    if (j == 38)
                                    {
                                        string[] temp = line.Split('(');
                                        temp[0] = RemoveLetters(temp[0]);
                                        temp[0] = RemoveParenthesisColonComma(temp[0]);

                                        temp[1] = RemoveLetters(temp[1]);
                                        temp[1] = RemoveParenthesisColonComma(temp[1]);
                                        if (temp[1] == null || temp[1].Equals(""))
                                        {
                                            temp[1] = "0";
                                        }

                                        solarShots = int.Parse(temp[0]);
                                        solarRate  = int.Parse(temp[1]);
                                        Console.WriteLine(temp[0] + '\n' + temp[1]);
                                    }
                                    line = reader.ReadLine();
                                    if (j >= 39 && j <= 50)
                                    {
                                        discovered = discovered + '\n' + line;
                                    }
                                }
                            }
                            Console.WriteLine("No Weapons Factory");
                            break;
                        }
                        else
                        {
                            //nukes
                            string[] temp = line.Split(':');
                            temp[1] = RemoveSpaces(temp[1]);
                            temp[1].Trim();
                            nukes = int.Parse(temp[1]);
                            Console.WriteLine(temp[1]);
                        }
                    }
                    else if (i == 39)
                    {
                        //cmines
                        string[] temp = line.Split(':');
                        temp[1] = RemoveSpaces(temp[1]);

                        cMines = int.Parse(temp[1]);
                        Console.WriteLine(temp[1]);
                    }
                    else if (i == 41)
                    {
                        //lasers
                        string[] temp = line.Split(':');
                        temp[1] = RemoveSpaces(temp[1]);

                        lasers = int.Parse(temp[1]);
                        Console.WriteLine(temp[1]);
                    }
                    else if (i == 46)
                    {
                        //solar
                        string[] temp = line.Split('(');
                        temp[0] = RemoveLetters(temp[0]);
                        temp[0] = RemoveParenthesisColonComma(temp[0]);

                        temp[1] = RemoveLetters(temp[1]);
                        temp[1] = RemoveParenthesisColonComma(temp[1]);

                        solarShots = int.Parse(temp[0]);
                        solarRate  = int.Parse(temp[1]);
                        Console.WriteLine(temp[0] + '\n' + temp[1]);
                    }
                    else if (i >= 48 && i <= 59)
                    {
                        discovered = discovered + '\n' + line;

                        //Console.WriteLine(line);
                    }
                }
            }
            Console.Write(discovered);

            string message = Replacer.ReplacePlanetMethod(excel, sheet, planetNum, colonyName);

            excel.WriteToCell(planetNum, 10, planetName);
            excel.WriteToCell(planetNum, 11, pop.ToString());
            excel.WriteToCell(planetNum, 12, morale.ToString());
            excel.WriteToCell(planetNum, 13, gov);
            excel.WriteToCell(planetNum, 14, treasury.ToString());
            excel.WriteToCell(planetNum, 15, hourlyIncome.ToString());
            //skip 16 this is a calculation
            excel.WriteToCell(planetNum, 17, pollution);
            excel.WriteToCell(planetNum, 18, disastas.ToString());
            excel.WriteToCell(planetNum, 19, pollutionRate);
            excel.WriteToCell(planetNum, 20, construction);
            excel.WriteToCell(planetNum, 21, research);
            excel.WriteToCell(planetNum, 22, military);
            excel.WriteToCell(planetNum, 23, harvesting);
            excel.WriteToCell(planetNum, 24, building);
            excel.WriteToCell(planetNum, 25, metal.ToString());
            excel.WriteToCell(planetNum, 26, anae.ToString());
            excel.WriteToCell(planetNum, 27, meds.ToString());
            excel.WriteToCell(planetNum, 28, orgs.ToString());
            excel.WriteToCell(planetNum, 29, oil.ToString());
            excel.WriteToCell(planetNum, 30, uri.ToString());
            excel.WriteToCell(planetNum, 31, equi.ToString());
            excel.WriteToCell(planetNum, 32, spice.ToString());
            excel.WriteToCell(planetNum, 33, nukes.ToString());
            excel.WriteToCell(planetNum, 34, cMines.ToString());
            excel.WriteToCell(planetNum, 35, lasers.ToString());
            excel.WriteToCell(planetNum, 36, solarShots.ToString());
            excel.WriteToCell(planetNum, 37, solarRate.ToString());
            excel.WriteToCell(planetNum, 38, discovered);

            excel.Close();

            return(message);
        }
Exemplo n.º 14
0
        private void VolcanicsButton_Click(object sender, EventArgs e)
        {
            int.TryParse(numberTextBox.Text, out int temp);

            if (temp > 0)
            {
                int planetNumber = Int32.Parse(numberTextBox.Text);
                Excel excel = OpenFileAt(10);
                string planet = excel.ReadCellString(planetNumber, 2); //read row planet number column c
                excel.Close();//dellocate
                numberTextBox.Text = planet;
                RetrievePicture("Vol", planetNumber);
            }
            else if (VolcanicZoundsCheckBox.Checked && VolcanicsCheckBox.Checked) //both
            {
                Excel excel = OpenFileAt(10);
                int planet = (int)excel.ReadCellDouble(1, 8); //amount of planets

                output.WriteLine("Volcanics: ");

                for (int i = 1; i <= planet; i++)
                {
                    WriteAllPlanetInfo(i, excel);
                }
                output.Flush();
                excel.Close();
                MessageBox.Show("Volcanics added to " + outputPath, "Completed");
            }
            else if (VolcanicZoundsCheckBox.Checked && !VolcanicsCheckBox.Checked) //Volcanic Zounds only
            {
                Excel excel = OpenFileAt(10);
                int planet = (int)excel.ReadCellDouble(2, 8); //amount of zounds

                output.WriteLine("Volcanic Zounds: ");

                for (int i = 1; i <= planet; i++)
                {
                    output.WriteLine(excel.ReadCellString(i, 5)); //column F
                }
                output.Flush();
                excel.Close();
                MessageBox.Show("Volcanics Zounds added to " + outputPath, "Completed");
            }
            else if (!VolcanicZoundsCheckBox.Checked && VolcanicsCheckBox.Checked) //normies only
            {
                Excel excel = OpenFileAt(10);
                int planet = (int)excel.ReadCellDouble(1, 8); //amount of planets

                output.WriteLine("Volcanic Non-Zounds: ");

                for (int i = 1; i <= planet; i++)
                {
                    string box = excel.ReadCellString(i, 2);
                    for (int j = 0; j < box.Length; j++)//go through string
                    {
                        if (box[j].Equals('.'))
                        {
                            if (j + 5 < box.Length && !box[j + 5].Equals('Z'))
                            {
                                output.WriteLine(excel.ReadCellString(i, 2)); //column C
                            }
                            else if (j + 3 == box.Length - 1 && !box[j - 4].Equals('.'))
                            {
                                output.WriteLine(excel.ReadCellString(i, 2)); //column C
                            }
                        }
                    }
                }
                output.Flush();
                excel.Close();
                MessageBox.Show("Volcanics without Zounds added to " + outputPath, "Completed");
            }
            else
            {
                MessageBox.Show("Nothing was selected");
            }
        }