Esempio n. 1
0
        static void generateBoard()
        {
            String[,] location =
            {
                { "~", "A", "B", "C", "D", "E" },
                { "1", " ", " ", " ", " ", " " },
                { "2", " ", " ", " ", " ", " " },
                { "3", " ", " ", " ", " ", " " },
                { "4", " ", " ", " ", " ", " " },
                { "5", " ", " ", " ", " ", " " },
            };

            bool firstTime = true;

            var rowCount = location.GetLength(0);
            var colCount = location.GetLength(1);

            for (int row1 = 0; row1 < rowCount; row1++)
            {
                for (int col = 0; col < colCount; col++)
                {
                    Console.Write(String.Format(" {0}  ", location[row1, col]));
                }
                Console.WriteLine();
            }

            Random rand       = new Random();
            int    kingColumn = rand.Next(1, 6);
            int    kingRow    = rand.Next(1, 6);

            location[kingColumn, kingRow] = "♔";

            game(firstTime, location, kingColumn, kingRow);
        }
        public void graficar_tabla()
        {
            String[,] tb = llenar_tabla();
            String file;

            file = "digraph Grafica{\n";

            file = file + "graph [ratio=fill];\n"
                   + "node [label=\"\\N\", fontsize=15, shape=plaintext];\n"
                   + "graph [bb=\"0,0,352,154\"];";

            file = file + "arset [label=<\n"
                   + "        <TABLE ALIGN=\"LEFT\">\n";

            for (int i = 0; i < tb.GetLength(0); i++)
            {
                file = file + "<TR>";
                for (int j = 0; j < tb.GetLength(1); j++)
                {
                    String valor = "--";
                    if (tb[i, j] != null)
                    {
                        valor = tb[i, j].Replace("<", "&#60;").Replace(">", "&#62;");
                    }

                    file = file + "<TD>" + valor + "</TD>\n";
                }
                file = file + "</TR>";
            }

            file = file + "</TABLE>\n>,];\n}";
            Generador_Grafica gr = new Generador_Grafica();

            gr.generar_imagen("tb_" + nombre, file);
        }
Esempio n. 3
0
        public int[] BuscarFacturacion(String[,] arrayVentas, String comElegido)
        {
            // datosFacturacion = new String[2];
            int ventas1 = 0;
            int ventas2 = 0;

            for (int i = 1; i < arrayVentas.GetLength(0); i++)
            {
                if (arrayVentas[i, 0].Equals(comElegido))
                {
                    for (int j = 0; j < arrayVentas.GetLength(1) - 2; j++)
                    {
                        if (arrayVentas[i, 1].Equals("1"))
                        {
                            ventas1 = ventas1 + int.Parse(arrayVentas[i, j + 2]);
                        }
                        else if (arrayVentas[i, 1].Equals("2"))
                        {
                            ventas2 = ventas2 + int.Parse(arrayVentas[i, j + 2]);
                        }
                    }
                }
            }
            int[] datosFacturacion = { ventas1, ventas2 };
            return(datosFacturacion);
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to the Tic Tac Toe Program");
            Console.WriteLine("Instructions:");
            Console.WriteLine("when marking enter position x and then enter y");
            String[,] grid =
            {
                { "0,0", "1,0", "2,0" },
                { "0,1", "1,1", "2,1" },
                { "0,2", "1,2", "2,2" }
            };
            int rows = grid.GetLength(0);
            int cols = grid.GetLength(1);

            for (int r = 0; r < rows; r++)
            {
                for (int c = 0; c < cols; c++)
                {
                    Console.Write("[" + grid[r, c] + "]");
                }
                Console.WriteLine();
            }
            Game game = new Game();

            game.PrintData();
            bool play = true;

            do
            {
                game.MakeMove(1);
                game.CheckGame(ref play);
                game.MakeMove(2);
                game.CheckGame(ref play);
            } while (play);
        }
Esempio n. 5
0
 static void results(bool firstTime, int row, int column, String[,] location, String guess, int kingColumn, int kingRow)
 {
     if (guess == "♔")
     {
         Console.Clear();
         {
             location[kingColumn, kingRow] = "K"; //show hit
             var rowCount = location.GetLength(0);
             var colCount = location.GetLength(1);
             for (int row1 = 0; row1 < rowCount; row1++)
             {
                 for (int col = 0; col < colCount; col++)
                 {
                     Console.Write(String.Format(" {0}  ", location[row1, col]));
                 }
                 Console.WriteLine();
             }
         }
         WriteLine("\nCorrect! You've found the king!");
         WriteLine("\nPress any key to play again.");
         ReadLine();
         Console.Clear();
         generateBoard();
     }
     else
     {
         WriteLine("\nSorry, that is incorrect.  Press any key to try again.");
         ReadLine();
         Console.Clear();
         firstTime             = false;
         location[row, column] = "m";
         game(firstTime, location, kingColumn, kingRow);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// テーブルにデータを挿入する
        /// </summary>
        /// <param name="tablename">テーブル名</param>
        /// <param name="data">挿入するデータ。e.g. { { "http://www.example/dog.jpg", "{3F2504E0-4F89-11D3-9A0C-0305E82C3301}"(GUID) } }</param>
        /// <returns></returns>
        private Boolean Insert(String tableName, String[,] data)
        {
            //テーブル名が空白ではないかチェック かつ
            //列が1以上あるかチェックし、問題なければそのまま処理を続行
            if (!tableName.Equals("") && data.GetLength(0) < 1)
            {
                return(false);
            }

            try
            {
                var sqlConnectionSb = new SQLiteConnectionStringBuilder {
                    DataSource = cacheDB
                };
                SQLiteConnection con = null;
                SQLiteCommand    cmd = null;

                //SQLiteでデータベースに接続
                try
                {
                    con = new SQLiteConnection(sqlConnectionSb.ToString());
                    con.Open();

                    //データ挿入処理
                    cmd = new SQLiteCommand("INSERT INTO " + tableName + " VALUES(?, ?);", con);

                    for (int i = 0; i < data.GetLength(0); i++)
                    {
                        //Parameterを追加するとき、追加するデータはObject型に変換しないと正しく追加されない模様
                        cmd.Parameters.Add(new SQLiteParameter(DbType.String, (Object)data[i, 0]));
                        cmd.Parameters.Add(new SQLiteParameter(DbType.String, (Object)data[i, 1]));
                        cmd.ExecuteNonQuery();
                        cmd.Parameters.Clear();
                    }
                }
                catch (Exception e)
                {
                }
                finally
                {
                    if (con != null)
                    {
                        con.Dispose();
                    }

                    if (cmd != null)
                    {
                        cmd.Dispose();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("---------------------------> ERROR:" + e.Message);
                return(false);
            }

            return(true);
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            int[] numbers = new int[2];
            numbers[0] = 10;
            numbers[1] = 15;
            Console.WriteLine(numbers[0]);
            Console.WriteLine(numbers[1]);

            int[] nums = new int[] { 2, 3, 5, 8, 13 };
            Console.WriteLine(nums[0]);
            Console.WriteLine(nums[3]);

            int i;

            Console.WriteLine();
            Console.Write("Num : ");
            for (i = 0; i < nums.Length; i++)
            {
                Console.Write("{0}, ", nums[i]);
            }
            int[] num2s = { 3, 1, 4, 1, 5, 9, 2 };
            Console.WriteLine();
            Console.Write("num2s : ");
            for (i = 0; i < num2s.Length; i++)
            {
                Console.Write("{0}, ", num2s[i]);
            }

            String[] tmpStrs = { "C++", "C#", "Java", "Switf" };
            Console.WriteLine();
            Console.Write("tmpStrs : ");
            foreach (string iter in tmpStrs)
            {
                Console.Write("{0}, ", iter);
            }

            String[,] tmpStrLists = { { "Apple", "Banana", "Lemon" }, { "Pizza", "Pasta", "Risoto" } };
            Console.WriteLine();
            Console.Write(tmpStrLists[0, 1]);
            Console.Write(tmpStrLists[1, 2]);
            Console.WriteLine();

            int j;

            for (i = 0; i < tmpStrLists.GetLength(0); i++)
            {
                for (j = 0; j < tmpStrLists.GetLength(1); j++)
                {
                    Console.Write("{0}, ", tmpStrLists[i, j]);
                }
                Console.WriteLine();
            }
            foreach (String iter in tmpStrLists)
            {
                Console.Write("{0}, ", iter);
            }

            Console.ReadKey();
        }
Esempio n. 8
0
 /// <summary>
 /// Prints the board in the following format:
 /// 1 | 2 | 3
 /// ---------
 /// 4 | 5 | 6
 /// ---------
 /// 7 | 8 | 9
 /// </summary>
 public void PrintBoard()
 {
     for (int i = 0; i < board.GetLength(0); i++)
     {
         Console.CursorLeft = 10;
         for (int j = 0; j < board.GetLength(1); j++)
         {
             if (j < 2)
             {
                 if (board[i, j] == "X")
                 {
                     Console.ForegroundColor = ConsoleColor.Green;
                 }
                 else if (board[i, j] == "O")
                 {
                     Console.ForegroundColor = ConsoleColor.Blue;
                 }
                 else
                 {
                     Console.ForegroundColor = ConsoleColor.White;
                 }
                 Console.Write(board[i, j]);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.Write(" | ");
             }
             else
             {
                 if (board[i, j] == "X")
                 {
                     Console.ForegroundColor = ConsoleColor.Green;
                 }
                 else if (board[i, j] == "O")
                 {
                     Console.ForegroundColor = ConsoleColor.Blue;
                 }
                 else
                 {
                     Console.ForegroundColor = ConsoleColor.White;
                 }
                 Console.Write(board[i, j]);
                 Console.ForegroundColor = ConsoleColor.White;
                 Console.Write("   ");
             }
         }
         Console.CursorLeft = 10;
         Console.WriteLine();
         Console.CursorLeft = 10;
         if (i < 2)
         {
             Console.ForegroundColor = ConsoleColor.White;
             Console.WriteLine("---------");
         }
         else
         {
             Console.ForegroundColor = ConsoleColor.White;
             Console.WriteLine(" ");
         }
     }
 }
Esempio n. 9
0
        public void Start()
        {
            String[,] grid =
            {
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
                { ". ", ".", ". ", ".", ". ", ". ", ".", ". ", ".", ". " },
            };

            World myWorld = new World(grid);

            myWorld.Draw();


            Console.ReadKey();

            int dx = 0;
            int dy = 1;

            int px = 2;
            int py = 2;

            while (true)
            {
                Console.Clear();

                //rita up spelplanen
                for (int y = 0; y < grid.GetLength(0); y++)
                {
                    for (int x = 0; x < grid.GetLength(1); x++)
                    {
                        if (px == x && py == y)
                        {
                            Console.BackgroundColor = ConsoleColor.Red;
                            Console.Write(" ");
                            Console.BackgroundColor = ConsoleColor.Black;
                        }
                        else
                        {
                            Console.WriteLine(grid[y, x]);
                        }
                    }
                    Console.WriteLine();
                }
                Console.ReadKey();

                px += dx;
                py += dy;
            }
        }
 static String[] getNamesArray(String[,] finalizedData)
 {
     String[] gameTitles = new String[finalizedData.GetLength(0)];
     for (int i = 0; i < finalizedData.GetLength(0); i++)
     {
         gameTitles[i] = finalizedData[i, 0];
     }
     return(gameTitles);
 }
Esempio n. 11
0
 public Matrix(String[,] data, String name, Type ringtype)
 {
     Ringtype  = ringtype;
     this.name = name;
     rows      = data.GetLength(1);
     columns   = data.GetLength(0);
     matrix    = new Ring[columns, rows];
     FillMatrix(data);
 }
Esempio n. 12
0
 public static void GroupEventCriteria(String [,] groups)
 {
     for (int i = 0; i < groups.GetLength(0); i++)
     {
         for (int j = 0; j < groups.GetLength(1); j++)
         {
             keyGroup[groups[i, j]] = i;
         }
     }
 }
Esempio n. 13
0
        public Mappa(String[,] celleMateriali, String[,] nomiCelle)
        {
            CelleMateriali = celleMateriali;
            CelleNomi      = nomiCelle;

            Righe = CelleMateriali.GetLength(0);
            Colon = CelleMateriali.GetLength(1);

            CelleEdifici = new Edificio[Righe, Colon];
        }
Esempio n. 14
0
 public void CreateBoard(String[,] board)    // Metode kas aizpilda laukuma lauciņus ar tukšumiem
 {
     for (int i = 0; i < board.GetLength(0); i++)
     {
         for (int j = 0; j < board.GetLength(1); j++)
         {
             board[i, j] = " ";      // aizpilda spēļu lauciņu ar tukšumiem
         }
     }
 }
Esempio n. 15
0
 void FillBoard()
 {
     for (int rows = 0; rows < ChessBoard.GetLength(0); rows++)
     {
         for (int columns = 0; columns < ChessBoard.GetLength(1); columns++)
         {
             ChessBoard[rows, columns] = "[   ]";
         }
     }
 }
Esempio n. 16
0
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            var tileWidthWithZoom  = (int)(TileWidth * cam.Zoom);
            var tileHeightWithZoom = (int)(TileHeight * cam.Zoom);

            var screenStartXWithOffset = (double)cam.Point.X / tileWidthWithZoom;
            var screenStartYWithOffset = (double)cam.Point.Y / tileHeightWithZoom;

            var screenStartX = (int)Math.Floor(screenStartXWithOffset);
            var screenStartY = (int)Math.Floor(screenStartYWithOffset);

            var offsetX = (int)((screenStartXWithOffset - screenStartX) * tileWidthWithZoom);
            var offsetY = (int)((screenStartYWithOffset - screenStartY) * tileHeightWithZoom);

            var screenTileWidth  = Math.Ceiling((double)graphic.Width / tileWidthWithZoom);
            var screenTileHeight = Math.Ceiling((double)graphic.Height / tileHeightWithZoom);

            var screenWidthNeededRender  = (int)screenTileWidth + screenStartX + 1;
            var screenHeightNeededRender = (int)screenTileHeight + screenStartY + 1;

            int ySize = MapNames.GetLength(0);
            int xSize = MapNames.GetLength(1);

            int currentScreenX = screenStartX;
            int currentScreenY = screenStartY;
            int currentHeight  = 0;

            for (int y = getMapHeight(currentScreenY); y < ySize; y++)
            {
                for (int x = getMapWidth(currentScreenX); x < xSize; x++)
                {
                    var part = partMaps[y, x];
                    var pos  = part.MapPosition;

                    if (pos.X < screenWidthNeededRender && pos.Y < screenHeightNeededRender)
                    {
                        var finalOffsetX = (currentScreenX - screenStartX) * tileWidthWithZoom - offsetX;
                        var finalOffsetY = (currentScreenY - screenStartY) * tileHeightWithZoom - offsetY;
                        currentScreenX = part.Draw(spriteBatch, currentScreenX, screenWidthNeededRender, currentScreenY, screenHeightNeededRender, finalOffsetX, finalOffsetY, tileWidthWithZoom, tileHeightWithZoom);
                    }
                    currentHeight = pos.Y + part.MapHeight;
                    if (currentScreenX == screenWidthNeededRender)
                    {
                        break;
                    }
                }
                currentScreenY = currentHeight;
                currentScreenX = screenStartX;
                if (currentScreenY >= screenHeightNeededRender)
                {
                    break;
                }
            }
        }
Esempio n. 17
0
 public static void CetakArray(String[,] Array2d)
 {
     for (int b = 0; b < Array2d.GetLength(0); b++)
     {
         for (int k = 0; k < Array2d.GetLength(1); k++)
         {
             Console.Write("{0}\t", Array2d[b, k]);
         }
         Console.WriteLine("\n");
     }
 }
Esempio n. 18
0
 public void printArray(String[,] s)
 {
     for (int r = 0; r < s.GetLength(0); r++)
     {
         for (int c = 0; c < s.GetLength(1); c++)
         {
             Console.Write(s[r, c]);
         }
         Console.WriteLine();
     }
 }
Esempio n. 19
0
 public static void printboard(String[,] board)
 {
     for (int i = 0; i < board.GetLength(0); i++)
     {
         for (int j = 0; j < board.GetLength(1); j++)
         {
             Console.Write(board[i, j]);
         }
         Console.WriteLine();
     }
 }
Esempio n. 20
0
 public Player(Rectangle rect, String[,] spriteDirectories) : base()
 {
     this.spriteDirectories = spriteDirectories;
     this.img        = new Texture2D[spriteDirectories.GetLength(0), spriteDirectories.GetLength(1)];
     this.rect       = rect;
     this.spriteRect = rect;
     this.pos        = new Vector2(rect.X, rect.Y);
     this.rect.X     = (int)this.pos.X;
     this.rect.Y     = (int)this.pos.Y;
     this.health     = 3;
 }
 public static void printLLATable()
 {
     for (int i = 0; i < llaTable.GetLength(0); i++)
     {
         for (int j = 0; j < llaTable.GetLength(1); j++)
         {
             Console.Write("[i=" + i + "][j=" + j + "] = " + llaTable[i, j]);
         }
         Console.WriteLine("");
     }
 }
 public static String[,] setEmpty(String[,] inpt)
 {
     for (int i = 0; i < inpt.GetLength(0); i++)
     {
         for (int j = 0; j < inpt.GetLength(1); j++)
         {
             inpt[i, j] = "";
         }
     }
     return(inpt);
 }
Esempio n. 23
0
 static void Show(String[,] temp)
 {
     for (Int32 i = 0; i < temp.GetLength(0); i++)
     {
         for (Int32 j = 0; j < temp.GetLength(1); j++)
         {
             Console.Write("{0} ", temp[i, j]);
         }
         Console.WriteLine();
     }
 }
Esempio n. 24
0
        public static Queue <Queue <String> > cardSort(String[,] playercard)
        {
            Queue <Queue <String> > sortedcard = new Queue <Queue <String> >();

            String[] rank  = { "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace" };
            int[]    arr   = new int[9];
            int      index = 0;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    String[] temp = (playercard[i, j] + " ").Split(' ');
                    for (int k = 0; k < 13; k++)
                    {
                        if (temp[1].Equals(rank[k]))
                        {
                            arr[index] = k;
                            index++;
                        }
                    }
                }
                Console.WriteLine();
                index = 0;
                for (int k1 = 0; k1 < arr.Length - 1; k1++)
                {
                    for (int k2 = k1 + 1; k2 < arr.Length; k2++)
                    {
                        if (arr[k1] > arr[k2])
                        {
                            int temp = arr[k1];
                            arr[k1] = arr[k2];
                            arr[k2] = temp;

                            String temp1 = playercard[i, k1];
                            playercard[i, k1] = playercard[i, k2];
                            playercard[i, k2] = temp1;
                        }
                    }
                }
            }

            for (int i = 0; i < playercard.GetLength(0); i++)
            {
                Queue <String> temp = new Queue <string>();
                for (int j = 0; j < playercard.GetLength(1); j++)
                {
                    temp.Enqueue(playercard[i, j]);
                }
                sortedcard.Enqueue(temp);
            }

            return(sortedcard);
        }
Esempio n. 25
0
 public static void DisplayMap()
 {
     for (int y = 0; y < gamemap.GetLength(0); y++)
     {
         for (int x = 0; x < gamemap.GetLength(1); x++)
         {
             Console.Write(gamemap[y, x]);
         }
         Console.Write("\n");
     }
 }
Esempio n. 26
0
 public void PrintDivDMas()
 {
     for (int i = 0; i < divD.GetLength(0); i++)
     {
         for (int j = 0; j < divD.GetLength(1); j++)
         {
             Console.Write("{0} ", divD[i, j] = "-");
         }
         Console.WriteLine();
     }
 }
 public static void printCSATable()
 {
     Console.WriteLine("printCSATable() called");
     for (int i = 0; i < csaTable.GetLength(0); i++)
     {
         for (int j = 0; j < csaTable.GetLength(1); j++)
         {
             Console.Write("[i=" + i + "][j=" + j + "] = " + csaTable[i, j]);
         }
         Console.WriteLine("");
     }
 }
Esempio n. 28
0
        public static void InserirRegistro(ref String[,] ListaDeNome, ref int IdParaLista)
        {
            for (int i = 0; i < ListaDeNome.GetLength(0); i++)
            {
                if (ListaDeNome[i, 0] != null)
                {
                    continue;
                }

                Console.WriteLine("\r\nInforma um nome para adicionar um registro");
                var nome = Console.ReadLine();

                Console.WriteLine("\r\nInforma sua idade para adicionar um registro");
                var idade = Console.ReadLine();



                ListaDeNome[i, 0] = (IdParaLista++).ToString();
                ListaDeNome[i, 1] = nome;
                ListaDeNome[i, 2] = idade;

                Console.WriteLine("Deseja inserir um novo registro? sim(1) || não(0) || Excluir(2)");

                var continuar = Console.ReadKey().KeyChar.ToString();

                if (continuar == "0")
                {
                    break;
                }

                /*
                 * if(continuar == "2")
                 *
                 *  foreach(var ListaDeNome in IdParaLista)
                 *  {
                 *      list.Remove(ListaDeNome);
                 *
                 *  }
                 *  Console.ReadLine();
                 */

                AumentaTamanhoDaLista(ref ListaDeNome);
            }

            Console.WriteLine("Registro adicionado com sucesso, segue lista de informação adicionadas:");

            //agora vo retornar os valores que adicionei acima

            for (int i = 0; i < ListaDeNome.GetLength(0); i++)
            {
                Console.WriteLine(string.Format("Registro ID {0} - Nome:{1} - Idade:{2}", ListaDeNome[i, 0], ListaDeNome[i, 1], ListaDeNome[i, 2]));
            }
        }
Esempio n. 29
0
 private static Boolean wonVert(String value)
 {
     for (int col = 0; col < gameBoardCheck.GetLength(1); col++)
     {
         if (gameBoardCheck[0, col] == value && gameBoardCheck[0, col] == gameBoardCheck[1, col] &&
             gameBoardCheck[1, col] == gameBoardCheck[2, col])
         {
             return(true);
         }
     }
     return(false);
 }
Esempio n. 30
0
        static void Main(string[] args)
        {
            // new Table is the output table
            String[,] newTable;
            // Read in tables
            String[,] LocationsTable = ReadTable(locationName);
            String[,] ProvidersTable = ReadTable(providerName);
            string API_key = "AIzaSyAqQxSKkvPV1m8EmyXy9XEVml477XgJNaA";

            // initialize raw data table
            if (File.Exists(directory + "DistanceMatrix.csv"))
            {
                rawTable = ReadTable("DistanceMatrix.csv");
            }
            else
            {
                InitializeTable(LocationsTable, ProvidersTable);
            }

            int lastInt = 0;

            // Reads newData.csv to find what line it is up to
            // This is usefull for the API so it can do API requests in chunks instead of all at once
            try {
                String[,] rawData = ReadTable("newData.csv");
                string LastID = rawData[rawData.GetLength(0) - 1, 0];
                Console.WriteLine(LastID);
                lastInt = Convert.ToInt32(LastID.Replace("Id ", "")) + 1;
            } catch {
                Console.WriteLine("Starting new file: {0}");
            }

            Decimal[] locationsPosition = new Decimal[LocationsTable.GetLength(0)];
            newTable = LocationsTable;
            String[] providers = new String[ProvidersTable.GetLength(0)];
            String[] locations = new String[LocationsTable.GetLength(0)];


            for (int i = 0; i < providers.Length; i++)
            {
                providers[i] = ProvidersTable[i, providerLatIndex] + "," + ProvidersTable[i, providerLongIndex];
            }
            for (int i = 0; i < locations.Length; i++)
            {
                locations[i] = LocationsTable[i, locationsLatIndex] + "," + LocationsTable[i, locationsLongIndex];
            }

            GetRoute(directory, locations, providers, LocationsTable, ProvidersTable, API_key, lastInt);

            SaveTable(rawTable, "DistanceMatrix.csv");

            Console.Read();
        }
        void Form1_Load(object sender, EventArgs e)
        {
            Program.ArkRcon.Run();
            Program.ArkRcon.ServerConnectionStarting += ArkRcon_ServerConnectionStarting;
            Program.ArkRcon.ServerConnectionFailed += ArkRcon_ServerConnectionFailed;
            Program.ArkRcon.ServerAuthSucceeded += ArkRcon_ServerAuthSucceeded;
            Program.ArkRcon.ServerAuthFailed += ArkRcon_ServerAuthFailed;
            Program.ArkRcon.ConsoleLogUpdated += ArkRcon_ConsoleLogUpdated;

            IPAddress[] localIP = Dns.GetHostAddresses(Dns.GetHostName()); //Local IP Info
            foreach (IPAddress address in localIP)
            {
                if (address.AddressFamily == AddressFamily.InterNetwork)
                {
                    label7.Text = address.ToString();
                }
            }

            TitlesBox.Items.Clear();
            rssData = getRssData(ChannelTextBox.Text);
            for (int i = 0; i < rssData.GetLength(0); i++)
            {
                if (rssData[i, 0] != null)
                {
                    TitlesBox.Items.Add(rssData[i, 0]);
                }
                TitlesBox.SelectedIndex = 0;
            }
        }
Esempio n. 32
0
        public void LoadContent(ContentManager Content)
        {
            parse.LoadContent(Content);
            map = parse.backgroundMap();

            for (int i = 0; i <= map.GetLength(0) - 1; i++)
            {
                Image pic = new Image();
                pic.LoadContent(Content, map[i, 4], Color.White, new Vector2(int.Parse(map[i, 0]), int.Parse(map[i, 1])));
                pic.scale = new Vector2(float.Parse(map[i,2], CultureInfo.InvariantCulture.NumberFormat), float.Parse(map[i, 3], CultureInfo.InvariantCulture.NumberFormat));
                listImage.Add(pic);
            }
        }
Esempio n. 33
0
        private void canalesListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            titulosComboBox.Items.Clear();
            rssData = getRssData(canalesListBox.GetItemText(canalesListBox.SelectedItem));

            if (rssData != null)
            {
                for (int i = 0; i < rssData.GetLength(0); i++)
                {
                    if (rssData[i, 0] != null)
                        titulosComboBox.Items.Add(rssData[i, 0]);

                    titulosComboBox.SelectedIndex = 0;
                }
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        InitializeArray();
        EmployeesInformation = (((Business)Application["Business"])).getEmployeesInformation();

        if (Session["Title"] == null)
        {
            Response.Redirect("StartPage.aspx");
        }
        else if (Session["Title"].ToString() != "Vice President, Sales")
        {
            Response.Redirect("Maintenance.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                // If there is valid session varavle, load the employee informations
                if (Session["Editing Employee Item"] != null)
                {
                    for (int i = 0; i < EmployeesInformation.GetLength(0); i++)
                    {
                        if ((String)Session["Editing Employee Item"] == EmployeesInformation[i, 0])
                        {
                            for (int j = 0; j < textBoxArray.Length; j++)
                            {
                                textBoxArray[j].Text = EmployeesInformation[i, j];
                            }
                        }
                    }

                    //Edit setting: Allow Update,Delete
                    btnUpdate.Visible = true;
                    btnDelete.Visible = true;
                    btnInsert.Visible = false;
                }
                else
                {
                    // Insert setting
                    btnUpdate.Visible = false;
                    btnDelete.Visible = false;
                    btnInsert.Visible = true;
                }

            }
            textBoxArray[1].Focus();
        }
    }
Esempio n. 35
0
        /// <summary>
        /// Get Data From Summary sheet for creation of DES
        /// </summary>
        public void GetDESheetDataFromSummarySheet(System.Globalization.CultureInfo currentCulture)
        {
            //System.Threading.Thread thisThread = System.Threading.Thread.CurrentThread;
            //System.Globalization.CultureInfo originalCulture = thisThread.CurrentCulture;

            try
            {
                // set current thread culture to english
                //thisThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

                int i = 0;
                int j = 0;
                int iDataCol = 0;

                //this.DIExcel = new DIExcel(TempLogFilePath);
                this.DIExcel = new DIExcel(TempLogFilePath, currentCulture);
                IWorksheet SummarySheet = DIExcel.GetWorksheet(0);
                //Excel.Worksheet
                switch (ApplicationWizardType)
                {
                    case WizardType.Percent:
                        //*** Decimal
                        if (Information.IsNumeric(SummarySheet.Cells[6, 1].Value))
                        {
                            this.DESheetInformation.Decimals = Convert.ToInt32(SummarySheet.Cells[6, 1].Value);
                            this.DecimalUpDownControlValue = this.DESheetInformation.Decimals;
                        }
                        iDataCol = 3 + Step1SelectionDataTable.Rows.Count + Step2SelectionDataTable.Rows.Count;

                        //*** Indicator & Unit
                        SetDESheetIUSGuid(SummarySheet.Cells[9, iDataCol + 1].Text, SummarySheet.Cells[10, iDataCol + 1].Text, "");

                        // raise to set step3 indicator and unit text
                        RaiseEventSetStep3IndicatorAndUnit(DESheetInformation.Indicator, this.DESheetInformation.Unit);
                        //*** Data Values
                        for (i = 0; i <= msDataArray.GetLength(0) - 1; i++)
                        {
                            //msDataArray(i, 3) = SummarySheet.Cells[i + 12, iDataCol].value;
                            msDataArray[i, 3] = SummarySheet.Cells[i + 12, iDataCol + 1].Text;
                        }

                        break;
                    case WizardType.HundredMinus:
                        //*** Decimal
                        if (Information.IsNumeric(SummarySheet.Cells[6, 1].Value))
                        {
                            this.DESheetInformation.Decimals = Convert.ToInt32(SummarySheet.Cells[6, 1].Value);
                            this.DecimalUpDownControlValue = (decimal)this.DESheetInformation.Decimals;
                        }
                        //*** Data Values
                        iDataCol = 3;
                        for (i = 0; i <= msDataArray.GetLength(0) - 1; i++)
                        {
                            msDataArray[i, 3] = SummarySheet.Cells[i + 10, iDataCol].Value.ToString();
                        }
                        break;
                    case WizardType.CompositeIndex:
                        //*** Decimal
                        if (Information.IsNumeric(SummarySheet.Cells[6, 4].Value))
                        {
                            this.DESheetInformation.Decimals = Convert.ToInt32(SummarySheet.Cells[6, 4].Value);
                            this.DecimalUpDownControlValue = (decimal)this.DESheetInformation.Decimals;
                        }

                        //*** Data Values
                        iDataCol = 2 + (this.Step1SelectionDataTable.Rows.Count * 2) ; //*** 1 for Score Col

                        //*** Handling Excel Sorting for Composite Index
                        string[] ArrAreaId = new string[msDataArray.GetLength(0)];
                        for (i = 0; i <= msDataArray.GetLength(0) - 1; i++)
                        {
                            ArrAreaId[i] = msDataArray[i, 1];
                        }

                        string[,] sTempDataArray = new string[msDataArray.GetLength(0), msDataArray.GetLength(1)];
                        int ArrIndex;
                        for (i = 0; i <= msDataArray.GetLength(0) - 1; i++)
                        {
                            ArrIndex = Array.IndexOf(ArrAreaId, SummarySheet.Cells[i + 16, iDataCol+1].Value);
                            for (j = 0; j <= msDataArray.GetLength(1) - 1; j++)
                            {
                                if (j == 3)
                                {
                                    sTempDataArray[i, 3] = SummarySheet.Cells[i + 16, iDataCol].Value.ToString();
                                }
                                else
                                {
                                    sTempDataArray[i, j] = msDataArray[ArrIndex, j];
                                }
                            }
                        }
                        msDataArray = null;
                        msDataArray = sTempDataArray;
                        break;

                    case WizardType.SubTotal:
                        // No decimal Combo
                        //Data Values
                        //Subtotal Step 5
                        iDataCol = 3;
                        for (i = 0; i <= (msDataArray.GetLength(0) / this.DESheetInformation.SubgroupGUID.Length) - 1; i++)
                        {
                            for (j = 0; j <= this.DESheetInformation.SubgroupGUID.Length - 1; j++)
                            {
                                msDataArray[i + j, 3] = SummarySheet.Cells[i + 11, (iDataCol + j) - 1].Value.ToString();
                            }
                        }
                        break;

                    case WizardType.TransformUnit:
                        ////*** Decimal
                        if (Information.IsNumeric(SummarySheet.Cells[6, 1].Value))
                        {
                            this.DESheetInformation.Decimals = Convert.ToInt32(SummarySheet.Cells[6, 1].Value);
                            this.DecimalUpDownControlValue = (decimal)this.DESheetInformation.Decimals;
                        }

                        //*** Data Values
                        iDataCol = 5;
                        for (i = 0; i <= msDataArray.GetLength(0) - 1; i++)
                        {
                            msDataArray[i, 3] = SummarySheet.Cells[i + 10, iDataCol].Value.ToString();
                        }

                        break;
                    case WizardType.UserDefinedFormula:
                        //*** Decimal
                        if (Information.IsNumeric(SummarySheet.Cells[6, 1].Value))
                        {
                            this.DESheetInformation.Decimals = Convert.ToInt32(SummarySheet.Cells[6, 1].Value);
                            this.DecimalUpDownControlValue = (decimal)this.DESheetInformation.Decimals;
                        }

                        //*** Data Values
                        iDataCol = 2 + this.SelectedNids.Count;
                        for (i = 0; i <= msDataArray.GetLength(0) - 1; i++)
                        {
                            msDataArray[i, 3] = SummarySheet.Cells[i + 11, iDataCol].Value.ToString();

                        }
                        break;
                }

                SummarySheet = null;

            }
            catch (Exception ex)
            {
            }
            // Reset Original culture
            //thisThread.CurrentCulture = originalCulture;
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        InitializeArray();
        CustomersInformation = (((Business)Application["Business"])).getCustomerInformation();
        if (Session["Title"] == null)
        {
            Response.Redirect("StartPage.aspx");
        }
        else
        {
            if (!IsPostBack)
            {
                // If there is valid session varavle, load the Customer informations
                if (Session["Editing Customer Item"] != null)
                {
                    for (int i = 0; i < CustomersInformation.GetLength(0); i++)
                    {
                        if ((String)Session["Editing Customer Item"] == CustomersInformation[i, 0])
                        {
                            for (int j = 0; j < textBoxArray.Length; j++)
                            {
                                textBoxArray[j].Text = CustomersInformation[i, j];
                            }
                        }
                    }

                    //Edit setting: Allow Update,Delete
                    btnUpdate.Visible = true;
                    btnDelete.Visible = true;
                    btnInsert.Visible = false;
                }
                else
                {
                    // Insert setting
                    btnUpdate.Visible = false;
                    btnDelete.Visible = false;
                    btnInsert.Visible = true;
                }

            }
            textBoxArray[0].Focus();
        }
    }