Ejemplo n.º 1
0
 public override void Process(string path, HttpCall call)
 {
     WebUI.WriteTemplate("sunfish-header", call, null);
     if (thing == "konosuba")
     {
         call.Write("<p>God's blessing on this wonderful world!</p>");
     }
     else
     {
         call.Write("<p>Hello world!</p>");
         call.Write("<p>");
         call.Write("The thing is: " + thing);
         call.Write("</p>");
         if (!string.IsNullOrEmpty(pass))
         {
             string ppass;
             if (call.Parameters.TryGetValue("pp", out ppass) && ppass == pass)
             {
                 call.Write("<p>it IS the passowrd</p>");
             }
             else
             {
                 call.Write("<p><form action=''>");
                 call.Write("Enter:<input type='password' name='pp'" + (ronly ? " DISABLED" : "") + "><br/><input type='submit' value='Go!'>");
                 call.Write("</form></p>");
             }
         }
         call.Write("<p>");
         call.Write(ronly ? "Read only!" : "You can write (not read only)");
         call.Write("</p>");
     }
     WebUI.WriteTemplate("sunfish-footer", call, null);
 }
Ejemplo n.º 2
0
        public WebUI(Proxy proxy, ConnectionManager connectionManager)
        {
            this.proxy = proxy;
            this.connectionManager = connectionManager;

            if (webUI != null)
                throw new InvalidOperationException ("There can only be one WebUI");
            webUI = this;
        }
Ejemplo n.º 3
0
        public DataTable GetReportDataForWinform(Hashtable ht)
        {
            DataTable dt = selectDS("Order.DataForReport", ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 报告打印审核导出数据
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public DataTable DataForFinanceAuditExport(Hashtable ht)
        {
            DataTable dt = selectDS("Order.DataForFinanceAuditExport", ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["年龄"] = WebUI.GetAge(dt.Rows[i]["年龄"]);
            }
            return(dt);
        }
        public DataTable GetOrderDelete(Hashtable ht)
        {
            DataTable dt = selectDS("Order.SelectOrderDelete", ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 查询统计HPV、TM检查人员信息
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public DataTable GetHPVTMAccondingInfos(Hashtable ht)
        {
            DataTable dt = selectDS("Order.GetHPVTMAccondingInfos", ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 根据姓名+性别查询体检记录
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public DataTable GetMemeberPastOrders(Hashtable ht)
        {
            DataTable dt = selectDS("Order.GetMemberPastOrders", ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
Ejemplo n.º 8
0
        /// <summary>
        ///体检报告单查询打印,分页查询
        /// </summary>
        /// <param name="ht"></param>
        /// <returns></returns>
        public DataTable DataForFocusPrintPageLst(Hashtable htPara)
        {
            DataTable dt = selectDS("Order.DataForFocusPrintPageLst", htPara).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
        /// <summary>
        /// 查询修改单位名称的相关数据
        /// </summary>
        public DataTable GetManagementOrdersByDictmemberid(Hashtable ht)
        {
            DataTable dt = this.selectDS("Order.GetManagementOrdersByDictmemberid", ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 总检医生查询订单
        /// </summary>
        /// <param name="ht">查询参数</param>
        /// <returns></returns>
        public DataTable GetFinishOrdersList(Hashtable ht, string t)
        {
            string    statementName = t == "1" ? "Order.GetAuthorizedOrdersList" : "Order.GetFinishOrdersList";
            DataTable dt            = selectDS(statementName, ht).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["AGE"] = WebUI.GetAge(dt.Rows[i]["AGE"]);
            }
            return(dt);
        }
Ejemplo n.º 11
0
 public void OnGetAsync(string where)
 {
     //string where = Request.Form["where"];
     if (where == null)
     {
         Status = WebUI.ShootAI();
     }
     else
     {
         Status = WebUI.Shoot(where);
     }
 }
        //打印条码
        protected void btnPrintBarcode_Click(object sender, EventArgs e)
        {
            foreach (int rowIndex in GridOrders.SelectedRowIndexArray)
            {
                GridRow row = GridOrders.Rows[rowIndex];
                if (!(row.Values[5].Contains("已登记") || row.Values[5].Contains("条码已打印")))
                {
                    MessageBoxShow(string.Format("条码号:{0} 姓名:{1} 已打印过条码,条码补打模块可补打条码", row.Values[0], row.Values[1]));
                    return;
                }
            }

            SetInitlocalsetting(hdMac.Text);//设置打印所需的客户端配置信息

            string ordernums = GetSelectOrderNums(false);

            if (ordernums == string.Empty)
            {
                return;
            }
            DataTable dtSource = new OrderbarcodeService().GetPrintBarcodeData(new Hashtable()
            {
                { "ordernum", ordernums }, { "orderbarcode", null }
            });

            for (int i = 0; i < dtSource.Rows.Count; i++)
            {
                string testnames = dtSource.Rows[i]["TESTNAMES"].ToString();
                dtSource.Rows[i]["AGE"]         = WebUI.GetAge(dtSource.Rows[i]["AGE"]);//处理年龄
                dtSource.Rows[i]["COLLECTDATE"] = dtSource.Rows[i]["COLLECTDATE"].ToString();
                dtSource.Rows[i]["TESTNAMES"]   = testnames.TrimEnd(',');
                dtSource.Rows[i]["COUNT"]       = String.Format("共{0}项", testnames.TrimEnd(',').Split(',').Length);
            }


            //修改订单状态为[条码已打印](已登记的才改)

            new OrdersService().EditStatusByOldStatus(new Hashtable()
            {
                { "ordernum", ordernums }, { "status", (int)ParamStatus.OrdersStatus.BarCodePrint }, { "oldstatus", (int)ParamStatus.OrdersStatus.Register },
            });
            //后续调用柯木朗方法打印
            //..........................

            commonReport.PrintBarCode(dtSource, Userinfo);
            ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintBarCode(\'{0}\',\'{1}\');", CommonReport.printer, CommonReport.json));

            //记录日志
            JournalLog(ordernums, "打印条码");
        }
Ejemplo n.º 13
0
        private void btUP_ItemClick(object sender, ItemClickEventArgs e)
        {
            try
            {
                txtE.EditValue = txtC.EditValue = "";
                SetSW();

                txtC.EditValue += WebUI.UpdatePage(db.Tables[listTable.Text]);
            }
            catch
            {
                txtE.EditValue = "Cannot Create Class";
            }
        }
        //打印指引单
        protected void btnPrintSingle_Click(object sender, EventArgs e)
        {
            SetInitlocalsetting(hdMac.Text);//设置打印所需的客户端配置信息

            string ordernums = GetSelectOrderNums(false);

            if (ordernums == string.Empty)
            {
                return;
            }
            DataTable dtSource = mamagement.GetPrintDirectData(ordernums);

            string[] arrordernum = ordernums.Split(',');
            Report   report      = new Report();

            for (int i = 0; i < arrordernum.Length; i++)
            {
                DataSet   ds     = new DataSet();
                DataTable dt     = dtSource.Select("ordernum=" + arrordernum[i]).CopyToDataTable();
                DataTable dthead = dt.Clone();//复制表结构
                dt.TableName     = "dtHealthGuideResult";
                dthead.TableName = "dtHealthGuideTitle";
                DataRow dr = dt.Rows[0];
                dr["AGE"]   = WebUI.GetAge(dr["AGE"]);                            //处理年龄
                dr["PHONE"] = dr["PHONE"].ToString().TrimEnd('/').TrimStart('/'); //处理电话格式
                dthead.ImportRow(dr);                                             //复制一行

                //title
                DataTable dttitle = new DataTable();
                dttitle.TableName = "dtTitle";
                dttitle.Columns.Add("titleName", typeof(string));//报告标题
                DataRow dttitledr = dttitle.NewRow();
                dttitledr[0] = dt.Rows[0]["titleName"];
                dttitle.Rows.Add(dttitledr);
                //title  end

                ds.Tables.Add(dthead);
                ds.Tables.Add(dt);
                ds.Tables.Add(dttitle);
                //后续调用柯木朗方法打印
                //..........................

                report = commonReport.GetReportByDataset("25", ds, 1);
                commonReport.PrintReport2(report.SaveToString(), commonReport.dsGetReportData.Copy(), Userinfo);
                ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintReport(\'{0}\',\'{1}\',\'{2}\');", CommonReport.printer, CommonReport.json, CommonReport.dsjson));
            }
            //记录日志
            JournalLog(ordernums, "打印指引单");
        }
Ejemplo n.º 15
0
 /// <summary>
 /// 根据选择,加载体检者基本信息
 /// </summary>
 void InitOrderText(int rowindex)
 {
     if (gdOrders.SelectedRowIndexArray.Length == 0)//判断是否选中一个体检者
     {
         return;
     }
     //初始化客户信息
     labInfo.Text = string.Format("[姓名:{0}]  [性别:{1}]  [年龄:{2}]  [婚姻:{3}]  [联系方式:{4}]  [单位:{5}]",
                                  gdOrders.DataKeys[rowindex][4],
                                  gdOrders.DataKeys[rowindex][5],
                                  WebUI.GetAge(gdOrders.DataKeys[rowindex][6].ToString()),
                                  gdOrders.DataKeys[rowindex][7].ToString() == "1" ? "已婚" : (gdOrders.DataKeys[rowindex][7].ToString() == "0" ? "未婚" : "未知"),
                                  gdOrders.DataKeys[rowindex][8] == null ? "无" : gdOrders.DataKeys[rowindex][8].ToString(),
                                  gdOrders.DataKeys[rowindex][9] == null ? "无" : gdOrders.DataKeys[rowindex][9].ToString()
                                  );
 }
Ejemplo n.º 16
0
        public async Task OnGetAsync(string where)
        {
            Player = WebUI.Current;
            if (Player.AI)
            {
                Status = WebUI.ShootAI();
            }
            if (where == "go" || where == null || where == "save")
            {
                //Status = WebUI.ShootAI();
                if (where == "save")
                {
                    if (SaveSystem.GameStates.Count != 0)
                    {
                        if (SaveSystem.GameStates.Last().Status == null)
                        {
                            SaveSystem.GameStates.Last().Status = "[" + SaveSystem.GameStates.Last().P1.ToString() +
                                                                  ": " + SaveSystem.GameStates.Last().P1.Board.Ships.Count +
                                                                  " Ships, " +
                                                                  SaveSystem.GameStates.Last().P2.ToString() +
                                                                  ": " + SaveSystem.GameStates.Last().P2.Board.Ships.Count +
                                                                  " Ships]";
                        }

                        SaveSystem.SavesList.Add(new List <State>(SaveSystem.GameStates));
                    }
                    SaveSystem.GameStates = new List <State>();
                    DAL.AppDbContext.SaveToDb();
                }
            }
            else
            {
                Status = WebUI.Shoot(where);
            }
            SaveSystem.GameStates.Add(new State(WebUI.Player1, WebUI.Player2, Rules.CanTouch, WebUI.P2Turn));
            if (WebUI.GetWinner() == null)
            {
            }
            else
            {
                Status = WebUI.GetWinner().Name;
            }
            GameBoard = Player.Board;
            Map       = Player.Map;
        }
Ejemplo n.º 17
0
        //打印条码
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            SetInitlocalsetting(hdMac.Text);//设置打印所需的客户端配置信息

            string ordernum      = "";
            string orderbarcodes = GetSelectBarcode(ref ordernum);

            if (orderbarcodes == string.Empty)
            {
                return;
            }
            DataTable dtSource = barcodeservice.GetPrintBarcodeData(new Hashtable()
            {
                { "ordernum", null }, { "orderbarcode", orderbarcodes }
            });

            for (int i = 0; i < dtSource.Rows.Count; i++)
            {
                string testnames = dtSource.Rows[i]["TESTNAMES"].ToString();
                dtSource.Rows[i]["AGE"]         = WebUI.GetAge(dtSource.Rows[i]["AGE"]);//处理年龄
                dtSource.Rows[i]["COLLECTDATE"] = dtSource.Rows[i]["COLLECTDATE"].ToString();
                dtSource.Rows[i]["TESTNAMES"]   = testnames.TrimEnd(',');
                dtSource.Rows[i]["COUNT"]       = "共" + testnames.TrimEnd(',').Split(',').Length + "项";
            }
            //修改订单状态为[条码已打印](已登记的才改)
            new OrdersService().EditStatusByOldStatus(new Hashtable()
            {
                { "ordernum", ordernum }, { "status", (int)ParamStatus.OrdersStatus.BarCodePrint }, { "oldstatus", (int)ParamStatus.OrdersStatus.Register },
            });
            //后续调用柯木朗方法打印
            //..........................

            commonReport.PrintBarCode(dtSource, Userinfo);
            ExtAspNet.PageContext.RegisterStartupScript(string.Format(" PrintBarCode(\'{0}\',\'{1}\');", CommonReport.printer, CommonReport.json));

            //记录日志
            JournalLog(ordernum, orderbarcodes, "条码补打");
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 按相关模型重复多次
 /// </summary>
 /// <param name="num">重复次数</param>
 /// <param name="pattern">复制相关模型</param>
 public static string Repeat(int num, string pattern)
 {
     return(WebUI.ReplicateObject(num, pattern));
 }
Ejemplo n.º 19
0
        protected void gvOrderUser_RowClick(object sender, GridRowClickEventArgs e)
        {
            highlightRows.Text = "";
            txtSearch.Text     = orderUserInfo[0].ToString();


            //未选择客户提示
            if (orderUserInfo == null)
            {
                MessageBoxShow("请至少选择一位客户!", MessageBoxIcon.Warning);
                gvOrderUser.SelectedRowIndexArray = new int[] { e.RowIndex };
                return;
            }

            //初始化客户信息
            labInfo.Text = string.Format("[姓名:{0}][性别:{1}][年龄:{2}][身份证号:{3}][单位:{4}]", orderUserInfo[1], orderUserInfo[2], WebUI.GetAge(orderUserInfo[3]), orderUserInfo[4], orderUserInfo[5]);

            //科室检查结果列表
            List <Ordertest> tempOrderTestLst = OrderTestData(orderUserInfo[0].ToString()).ToList <Ordertest>();

            gvOrderTest.DataSource = tempOrderTestLst;
            gvOrderTest.DataBind();

            //判断是否已审核,如果审核,检查结果、科室小结、诊断建议不能修改
            if (orderUserInfo[7].ToString() == ((int)ParamStatus.Orderlabdepstatus.Audited).ToString())
            {
                //检查结果
                txtTestResult.Enabled  = false;
                chkIsexception.Enabled = false;
                btnTestResult.Hidden   = true;
                btnResultSelect.Hidden = true;

                //科室小结
                txtOrderLabdeptResult.Enabled    = false;
                btnSaveOrderLabdeptResult.Hidden = true;
                //诊断建议
                txtEditSuggestion.Enabled     = false;
                btnOrderdiagnosisModel.Hidden = true;
                btnSaveOrderdiagnosis.Hidden  = true;
            }
            else
            {
                txtTestResult.Enabled  = true;
                chkIsexception.Enabled = true;
                btnTestResult.Hidden   = false;
                btnResultSelect.Hidden = false;

                txtOrderLabdeptResult.Enabled    = true;
                btnSaveOrderLabdeptResult.Hidden = false;

                txtEditSuggestion.Enabled     = true;
                btnOrderdiagnosisModel.Hidden = false;
                btnSaveOrderdiagnosis.Hidden  = false;
            }

            //绑定科室小结列表
            gvOrderLabdeptResult.DataSource = OrderlabdeptresultData(orderUserInfo[0].ToString());
            gvOrderLabdeptResult.DataBind();

            //绑定诊断建议列表
            gvSuggestion.DataSource = OrderdiagnosisData(orderUserInfo[0].ToString());
            gvSuggestion.DataBind();

            //清空编辑区先前选择的结果、科室小结、诊断建议
            txtEditSuggestion.Text     = "";
            txtOrderLabdeptResult.Text = "";
            txtTestResult.Text         = "";
            chkIsexception.Checked     = false;
        }
Ejemplo n.º 20
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(45, 1, true);
            WriteLiteral("\n");
            EndContext();
#line 5 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"

            ViewData["Title"] = "Game Setup";

#line default
#line hidden
            BeginContext(89, 25, true);
            WriteLiteral("\n<!DOCTYPE html>\n\n<html>\n");
            EndContext();
            BeginContext(114, 78, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "069333ddb92e3c3fe1a7ce8de8b76ef2204992083517", async() => {
                BeginContext(120, 65, true);
                WriteLiteral("\n    <title>Game in Progress</title>\n    <link href=\"style.css\">\n");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(192, 1, true);
            WriteLiteral("\n");
            EndContext();
            BeginContext(193, 3402, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "069333ddb92e3c3fe1a7ce8de8b76ef2204992084744", async() => {
                BeginContext(199, 1, true);
                WriteLiteral("\n");
                EndContext();
#line 17 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                if (WebUI.GetWinner() == null)
                {
#line default
#line hidden
                    BeginContext(234, 30, true);
                    WriteLiteral("    <div class=\"text-center\">\n");
                    EndContext();
#line 20 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    if (Model.Player != WebUI.Current)
                    {
#line default
#line hidden
                        BeginContext(318, 33, true);
                        WriteLiteral("            <a href=\"?cmd=go\">🔄 ");
                        EndContext();
                        BeginContext(352, 35, false);
#line 22 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        Write(Html.DisplayFor(s => s.Player.Name));

#line default
#line hidden
                        EndContext();
                        BeginContext(387, 5, true);
                        WriteLiteral("</a>\n");
                        EndContext();
#line 23 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }
                    else
                    {
#line default
#line hidden
                        BeginContext(425, 18, true);
                        WriteLiteral("            <a>👤 ");
                        EndContext();
                        BeginContext(444, 35, false);
#line 26 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        Write(Html.DisplayFor(s => s.Player.Name));

#line default
#line hidden
                        EndContext();
                        BeginContext(479, 5, true);
                        WriteLiteral("</a>\n");
                        EndContext();
#line 27 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }

#line default
#line hidden
                    BeginContext(494, 147, true);
                    WriteLiteral("    </div>\n    <div style=\"padding-left: 15%; padding-right: 15%; font-size: 180%\">\n        \n        <div style=\"position: relative; width: 50%;\">\n");
                    EndContext();
#line 32 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    if (Model.Player != WebUI.Current)//blurred
                    {
#line default
#line hidden
                        BeginContext(712, 80, true);
                        WriteLiteral("                <table class=\"border\" style=\"float: left; filter: blur(24px);\">\n");
                        EndContext();
#line 35 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        for (int i = 0; i < WebUI.Player1.Map.Board.Count; i++)
                        {
#line default
#line hidden
                            BeginContext(891, 44, true);
                            WriteLiteral("                        <tr class=\"border\">\n");
                            EndContext();
#line 38 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            for (var j = 0; j < WebUI.Player1.Map.Board[i].Count; j++)
                            {
#line default
#line hidden
                                BeginContext(1053, 88, true);
                                WriteLiteral("                                <td class=\"border\">\n                                    ");
                                EndContext();
                                BeginContext(1142, 64, false);
#line 41 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                                Write(WebUI.ConvertToSymbols(WebUI.Current.Map.Board[i][j].ToString()));

#line default
#line hidden
                                EndContext();
                                BeginContext(1206, 39, true);
                                WriteLiteral("\n                                </td>\n");
                                EndContext();
#line 43 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            }

#line default
#line hidden
                            BeginContext(1275, 30, true);
                            WriteLiteral("                        </tr>\n");
                            EndContext();
#line 45 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        }

#line default
#line hidden
                        BeginContext(1327, 132, true);
                        WriteLiteral("                </table>\n                <div class=\"text-center\" style=\"position: absolute; top: 120px; left: 35%\">Hidden �</div>\n");
                        EndContext();
#line 48 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }
                    else
                    {
#line default
#line hidden
                        BeginContext(1504, 88, true);
                        WriteLiteral("                <table class=\"border\" style=\"float: left;\">\n                    <tbody>\n");
                        EndContext();
#line 53 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        for (int i = 0; i < Model.GameBoard.Board.Count; i++)
                        {
#line default
#line hidden
                            BeginContext(1689, 44, true);
                            WriteLiteral("                        <tr class=\"border\">\n");
                            EndContext();
#line 56 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            for (var j = 0; j < Model.GameBoard.Board[i].Count; j++)
                            {
#line default
#line hidden
                                BeginContext(1849, 88, true);
                                WriteLiteral("                                <td class=\"border\">\n                                    ");
                                EndContext();
                                BeginContext(1938, 62, false);
#line 59 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                                Write(WebUI.ConvertToSymbols(Model.GameBoard.Board[i][j].ToString()));

#line default
#line hidden
                                EndContext();
                                BeginContext(2000, 39, true);
                                WriteLiteral("\n                                </td>\n");
                                EndContext();
#line 61 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            }

#line default
#line hidden
                            BeginContext(2069, 30, true);
                            WriteLiteral("                        </tr>\n");
                            EndContext();
#line 63 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        }

#line default
#line hidden
                        BeginContext(2121, 54, true);
                        WriteLiteral("                    </tbody>\n                </table>\n");
                        EndContext();
#line 66 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }

#line default
#line hidden
                    BeginContext(2189, 151, true);
                    WriteLiteral("        </div>\n        <div style=\"float: right;width: 50%\">\n            <table class=\"border\" style=\"display: inline-block;\">\n                <tbody>\n");
                    EndContext();
#line 71 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    for (int i = 0; i < Model.Map.Board.Count; i++)
                    {
#line default
#line hidden
                        BeginContext(2423, 40, true);
                        WriteLiteral("                    <tr class=\"border\">\n");
                        EndContext();
#line 74 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        for (var j = 0; j < Model.Map.Board[i].Count; j++)
                        {
#line default
#line hidden
                            BeginContext(2565, 48, true);
                            WriteLiteral("                            <td class=\"border\">\n");
                            EndContext();
#line 77 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            if (Model.Player != WebUI.Current)
                            {
#line default
#line hidden
                                BeginContext(2752, 56, false);
#line 79 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                                Write(WebUI.ConvertToSymbols(Model.Map.Board[i][j].ToString()));

#line default
#line hidden
                                EndContext();
#line 79 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            }
                            else
                            {
#line default
#line hidden
                                BeginContext(2914, 38, true);
                                WriteLiteral("                                    <a");
                                EndContext();
                                BeginWriteAttribute("href", " href=\"", 2952, "\"", 2971, 4);
                                WriteAttributeValue("", 2959, "?Where=", 2959, 7, true);
#line 83 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                                WriteAttributeValue("", 2966, i, 2966, 2, false);

#line default
#line hidden
                                WriteAttributeValue("", 2968, ",", 2968, 1, true);
#line 83 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                                WriteAttributeValue("", 2969, j, 2969, 2, false);

#line default
#line hidden
                                EndWriteAttribute();
                                BeginContext(2972, 1, true);
                                WriteLiteral(">");
                                EndContext();
                                BeginContext(2974, 56, false);
#line 83 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                                Write(WebUI.ConvertToSymbols(Model.Map.Board[i][j].ToString()));

#line default
#line hidden
                                EndContext();
                                BeginContext(3030, 5, true);
                                WriteLiteral("</a>\n");
                                EndContext();
#line 84 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                            }

#line default
#line hidden
                            BeginContext(3069, 34, true);
                            WriteLiteral("                            </td>\n");
                            EndContext();
#line 86 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                        }

#line default
#line hidden
                        BeginContext(3129, 26, true);
                        WriteLiteral("                    </tr>\n");
                        EndContext();
#line 88 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }

#line default
#line hidden
                    BeginContext(3173, 72, true);
                    WriteLiteral("                </tbody>\n            </table>\n        </div>\n    </div>\n");
                    EndContext();
#line 93 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                }
                else
                {
#line default
#line hidden
                    BeginContext(3254, 38, true);
                    WriteLiteral("    <div class=\"text-center\">\n        ");
                    EndContext();
                    BeginContext(3293, 22, false);
#line 97 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    Write(WebUI.GetWinner().Name);

#line default
#line hidden
                    EndContext();
                    BeginContext(3315, 6, true);
                    WriteLiteral(" Won!\n");
                    EndContext();
#line 98 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    if (WebUI.GetWinner().AI)
                    {
#line default
#line hidden
                        BeginContext(3366, 26, true);
                        WriteLiteral("            <a>🤣🤣🤣</a>\n");
                        EndContext();
#line 101 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }
                    else
                    {
#line default
#line hidden
                        BeginContext(3425, 22, true);
                        WriteLiteral("            <a>😎</a>\n");
                        EndContext();
#line 105 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                    }

#line default
#line hidden
                    BeginContext(3456, 49, true);
                    WriteLiteral("<br>\n        <a href=\"Index\">Exit</a>\n    </div>\n");
                    EndContext();
#line 108 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                }

#line default
#line hidden
                BeginContext(3507, 6, true);
                WriteLiteral("<br/>\n");
                EndContext();
#line 110 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                if (SaveSystem.GameStates.Count > 0)
                {
#line default
#line hidden
                    BeginContext(3553, 33, true);
                    WriteLiteral("    <a href=\"?Where=save\">💾</a>\n");
                    EndContext();
#line 113 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Game.cshtml"
                }

#line default
#line hidden
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(3595, 8, true);
            WriteLiteral("\n</html>");
            EndContext();
        }
Ejemplo n.º 21
0
 /// <summary>
 /// HTML格式文本转换为普通文本
 /// </summary>
 /// <param name="htmlObj">转换HTML文本对象</param>
 /// <returns>格式化的普通文本</returns>
 public static string Html2Text(object htmlObj)
 {
     return(WebUI.Html2Text(htmlObj));
 }
Ejemplo n.º 22
0
        public void OnGet(string cmd)
        {
            if (cmd.Contains("load-"))
            {
                WebUI.LoadSave(Int32.Parse(cmd.Substring(5)));
            }
            if (cmd == "random")
            {
                WebUI.PlaceRandomly();
            }

            if (cmd == "switch")
            {
                WebUI.Switch();
            }
            Player = WebUI.Current;
            if (cmd == "pvp")
            {
                WebUI.Player2.AI   = false;
                WebUI.Player2.Name = "Player 2";
                WebUI.Run();
            }
            if (cmd == "sp")
            {
                WebUI.Run();
                WebUI.AIPlace();
                WebUI.Player2.AI   = true;
                WebUI.Player2.Name = "AI";
            }

            if (cmd.Contains(","))
            {
                if (WebUI.ShipInHand != 0 && AI.CheckPlace(Player.Board, WebUI.ParseCoords(cmd), WebUI.ShipInHand, WebUI.RotationInHand))
                {
                    AI.SetPlace(Player.Board, WebUI.ParseCoords(cmd), WebUI.ShipInHand, WebUI.RotationInHand);
                    foreach (var ship in WebUI.Current.Ships)
                    {
                        if (ship.Length == WebUI.ShipInHand)
                        {
                            WebUI.Current.Ships.Remove(ship);
                            WebUI.ShipInHand = 0;
                            break;
                        }
                    }
                }
            }

            if (cmd.Contains("choose-"))
            {
                WebUI.ShipInHand = Int32.Parse(cmd.Substring(7));
            }

            if (cmd == "rotate")
            {
                if (WebUI.RotationInHand)
                {
                    WebUI.RotationInHand = false;
                }
                else
                {
                    WebUI.RotationInHand = true;
                }
            }
        }
Ejemplo n.º 23
0
        #pragma warning disable 1998
        public async override global::System.Threading.Tasks.Task ExecuteAsync()
        {
            BeginContext(32, 1, true);
            WriteLiteral("\n");
            EndContext();
#line 4 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"

            ViewData["Title"] = "Game Setup";

#line default
#line hidden
            BeginContext(76, 25, true);
            WriteLiteral("\n<!DOCTYPE html>\n\n<html>\n");
            EndContext();
            BeginContext(101, 47, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("head", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "7107aab3750c1123d02f9669977be1417c48cee73393", async() => {
                BeginContext(107, 34, true);
                WriteLiteral("\n    <title>Placing ships</title>\n");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_HeadTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(148, 1, true);
            WriteLiteral("\n");
            EndContext();
            BeginContext(149, 1405, false);
            __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "7107aab3750c1123d02f9669977be1417c48cee74586", async() => {
                BeginContext(155, 83, true);
                WriteLiteral("\n<div class=\"\">\n    <div>\n        <div class=\"\">\n            <h1 class=\"display-5\">");
                EndContext();
                BeginContext(239, 33, false);
#line 18 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                Write(Html.DisplayFor(s => s.Player.Name));

#line default
#line hidden
                EndContext();
                BeginContext(272, 81, true);
                WriteLiteral("</h1>\n        </div>\n        \n        <table class=\"border\">\n            <tbody>\n");
                EndContext();
#line 23 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                for (int i = 0; i < Model.Player.Board.Board.Count; i++)
                {
#line default
#line hidden
                    BeginContext(437, 36, true);
                    WriteLiteral("                <tr class=\"border\">\n");
                    EndContext();
#line 26 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                    for (var j = 0; j < Model.Player.Board.Board[i].Count; j++)
                    {
#line default
#line hidden
                        BeginContext(576, 74, true);
                        WriteLiteral("                        <td class=\"border\">\n                            <a");
                        EndContext();
                        BeginWriteAttribute("href", " href=\"", 650, "\"", 667, 4);
                        WriteAttributeValue("", 657, "?cmd=", 657, 5, true);
#line 29 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                        WriteAttributeValue("", 662, i, 662, 2, false);

#line default
#line hidden
                        WriteAttributeValue("", 664, ",", 664, 1, true);
#line 29 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                        WriteAttributeValue("", 665, j, 665, 2, false);

#line default
#line hidden
                        EndWriteAttribute();
                        BeginContext(668, 1, true);
                        WriteLiteral(">");
                        EndContext();
                        BeginContext(670, 65, false);
#line 29 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                        Write(WebUI.ConvertToSymbols(Model.Player.Board.Board[i][j].ToString()));

#line default
#line hidden
                        EndContext();
                        BeginContext(735, 35, true);
                        WriteLiteral("</a>\n                        </td>\n");
                        EndContext();
#line 31 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                    }

#line default
#line hidden
                    BeginContext(792, 22, true);
                    WriteLiteral("                </tr>\n");
                    EndContext();
#line 33 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                }

#line default
#line hidden
                BeginContext(828, 69, true);
                WriteLiteral("            </tbody>\n        </table>\n        <div>\n            <br>\n");
                EndContext();
#line 38 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                foreach (var ship in WebUI.Current.Ships)
                {
#line default
#line hidden
                    BeginContext(966, 18, true);
                    WriteLiteral("                <a");
                    EndContext();
                    BeginWriteAttribute("href", " href=\"", 984, "\"", 1015, 2);
                    WriteAttributeValue("", 991, "?cmd=choose-", 991, 12, true);
#line 40 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                    WriteAttributeValue("", 1003, ship.Length, 1003, 12, false);

#line default
#line hidden
                    EndWriteAttribute();
                    BeginContext(1016, 1, true);
                    WriteLiteral(">");
                    EndContext();
                    BeginContext(1018, 34, false);
#line 40 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                    Write(ship.ToString().Replace("+", "⚓️"));

#line default
#line hidden
                    EndContext();
                    BeginContext(1052, 9, true);
                    WriteLiteral("</a><br>\n");
                    EndContext();
#line 41 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                }

#line default
#line hidden
                BeginContext(1076, 12, true);
                WriteLiteral("            ");
                EndContext();
#line 43 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"

                var orientation = "Horizontal";
                if (WebUI.RotationInHand)
                {
                    orientation = "Vertical";
                }


#line default
#line hidden
                BeginContext(1277, 12, true);
                WriteLiteral("            ");
                EndContext();
#line 50 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                if (WebUI.ShipInHand != 0)
                {
#line default
#line hidden
                    BeginContext(1317, 37, true);
                    WriteLiteral("            <a href=\"?cmd=rotate\">🔄 ");
                    EndContext();
                    BeginContext(1355, 11, false);
#line 51 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                    Write(orientation);

#line default
#line hidden
                    EndContext();
                    BeginContext(1366, 9, true);
                    WriteLiteral("</a><br/>");
                    EndContext();
#line 51 "/Users/olkoro/CodeProjects/battleship-by-oleg-korotkov/WebApp/Pages/Place.cshtml"
                }

#line default
#line hidden
                BeginContext(1377, 170, true);
                WriteLiteral("        </div>\n    </div>\n    <br/>\n    <a href=\"?cmd=switch\">🔄 Switch Board</a><br/>\n    <a href=\"?cmd=random\">🎲 Random</a><br/>\n    <a href=\"Game\">🎮 Play</a>\n</div>\n");
                EndContext();
            }
                                                                        );
            __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper = CreateTagHelper <global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper>();
            __tagHelperExecutionContext.Add(__Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper);
            await __tagHelperRunner.RunAsync(__tagHelperExecutionContext);

            if (!__tagHelperExecutionContext.Output.IsContentModified)
            {
                await __tagHelperExecutionContext.SetOutputContentAsync();
            }
            Write(__tagHelperExecutionContext.Output);
            __tagHelperExecutionContext = __tagHelperScopeManager.End();
            EndContext();
            BeginContext(1554, 8, true);
            WriteLiteral("\n</html>");
            EndContext();
        }
Ejemplo n.º 24
0
        public override void Process(string path, HttpCall call)
        {
            if (path == "/")
            {
                // Root page
                if (ShowMenu)
                {
                    List <WebUILink> items = new List <WebUILink>();
                    foreach (SunfishService s in Sunfish.Services)
                    {
                        if (!s.Enabled)
                        {
                            continue;
                        }
                        items.Add(new WebUILink()
                        {
                            Icon        = "/$sunfish/folder.png",
                            Name        = s.Configuration.Name,
                            Description = s.Configuration.Location,
                            Link        = s.Configuration.Location,
                        });
                    }
                    Dictionary <string, object> data = new Dictionary <string, object>();
                    data["Breadcrumb"] = new WebUILink[] { LinkHome };
                    //data["Actions"] = actions;
                    data["Items"] = items;
                    WebUI.WriteTemplate("directory-index", call, data);
                }
                else
                {
                    call.Response.StatusCode = 404;
                }
            }
            else if (path.StartsWith(DIR_COMMON))
            {
                path = path.Substring(DIR_COMMON.Length);
                if (path == "Sunfish.exe")
                {
                    // Self copy
                    call.Response.ContentType = "application/x-msdownload";
                    call.Write(File.ReadAllBytes(Assembly.GetExecutingAssembly().Location));
                }
                else if (path == "info")
                {
                    WebUI.WriteTemplate("sunfish-header", call, null);
                    call.Write("<p>Sunfish " + Program.VERSION + " (C) XWolfOverride</p>");
#if DEBUG
                    call.Write("<p>Debug build</p>");
                    if (WebUI.EXTERNAL_RESOURCES)
                    {
                        call.Write("<p>Using external resources</p>");
                    }
                    else
                    {
                        call.Write("<p>Using internal resources</p>");
                    }
#else
                    call.Write("<p>Release build</p>");
#endif
                    if (WebUI.Ready)
                    {
                        call.Write("<p>Resources loaded succesfully</p>");
                    }
                    else
                    {
                        call.Write("<p>No resources</p>");
                    }
                    call.Write("<p><b><a href='info/seal'>Seal resources</a></b></p>");
                    WebUI.WriteTemplate("sunfish-footer", call, null);
                }
                else if (path == "info/seal")
                {
                    WebUI.Seal();
                    call.Response.StatusCode          = 307;
                    call.Response.Headers["Location"] = "/$sunfish/info";
                }
                else

                {
                    // Internal Resources
                    WebUI.WriteResource(path, call);
                }
            }
            else
            {
                call.HTTPNotFound();
            }
        }
Ejemplo n.º 25
0
        private void WriteIndex(string path, VFSItem dir, HttpCall call)
        {
            List <WebUILink> items    = new List <WebUILink>();
            List <string>    fileList = new List <string>();

            foreach (VFSItem vd in dir.ListDirectories())
            {
                items.Add(new WebUILink()
                {
                    Icon        = "/$sunfish/folder.png",
                    Name        = vd.Name,
                    Description = "Directory",
                    Link        = vd.Name + "/",
                    Style       = "directory",
                    Actions     = new WebUILink[] {
                        new WebUILink()
                        {
                            Icon    = "archive",
                            Tooltip = "Download as zip",
                            //Click="sunfish.openFile(this)"
                            Link = vd.Name + "?action=zip"
                        },
                        readOnly?null:new WebUILink()
                        {
                            Icon    = "drive_file_rename_outline",
                            Tooltip = "Rename",
                            Click   = "sunfish.renameFile(this)"
                        },
                        allowDelete?new WebUILink()
                        {
                            Icon    = "delete",
                            Tooltip = "Delete folder",
                            Click   = "sunfish.deleteFile(this);"
                        }:null
                    }
                });
            }
            fileList.Clear();
            foreach (VFSItem vf in dir.ListFiles())
            {
                items.Add(new WebUILink()
                {
                    Icon        = vf.Name + "?action=icon",
                    Name        = vf.Name,
                    Description = "<span class='size'>" + vf.Length.ToSize() + "</span> <span class='info'>(" + MimeTypes.GetMimeType(Path.GetExtension(vf.Name)) + ")</span>",
                    Link        = vf.Name,
                    Actions     = new WebUILink[] {
                        allowExec?new WebUILink()
                        {
                            Icon    = "api",
                            Tooltip = "Open in server",
                            Click   = "sunfish.openFile(this)"
                        }:null,
                        readOnly?null:new WebUILink()
                        {
                            Icon    = "drive_file_rename_outline",
                            Tooltip = "Rename",
                            Click   = "sunfish.renameFile(this)"
                        },
                        allowDelete?new WebUILink()
                        {
                            Icon    = "delete",
                            Tooltip = "Delete file",
                            Click   = "sunfish.deleteFile(this)"
                        }:null
                    }
                });;
            }
            Dictionary <string, object> data = new Dictionary <string, object>();

            data["Breadcrumb"] = GetBreadcrumb(path);
            data["Actions"]    = new WebUILink[] {
                readOnly?null : new WebUILink()
                {
                    Icon    = "create_new_folder",
                    Tooltip = "New folder",
                    Click   = "sunfish.newFolder(this)",
                },
                readOnly?null : new WebUILink()
                {
                    Icon    = "note_add",
                    Tooltip = "New file",
                    Click   = "sunfish.newFile(this)",
                },
                readOnly?null : new WebUILink()
                {
                    Icon    = "upload",
                    Tooltip = "Upload. Drop files or fonders here",
                    Click   = "sunfish.uploadFile(this)",
                    //Style="upload-drop",
                }
            };
            data["Items"]   = items;
            data["Include"] = "<script src=\"/$sunfish/sunfish-directory.js\"></script>";
            WebUI.WriteTemplate("directory-index", call, data);
        }
Ejemplo n.º 26
0
 /// <summary>
 /// 获取相关文件长度的字符表示形式 从Byte到M
 /// </summary>
 public static string Size(object objT)
 {
     return(WebUI.GetSize(objT));
 }
Ejemplo n.º 27
0
        public static void CommonVariable(ref string Tvalue, ref string Target, ref string sType)
        {
            string Key, Value;

            //1.Tvalue
            if (Tvalue.Contains("@生成") || Tvalue.Contains("@释放"))
            {
                Key   = Tvalue.Split('-')[0];
                Value = Tvalue.Split('-')[1];
                switch (Key)
                {
                case "@生成":
                    switch (Value)
                    {
                    case "姓名":
                        Tvalue = Tvalue.CreateCnName();
                        break;

                    case "邮箱":
                        Tvalue = Tvalue.CreateEmail();
                        break;

                    case "手机号":
                        Tvalue = Tvalue.CreatePhoneNumber();
                        break;

                    case "身份证号":
                        Tvalue = Tvalue.CreateID();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(string.Format("✘:Tvalue生成变量集合命令中不存在:{0}", Value));
                    }
                    break;

                case "@释放":
                    switch (Value)
                    {
                    case "姓名":
                        Tvalue = DataList.Get("姓名");
                        break;

                    case "邮箱":
                        Tvalue = DataList.Get("邮箱");
                        break;

                    case "手机号":
                        Tvalue = DataList.Get("手机号");
                        break;

                    case "身份证号":
                        Tvalue = DataList.Get("身份证号");
                        break;

                    default:
                        try {
                            Tvalue = DataList.Get(Tvalue);
                        }
                        catch {
                            throw new Exception(string.Format("✘:Tvalue释放变量集合中不存在:{0}", Value));
                        }
                        break;
                    }
                    break;

                default:
                    throw new ArgumentOutOfRangeException(string.Format("✘:Tvalue命令集合中不存在:{0}", Key));
                }
            }
            //2.Target
            if (!string.IsNullOrEmpty(Target) && (Target.Contains("@释放") || Target.Contains("@索引")))
            {
                var Save = new List <string>(Target.Split('|')).FindAll(x => x.Contains("@"));
                foreach (string item in Save)
                {
                    Key   = item.Split('-')[0];
                    Value = item.Split('-')[1];
                    switch (Key)
                    {
                    case "@释放":
                        switch (Value)
                        {
                        case "姓名":
                            Tvalue = DataList.Get("姓名");
                            break;

                        case "邮箱":
                            Tvalue = DataList.Get("邮箱");
                            break;

                        case "手机号":
                            Tvalue = DataList.Get("手机号");
                            break;

                        case "身份证号":
                            Tvalue = DataList.Get("身份证号");
                            break;

                        default:
                            try
                            {
                                Target = DataList.Get(Tvalue);
                            }
                            catch
                            {
                                throw new Exception(string.Format("✘:Target释放变量集合中不存在:{0}", Value));
                            }
                            break;
                        }
                        break;

                    case "@索引":
                        JSupport.Index = Value;
                        Target         = Target.Remove(Target.IndexOf('|'));
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(string.Format("✘:Target命令集合中不存在:{0}", Key));
                    }
                }
            }
            //3.sType
            if (!string.IsNullOrEmpty(sType) && sType.Contains("@保存") || sType.Contains("@切入") || sType.Contains("@Debug"))
            {
                var Save = new List <string>(sType.Split('|')).FindAll(x => x.Contains("@保存") || x.Contains("@切入") || x.Contains("@Debug"));
                foreach (string item in Save)
                {
                    Key   = item.Split('-')[0];
                    Value = item.Split('-')[1];
                    switch (Key)
                    {
                    case "@保存":
                        switch (Value)
                        {
                        case "姓名":
                            DataList.Set("姓名", Tvalue);
                            break;

                        case "邮箱":
                            DataList.Set("邮箱", Tvalue);
                            break;

                        case "手机号":
                            DataList.Set("手机号", Tvalue);
                            break;

                        case "身份证号":
                            DataList.Set("身份证号", Tvalue);
                            break;

                        default:
                            DataList.Set(Value, Tvalue);
                            break;
                        }
                        break;

                    case "@切入":
                        JSupport.SwitchIFrame(SXDXWeb.driver, Value);
                        break;

                    case "@Debug":
                        WebUI.WebUIDebug(Tvalue, Target);
                        break;

                    default:
                        throw new ArgumentOutOfRangeException(string.Format("✘:sType命令集合中不存在:{0}", Key));
                    }
                }
            }
        }