public static void SetString(Text component, string content, bool language = true) { if (language) { if (dictionary != null) { SetString(component, dictionary.Get(content), false); } else { dictionary = DataManager.Instance.Load <DataText>(); if (dictionary != null) { SetString(component, dictionary.Get(content), false); } else { SetString(component, content, false); } } } else { if (component != null) { component.text = content; } } }
protected static void LoadDataText() { DataText data = Load <DataText>(); string[] guids = AssetDatabase.FindAssets("t:TextAsset", new string[] { "Assets/Art/Language" }); string path, file; foreach (var guid in guids) { path = AssetDatabase.GUIDToAssetPath(guid); file = System.IO.Path.GetFileNameWithoutExtension(path); if (GameConfig.Lang.ToString().ToLower() == file) { TextAsset asset = AssetDatabase.LoadAssetAtPath <TextAsset>(path); if (asset != null && !string.IsNullOrEmpty(asset.text)) { data.dictionary = JsonUtility.FromJson <DataText.Dictionary>(asset.text); } break; } } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
private void runConvertProcesses(DataText processingData) { Result = String.Empty; foreach (IConverterProcess process in converterProcesses) { process.Convert(processingData); processingData.Input = processingData.Output; } }
public IActionResult AddNew(DataText _datatext) { if (ModelState.IsValid) { _context.dataText.Add(_datatext); _context.SaveChanges(); return(Redirect("Index")); } return(View()); }
private DataText getCopy(DataText dataText) { DataText dt = new DataText(); dt.Configuration = dataText.Configuration; dt.Input = dataText.Input == null ? null : (String[])dataText.Input.Clone(); dt.Output = dataText.Output == null ? null : (String[])dataText.Output.Clone(); dt.InputType = dataText.InputType; return(dt); }
public bool Convert(DataText dataText) { string textToAppend = dataText.Configuration.CodeStringBuilder; dataText.Output = new String[dataText.Input.Length]; for (int i = 0; i < dataText.Input.Length; i++) { dataText.Output[i] = String.Format(" {0}(\" {1} \")", textToAppend, dataText.Input[i]); } return(true); }
public IActionResult Delete(int _id) { DataText data = _context.dataText.FirstOrDefault(x => x.Id == _id); if (data != null) { _context.dataText.Remove(data); _context.SaveChanges(); } return(Redirect("Index")); }
// 消息框显示信息 private void BoxShow(String str) { this.DataText.Dispatcher.Invoke( new Action( delegate { DataText.Text += str + "\n"; DataText.ScrollToEnd(); } ) ); }
public bool Convert(DataText dataText) { string textToCut = dataText.Configuration.CodeStringBuilder; dataText.Output = new String[dataText.Input.Length]; for (int i = 0; i < dataText.Input.Length; i++) { dataText.Output[i] = dataText.Input[i].Replace(textToCut, "").Replace("(\"", "").Replace("\")", "").Trim(); } return(true); }
private void DoSaveModify() { byte[] data = null; //added by Yang Li string dataText = DataText.Trim(); if (_selectedEncoding == "HEX") { MemoryStream ms = new MemoryStream(); //modified by Yang Li //foreach (string hex in DataText.Split('-')) foreach (string hex in dataText.Split('-')) { byte b = 0; if (byte.TryParse(hex, System.Globalization.NumberStyles.HexNumber, null, out b)) { ms.WriteByte(b); } else { this.AddLog(LogType.Error, "hex data format error"); return; } } data = ms.ToArray(); } else { //modified by Yang Li //data = ConvertEncoding(_selectedEncoding).GetBytes(DataText); data = ConvertEncoding(_selectedEncoding).GetBytes(dataText); } //added by Yang Li: 修复了个Bug--每次修改后,都要把最新值赋给_data _data = data; //fixed by Yang Li: 1、当第>1次修改保存节点值时,解决抛异常的问题。2、必须根据实际将要被更新值的节点Version,进行更新值: //Stat stat = this.SetZookeeperNodeData(SelectedZookeeperTreeNodeModel.QueryPath, data, SelectedZookeeperTreeNodeModel.Stat.Cversion); Stat stat = this.SetZookeeperNodeData(SelectedZookeeperTreeNodeModel.QueryPath, data); if (stat != null) { this.SelectedZookeeperTreeNodeModel.Stat = stat; this.ChangeListView(stat); } else { this.SyncDataText(); this.AddLog(LogType.Error, "version unmatch,set data failed"); } }
public void Start() { //Copy the input data to preserve the original data DataText processingData = getCopy(DataInput); runConvertProcesses(processingData); DataInput.Output = processingData.Output; //Extract the output string foreach (string line in DataInput.Output) { Result += line + System.Environment.NewLine; } }
private void DoSaveModify() { byte[] data = null; if (_selectedEncoding == "HEX") { MemoryStream ms = new MemoryStream(); foreach (string hex in DataText.Split('-')) { byte b = 0; if (byte.TryParse(hex, System.Globalization.NumberStyles.HexNumber, null, out b)) { ms.WriteByte(b); } else { this.AddLog(LogType.Error, "hex data format error"); return; } } data = ms.ToArray(); } else { data = ConvertEncoding(_selectedEncoding).GetBytes(DataText); } Stat stat = this.SetZookeeperNodeData(SelectedZookeeperTreeNodeModel.QueryPath, data, SelectedZookeeperTreeNodeModel.Stat.Cversion); if (stat != null) { this.SelectedZookeeperTreeNodeModel.Stat = stat; this.ChangeListView(stat); } else { this.SyncDataText(); this.AddLog(LogType.Error, "version unmatch,set data failed"); } }
void Awake() { instance = this; tm = GetComponent<TextMesh>(); }