private string GetDirectoryHelper(string logicalDirectoryName) { using (var pin = new PinBlittable(logicalDirectoryName)) { return(StringResult.FromNative(nativeNodeContext.GetDirectory(pin.AddrOfPinnedObject()))); } }
private TooltipContent DrawItem(GameTime gameTime, RenderEnv env, UIWorldMap.Tooltip item) { var blocks = new List <TextBlock>(); Vector2 size = Vector2.Zero; Vector2 current = Vector2.Zero; StringResult sr = null; if (item.MapID != null) { this.StringLinker?.StringMap.TryGetValue(item.MapID.Value, out sr); string title = sr != null?string.Format("{0} : {1}", sr["streetName"], sr["mapName"]) : item.MapID.ToString(); string desc = sr?["mapDesc"]; var titleFont = string.IsNullOrEmpty(desc) ? env.Fonts.TooltipContentFont : env.Fonts.TooltipTitleFont; blocks.Add(PrepareTextLine(titleFont, title, ref current, Color.White, ref size.X)); if (!string.IsNullOrEmpty(desc)) { blocks.AddRange(PrepareFormatText(env.Fonts.TooltipContentFont, desc, ref current, 280, ref size.X)); } } size.Y = current.Y; return(new TooltipContent() { blocks = blocks, size = size }); }
public PatientData() { PatientAge = new Result("Age", "years"); GestationalAge = new Result("Gestational Age", "weeks"); FemurLength = new Result("Femur Length", "mm"); PatientName = new StringResult("Patient Name"); PatientID = new StringResult("Patient ID"); PatientDOB = new DateResult("DOB"); StudyDate = new DateResult("Study Date"); EstimatedDueDate = new DateResult("Estimated Due Date"); ReasonForStudy = new StringResult("Reason For Study"); ReferringPhysician = new StringResult("Referring Physician"); EchoType = new MultipleChoiceResult("Echo Type", new List <string>() { "Fetal Echo" }); ReportingDoctor = new MultipleChoiceResult("Reporting Doctor", new List <string>() { "Dr Paul Brooks" }); UpdateGestationalAgeResult(); }
private string RegisterServiceHelper(Guid partitionId, long replicaId, IUpgradeOrchestrationService service) { var broker = new UpgradeOrchestrationServiceBroker(service); NativeCommon.IFabricStringResult nativeString = this.nativeAgent.RegisterUpgradeOrchestrationService(partitionId, replicaId, broker); return(StringResult.FromNative(nativeString)); }
public StringFieldControl(StringResult result) { InitializeComponent(); Result = result; ResultTitleLabel.Text = result.Name; ResultValueTextBox.Text = result.Value; }
private static string GetVersionInfoHelper(string path) { using (var pin = new PinCollection()) { return(StringResult.FromNative(NativeCommon.FabricFileGetVersionInfo(pin.AddBlittable(path)))); } }
public StringResult POST_Json(Uri requestUri, string json) { #if DEBUG if (string.IsNullOrEmpty(json)) { throw new ArgumentException(nameof(json)); } #endif var data = _utf8.GetBytes(json); var request = CreateRequest(requestUri); request.Method = "POST"; request.ContentType = "application/json"; request.ContentLength = data.Length; var result = new StringResult(requestUri); if (SetRequestData(result, request, data)) { var response = GetHttpWebResponse(result, request); SetStringResult(result, response); } return(result); }
internal void callDidStringReceive(StringResult stringResult) { if (this.didStringReceive != null) { this.didStringReceive(stringResult); } }
public StringResult POST_Form(Uri requestUri, Dictionary <string, string> postParameters) { #if DEBUG if (postParameters == null || postParameters.Count == 0) { throw new ArgumentException(nameof(postParameters)); } #endif var postData = GetParametersString(postParameters); var data = Encoding.ASCII.GetBytes(postData); var request = CreateRequest(requestUri); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = data.Length; var result = new StringResult(requestUri); if (SetRequestData(result, request, data)) { var response = GetHttpWebResponse(result, request); SetStringResult(result, response); } return(result); }
public static string GetSkillSummary(Skill skill, int level, StringResult sr, SummaryParams param, SkillSummaryOptions options = default) { if (skill == null || sr == null) { return(null); } string h = null; if (skill.PreBBSkill) //用level声明的技能 { string hs; if (skill.Level == level && skill.Common.TryGetValue("hs", out hs)) { h = sr[hs]; } else if (sr.SkillH.Count >= level) { h = sr.SkillH[level - 1]; } } else { if (sr.SkillH.Count > 0) { h = sr.SkillH[0]; } } return(GetSkillSummary(h, level, skill.Common, param, options)); }
private static string GetFullPathHelper(string path) { using (var pin = new PinCollection()) { return(StringResult.FromNative(NativeCommon.FabricGetFullPath(pin.AddBlittable(path)))); } }
public static string GetSkillSummary(Skill skill, StringResult sr, SummaryParams param) { if (skill == null) { return(null); } return(GetSkillSummary(skill, skill.Level, sr, param)); }
public static void free_string_result(StringResult p0) { storj_uplinkPINVOKE.free_string_result(StringResult.getCPtr(p0)); if (storj_uplinkPINVOKE.SWIGPendingException.Pending) { throw storj_uplinkPINVOKE.SWIGPendingException.Retrieve(); } }
private string GetSettingsFileHelper(string configPackageFolder) { using (var pin = new PinBlittable(configPackageFolder)) { return(StringResult.FromNative( this.nativeStoreLayout.GetSettingsFile(pin.AddrOfPinnedObject()))); } }
private string GetServiceManifestChecksumFileHelper(string serviceManifestName) { using (var pin = new PinBlittable(serviceManifestName)) { return(StringResult.FromNative( this.nativeBuildLayout.GetServiceManifestChecksumFile(pin.AddrOfPinnedObject()))); } }
private SecureString DecryptValueHelper(string encryptedValue) { using (var pin = new PinCollection()) { return(StringResult.FromNativeToSecureString(NativeCommon.FabricDecryptText( pin.AddBlittable(encryptedValue), NativeTypes.FABRIC_X509_STORE_LOCATION.FABRIC_X509_STORE_LOCATION_LOCALMACHINE))); } }
public void ProcessResult_WhenCreated_ContentTypeIsTextHtml() { var response = new FakeResponseContext(); var result = new StringResult("test data"); result.ProcessResult(null, response); Assert.That(response.ContentType, Is.EqualTo("text/html")); }
private TooltipContent DrawItem(GameTime gameTime, RenderEnv env, LifeItem item) { var blocks = new List <TextBlock>(); Vector2 size = Vector2.Zero; blocks = new List <TextBlock>(); StringResult sr = null; Vector2 current = Vector2.Zero; switch (item.Type) { case LifeItem.LifeType.Mob: { this.StringLinker?.StringMob.TryGetValue(item.ID, out sr); blocks.Add(PrepareTextBlock(env.Fonts.TooltipTitleFont, sr == null ? "(null)" : sr.Name, ref current, Color.LightYellow)); current += new Vector2(4, 4); blocks.Add(PrepareTextBlock(env.Fonts.TooltipContentFont, "id:" + item.ID.ToString("d7"), ref current, Color.White)); size.X = Math.Max(size.X, current.X); current = new Vector2(0, current.Y + 16); Vector2 size2; var blocks2 = TooltipHelper.Prepare(item.LifeInfo, env.Fonts, out size2); for (int i = 0; i < blocks2.Length; i++) { blocks2[i].Position.Y += current.Y; blocks.Add(blocks2[i]); } size.X = Math.Max(size.X, size2.X); size.Y = current.Y + size2.Y; } break; case LifeItem.LifeType.Npc: { this.StringLinker?.StringNpc.TryGetValue(item.ID, out sr); blocks.Add(PrepareTextBlock(env.Fonts.TooltipTitleFont, sr == null ? "(null)" : sr.Name, ref current, Color.LightYellow)); current += new Vector2(4, 4); blocks.Add(PrepareTextBlock(env.Fonts.TooltipContentFont, "id:" + item.ID.ToString("d7"), ref current, Color.White)); size.X = Math.Max(size.X, current.X); current = new Vector2(0, current.Y + 16); var aniName = (item.View?.Animator as StateMachineAnimator)?.GetCurrent(); if (aniName != null) { blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "action: " + aniName, ref current, Color.White, ref size.X)); } size.Y = current.Y; } break; } return(new TooltipContent() { blocks = blocks, size = size }); }
public void ProcessResult_WhenCreatedWithNewString_ReturnsString() { var response = new FakeResponseContext(); var result = new StringResult("test data"); result.ProcessResult(null, response); Assert.That(response.Response, Is.EqualTo("test data")); }
private static SecureString DecryptTextHelper(string encryptedValue, StoreLocation storeLocation) { using (var pin = new PinCollection()) { return(StringResult.FromNativeToSecureString(NativeCommon.FabricDecryptText( pin.AddBlittable(encryptedValue), (NativeTypes.FABRIC_X509_STORE_LOCATION)storeLocation))); } }
public T Response <T>(SmartRoute.WebApi4Grid.Result result) { if (!mOutPutErrorStackTrace) { result.ErrorStackTrace = null; } object apiresult = new StringResult(Newtonsoft.Json.JsonConvert.SerializeObject(result)); return((T)apiresult); }
private string GetConfigurationDeploymentFolderHelper(string nodeName, string configVersion) { using (var pin = new PinCollection()) { var result = this.nativeFabricDeployment.GetConfigurationDeploymentFolder( pin.AddBlittable(nodeName), pin.AddBlittable(configVersion)); return(StringResult.FromNative(result)); } }
private string GetCurrentFabricPackageFileHelper(string nodeName) { using (var pin = new PinCollection()) { var result = this.nativeFabricDeployment.GetCurrentFabricPackageFile( pin.AddBlittable(nodeName)); return(StringResult.FromNative(result)); } }
private string GetCabPatchFileHelper(string version) { using (var pin = new PinCollection()) { var result = this.nativeWinFabStoreLayout.GetCabPatchFile( pin.AddBlittable(version)); return(StringResult.FromNative(result)); } }
/// <summary> /// Displays text messages: original, unencoded and withEncoding /// </summary> /// <param name="original">Original message</param> /// <param name="resultWithoutEncoding">Text result when no encoding was used together with error information</param> /// <param name="resultWithEncoding">Text result when encoding was used together with error information</param> private void DisplayTextResult(string original, StringResult resultWithoutEncoding, StringResult resultWithEncoding) { encodingResultPanel.Controls.Clear(); encodingResultPanel.Controls.Add(UIHelper.CreateLabelWithText("Initial Text: " + original)); encodingResultPanel.Controls.Add(UIHelper.CreateLabelWithText("Unencoded Text: " + resultWithoutEncoding.Result)); encodingResultPanel.Controls.Add(UIHelper.CreateLabelWithText("Encoded Text: " + resultWithEncoding.Result)); DisplayErrors(resultWithoutEncoding.Errors, resultWithEncoding.Errors); }
private string GetVersionedClusterManifestFileHelper(string nodeName, string version) { using (var pin = new PinCollection()) { var result = this.nativeFabricDeployment.GetVersionedClusterManifestFile( pin.AddBlittable(nodeName), pin.AddBlittable(version)); return(StringResult.FromNative(result)); } }
private string GetSubPackageArchiveFileHelper( string packageFolder) { using (var pin = new PinCollection()) { var result = this.nativeStoreLayout.GetSubPackageArchiveFile( pin.AddBlittable(packageFolder)); return(StringResult.FromNative(result)); } }
protected string DecryptText(string text, StoreLocation storeLocation) { using (var pin = new PinCollection()) { // Calling native API directly because we need to return string instead of SecureString for this cmdlet, // and we do not want to have a public managed API that returns string instead of SecureString. return(StringResult.FromNative(NativeCommon.FabricDecryptText( pin.AddBlittable(text), (NativeTypes.FABRIC_X509_STORE_LOCATION)storeLocation))); } }
private string RegisterTokenValidationServiceHelper(Guid partitionId, long replicaId, ITokenValidationService service) { TokenValidationServiceBroker broker = new TokenValidationServiceBroker(service); NativeCommon.IFabricStringResult nativeString = this.nativeAgent.RegisterTokenValidationService( partitionId, replicaId, broker); return(StringResult.FromNative(nativeString)); }
private string GetInstallerLogFileHelper(string nodeName, string codeVersion) { using (var pin = new PinCollection()) { var result = this.nativeFabricDeployment.GetInstallerLogFile( pin.AddBlittable(nodeName), pin.AddBlittable(codeVersion)); return(StringResult.FromNative(result)); } }
private string RegisterGatewayResourceManagerHelper(Guid partitionId, long replicaId, IGatewayResourceManager service) { GatewayResourceManagerBroker broker = new GatewayResourceManagerBroker(service); NativeCommon.IFabricStringResult nativeString = this.nativeAgent.RegisterGatewayResourceManager( partitionId, replicaId, broker); return(StringResult.FromNative(nativeString)); }
private string GetInstalledBinaryFolderHelper(string installationFolder, string service) { using (var pin = new PinCollection()) { var result = this.nativeFabricDeployment.GetInstalledBinaryFolder( pin.AddBlittable(installationFolder), pin.AddBlittable(service)); return(StringResult.FromNative(result)); } }
//將變數套用至信件版面 public string getMailBody(string EmailView, object md) { ViewResult resultView = View(EmailView, md); StringResult sr = new StringResult(); sr.ViewName = resultView.ViewName; sr.MasterName = resultView.MasterName; sr.ViewData = resultView.ViewData; sr.TempData = resultView.TempData; sr.ExecuteResult(this.ControllerContext); return sr.ToHtmlString; }
public void Execute_should_write_on_response_output_stream() { var http = new Mock<HttpContextBase>(); var response = new Mock<HttpResponseBase>(); var context = new ActionResultContext("test", "testcontroller", "action", http.Object); var result = new StringResult("value"); http.SetupGet(ctx => ctx.Response).Returns(response.Object); response.Setup(rp => rp.Write("value")); result.Execute(context, new ControllerContext(), null); }
public void SetUp() { _stringResult = new StringResult(); }
public String ajax_Login(String account, String password, String img_vildate) { JavaScriptSerializer js = new JavaScriptSerializer() { MaxJsonLength = 65536 }; //64K LoginResult getLoginResult = new LoginResult(); a_Users ac = new a_Users() { Connection = getSQLConnection(), logPlamInfo = new Log.LogPlamInfo() { UserId = 0, IP = System.Web.HttpContext.Current.Request.UserHostAddress, BroswerInfo = System.Web.HttpContext.Current.Request.Browser.Browser + "." + System.Web.HttpContext.Current.Request.Browser.Version } }; try { getLoginResult.vildate = Session["CheckCode"].ToString() != img_vildate ? false : true; #if DEBUG getLoginResult.vildate = true; #endif if (!getLoginResult.vildate) throw new Exception(Resources.Res.Log_Err_ImgValideNotEquel); LoginSate CheckLoginState = ac.SystemLogin(account, password); if (CheckLoginState.Result) { getLoginResult.result = true; getLoginResult.url = Url.Content(CommWebSetup.ManageDefCTR); Session.Timeout = 720; Session["Id"] = CheckLoginState.Id; Session["UnitId"] = CheckLoginState.Unit; ViewData["WebAppPath"] = System.Web.HttpContext.Current.Request.ApplicationPath == "/" ? System.Web.HttpContext.Current.Request.ApplicationPath : System.Web.HttpContext.Current.Request.ApplicationPath + "/"; ViewData["user"] = CheckLoginState.Acccount; //登錄記錄 a__UserLoginLog ac_UserLoginLog = new a__UserLoginLog() { Connection = getSQLConnection(), logPlamInfo = new Log.LogPlamInfo() { UserId = 0, IP = System.Web.HttpContext.Current.Request.UserHostAddress, BroswerInfo = System.Web.HttpContext.Current.Request.Browser.Browser + "." + System.Web.HttpContext.Current.Request.Browser.Version } }; var r1 = ac_UserLoginLog.SearchMaster(new q__UserLoginLog() { s_account = CheckLoginState.Acccount,MaxRecord=1,sord="desc",sidx="logintime"}, CheckLoginState.Id).SearchData; if (r1.Count() > 0) { ViewData["lastlogin"] = r1.FirstOrDefault().logintime; } else { ViewData["lastlogin"] = DateTime.Now; } m__UserLoginLog md = new m__UserLoginLog() { ip = System.Web.HttpContext.Current.Request.UserHostAddress , account = CheckLoginState.Acccount, logintime = DateTime.Now, browers = System.Web.HttpContext.Current.Request.Headers.ToString() }; var r3 = ac_UserLoginLog.InsertMaster(md, CheckLoginState.Id); //語系使用 HttpCookie WebLang = Request.Cookies[CommWebSetup.WebCookiesId + ".Lang"]; a__Lang ac_Lang = new a__Lang() { Connection = getSQLConnection(), logPlamInfo = new Log.LogPlamInfo() { UserId = CheckLoginState.Id, IP = System.Web.HttpContext.Current.Request.UserHostAddress, BroswerInfo = System.Web.HttpContext.Current.Request.Browser.Browser + "." + System.Web.HttpContext.Current.Request.Browser.Version } }; var r2 = ac_Lang.SearchMaster(new q__Lang() { s_lang = WebLang.Value }, CheckLoginState.Id).SearchData.FirstOrDefault(); ViewData["lang"] = r2.area; ViewResult resultView = View("Manage/vucMenu"); StringResult sr = new StringResult(); sr.ViewName = resultView.ViewName; sr.MasterName = resultView.MasterName; sr.ViewData = resultView.ViewData; sr.TempData = resultView.TempData; sr.ExecuteResult(this.ControllerContext); Session["MenuHtmlString"] = sr.ToHtmlString; Log.Write("ajax_Login Login OK!:" + Session["Id"].ToString()); } else { getLoginResult.title = Resources.Res.Log_Err_Title; getLoginResult.result = false; getLoginResult.message = GetRecMessage(CheckLoginState.Message); Log.Write("ajax_Login Login Fail!:" + getLoginResult.message); Session.Remove("Id"); Session.Remove("UnitId"); Session.Remove("MenuHtmlString"); } } catch (Exception ex) { getLoginResult.title = Resources.Res.Log_Err_Title; getLoginResult.result = false; getLoginResult.message = ex.Message; } return JsonConvert.SerializeObject(getLoginResult, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore }); }