public void Apply(Window window) { using (RegistryKey runKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true)) { if (this.RunAtLogin) { string commandLine = TextUtility.EnsureQuotes(ApplicationInfo.ExecutableFile); if (this.AutoStartMinimized) { commandLine += " /Minimize"; } runKey.SetValue(nameof(WirePeep), commandLine); } else { runKey.DeleteValue(nameof(WirePeep), false); } } if (window != null) { window.Topmost = this.AlwaysOnTop; } }
public static string GetForgetPwdNumber() { StringBuffer stringBuffer = new StringBuffer() + TextUtility.GetDateTimeLongString(); stringBuffer += TextUtility.CreateRandom(8, 1, 0, 0, 0, ""); return(stringBuffer.ToString()); }
public static void VerifyRefactoring( string sourceTemplate, string fixableCode, string fixedCode, CodeRefactoringProvider refactoringProvider, string equivalenceKey = null, bool allowNewCompilerDiagnostics = false) { (string source, string newSource, TextSpan span) = TextUtility.GetMarkedSpan(sourceTemplate, fixableCode, fixedCode); (string source2, List <TextSpan> spans) = TextUtility.GetMarkedSpans(source); if (spans != null) { source = source2; span = spans[0]; } CodeRefactoringVerifier.VerifyRefactoring( source: source, newSource: newSource, span: span, refactoringProvider: refactoringProvider, language: LanguageNames.CSharp, equivalenceKey: equivalenceKey, allowNewCompilerDiagnostics: allowNewCompilerDiagnostics); }
public string Logon(string userName, string userPass) { string msg = ""; if (TextUtility.EmptyTrimOrNull(userName) || TextUtility.EmptyTrimOrNull(userPass)) { msg = "죄송합니다.입력하신 아이디 또는 비밀번호가 잘못되였습니다."; return("{success:'error',msg:'" + msg + "'}"); } Message umsg = aideNewTroyFacade.Logon(userName, userPass); if (umsg.Success) { ezt_members ui = umsg.EntityList[0] as ezt_members; ui.Passwd = Utility.troymd5(userPass, 32); //SetUserCookie Fetch.SetUserCookie(ui.ToUserTicketInfo()); msg = "{success:'success',account:'" + ui.Id + "',NickName:'" + ui.Nickname + "',Pid:'" + ui.Pid + "'}"; } else { msg = "{success:'error',msg:'" + umsg.Content + "'}"; } return(msg); }
/// <summary> /// 创建目录 /// </summary> private void CreateFolder() { string folderName = GameRequest.GetFormString("txtFolderName"); string serverPath = TextUtility.GetRealPath(m_folderPath); if (TextUtility.EmptyTrimOrNull(folderName)) { m_value = "目录名不能为空"; return; } DirectoryInfo dir = new DirectoryInfo(serverPath + "\\" + folderName); if (dir.Exists) { m_value = "目录名已存在"; } else { try { dir.Create(); m_value = "创建目录成功, 目录名称为: " + folderName; } catch { m_value = "创建目录失败, 权限不足"; } } }
/// <summary> /// 发送成功 발송성공! /// 发送失败 발송실패! /// 内容不能为空 내용을 비워 둘수 없습니다! /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnsure_Click(object sender, EventArgs e) { if (TextUtility.EmptyTrimOrNull(txtContent.Text.Trim())) { Show(" 내용을 비워 둘수 없습니다!"); this.txtContent.Text = ""; return; } else { Mail model = new Mail(); ezt_members member = aideNewTroyFacade.GetMembersByUserid(Fetch.GetUserCookie().Pid); model.S_Account = member.Id; model.S_NickName = member.Nickname; model.SendDate = DateTime.Now; model.M_Content = txtContent.Text.Trim(); model.Status = 0; model.Type = 1; Message umsg = aideNewTroyFacade.GiveMailToBack(model); if (umsg.Success) { Response.Write("<script language='javascript'>alert('발송성공!');window.location.href='AddMail.aspx';</script>"); } else { Response.Write("<script language='javascript'>alert(' 발송실패!');window.location.href='AddMail.aspx';</script>"); } } }
public KeyValuePair <string, double>[] Search(string query) { var terms = TextUtility.BuildTerms(query) .GroupBy(x => x) .ToDictionary(x => x.Key, x => x.Count()); var result = new Dictionary <string, double>(); foreach (var(term, termInQueryCount) in terms) { if (!_stats.TermAtPagesCount.ContainsKey(term)) { continue; } foreach (var(page, termInPageCount) in _stats.TermOnPageCount[term]) { if (!result.ContainsKey(page)) { result[page] = 0; } var k = _k1 * (1 - _b + _b * (_stats.PagesWordCount[page] / _stats.AveragePageWordCount)); result[page] += Idf(term) * ((_k1 + 1) * termInPageCount) / (k + termInPageCount) * ((_k2 + 1) * termInQueryCount) / (_k2 + termInQueryCount); } } return(result .OrderByDescending(x => x.Value) .Take(10) .ToArray()); }
public ActionResult Export(int id) { if (id == 0) { throw new ArgumentOutOfRangeException("id"); } var page = dataContext.WebPages.Find(id); if (page == null) { return(HttpNotFound()); } var stream = new MemoryStream(); var writer = new StreamWriter(stream); try { ///TODO: Export page data to xml // writer.Write(page.ToXml(Server.MapPath(DESCRIPTOR_PATH))); } catch { return(Content("Could not export the page data.Mybe the xml document no correct.")); } writer.Flush(); stream.Position = 0; return(File(stream, "text/xml", TextUtility.Slug(page.Title) + "-" + DateTime.Now.ToString("yy-MM-dd") + ".xml")); }
//クリア時の処理 void ClearState() { if (TextBackGround.activeInHierarchy) { return; } //プレイヤーを止める Player.GetComponent <Rigidbody2D>().velocity = new Vector2(0, 0); //リザルト表示 TextBackGround.SetActive(true); SC.ResultSE(); string result_text; if (ConfigPara.language != ConfigPara.Language.Japanese) { result_text = "Clear!\n" + "Score " + (int)(Variable.count * jewel_rate + Variable.time * time_rate); } else { result_text = "クリア!\n" + "スコア " + (int)(Variable.count * jewel_rate + Variable.time * time_rate); if ((int)(Variable.count * jewel_rate + Variable.time * time_rate) > Variable.Score) { Variable.Score = (int)(Variable.count * jewel_rate + Variable.time * time_rate); SL.Save(); } } TextUtility.SetText(TextUtility.TextName.win, result_text); //ボタン表示 RightButton.SetActive(true); LeftButton.SetActive(true); }
/// <summary> /// 用于处理密码不够或密码过长的处理 /// </summary> /// <param name="encryptKey">原密码密钥</param> /// <param name="length">密码要求长度</param> /// <returns>返回实际密码</returns> public static string GetPassword(string encryptKey, int length) { encryptKey = TextUtility.CutLeft(encryptKey, length); encryptKey = encryptKey.PadRight(length, ' '); return(encryptKey.Substring(0, length)); }
public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { SyntaxNode root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); VariableDeclaratorSyntax declarator = root .FindNode(context.Span, getInnermostNodeForTie: true)? .FirstAncestorOrSelf <VariableDeclaratorSyntax>(); if (declarator == null) { return; } if (context.Document.SupportsSemanticModel) { SemanticModel semanticModel = await context.Document.GetSemanticModelAsync(context.CancellationToken).ConfigureAwait(false); ISymbol symbol = semanticModel.GetDeclaredSymbol(declarator, context.CancellationToken); string newName = TextUtility.ToCamelCaseWithUnderscore(declarator.Identifier.ValueText); CodeAction codeAction = CodeAction.Create( $"Rename field to '{newName}'", cancellationToken => SymbolRenamer.RenameAsync(context.Document, symbol, newName, cancellationToken), DiagnosticIdentifiers.RenamePrivateFieldAccordingToCamelCaseWithUnderscore); context.RegisterCodeFix(codeAction, context.Diagnostics); } }
/// <summary> /// 获取查询参数 /// </summary> /// <returns></returns> Hashtable GetParm() { Hashtable _parameterCache = new Hashtable(); #region 分点 if (dropDictLab.SelectedValue != "-1") { _parameterCache.Add("dropDictLab", dropDictLab.SelectedValue); } else { _parameterCache.Add("dropDictLab", Userinfo.joinLabidstr); } #endregion _parameterCache.Add("DropSure", dropStatus.SelectedValue == "-1" ? null : dropStatus.SelectedValue); _parameterCache.Add("StartDate", ((DateTime)dpFrom.SelectedDate).ToString("yyyy-MM-dd")); _parameterCache.Add("EndDate", ((DateTime)dpTo.SelectedDate).AddDays(1).ToString("yyyy-MM-dd")); if (tbStrKey.Text.Trim().Length > 0) { _parameterCache.Add("tbStrKey", TextUtility.ReplaceText(tbStrKey.Text)); } else { _parameterCache.Add("tbStrKey", null); } return(_parameterCache); }
private void CreateFolder() { string formString = GameRequest.GetFormString("txtFolderName"); string realPath = TextUtility.GetRealPath(m_folderPath); if (TextUtility.EmptyTrimOrNull(formString)) { m_value = "目录名不能为空"; } else { DirectoryInfo directoryInfo = new DirectoryInfo(realPath + "\\" + formString); if (!directoryInfo.Exists) { try { directoryInfo.Create(); m_value = "创建目录成功, 目录名称为: " + formString; } catch { m_value = "创建目录失败, 权限不足"; } } else { m_value = "目录名已存在"; } } }
private void SetInitiative() { var sheet = characterSheetController.Character; int initiativeModificator = CharacterValuesUtility.GetCharacteristicModificator(sheet[CharacteristicType.Dexterity]); characterHolder.initiativeValueText.text = TextUtility.GetSignedValueString(initiativeModificator); }
/// <summary> /// 查询结果绑定 /// </summary> private void BindData() { Hashtable ht = new Hashtable(); if (string.IsNullOrWhiteSpace(datebegin.Text) || string.IsNullOrWhiteSpace(dateend.Text)) { MessageBoxShow("请输入开始时间及结束时间查询!", MessageBoxIcon.Information); return; } PageUtil pageUtil = new PageUtil(GridOrders.PageIndex, GridOrders.PageSize); ht["DateStart"] = datebegin.Text; ht["DateEnd"] = Convert.ToDateTime(dateend.Text).AddDays(1).ToString("yyyy-MM-dd"); if (DropDictLab.SelectedValue == "0") { ht["labid"] = Userinfo.joinLabidstr; } else { ht["labid"] = DropDictLab.SelectedValue; } ht["realname"] = tbxName.Text = TextUtility.ReplaceText(tbxName.Text); ht["ordernum"] = tbxOrderNum.Text; ht["status"] = dropStatus.SelectedIndex == 0 ? null : dropStatus.SelectedValue; ht["customerid"] = DropCustomer.SelectedValue == "-1" ? null : DropCustomer.SelectedValue; ht["iscancel"] = DropIScancel.SelectedIndex == 0 ? null : DropIScancel.SelectedValue; ht["pageStart"] = pageUtil.GetPageStartNum(); ht["pageEnd"] = pageUtil.GetPageEndNum(); GridOrders.RecordCount = mamagement.GetSusmanagemenetOrdersCount(ht); GridOrders.DataSource = mamagement.GetSusManagementOrdersList(ht); GridOrders.DataBind(); }
protected void btnExport_Click(object sender, EventArgs e) { try { if (gdDiagnosis.Rows.Count == 0) { MessageBoxShow("导出没有数据!"); return; } Hashtable ht1 = new Hashtable(); ht1.Add("strKey", TextUtility.ReplaceText(ttbSearch.Text.Trim()) == "" ? null : TextUtility.ReplaceText(ttbSearch.Text.Trim())); List <Dictdiagnosis> newslist = diagnosisservice.GetDictdiagnosisLst(ht1); String sheetname = DateTime.Now.ToString("yyyy-MM-dd"); String filename = DateTime.Now.ToString("yyyyMMdd_hhmmss"); SortedList sortlist = new SortedList(new MySort()); sortlist.Add("Diagnosisname", "诊断名称"); ExcelOperation <Dictdiagnosis> .ExportListToExcel(newslist, sortlist, filename, sheetname); } catch (Exception) { MessageBoxShow("导出出错,请联系管理员!"); } }
public string Logon(string userName, string userPass, string code) { string msg = ""; if (TextUtility.EmptyTrimOrNull(userName) || TextUtility.EmptyTrimOrNull(userPass)) { msg = "抱歉!您输入的用户名或密码错误了。"; return("{success:'error',msg:'" + msg + "'}"); } //验证码错误 if (!code.Equals(Fetch.GetVerifyCode( ), StringComparison.InvariantCultureIgnoreCase)) { msg = "抱歉!您输入的验证码错误了。"; return("{success:'error',msg:'" + msg + "'}"); } Message umsg = accountFacade.Logon(userName, userPass); if (umsg.Success) { UserInfo ui = umsg.EntityList[0] as UserInfo; ui.LogonPass = TextEncrypt.EncryptPassword(userPass); Fetch.SetUserCookie(ui.ToUserTicketInfo( )); string mOrder = ui.MemberOrder == 0 ? "普通会员" : ui.MemberOrder == 1 ? "蓝钻会员" : ui.MemberOrder == 2 ? "黄钻会员" : ui.MemberOrder == 3 ? "白钻会员" : "红钻会员"; msg = "{success:'success',account:'" + ui.Accounts + "',gid:'" + ui.GameID + "',loves:'" + ui.LoveLiness + "',morder:'" + mOrder + "',fid:'" + ui.FaceID + "'}"; } else { msg = "{success:'error',msg:'" + umsg.Content + "'}"; } return(msg); }
private void SetCharacteristic(CharacteristicType type, int statValue) { characterHolder.GetCharacteristicInput(type).text = statValue.ToString(); int modificator = CharacterValuesUtility.GetCharacteristicModificator(statValue); characterHolder.GetCharacteristicModificatorText(type).text = TextUtility.GetSignedValueString(modificator); }
/// <summary> /// 获取查询参数 /// </summary> /// <returns></returns> private Hashtable GetParm() { Hashtable _parameterCache = new Hashtable(); #region 分点 if (dropDictLab.SelectedValue != "-1") { _parameterCache.Add("dropDictLab", dropDictLab.SelectedValue); } else { _parameterCache.Add("dropDictLab", null); } #endregion _parameterCache.Add("DropTransed", dropTransed.SelectedValue == "-1" ? null : dropTransed.SelectedValue == "0" ? "0 or TranSed is null" : dropTransed.SelectedValue); _parameterCache.Add("StartDate", ((DateTime)dpFrom.SelectedDate).ToString("yyyy-MM-dd")); _parameterCache.Add("EndDate", ((DateTime)dpTo.SelectedDate).AddDays(1).ToString("yyyy-MM-dd")); _parameterCache.Add("Dictcustomerid", dropDictcustomer.SelectedValue == "-1" ? null : dropDictcustomer.SelectedValue); if (tbStrKey.Text.Trim().Length > 0) { _parameterCache.Add("tbStrKey", TextUtility.ReplaceText(tbStrKey.Text)); } else { _parameterCache.Add("tbStrKey", null); } PageUtil pageutil = new PageUtil(gdUploadPdfToSheQu.PageIndex, gdUploadPdfToSheQu.PageSize); _parameterCache.Add("PageStart", pageutil.GetPageStartNum()); _parameterCache.Add("PageEnd", pageutil.GetPageEndNum()); return(_parameterCache); }
void Init() { if (m_Initialized) { if (m_HostMigrationProperty == null) { // need to re-init. don't return } else { return; } } m_Initialized = true; m_Manager = target as NetworkMigrationManager; m_HostMigrationProperty = serializedObject.FindProperty("m_HostMigration"); m_ShowGUIProperty = serializedObject.FindProperty("m_ShowGUI"); m_OffsetXProperty = serializedObject.FindProperty("m_OffsetX"); m_OffsetYProperty = serializedObject.FindProperty("m_OffsetY"); m_ShowGUILabel = TextUtility.TextContent("Show GUI", "Enable to display the default UI."); m_OffsetXLabel = TextUtility.TextContent("Offset X", "The horizonal offset of the GUI."); m_OffsetYLabel = TextUtility.TextContent("Offset Y", "The vertical offset of the GUI."); m_HostMigrationLabel = TextUtility.TextContent("Use Host Migration", "Enable to use host migration."); }
/// <summary> /// 绑定列表数据 /// </summary> private void BindData() { try { //分页查询条件 PageUtil pageUtil = new PageUtil(gvList.PageIndex, gvList.PageSize); Hashtable ht1 = new Hashtable(); ht1.Add("pageStart", pageUtil.GetPageStartNum()); ht1.Add("pageEnd", pageUtil.GetPageEndNum()); ht1.Add("Dictlabid", dropDictlab.SelectedValue); ht1.Add("IsActive", dropStatus.SelectedValue); ht1.Add("strKey", TextUtility.ReplaceText(txtStrKey.Text.Trim()) == "" ? null : TextUtility.ReplaceText(txtStrKey.Text.Trim())); DataTable dt = null; int count = 0; if (raoType.SelectedValue == "0") { dt = dictCustomerService.GetDictcustomerAuditList(ht1); count = dictCustomerService.GetDictcustomerAuditListCount(ht1); } else { dt = dictCustomerService.GetDictcustomerdiscountedAuditList(ht1); count = dictCustomerService.GetDictcustomerdiscountedAuditListCount(ht1); } gvList.DataSource = dt; gvList.RecordCount = count; gvList.DataBind(); } catch (Exception ex) { MessageBoxShow(ex.Message, MessageBoxIcon.Error); } }
private void RptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) { return; } var contentInfo = new ContentInfo(e.Item.DataItem); var ltlTitle = (Literal)e.Item.FindControl("ltlTitle"); var ltlColumns = (Literal)e.Item.FindControl("ltlColumns"); var ltlStatus = (Literal)e.Item.FindControl("ltlStatus"); var ltlCommands = (Literal)e.Item.FindControl("ltlCommands"); var ltlSelect = (Literal)e.Item.FindControl("ltlSelect"); ltlTitle.Text = WebUtils.GetContentTitle(SiteInfo, contentInfo, PageUrl); ltlColumns.Text = TextUtility.GetColumnsHtml(_nameValueCacheDict, SiteInfo, contentInfo, _attributesOfDisplay, _attributesOfDisplayStyleInfoList); ltlStatus.Text = $@"<a href=""javascript:;"" title=""设置内容状态"" onclick=""{ModalCheckState.GetOpenWindowString(SiteId, contentInfo, PageUrl)}"">{CheckManager.GetCheckState(SiteInfo, contentInfo.IsChecked, contentInfo.CheckedLevel)}</a>"; ltlCommands.Text = TextUtility.GetCommandsHtml(SiteInfo, _pluginLinks, contentInfo, PageUrl, Body.AdminName, _isEdit); ltlSelect.Text = $@"<input type=""checkbox"" name=""contentIdCollection"" value=""{contentInfo.Id}"" />"; }
private static ConstructorDeclarationSyntax CreateConstructor(string identifierText, IEnumerable <MemberDeclarationSyntax> members) { var parameters = new List <ParameterSyntax>(); var statements = new List <ExpressionStatementSyntax>(); foreach (MemberDeclarationSyntax member in members) { string name = GetIdentifier(member).ValueText; string parameterName = NamingHelper.RemoveUnderscoreFromIdentifier(name); parameterName = TextUtility.FirstCharToLower(parameterName); statements.Add(ExpressionStatement( AssignmentExpression( SyntaxKind.SimpleAssignmentExpression, IdentifierName(name), IdentifierName(parameterName)))); parameters.Add(Parameter( default(SyntaxList <AttributeListSyntax>), default(SyntaxTokenList), GetType(member), Identifier(parameterName), null)); } return(ConstructorDeclaration( default(SyntaxList <AttributeListSyntax>), TokenList(Token(SyntaxKind.PublicKeyword)), Identifier(identifierText), ParameterList(SeparatedList(parameters)), null, Block(statements))); }
#pragma warning restore CC0052 // Make field readonly #endregion #region Constructors public CommandLineArgs() { CommandLine cmdLine = new(false); cmdLine.AddSwitch(nameof(this.Build), string.Empty, value => this.build = value); cmdLine.AddSwitch(nameof(this.Exit), string.Empty, value => this.exit = value); cmdLine.AddValueHandler((value, errors) => { this.project = TextUtility.StripQuotes(value); if (File.Exists(this.project)) { // Expand a short file name into a long one since the file name will be displayed in the title bar. this.project = FileUtility.ExpandFileName(this.project); } else { this.project = string.Empty; } }); CommandLineParseResult parseResult = cmdLine.Parse(); // Check for some invalid combinations if (parseResult != CommandLineParseResult.Valid || (string.IsNullOrEmpty(this.project) && (this.build || this.exit)) || (this.exit && !this.build)) { this.showHelp = true; // If the arguments are stunk up, then reset all the data. this.project = string.Empty; this.build = false; this.exit = false; } }
void Init() { if (m_Initialized) { if (m_ShowGUIProperty == null) { // initialize again.. something got broken } else { return; } } m_Initialized = true; m_ManagerHud = target as NetworkManagerHUD; if (m_ManagerHud != null) { m_Manager = m_ManagerHud.manager; } m_ShowGUIProperty = serializedObject.FindProperty("showGUI"); m_OffsetXProperty = serializedObject.FindProperty("offsetX"); m_OffsetYProperty = serializedObject.FindProperty("offsetY"); m_ShowServerLabel = TextUtility.TextContent("Server Info", "Details of internal server state"); m_ShowServerConnectionsLabel = TextUtility.TextContent("Server Connections", "List of local and remote network connections to the server"); m_ShowServerObjectsLabel = TextUtility.TextContent("Server Objects", "Networked objects spawned by the server"); m_ShowClientLabel = TextUtility.TextContent("Client Info", "Details of internal client state"); m_ShowClientObjectsLabel = TextUtility.TextContent("Client Objects", "Networked objects created on the client"); m_ShowMatchMakerLabel = TextUtility.TextContent("MatchMaker Info", "Details about the matchmaker state"); m_ShowControlsLabel = TextUtility.TextContent("Runtime Controls", "Buttons for controlling network state at runtime"); m_ShowRuntimeGuiLabel = TextUtility.TextContent("Show Runtime GUI", "Show the default network control GUI when the game is running"); m_OffsetXLabel = TextUtility.TextContent("GUI Horizontal Offset", "Horizontal offset of runtime GUI"); m_OffsetYLabel = TextUtility.TextContent("GUI Vertical Offset", "Vertical offset of runtime GUI"); }
void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var ltlItemTitle = e.Item.FindControl("ltlItemTitle") as Literal; var ltlColumnItemRows = e.Item.FindControl("ltlColumnItemRows") as Literal; var ltlItemStatus = e.Item.FindControl("ltlItemStatus") as Literal; var ltlItemEditUrl = e.Item.FindControl("ltlItemEditUrl") as Literal; var ltlCommandItemRows = e.Item.FindControl("ltlCommandItemRows") as Literal; var contentInfo = new ContentInfo(e.Item.DataItem); ltlItemTitle.Text = WebUtils.GetContentTitle(PublishmentSystemInfo, contentInfo, PageUrl); var showPopWinString = ModalCheckState.GetOpenWindowString(PublishmentSystemId, contentInfo, PageUrl); ltlItemStatus.Text = $@"<a href=""javascript:;"" title=""设置内容状态"" onclick=""{showPopWinString}"">{LevelManager.GetCheckState( PublishmentSystemInfo, contentInfo.IsChecked, contentInfo.CheckedLevel)}</a>"; if (HasChannelPermissions(contentInfo.NodeId, AppManager.Cms.Permission.Channel.ContentEdit) || Body.AdministratorName == contentInfo.AddUserName) { ltlItemEditUrl.Text = $"<a href=\"{WebUtils.GetContentAddEditUrl(PublishmentSystemId, nodeInfo, contentInfo.Id, PageUrl)}\">编辑</a>"; } ltlColumnItemRows.Text = TextUtility.GetColumnItemRowsHtml(styleInfoList, attributesOfDisplay, valueHashtable, tableStyle, PublishmentSystemInfo, contentInfo); ltlCommandItemRows.Text = TextUtility.GetCommandItemRowsHtml(tableStyle, PublishmentSystemInfo, nodeInfo, contentInfo, PageUrl, Body.AdministratorName); } }
private ITextView TestAutoFormat(int position, string textToType, string initialContent = "") { AstRoot ast; ITextView textView = TextViewTest.MakeTextView(initialContent, position, out ast); textView.TextBuffer.Changed += (object sender, TextContentChangedEventArgs e) => { List <TextChangeEventArgs> textChanges = TextUtility.ConvertToRelative(e); ast.ReflectTextChanges(textChanges); if (e.Changes[0].NewText.Length == 1) { char ch = e.Changes[0].NewText[0]; if (AutoFormat.IsAutoformatTriggerCharacter(ch)) { int offset = 0; if (e.Changes[0].NewText[0].IsLineBreak()) { position = e.Changes[0].OldPosition + 1; textView.Caret.MoveTo(new SnapshotPoint(e.After, position)); offset = -1; } FormatOperations.FormatLine(textView, textView.TextBuffer, offset); } } else { ITextSnapshotLine line = e.After.GetLineFromPosition(position); textView.Caret.MoveTo(new SnapshotPoint(e.After, Math.Min(e.After.Length, line.Length + 1))); } }; Typing.Type(textView.TextBuffer, position, textToType); return(textView); }
public TextEntry(int offset, byte[] data) { Offset = offset; Text = TextUtility.Decode(data); Length = data.Length; Data = data; }
/// <summary> /// 开始打包 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnStart_Click(object sender, EventArgs e) { //if (!Verification()) { LabelLog.Text = "打包渠道SDK所需文件不完整"; return; } string createtaskid = TextUtility.GetDateTimeLongString(); //string[] arr = placeidlist.Split(','); string hx_ad_list = string.Empty; string lbhx_ad_list = string.Empty; string adplatformlist = string.Empty; string adidlist = string.Empty; foreach (Control item in GamePlaceList.Items) { HiddenField hf = (HiddenField)item.FindControl("HiddenFieldPlatformID"); HiddenField hf_val = (HiddenField)item.FindControl("HiddenFieldAdID"); string val = hf.Value; if (val == "1071_0") { hx_ad_list = hf_val.Value; adplatformlist += val + ","; } else if (val == "1071_1") { lbhx_ad_list = hf_val.Value; adplatformlist += val + ","; } } string ad_platform = string.Empty; if (!string.IsNullOrEmpty(hx_ad_list)) { ad_platform += hx_ad_list + "_"; } if (!string.IsNullOrEmpty(lbhx_ad_list)) { ad_platform += lbhx_ad_list + "_"; } if (ad_platform.Length > 0) { ad_platform = ad_platform.Substring(0, ad_platform.Length - 1); } if (adplatformlist.Length > 0) { adplatformlist = adplatformlist.Substring(0, adplatformlist.Length - 1); } SetPackageTask(taskid.ToString(), Context.User.Identity.Name, createtaskid, platform, gameId, gameversion, gamelable, platformversionlist, this.CheckBoxIsEncryption.Checked ? "1" : "0", adplatformlist, ad_platform); //string isencryption=this.CheckBoxIsEncryption.Checked ? "1" : "0"; //Message umsg = aideNativeWebFacade.AddNewPackageTask(taskid, Context.User.Identity.Name, placeidlist, createtaskid, platform, Convert.ToInt32(gameId), gameversion, gamelable, platformversionlist, isencryption); //if (umsg.Success) //{ // Response.Redirect("SelectPackageInfo.aspx?gameid=" + gameId + "&gameName=" + gameName + "&gameDisplayName=" + gameDisplayName + "&platform=" + platform + "&createtaskid=" + createtaskid + "&gameversion=" + gameversion + "&isencryption=" + isencryption); //} //else //{ // this.LabelLog.Text = "打包任务发布失败!"; //} }
public ActionResult UploadOrCreate(string path, string sub = "") { if (!string.IsNullOrEmpty(sub)) { var newPath = new Uri(Request.Url.ToString() + (Request.Url.LocalPath.EndsWith("/") ? "" : "/") + sub); service.CreatePath(newPath); UpdateAttributes(newPath); dynamic dirJson = PathToJson(new WebResourceInfo(newPath)); //return Json(fileJson , JsonRequestBehavior.AllowGet); var ser = new System.Web.Script.Serialization.JavaScriptSerializer(); string jsontext = ser.Serialize(dirJson); return(Content(jsontext, "application/json", System.Text.Encoding.UTF8)); //return Json(PathToJson(new WebResourceInfo(newPath)), JsonRequestBehavior.AllowGet); } else { try { if (Request.Files.Count == 0) { return(new HttpStatusCodeResult((int)HttpStatusCode.NoContent)); } foreach (string key in Request.Files.Keys) { var file = Request.Files[key]; //var fileInfo = new FileInfo(file.FileName); var ext = Path.GetExtension(file.FileName); //if (!_context.RootWeb.IsAllowUpload(ext)) // return new HttpStatusCodeResult((int)HttpStatusCode.UnsupportedMediaType, string.Format(Resources.language.WebFilesController_Unsupported, "\"" + ext + "\"")); //if (file.ContentLength > (_context.RootWeb.MaximumFileSize * 1000000)) // return new HttpStatusCodeResult((int)HttpStatusCode.RequestEntityTooLarge, Resources.language.WebFilesController_Forbidden); var fileName = TextUtility.Slug(Path.GetFileNameWithoutExtension(file.FileName)) + ext; service.SaveFile(FileUtility.ReadStream(file.InputStream), fileName, Request.Url); var requestUrl = Request.Url.ToString(); var fileUri = new Uri(requestUrl + (requestUrl.EndsWith("/") ? "" : "/") + fileName); UpdateAttributes(fileUri); dynamic fileJson = FileToJson(new WebResourceInfo(fileUri)); //return Json(fileJson , JsonRequestBehavior.AllowGet); var ser = new System.Web.Script.Serialization.JavaScriptSerializer(); string jsontext = ser.Serialize(fileJson); return(Content(jsontext, "application/json", System.Text.Encoding.UTF8)); } } catch (Exception e) { HttpContext.Response.StatusCode = 500; return(Content("Method Failure - " + e.Message)); } } HttpContext.Response.StatusCode = 201; return(Content("OK")); }