Example #1
0
        void runProgram()
        {
            Utils    util          = new Utils();
            PngClass png           = new PngClass(true);
            bool     makingChanges = true;

            while (makingChanges)
            {
                int choice = 0;
                try
                {
                    setStatus(png);
                    choice = Utils.printOptions(); //Display user choices.
                }
                catch (Exception e)
                {
                    Console.WriteLine("Exception: " + e);
                }

                switch (choice)
                {
                case 1:    //add new png.
                    png = new PngClass();
                    break;

                case 2:    //select a png file.
                    png = new PngClass(true);
                    break;

                case 3:    //select cloudcoins
                    png.stageCoins();
                    break;

                case 4:    //insert cloudcoins to png ([byte[] data][string Names][int length])
                    if (png.hasStagedCoins)
                    {
                        png.SaveCoins();
                    }
                    png.updatePNG();
                    break;

                case 5:    //retrieve cloudcoins from png
                    png.removeCoins();
                    break;

                case 6:                    //quit
                    makingChanges = false; //Select the png file.
                    break;
                }
                if (png.hasCoins)
                {
                }
            }
        }// end runProgram