/// <summary>
 /// 입력된 BoardType을 적당한 문자열로 바꿔줍니다.
 /// </summary>
 /// <param name="type">BoardType 열거형</param>
 /// <returns>string 문자열</returns>
 public string BoardTypeToDesc(BoardType type)
 {
     try
     {
         string str = type.ToString().Substring(4, type.ToString().IndexOf('x') - 4);
         return(str + " x " + str);
     }
     catch
     {
         return("Any Type");
     }
 }
Exemple #2
0
        public XElement Serialize()
        {
            return(new XElement("Config",
                                new XElement("PPM",
                                             new XAttribute("Enabled", _ppmGenEnabled)
                                             ),

                                new XElement("LCD",
                                             new XAttribute("Enabled", _lcdEnabled),
                                             new XAttribute("BL", _cldbl),
                                             new XAttribute("Addr", _lcdAddr),
                                             new XAttribute("I8080", _lcd8080)
                                             ),

                                new XElement("Debug",
                                             new XAttribute("Enabled", _debugEnabled)
                                             ),

                                new XElement("Retranslator",
                                             new XAttribute("XBee", _xBeeEnabled),
                                             new XAttribute("NRF", _nrfEnabled)
                                             ),

                                new XElement("ROM",
                                             new XAttribute("Enabled", _romEnabled),
                                             new XAttribute("Addr", _romAddr),
                                             new XAttribute("AStyle", _romAddrStyle)
                                             ),

                                new XAttribute("Path", OutputPath),
                                new XAttribute("BoardType", BoardType.ToString())
                                ));
        }
Exemple #3
0
 public Bus429()
 {
     BoardType     = BoardType.A429;
     Name          = BoardType.ToString();//此处以BoardType来作为Name,标识唯一性。
     DriverOperate = new Device429Operator();
     Path          = "BinHong_" + this.Name;
 }
Exemple #4
0
        /// <summary>
        /// この構造体のデータを文字列の並びにする。
        /// </summary>
        /// <returns></returns>
        public List <string> ToList()
        {
            var list = new List <string>();

            list.Add(PlayerNames[0]);
            list.Add(PlayerNames[1]);
            list.Add(StartTime.ToString());
            list.Add(EndTime.ToString());

            /* EnumのToString()あまり使いたくないけど、intにcastすると定義変えたときに困るので…。*/
            list.Add(LastMove.MoveToString());
            list.Add(LastColor.ToUsi());

            list.Add(KifuFileName);
            list.Add(GamePly.ToString());

            list.Add(BoardType.ToString());
            list.Add(TimeSettingString);
            list.Add(Comment);

            // 後方互換性を維持するために、追加が必要になったときは、
            // ここの末尾に追加していく。

            // これあとから追加した。(V1.16)
            list.Add(Handicapped.ToString());

            return(list);
        }
Exemple #5
0
 public Bus1553()
 {
     BoardType     = BoardType.A1553;
     Name          = BoardType.ToString();//此处以BoardType来作为Name,标识唯一性。
     DriverOperate = new Device1553Operator();
 }
        public Battlefield()
        {
            boardPanel = new Panel();

            ships        = new List <Ship>();
            cells        = new Cell[FIELD_SIZE, FIELD_SIZE];
            rowLabels    = new Label[FIELD_SIZE];
            columnLabels = new Label[FIELD_SIZE];
            int rowLabelSize    = CELL_SIZE;
            int columnLabelSize = CELL_SIZE;

            for (int i = 0; i < FIELD_SIZE; i++)
            {
                rowLabels[i]           = new Label();
                rowLabels[i].Text      = Convert.ToString(i + 1);
                rowLabels[i].Location  = new Point(1, (i + 1) * CELL_SIZE);
                rowLabels[i].Size      = new Size(rowLabelSize, CELL_SIZE);
                rowLabels[i].TextAlign = ContentAlignment.MiddleCenter;
                boardPanel.Controls.Add(rowLabels[i]);
            }

            for (int i = 0; i < FIELD_SIZE; i++)
            {
                char columnLabelChar = (char)('A' + i);
                columnLabels[i]           = new Label();
                columnLabels[i].Text      = Convert.ToString(columnLabelChar);
                columnLabels[i].Location  = new Point((i + 1) * CELL_SIZE, 1);
                columnLabels[i].Size      = new Size(columnLabelSize, CELL_SIZE);
                columnLabels[i].TextAlign = ContentAlignment.MiddleCenter;
                boardPanel.Controls.Add(columnLabels[i]);
            }

            for (int i = 0; i < FIELD_SIZE; i++)
            {
                for (int j = 0; j < FIELD_SIZE; j++)
                {
                    cells[i, j]              = new Cell();
                    cells[i, j].RowNumber    = i;
                    cells[i, j].ColumnNumber = j;
                    cells[i, j].Location     = new Point(rowLabelSize + i * Battlefield.CELL_SIZE, columnLabelSize + j * Battlefield.CELL_SIZE);
                    cells[i, j].Battlefield  = this;
                    boardPanel.Controls.Add(cells[i, j]);
                }
            }

            boardTypeLabel           = new Label();
            boardTypeLabel.Text      = BoardType.ToString();
            boardTypeLabel.Font      = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            boardTypeLabel.Size      = new Size(CELL_SIZE * (FIELD_SIZE + 1), 24);
            boardTypeLabel.Location  = new Point(0, 0);
            boardTypeLabel.TextAlign = ContentAlignment.MiddleCenter;
            this.Controls.Add(boardTypeLabel);

            boardPanel.Size     = new Size(CELL_SIZE * (FIELD_SIZE + 1), CELL_SIZE * (FIELD_SIZE + 1));
            boardPanel.Location = new Point(0, boardTypeLabel.Size.Height + 1);
            this.Controls.Add(boardPanel);

            scoreboard             = new Scoreboard();
            scoreboard.Size        = new Size(60, 70);
            scoreboard.Location    = new Point(boardPanel.Size.Width + 10, boardTypeLabel.Size.Height + 1 + columnLabelSize + 1);
            scoreboard.Battlefield = this;
            this.Controls.Add(scoreboard);

            this.BoardType = GameLibrary.BoardType.User;
        }
 public override string ToString()
 {
     return(BoardType.ToString() + BoardNo + ChannelType + ChannelCount);
 }
Exemple #8
0
/*
 * Updates an entries data in the db
 */
        public bool UpdateItem()
        {
            string myConnectString;
            string strSQL = "";

            //build SQL
            strSQL = "UPDATE tblEntry SET dLastModified ='" + DateTime.Now + "',Location = '" + Location + "',txtTown = '" + Town + "',txtZip = '" + Zip + "',txtDetails = '" + Details + "',txtBrand = '" + Brand + "',fltPrice = '" + Price + "'";

            if (PriceChange == 1)
            {
                strSQL += ",iPriceChange ='" + 1 + "'";
            }

            //can't do this
            if (ImgPath1 != "KEEP")
            {
                strSQL += ",txtImgPath1 = '" + ImgPath1 + "'";
            }
            if (ImgPath2 != "KEEP")
            {
                strSQL += ",txtImgPath2 = '" + ImgPath2 + "'";
            }
            if (ImgPath3 != "KEEP")
            {
                strSQL += ",txtImgPath3 = '" + ImgPath3 + "'";
            }
            if (ImgPath4 != "KEEP")
            {
                strSQL += ",txtImgPath4 = '" + ImgPath4 + "'";
            }

            //Build SQL for category specific
            switch (Category)
            {
            case 1:     //surf
                strSQL += ",txtShaper = '" + Shaper + "'";

                //Build SQL for surf board dimensions (Width & Thickness)
                strSQL += ",iBoardType = '" + BoardType + "'";
                strSQL += ",iHtFt = '" + HtFt + "',iHtIn = '" + HtIn + "'";

                strSQL += ",width ='" + Width + "',widthNum ='" + WidthNum + "',widthDeNum ='" + WidthDenum + "'";
                strSQL += ",Thick = '" + Thickness + "',ThickNum ='" + ThickNum + "',ThickDenum = '" + ThickDenum + "'";

                strSQL += ",iTailType = '" + TailType + "',iFins = '" + Fins + "'";
                strSQL += ",iShip = '" + Ship + "' ";
                break;

            case 2:     //snow
                strSQL += ",iBoardType = '" + BoardType + "'";
                strSQL += ",iHtFt = '" + HtFt + "'";
                strSQL += ",iShip = '" + Ship + "' ";
                break;

            case 3:     //other boards

                if (BoardType.ToString() != "" && BoardType > (int)0)
                {
                    strSQL += ",iBoardType = '" + BoardType + "'";
                    strSQL += ",txtOtherBoardType = NULL";
                }
                else
                {
                    strSQL += ",iBoardType = NULL";
                    strSQL += ",txtOtherBoardType = '" + OtherBoardType + "'";
                }
                strSQL += ",txtShaper = '" + Shaper + "'";
                strSQL += ", txtGenDimensions = '" + GenDimensions + "'";
                strSQL += ",iShip = '" + Ship + "' ";
                break;

            case 4:     //gear
                strSQL += ",txtGearItem = '" + GearItem + "'";
                strSQL += ",iShip = '" + Ship + "' ";
                break;
            }
            strSQL += "WHERE iD = '" + EntryId + "'";

            //ErrorLog.ErrorRoutine(false, "strSQL:Update: " + strSQL);

            //get connect string
            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;
            SqlConnection myConnection = new SqlConnection(myConnectString);

            try
            {
                myConnection.Open();
                SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
                objCommand.ExecuteNonQuery();
                return(true);
            }

            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "Error:BoardItems.cs:UpdateItem: " + ex.Message);
                ErrorLog.ErrorRoutine(false, "Error:BoardItems.cs:UpdateItem:StrSQL: " + strSQL);

                return(false);
            }

            finally
            {
                myConnection.Close();
            }
        }
Exemple #9
0
        /// <summary>
        /// Public Methods
        /// </summary>
        public override bool SaveItem()
        {
            string myConnectString;
            string strSQL = "Zippo";

            myConnectString = ConfigurationManager.ConnectionStrings["myConn"].ConnectionString;;

            //Build SQL
            switch (Category)
            {
            case (int)1:     //SURF

                switch (AdType)
                {
                case 1:         //selling
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, txtZip, adType, iCategory, iBoardType, txtBrand, iHtFt, iHtIn, iTailType, iFins, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, width, widthNum, widthDenum, Thick, ThickNum, ThickDenum, iRatingVal, iRatingCount, iCondition, activateCode, iShip, txtShaper, iStatus, txtModel)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + Zip + "', '" + AdType + "', '" + Category + "', '" + BoardType + "', '" + Brand + "', '" + HtFt +
                              "', '" + HtIn + "', '" + TailType + "', '" + Fins + "' , '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "', '" + Width + "','" + WidthNum + "','" + WidthDenum + "','" + Thickness + "','" + ThickNum + "','" + ThickDenum + "','" + (int)0 +
                              "','" + (int)0 + "','" + ICondition + "','" + ActivateCode + "','" + Ship + "','" + Shaper + "','" + (int)1 + "','" + model + "')";
                    break;

                case 2:         //wanted
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adType, iCategory, iHtFt, iHtIn, iBoardType,  txtDetails, dCreateDate, fltPrice, iUser, iRatingVal, iRatingCount, iShip, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + AdType + "', '" + Category + "', '" + HtFt +
                              "', '" + HtIn + "', '" + BoardType + "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + (int)0 + "','" + (int)0 + "','" + Ship + "','" + (int)1 + "')";
                    break;

                case 3:         //showcase
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adTitle, adType, iCategory, txtBrand, txtWeb, txtGearItem, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, txtGenDimensions, iRatingVal, iRatingCount, activateCode, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "','" + AdTitle + "', '" + AdType + "', '" + Category + "', '" + Brand + "', '" + WebURL +
                              "', '" + GearItem + "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "', '" + GenDimensions + "','" + (int)0 + "','" + (int)0 + "','" + ActivateCode + "','" + (int)1 + "')";
                    break;

                case 4:         //ShaperHouse
                    strSQL  = "INSERT INTO tblEntry (Location, iBoardType, adType, iCategory, txtBrand, txtModel, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, txtGenDimensions, iRatingVal, iRatingCount, iStatus, activateCode, EntryVideoEmbed)";
                    strSQL += "VALUES ('" + Location + "', '" + BoardType + "','" + AdType + "', '" + Category + "', '" + Brand + "','" + model + "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "', '" + GenDimensions + "','" + (int)0 + "','" + (int)0 + "','" + Status + "','" + ActivateCode + "','" + videoLink + "')";          //WHY is iStatus 4?
                    break;
                }
                break;

            case (int)2:     //SNOW
                //TODO: for adtypes
                strSQL  = "INSERT INTO tblEntry (Location, txtTown, adType, iCategory, iBoardType, txtBrand, iHtFt, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, iRatingVal, iRatingCount, activateCode, iShip, iStatus)";
                strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + AdType + "', '" + Category + "', '" + BoardType + "', '" + Brand + "', '" + HtFt +
                          "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                          IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                          "','" + (int)0 + "','" + (int)0 + "','" + ActivateCode + "','" + Ship + "','" + (int)1 + "')";
                break;

            case (int)3:     //OTHER boards
                //TODO: for adtypes
                if (BoardType == (int)0 || BoardType.ToString() == "")
                {
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adType, iCategory, txtBrand, txtGenDimensions, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, iRatingVal, iRatingCount, txtOtherBoardType, activateCode, iShip, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + AdType + "', '" + Category + "', '" + Brand + "', '" + GenDimensions +
                              "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "','" + (int)0 + "','" + (int)0 + "','" + OtherBoardType + "','" + ActivateCode + "','" + Ship + "','" + (int)1 + "')";
                }
                else
                {
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adType, iCategory, iBoardType, txtBrand, txtGenDimensions, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, iRatingVal, iRatingCount, activateCode, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + AdType + "', '" + Category + "', '" + BoardType + "', '" + Brand + "', '" + GenDimensions +
                              "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "','" + (int)0 + "','" + (int)0 + "','" + ActivateCode + "','" + (int)1 + "')";
                }
                break;

            case (int)4:     //Gear

                switch (AdType)
                {
                case 1:         //Selling
                    //TODO: for adtypes
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adType, iCategory, txtBrand, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, iRatingVal, iRatingCount, txtGearItem, activateCode, iShip, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + AdType + "', '" + Category + "', '" + Brand + "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "','" + (int)0 + "','" + (int)0 + "','" + GearItem + "','" + ActivateCode + "','" + Ship + "','" + (int)1 + "')";
                    break;

                case 2:         //Wanted
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adType, iCategory, iHtFt, iHtIn, iBoardType,  txtDetails, dCreateDate, fltPrice, iUser, iRatingVal, iRatingCount, activateCode, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "', '" + AdType + "', '" + Category + "', '" + HtFt +
                              "', '" + HtIn + "', '" + BoardType + "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + (int)0 + "','" + (int)0 + "','" + ActivateCode + "','" + (int)1 + "')";
                    break;

                case 3:         //Showcase
                    strSQL  = "INSERT INTO tblEntry (Location, txtTown, adTitle, adType, iCategory, txtBrand, txtWeb, txtGearItem, txtDetails, dCreateDate, fltPrice, iUser, txtImgPath1, txtImgPath2, txtImgPath3, txtImgPath4, txtGenDimensions, iRatingVal, iRatingCount, activateCode, iStatus)";
                    strSQL += "VALUES ('" + Location + "', '" + Town + "','" + AdTitle + "', '" + AdType + "', '" + Category + "', '" + Brand + "', '" + WebURL +
                              "', '" + GearItem + "', '" + Details + "' , '" + Created + "' , '" + Price + "', '" +
                              IUser + "', '" + ImgPath1 + "', '" + ImgPath2 + "', '" + ImgPath3 + "', '" + ImgPath4 +
                              "', '" + GenDimensions + "','" + (int)0 + "','" + (int)0 + "','" + ActivateCode + "','" + (int)1 + "')";
                    break;
                }
                break;
            }

            SqlConnection myConnection = new SqlConnection(myConnectString);

            try
            {
                myConnection.Open();

                SqlCommand objCommand = new SqlCommand(strSQL, myConnection);
                objCommand.ExecuteNonQuery();

                return(true);
            }

            catch (Exception ex)
            {
                ErrorLog.ErrorRoutine(false, "ErrMessage: " + ex.Message);
                ErrorLog.ErrorRoutine(false, "strSQL: " + strSQL);
                ErrorLog.ErrorRoutine(false, "Error Saving");
                return(false);
            }
            finally
            {
                myConnection.Close();
            }
        }