// 型情報作成 private void CreateValueData() { // 初期化 _valueData = new ValueData(); // 文字列なら if (typeof(T) == typeof(string)) { // 情報登録 _valueData.ID = ValueID.STRING; _valueData.Name = "string"; return; } // 整数なら if (typeof(T) == typeof(int)) { // 情報登録 _valueData.ID = ValueID.INT; _valueData.Name = "int"; return; } // 実数なら if (typeof(T) == typeof(float)) { // 登録 _valueData.ID = ValueID.FLOAT; _valueData.Name = "float"; return; } }
public void LoadValues() { ValueData valdata = SaveScript.Load(); this.val = valdata.val; print("Current Load Value " + val["Authority"]); }
/// <summary> /// creates new instance of AbstratData derived class from <c>inStream</c> /// inStream position should be in the beginning of data of pointer to data /// </summary> /// <param name="type">type to read</param> /// <param name="inStream">strem to read from</param> /// <param name="options">null or list of params required to read dat aof type <c>type</c></param> /// <returns></returns> public static AbstractData CreateData(BaseDataType type, BinaryReader inStream, Dictionary <string, object> options) { // check if list type var listDataType = type as ListDataType; if (listDataType != null) // list type data { return(new ListData(listDataType, inStream, options)); } // check if pointer type var pointerDataType = type as PointerDataType; if (pointerDataType != null) // pointer type data { return(new PointerData(pointerDataType, inStream, options)); } // value type data AbstractData data; switch (type.Name) { case "bool": data = new ValueData <bool>(type, inStream, options); break; case "byte": data = new ValueData <byte>(type, inStream, options); break; case "short": data = new ValueData <short>(type, inStream, options); break; case "int": data = new Int32Data(type, inStream, options); break; case "uint": data = new ValueData <uint>(type, inStream, options); break; case "long": data = new Int64Data(type, inStream, options); break; case "ulong": data = new ValueData <ulong>(type, inStream, options); break; case "string": data = new StringData(type, inStream, options); break; default: throw new Exception("Unknown value type name: " + type.Name); } return(data); }
/// <summary> /// Read nodes of <see cref="XmlDocument">xmlDoc</see> and if node is an element, it treats its attributes <br /> /// in <see cref="ProcessFullAttributes">ProcessFullAttributes</see> and its children nodes in the <see cref="ProcessFullNode">ProcessFullNode</see><br /> /// converting the content to <see cref="Data">data</see> object type.<br /> /// </summary> /// <param name="xmlDoc">Document to parse</param> /// <param name="data">Data to insert Document content</param> public static void LastTry(XmlDocument xmlDoc, Data data) { var rootData = new ObjectData(); foreach (var rootNodes in xmlDoc) { var firstObject = new ObjectData(); switch (rootNodes) { case XmlDeclaration de: firstObject.Key = "?" + de.Name; var version = new ValueData(); version.Key = "@version"; version.Value = de.Version; var encoding = new ValueData(); encoding.Key = "@encoding"; encoding.Value = de.Encoding; firstObject.Values.Add(version); firstObject.Values.Add(encoding); break; case XmlElement _: firstObject.Key = xmlDoc.DocumentElement.Name; //PROCESS ATTRIBUTES FROM ROOT NODES ProcessFullAttributes(((XmlNode)rootNodes).Attributes, firstObject); ProcessFullNode((XmlNode)rootNodes, firstObject, false, ""); break; } rootData.Objects.Add(firstObject); } rootData.Noun = "TESTE_BOOK"; data.Objects.Add(rootData); }
internal void buildSecondTernaryOperator() { int type; string name = pop(out type); StatementData statement = getCurStatement(); FunctionData newFunc = new FunctionData(); CallData call = new CallData(); ValueData nname = new ValueData(); call.Name = nname; newFunc.Call = call; statement.Functions.Add(newFunc); FunctionData func = getLastFunction(); if (!func.IsValid()) { func.Call.SetParamClass((int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR); func.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_STATEMENT); func.Call.Name.SetId(name); func.Call.Name.SetType(type); func.Call.Name.SetLine(getLastLineNumber()); } }
public void SetValue(MorphingValueType _type, ValueData _value) { switch (_type) { case MorphingValueType.Position: break; case MorphingValueType.localPosition: VirTrans.localPosition = MorphingTool.GetData(VirTrans.localPosition, _value); break; case MorphingValueType.Rotation: break; case MorphingValueType.localRotation: break; case MorphingValueType.localScale: Trans.localScale = MorphingTool.GetData(Trans.localScale, _value); break; case MorphingValueType.color: break; case MorphingValueType.value: MatChange(MorphingTool.GetData(_value)); break; } }
public void UpdateData(UInt64 time, EngineNS.Profiler.PerfViewer.PfValue_Data value) { if (value == null) { return; } EngineNS.CEngine.Instance.EventPoster.RunOn(() => { if (value.ValueDatas.Count != DataValues.Count) { DataValues.Clear(); //foreach (var data in value.ValueDatas) for (int i = 0; i < value.ValueDatas.Count; i++) { var vd = new ValueData(this); vd.ValueName = value.ValueNames[i]; vd.Value = value.ValueDatas[i]; DataValues.Add(vd); } } for (int i = 0; i < DataValues.Count; i++) { DataValues[i].ValueName = value.ValueNames[i]; DataValues[i].Value = value.ValueDatas[i]; if (DataValues[i].ShowInGraphButtonVisible == Visibility.Visible) { DataValues[i].GraphDataSource.AppendAsync(Application.Current.MainWindow.Dispatcher, new Point(time, System.Convert.ToDouble(value.ValueDatas[i]))); } } return(true); }, EngineNS.Thread.Async.EAsyncTarget.Editor); }
public void LevelUp(int amount) { float reverse = amount < 0 ? -1 : 1; data.level += amount; for (int i = 0; i < amount; i++) { data.manaCost += data.levelUp.manaCost * reverse; data.size += data.levelUp.size * reverse; data.coolTime = Mathf.Max(0.3f, data.coolTime + data.levelUp.coolTime * reverse); ; for (int j = 0; j < data.levelUp.values.Length; j++) { ValueData value = GetValue(data.levelUp.values[j].name); if (value != null) { value.value += data.levelUp.values[j].value * reverse; } } for (int j = 0; j < data.levelUp.effects.Length; j++) { EffectData effect = GetEffect(data.levelUp.effects[j].type); if (effect != null) { effect.time += data.levelUp.effects[j].time * reverse; effect.value += data.levelUp.effects[j].value * reverse; } } } }
/// <summary> /// 转换为V3类型的数据 /// </summary> /// <param name="_v3"></param> /// <param name="_valueData"></param> /// <returns></returns> public static Vector3 GetData(Vector3 _v3, ValueData _valueData) { _v3.x = _valueData.data[0]; _v3.y = _valueData.data[1]; _v3.z = _valueData.data[2]; return(_v3); }
public bool UpdateProfileProperty(string login, string key, string value) { try { var valueData = new ValueData { Value = value }; var newdata = new PropertyData[1]; newdata[0] = new PropertyData { Name = key, Values = new ValueData[1] }; newdata[0].Values[0] = valueData; newdata[0].IsValueChanged = true; var memLogin = GetMembershipLogin(login); _userProfileService.ModifyUserPropertyByAccountName(memLogin, newdata); } catch { return(false); } return(true); }
IEnumerator IE_OnceMorphing(ISetValue _fun, int _index, ValueData _org, ValueData _target, float _useTime, EasingEquation _easingType) { var _end = false; var _timer = 0f; var _v = 0f; var _cur = new ValueData(); _cur.data = new float[4]; var _type = (MorphingValueType)_index; while (!_end) { if (_v >= 1) { _end = true; } else { _timer += Time.deltaTime; } _v = Mathf.Clamp01(_timer / _useTime); DataValueMorphing(ref _cur, _org, _target, _easingType, _v); _fun.SetValue(_type, _cur); yield return(null); } }
/// <summary> /// Refreshes the report. /// </summary> private void RefreshReport() { //refresh report data here GraphPane myPane = zedGraphControl1.GraphPane; //clear everything myPane.CurveList.Clear(); myPane.GraphObjList.Clear(); //set the title myPane.Title.Text = reportCmbo.Text; myPane.XAxis.Title.FontSpec = new FontSpec(zedGraphControl1.Font.FontFamily.Name, 08.0f, Color.Black, true, false, false); myPane.XAxis.Title.FontSpec.Border.IsVisible = false; myPane.YAxis.Title.FontSpec = new FontSpec(zedGraphControl1.Font.FontFamily.Name, 08.0f, Color.Black, true, false, false); myPane.YAxis.Title.FontSpec.Border.IsVisible = false; myPane.YAxis.Scale.Min = 0; switch (typeCombo.Text) { case "Calls": { switch (reportCmbo.Text) { case "Call Count": case "Required Workers Count": { myPane.YAxis.Title.Text = "Count"; break; } case "Call Duration": case "Avg Call Duration": { myPane.YAxis.Title.Text = "Duration (mins)"; break; } } //get the report data ValueData data = GetReportData(); //build the date report BuildDateReport(myPane, PeriodStartDate.AddDays(-7), 7, PeriodStartDate.AddDays(7 * Settings.Instance.rotaweekcount).AddDays(7), data.weeks, data.valuesets); break; } } zedGraphControl1.AxisChange(); zedGraphControl1.Invalidate(); UpdateControls(); }
public virtual void SetText(string text) { if (this.lastText == text) { return; } this.lastText = text; this.lastValueData = default; #if UNITY_LOCALIZATION_SUPPORT if (this.avoidLocalizationUnsubscribe == false && this.lastLocalizationKey != null) { this.lastLocalizationKey.StringChanged -= this.OnLocalizationStringChanged; this.lastLocalizationKey = null; } #endif if (this.graphics is UnityEngine.UI.Text textGraphic) { textGraphic.text = text; } #if TEXTMESHPRO_SUPPORT else if (this.graphics is TMPro.TMP_Text textGraphicTmp) { textGraphicTmp.text = text; } #endif }
public void SetValue(MorphingValueType _type, ValueData _value) { switch (_type) { case MorphingValueType.Position: CamTrans.position = MorphingTool.GetData(CamTrans.position, _value); break; case MorphingValueType.localPosition: CamTrans.localPosition = MorphingTool.GetData(CamTrans.localPosition, _value); break; case MorphingValueType.Rotation: CamTrans.rotation = MorphingTool.GetData(CamTrans.rotation, _value); break; case MorphingValueType.localRotation: break; case MorphingValueType.localScale: break; case MorphingValueType.color: break; case MorphingValueType.value: break; } }
private static VariableValue CreateValue(VariableType type, ValueData value) { return(new VariableValue { _type = type, _value = value }); }
private string GetValueData(ValueData data) { return data == null ? string.Empty : data.Value.ToString() .Replace(@"""", @"'") .Replace(@"\", @"\\") .Replace("\n", "") .Replace("\r", ""); }
public bool Equals(ValueData other) { return(this.isCreated == other.isCreated && this.sourceValue == other.sourceValue && this.timeValueResult == other.timeValueResult && this.timeShortestVariant == other.timeShortestVariant && this.value.Equals(other.value)); }
/// <summary> /// Helper method to convert a <see cref="ValueData"/> instance /// to an <see cref="AttributeInfo"/> instance. /// </summary> /// <param name="data">The data instance.</param> /// <returns>The converted data.</returns> public static AttributeInfo ToAttributeInfo(this ValueData data) { return(new AttributeInfo() { Uuid = data?.Uuid, Value = data?.Value }); }
/// <summary> /// 转为color /// </summary> /// <param name="_v4"></param> /// <param name="_valueData"></param> /// <returns></returns> public static Color GetData(Color _v4, ValueData _valueData) { _v4.r = _valueData.data[0]; _v4.g = _valueData.data[1]; _v4.b = _valueData.data[2]; _v4.a = _valueData.data[3]; return(_v4); }
void DataValueMorphing(ref ValueData _cur, ValueData _org, ValueData _target, EasingEquation _easingType, float _v) { for (var i = 0; i < 4; i++) { //思考:通过ref能否给结构体赋值=>可以 _cur.data[i] = Mathf.LerpUnclamped(_org.data[i], _target.data[i], EasingManager.GetEaseProgress(_easingType, _v)); } }
/// <summary> /// 转换为Q4类型的数据 /// </summary> /// <param name="_v4"></param> /// <param name="_valueData"></param> /// <returns></returns> public static Quaternion GetData(Quaternion _v4, ValueData _valueData) { _v4.x = _valueData.data[0]; _v4.y = _valueData.data[1]; _v4.z = _valueData.data[2]; _v4.w = _valueData.data[3]; return(_v4); }
private FunctionData newFunctionOfStatement(StatementData data) { FunctionData func = new FunctionData(); ValueData name = new ValueData(); func.Name = name; data.Functions.Add(func); return(func); }
private AbstractSyntaxComponent simplifyStatement(CallData data) { if (!data.HaveParam()) { //没有参数的调用退化为基本值数据 if (data.IsHighOrder) { //这种情况应该不会出现 return(data); } else { data.Name.CopyComments(data); return(data.Name); } } else if (data.GetId() == "-" && data.GetParamNum() == 1) { ISyntaxComponent val = data.GetParam(0); ValueData temp = val as ValueData; if (null != temp && temp.IsNumber()) { ValueData ret = new ValueData("-" + temp.GetId(), ValueData.NUM_TOKEN); ret.CopyComments(temp); ret.CopyComments(data); return(ret); } else { simplifyCallData(data); return(data); } } else if (data.GetId() == "+" && data.GetParamNum() == 1) { ISyntaxComponent val = data.GetParam(0); ValueData temp = val as ValueData; if (null != temp && temp.IsNumber()) { ValueData ret = new ValueData(temp.GetId(), ValueData.NUM_TOKEN); ret.CopyComments(temp); ret.CopyComments(data); return(ret); } else { simplifyCallData(data); return(data); } } else { //有参数不会退化,对各参数进行化简 simplifyCallData(data); return(data); } }
private void exportOutBtn_Click(object sender, EventArgs e) { SaveFileDialog dlg = new SaveFileDialog(); dlg.FileName = "CuraReport_" + DateTime.Now.ToString("ddMMyy_HHmss"); dlg.Filter = "Excel files (*.csv)|*.csv|All files (*.*)|*.*"; if (dlg.ShowDialog() != DialogResult.OK) { return; } try { System.IO.StreamWriter writer = new System.IO.StreamWriter(dlg.FileName); ValueData data = GetReportData(); writer.WriteLine(reportCmbo.Text); writer.WriteLine(); writer.WriteLine("Period Starting :, " + PeriodStartDate.ToString("dd/MM/yyyy")); IEnumerable <string> headers = data.valuesets.Select(v => v.Name).Distinct(); string header = "Date"; foreach (string h in headers) { header += "," + h; } writer.WriteLine(header); for (int i = 0; i < data.weeks.Count; i++) { string line = data.weeks[i].ToString(); foreach (string h in headers) { line += "," + data.valuesets.Single(v => v.Name == h).values[i]; } writer.WriteLine(line); } writer.Close(); if (MessageBox.Show("Would you like to view this file now?", "Open", MessageBoxButtons.YesNo) == DialogResult.Yes) { System.Diagnostics.Process.Start(dlg.FileName); } } catch (Exception ex) { //(ex.ToString()); } }
/// <summary> /// Adds every attribute in <see cref="XmlAttributeCollection">attributes</see> to the respective <see cref="JsonData">object</see>.<br /> /// <br /> /// <see cref="LastTry">ProcessRoot</see> /// <see cref="ProcessFullNode">ProcessFullNode</see> /// </summary> /// <param name="attributes">XmlAttributeCollection to parse</param> /// <param name="objData">Object to add the attributes</param> public static void ProcessFullAttributes(XmlAttributeCollection attributes, JsonData objData) { foreach (XmlAttribute attr in attributes) { var attData = new ValueData(); attData.Value = attr.InnerText; attData.Key = "@" + attr.Name; objData.Values.Add(attData); } }
private StatementData newStatementWithOneFunction() { StatementData data = new StatementData(); FunctionData func = new FunctionData(); ValueData name = new ValueData(); func.Name = name; data.Functions.Add(func); return(data); }
public static void Save(Values val) { BinaryFormatter formatter = new BinaryFormatter(); string savingPath = Application.persistentDataPath + "/save.txt"; FileStream stream = new FileStream(savingPath, FileMode.Create); ValueData valdata = new ValueData(val); formatter.Serialize(stream, valdata); stream.Close(); }
public IEnumerator IE_ColorChange(float _useTime, float _endValue) { var _count = Enum.GetValues(typeof(MorphingValueType)).Length; var _org = new ValueData[_count]; var _target = new ValueData[_count]; var v0 = (int)MorphingValueType.value; _org[v0] = new ValueData(MorphingTool.GetFloat4(GetMatValue())); _target[v0] = new ValueData(MorphingTool.GetFloat4(_endValue)); yield return(StartCoroutine(MorphingTool._instance.IE_Morphing(this, _org, _target, _useTime))); }
private TValue LoadLazyValue(TKey id, ValueData data) { var lazyLoader = data.LazyLoader; if (lazyLoader != null) { data.Value = lazyLoader(id); data.LazyLoader = null; } return(data.Value); }
public async System.Threading.Tasks.Task <ActionResult> ClaimsDetails(List <ValueData> data) { HttpClient hclient = new HttpClient(); string url = System.Configuration.ConfigurationManager.AppSettings["APIURL"]; hclient.BaseAddress = new Uri(url); hclient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); // string apikey = null; List <ValueData> lstvd = new List <ValueData>(); List <ValueData> vdlst = new List <ValueData>(); vdlst = data; int? cid = 0; int? PcId = null; ClaimsDetails ClaimsDetails = new ClaimsDetails(); if (Session["cid"] != null) { cid = Convert.ToInt32(Session["cid"]); } if (Session["PcId"] != null) { PcId = Convert.ToInt32(Session["PcId"]); ClaimsDetails.PcId = PcId; } if (vdlst != null && vdlst.Count() > 0) { for (int v = 0; v < vdlst.Count(); v++) { ValueData vd = new ValueData(); vd.Element = new Elements(); vd.Element.ElId = vdlst[v].Element.ElId; vd.Element.ItId = vdlst[v].Element.ItId; vd.Value = vdlst[v].Value; lstvd.Add(vd); } } ClaimsDetails.ValueData = lstvd; if (Session["apiKey"] != null) { string ApiKey = Session["apiKey"].ToString(); ClaimsDetails.ApiKey = ApiKey; } StringContent content = new StringContent(JsonConvert.SerializeObject(ClaimsDetails), Encoding.UTF8, "application/json"); var responses = await hclient.PostAsync("PreviousClaims", content); var result = await responses.Content.ReadAsStringAsync(); if (result != null) { return(Json(Url.Action("PremiumDetails", "Customer", new { cid = cid, PcId = ClaimsDetails.PcId }))); } return(RedirectToAction("PremiumDetails", "Customer", new { cid = ClaimsDetails.CustomerId, PcId = ClaimsDetails.PcId })); }
internal void buildSecondTernaryOperator() { int type; string name = pop(out type); StatementData statement = getCurStatement(); FunctionData newFunc = new FunctionData(); CallData call = new CallData(); ValueData nname = new ValueData(); call.Name = nname; newFunc.Call = call; statement.Functions.Add(newFunc); FunctionData func = getLastFunction(); if (!func.IsValid()) { func.Call.SetParamClass((int)CallData.ParamClassEnum.PARAM_CLASS_TERNARY_OPERATOR); func.SetExtentClass((int)FunctionData.ExtentClassEnum.EXTENT_CLASS_STATEMENT); func.Call.Name.SetId(name); func.Call.Name.SetType(type); func.Call.Name.SetLine(getLastLineNumber()); } }
private AbstractSyntaxComponent simplifyStatement(CallData data) { if (!data.HaveParam()) { //没有参数的调用退化为基本值数据 if (data.IsHighOrder) { //这种情况应该不会出现 return data; } else { data.Name.CopyComments(data); return data.Name; } } else if (data.GetId() == "-" && data.GetParamNum() == 1) { ISyntaxComponent val = data.GetParam(0); ValueData temp = val as ValueData; if (null != temp && temp.IsNumber()) { ValueData ret = new ValueData("-" + temp.GetId(), ValueData.NUM_TOKEN); ret.CopyComments(temp); ret.CopyComments(data); return ret; } else { simplifyCallData(data); return data; } } else if (data.GetId() == "+" && data.GetParamNum() == 1) { ISyntaxComponent val = data.GetParam(0); ValueData temp = val as ValueData; if (null != temp && temp.IsNumber()) { ValueData ret = new ValueData(temp.GetId(), ValueData.NUM_TOKEN); ret.CopyComments(temp); ret.CopyComments(data); return ret; } else { simplifyCallData(data); return data; } } else { //有参数不会退化,对各参数进行化简 simplifyCallData(data); return data; } }
private StatementData newStatement() { StatementData data = new StatementData(); FunctionData func = new FunctionData(); CallData call = new CallData(); ValueData name = new ValueData(); call.Name = name; func.Call = call; data.Functions.Add(func); return data; }
internal void beginFunction() { StatementData statement = getCurStatement(); FunctionData func = getLastFunction(); if (func.IsValid()) { //语句的多元函数的其它元函数名 FunctionData newFunc = new FunctionData(); CallData call = new CallData(); ValueData name = new ValueData(); call.Name = name; newFunc.Call = call; statement.Functions.Add(newFunc); } }
/// <summary> /// Constructor which initializes the local variables /// </summary> public QuestionParser() { answerData = AnswerData.GetAnswerData(); questionData = QuestionData.GetQuestionData(); valueData = ValueData.GetValueData(); }