Example #1
0
        private void NaTools_Load(object sender, EventArgs e)
        {
            if (!Variable.allowBakRes)
            {
                button24.Enabled = false;
                button25.Enabled = false;
            }
            //Initialize Na Path
            installPath      = Variable.n_installPath;
            airVer           = Variable.airVer;
            gameVer          = Variable.gameVer;
            Variable.airPath = airPath = installPath + @"\RADS\projects\lol_air_client\releases\" + airVer + @"\deploy";
            gamePath         = installPath + @"\RADS\projects\lol_game_client\releases\" + gameVer + @"\deploy";

            if (Variable.allowUpdate)
            {
                CFGFile checkAutoUpdate = new CFGFile(Variable.CurrentDirectory + @"\config.ini");
                if (checkAutoUpdate.GetValue("LoLToolsX", "AutoUpdate") == "true")
                {
                    Variable.updating      = true;
                    this.checkBox1.Checked = false;
                    Thread updateThread = new Thread(CheckUpdate.checkUpdate);
                    updateThread.Start();
                }
                else
                {
                    this.checkBox1.Checked = true;
                }
            }
            else
            {
                button23.Enabled = false;
            }

            //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);   //If crush, call CrushHandler

            //寫入目前LoLToolsX版本到Log
            Logger.log("LoLToolsX版本: " + Application.ProductVersion, Logger.LogType.Info);

            Logger.log("目前客戶端 : 美服", Logger.LogType.Info);
            //載入LoLToolsX Logo
            PictureBox1.ImageLocation = Variable.CurrentDirectory + @"\logo.png";
            Logger.log("LoLToolsX Logo載入成功!", Logger.LogType.Info);


            //取得目前伺服器;
            CheckProp cp = new CheckProp();

            cp.CheckPropNa(airPath);
            serverLocation.Text = cp.currentLoc;

            notifyIcon1.Visible = false;
            PathLabel.Text      = installPath;

            //取得版本資訊
            toolsVersion.Text = Application.ProductVersion.ToString();



            //在綫統計使用人數
            try
            {
                WebBrowser1.Navigate("http://nitroxenon.com/loltoolsx/stat.html");
            }
            catch (Exception e2)
            {
                Logger.log("使用人數統計失敗", Logger.LogType.Error);
                Logger.log(e2);
            }

            //刪除物件
            cp = null;

            //Variable.na_installPath = installPath;
            Variable.curClient = "美服";
        }
Example #2
0
        private void Form1_Load(object sender, EventArgs e)     //Form1_Load
        {
            if (!Variable.allowBakRes)
            {
                button24.Enabled = false;
                button25.Enabled = false;
            }
            //AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);   //If crush, call CrushHandler

            //寫入目前LoLToolsX版本到Log
            Logger.log("LoLToolsX版本: " + Application.ProductVersion, Logger.LogType.Info);

            Logger.log("目前客戶端 : 台服", Logger.LogType.Info);
            //載入LoLToolsX Logo
            PictureBox1.ImageLocation = Application.StartupPath + @"\logo.png";
            Logger.log("LoLToolsX Logo載入成功!", Logger.LogType.Info);

            if (Variable.forceSelectPath)
            {
                goto SelectPath;
            }

            //取得LoL路徑
            GetReg gr = new GetReg();

            installPath = gr.TwPath(Application.StartupPath + @"\config.ini");
            Logger.log("LoL目錄取得成功! " + installPath, Logger.LogType.Info);

SelectPath:
            CFGFile CFGFile = new CFGFile(Application.StartupPath + @"\config.ini");

            //檢查路徑是否存有 LoLTW 字串
            if (!installPath.Contains("LoLTW"))
            {
                if (MessageBox.Show("無法取得LoL目錄 請手動選擇LoLTW目錄", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                {
                    folderBrowserDialog1.ShowDialog();
                    Logger.log("LoL手動選擇目錄! ", Logger.LogType.Info);
                    if (folderBrowserDialog1.SelectedPath.Contains("LoLTW"))
                    {
                        installPath = folderBrowserDialog1.SelectedPath;
                        Logger.log("LoL目錄檢查成功! " + installPath, Logger.LogType.Info);
                        CFGFile.SetValue("LoLPath", "TwPath", "\"" + installPath + "\"");
                        CFGFile.SetValue("LoLToolsX", "Version", Application.ProductVersion.ToString());
                    }
                    else
                    {
                        MessageBox.Show("目錄選擇錯誤 按確定退出程式", "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Logger.log("LoL目錄檢查失敗 ", Logger.LogType.Error);
                        Logger.log("強制關閉程式... ", Logger.LogType.Info);
                        Application.Exit();
                    }
                }
                else
                {
                    Logger.log("LoL目錄選擇取消 ", Logger.LogType.Error);
                    Logger.log("關閉程式... " + installPath, Logger.LogType.Info);
                    Application.Exit();
                }
            }
            else
            {
                CFGFile.SetValue("LoLPath", "TwPath", "\"" + installPath + "\"");
                CFGFile.SetValue("LoLToolsX", "Version", Application.ProductVersion.ToString());
                PathLabel.Text = installPath;
                Logger.log("LoL目錄檢查成功! ", Logger.LogType.Info);
                Logger.log("LoL目錄寫入成功! " + installPath, Logger.LogType.Info);
            }

            //CFGFile = null;

            if (Variable.allowUpdate)
            {
                //CFGFile checkAutoUpdate = new CFGFile(Application.StartupPath + @"\config.ini");
                if (CFGFile.GetValue("LoLToolsX", "AutoUpdate") == "true")
                {
                    Variable.updating      = true;
                    this.checkBox1.Checked = false;
                    Thread updateThread = new Thread(CheckUpdate.checkUpdate);
                    //開始檢查更新
                    updateThread.Start();
                }
                else
                {
                    this.checkBox1.Checked = true;
                }
            }
            else
            {
                button23.Enabled = false;
            }

            //檢查語言檔更新
            //Thread langUpdate = new Thread(LangUpdate.CheckLangUpdate);
            //langUpdate.Start();

            //string test = Application.StartupPath;
            //MessageBox.Show(test);

            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            //取得目前伺服器
            CheckProp cp = new CheckProp();

            cp.CheckPropFL(installPath);
            serverLocation.Text = cp.currentLoc;

            notifyIcon1.Visible = false;
            PathLabel.Text      = installPath;

            //取得版本資訊
            toolsVersion.Text    = Application.ProductVersion.ToString();
            LoLVersionLabel.Text = GetLoLVer();



            //在綫統計使用人數
            try
            {
                WebBrowser1.Navigate("http://nitroxenon.com/loltoolsx/stat.html");
            }
            catch (Exception e2)
            {
                Logger.log("使用人數統計失敗", Logger.LogType.Error);
                Logger.log(e2);
            }

            //刪除物件
            cp = null;
            gr = null;


            string[] skins = File.ReadAllLines(Application.StartupPath + @"\Skin.txt");
            foreach (string s in skins)
            {
                installedSkin.Items.Add(s);
            }

            //Variable.tw_installPath = installPath;
            Variable.curClient = "台服";
        }
        public ActionResult Check([Bind(Include = "DiscountCode,dateTime,Way,Message_Way,UserAddressId,RestaurantTableCount")] CheckProp checkProp)
        {
            if (checkProp.dateTime != null && DateTime.Parse(checkProp.dateTime) >= DateTime.Now.AddMinutes(18))
            {
                #region Queries
                var OrderList = userAppManager.FindAllOrderList().Where(a => a.UserId == User.Identity.GetUserId() && a.IsPay == false).OrderByDescending(a => a.OrderDate);
                var SumPrice  = OrderList.Sum(a => a.Food.Price * a.FoodCount);
                #endregion

                #region Courier || UserAddressId
                if (checkProp.Way == "1")
                {
                    if (checkProp.UserAddressId != null)
                    {
                        #region Find UserAddress by Id
                        UserAddress userAddress = userAppManager.FindUserAddress(Convert.ToInt32(checkProp.UserAddressId));
                        #endregion

                        #region Send Params with ViewData
                        ViewData["Way"]           = checkProp.Way;
                        ViewData["UserAddressId"] = checkProp.UserAddressId;
                        ViewData["Message_Way"]   = $"سفارش شما در تاریخ و ساعت : {checkProp.dateTime}  توسط پیک به آدرس {userAddress.Place} تحویل داده خواهد شد.";
                        #endregion
                    }
                }
                #endregion
                #region Reserve Table || RestaurantTableCount
                if (checkProp.Way == "2")
                {
                    if (checkProp.RestaurantTableCount != null)
                    {
                        #region Send Params with ViewData
                        ViewData["Way"] = checkProp.Way;
                        ViewData["RestaurantTableCount"] = checkProp.RestaurantTableCount;
                        ViewData["Message_Way"]          = $"برای شما در تاریخ و ساعت : {checkProp.dateTime}  به تعداد {checkProp.RestaurantTableCount} نفر میز و صندلی رزرو خواهد شد.";
                        #endregion
                    }
                }
                #endregion
                #region Get In Resturant
                if (checkProp.Way == "3")
                {
                    #region Send Params with ViewData
                    ViewData["Way"]         = checkProp.Way;
                    ViewData["Message_Way"] = $"شما می بایست به صورت حضوری در تاریخ و ساعت : {checkProp.dateTime} در محل رستوران سفارش خود را تحویل بگیرید.";
                    #endregion
                }
                #endregion

                #region Discount Code
                if (checkProp.DiscountCode != null)
                {
                    #region Query
                    var Discountcode_list = userAppManager.FindAllDiscountCode().Single(a => a.Code == checkProp.DiscountCode);
                    #endregion

                    #region Send Params with ViewData
                    if (Discountcode_list != null)
                    {
                        ViewData["Status_DiscountCode"]   = "1";
                        ViewData["Message_DiscountCode"]  = $"کد تخفیف صحیح است و برای شما به میزان {Discountcode_list.Persent} درصد تخفیف اعمال می شود.";
                        ViewData["SumPrice_DiscountCode"] = SumPrice * (100 - Discountcode_list.Persent) / 100;
                    }
                    else
                    {
                        ViewData["Status_DiscountCode"]  = "2";
                        ViewData["Message_DiscountCode"] = "کد تخفیف وارد شده صحبح نمی باشد!";
                    }
                    #endregion
                }
                #endregion

                #region Send Params for All
                ViewData["SumPrice"]             = SumPrice;
                ViewData["DiscountCode"]         = checkProp.DiscountCode;
                ViewData["DateTime"]             = checkProp.dateTime;
                ViewData["Way"]                  = checkProp.Way;
                ViewData["UserAddressId"]        = checkProp.UserAddressId;
                ViewData["RestaurantTableCount"] = checkProp.RestaurantTableCount;

                if (checkProp.Message_Way != null)
                {
                    ViewData["Message_Way"] = checkProp.Message_Way;
                }
                #endregion

                return(View(OrderList));
            }
            else
            {
                ViewData["Message"] = "در انتخاب تاریخ دقت فرمایید! لطفا 20 دقیقه اضافه بر زمان هم اکنون تاریخ و ساعت را ثبت نمایید.";
                return(View());
            }
        }