public TLEditorString(List <TLBaseKeyFrame> Keys) : base(Keys) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); //check if all keyframes have the same time/value double time = FKeyFrames[0].Time; string text = (FKeyFrames[0] as TLStringKeyFrame).Value; TLBaseKeyFrame kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time != time); }); if (kf == null) { TimeBox.Value = time; } kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLStringKeyFrame).Value != text); }); if (kf == null) { ValueBox.Text = text; } FStartValue = ValueBox.Text; Height = TimeBox.Height + ValueBox.Height + 1; //make the valuebox have the focus ValueBox.SelectAll(); this.ActiveControl = ValueBox; }
private void SetProperties() { if (_address.HasValue) { AddressBox.SetFromRawInt(_address.Value); } else { AddressBox.ResetText(); } if (_compare.HasValue) { CompareBox.SetFromRawInt(_compare.Value); } else { CompareBox.ResetText(); } if (_value.HasValue) { ValueBox.SetFromRawInt(_value.Value); } else { ValueBox.ResetText(); } }
public AttributesEnumerable(Func <string> readNextLine, Predicate <string> isAttributeLine, ValueBox <string> currentLine) { m_Finished = false; m_CurrentLine = currentLine; m_ReadNextLine = readNextLine; m_IsAttributeLine = isAttributeLine; }
public TLEditorValue(List <TLBaseKeyFrame> Keys) : base(Keys) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); ValueBox.Minimum = double.MinValue; ValueBox.Maximum = double.MaxValue; //check if all keyframes have the same time/value double time = FKeyFrames[0].Time; double val = (FKeyFrames[0] as TLValueKeyFrame).Value; TLBaseKeyFrame kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return(k.Time != time); }); if (kf == null) { TimeBox.Value = time; } kf = FKeyFrames.Find(delegate(TLBaseKeyFrame k) { return((k as TLValueKeyFrame).Value != val); }); if (kf == null) { ValueBox.Value = val; } FStartValue = val; Height = TimeBox.Height + ValueBox.Height + 1; this.ActiveControl = ValueBox; ValueBox.ShowValueBox(); }
public NESGameGenie() { InitializeComponent(); AddressBox.SetHexProperties(0x10000); ValueBox.SetHexProperties(0x100); CompareBox.SetHexProperties(0x100); }
private static void ValueBoxOnTextChanged(ref ValueBox valueBox) { String text = new Regex("-[^0-9]{1,3}").Replace(valueBox.Text, String.Empty); Int32.TryParse(text, out Int32 value); if (valueBox.Name == "Angle" && value > valueBox.MaxValue) { valueBox.Text = (value % 360).ToString(); valueBox.SelectionStart = valueBox.Text.Length; } else if (value > valueBox.MaxValue) { Int32 selection = valueBox.SelectionStart; valueBox.Text = valueBox.MaxValue.ToString(); valueBox.SelectionStart = selection; } else if (value < -100) { valueBox.Text = @"0"; valueBox.SelectionStart = 1; } else { Int32 selection = valueBox.SelectionStart; valueBox.Text = text; valueBox.SelectionStart = selection == 0 ? 0 : selection <= valueBox.Text.Length ? selection : valueBox.Text.Length; } }
/// <summary> /// </summary> /// <param name="ss">The SpreadsheetPanel in the current Form1</param> private void DisplaySelection(SpreadsheetPanel ss) { if (_spreadsheet == null) { return; } int col, row; ss.GetSelection(out col, out row); // Convert col, row index to spreadsheet cell names. var cellName = ((char)(col + 65)) + (row + 1).ToString(CultureInfo.InvariantCulture); // Displays selected cell's name CellNameBox.Invoke(new Action(() => { CellNameBox.Text = cellName; })); var content = _spreadsheet.GetCellContents(cellName); // If content is a formula, prepend "=" before displaying var f = content as Formula; if (f != null) { ContentBox.Invoke(new Action(() => { ContentBox.Text = "=" + f; })); } // Otherwise just display the content. else { ContentBox.Invoke(new Action(() => { ContentBox.Text = content.ToString(); })); } // No need to fetch the value from the spreadsheet again, just copy it from // the spreadsheetpanel. This avoids reworking the FormulaError message. string value; ss.GetValue(col, row, out value); ValueBox.Invoke(new Action(() => { ValueBox.Text = value; })); }
private void EncodeGameGenie() { _address = AddressBox.ToRawInt(); _value = ValueBox.ToRawInt(); _compare = CompareBox.ToRawInt(); GameGenieCode.Text = new NESGameGenieEncoder(_address.Value, _value.Value, _compare).Encode(); }
void ValueBoxLeave(object sender, EventArgs e) { if (ValueBox.Visible) { DoChangeValue(); ValueBox.Hide(); } }
private void OnVector2ValueChanged(ValueBox <float> valueBox) { var control = valueBox.Parent; var box = (InputBox)control.Tag; var x = ((FloatValueBox)control.Children[0]).Value; var y = ((FloatValueBox)control.Children[1]).Value; box.Value = new Vector2(x, y); }
private void OnVector2ValueChanged(ValueBox <float> valueBox) { var control = valueBox.Parent; var box = (InputBox)control.Tag; var x = ((FloatValueBox)control.Children[0]).Value; var y = ((FloatValueBox)control.Children[1]).Value; box.ParentNode.SetValue(box.Archetype.ValueIndex, new Vector2(x, y)); }
public void Initialize(OpcServer.OpcList opcName) { _opcName = opcName; ValueBox.Initialize(_opcName); ValueBox.Digit = ContainerItem == Static.ContainerItem.Additive1?2:1; DataContext = this; }
void ValueBoxKeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { DoChangeValue(); ValueBox.Hide(); } this.Focus(); }
private void CleanSpreadsheet() { DeregisterHandlers(); _spreadsheet = null; spreadsheetPanel1.Invoke(new Action(() => { spreadsheetPanel1.Clear(); })); CellNameBox.Invoke(new Action(() => { CellNameBox.Text = string.Empty; })); ValueBox.Invoke(new Action(() => { ValueBox.Text = string.Empty; })); ContentBox.Invoke(new Action(() => { ContentBox.Text = string.Empty; })); this.Invoke(new Action(() => { this.Text = "Spreadsheet Program - Not Connected"; })); }
private void OnQuaternionValueChanged(ValueBox <float> valueBox) { var control = valueBox.Parent; var box = (InputBox)control.Tag; var x = ((FloatValueBox)control.Children[0]).Value; var y = ((FloatValueBox)control.Children[1]).Value; var z = ((FloatValueBox)control.Children[2]).Value; box.Value = Quaternion.Euler(x, y, z); }
private void OnQuaternionValueChanged(ValueBox <float> valueBox) { var control = valueBox.Parent; var box = (InputBox)control.Tag; var x = ((FloatValueBox)control.Children[0]).Value; var y = ((FloatValueBox)control.Children[1]).Value; var z = ((FloatValueBox)control.Children[2]).Value; box.ParentNode.SetValue(box.Archetype.ValueIndex, Quaternion.Euler(x, y, z)); }
public static void ConsumeAttributes(Func <string> readNextLine, ValueBox <string> currentLine, Predicate <string> isAttributeLine) { for (;;) { currentLine.Value = readNextLine(); if (!isAttributeLine(currentLine.Value)) { break; } } }
public Cheat GetCheat() { Cheat.COMPARISONTYPE comparisonType = Cheat.COMPARISONTYPE.NONE; var domain = MemoryDomains[DomainDropDown.SelectedItem.ToString()]; var address = AddressBox.ToRawInt().Value; if (address < domain.Size) { var watch = Watch.GenerateWatch( MemoryDomains[DomainDropDown.SelectedItem.ToString()], AddressBox.ToRawInt().Value, GetCurrentSize(), Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString()), BigEndianCheckBox.Checked, NameBox.Text ); switch (CompareTypeDropDown.SelectedItem.ToString()) { case "": comparisonType = Cheat.COMPARISONTYPE.NONE; break; case "=": comparisonType = Cheat.COMPARISONTYPE.EQUAL; break; case ">": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN; break; case ">=": comparisonType = Cheat.COMPARISONTYPE.GREATER_THAN_OR_EQUAL; break; case "<": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN; break; case "<=": comparisonType = Cheat.COMPARISONTYPE.LESS_THAN_OR_EQUAL; break; case "!=": comparisonType = Cheat.COMPARISONTYPE.NOT_EQUAL; break; default: comparisonType = Cheat.COMPARISONTYPE.NONE; break; } int?c = CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value; return(new Cheat( watch, ValueBox.ToRawInt().Value, CompareBox.ToRawInt() == null ? null : (int?)CompareBox.ToRawInt().Value, true, comparisonType )); } else { MessageBox.Show(address.ToString() + " is not a valid address for the domain " + domain.Name, "Index out of range", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(Cheat.Separator); } }
private void OnFloatValueBoxChanged(ValueBox <float> control) { var box = (InputBox)control.Tag; if (box.HasCustomValueAccess) { box.Value = control.Value; } else { FloatValue.Set(box.ParentNode, box.Archetype, control.Value); } }
public NESGameGenie() { InitializeComponent(); Closing += (o, e) => { Global.Config.NesGGSettings.Wndx = Location.X; Global.Config.NesGGSettings.Wndy = Location.Y; }; TopMost = Global.Config.NesGGSettings.TopMost; AddressBox.SetHexProperties(0x10000); ValueBox.SetHexProperties(0x100); CompareBox.SetHexProperties(0x100); }
private void OnValueBoxChanged(ValueBox <uint> control) { var box = (InputBox)control.Tag; if (box.HasCustomValueAccess) { box.Value = control.Value; } else { UnsignedIntegerValue.Set(box.ParentNode, box.Archetype, control.Value); } }
public override void Process(Command command) { Exception e = null; var options = (CommandOptions)this.LoadOptions((TextCommand)command); var nodeType = NodeType.FromName(options.NodeType); var node = this.Connection.FileSystemManager.Resolve(options.Uri, nodeType); node.Refresh(); if (!node.Exists) { throw new NodeNotFoundException(node.Address); } if (!NodeTypeSupported(node.NodeType)) { Connection.WriteError(ErrorCodes.INVALID_PARAM); return; } Connection.WriteOk(); Connection.Flush(); using (node.Attributes.AquireUpdateContext()) { var lastLineRead = new ValueBox <string>(); foreach (var attribute in TextNetworkProtocol.ReadAttributes(Connection.ReadTextBlock, lastLineRead)) { var attributeName = attribute.Name; var attributeValue = attribute.Value; if (!(attributeName.EqualsIgnoreCase("exists") || attributeName.EqualsIgnoreCase("length"))) { e = ActionUtils.IgnoreExceptions(delegate { node.Attributes[attributeName] = attributeValue; }); } } } if (e != null) { throw e; } this.Connection.WriteOk(); }
public override void Process(Command command) { Exception e = null; var options = (CommandOptions)this.LoadOptions((TextCommand)command); var nodeType = NodeType.FromName(options.NodeType); var node = this.Connection.FileSystemManager.Resolve(options.Uri, nodeType); node.Refresh(); if (!node.Exists) { throw new NodeNotFoundException(node.Address); } if (!NodeTypeSupported(node.NodeType)) { Connection.WriteError(ErrorCodes.INVALID_PARAM); return; } Connection.WriteOk(); Connection.Flush(); using (node.Attributes.AquireUpdateContext()) { var lastLineRead = new ValueBox<string>(); foreach (var attribute in TextNetworkProtocol.ReadAttributes(Connection.ReadTextBlock, lastLineRead)) { var attributeName = attribute.Name; var attributeValue = attribute.Value; if (!(attributeName.EqualsIgnoreCase("exists") || attributeName.EqualsIgnoreCase("length"))) { e = ActionUtils.IgnoreExceptions(delegate { node.Attributes[attributeName] = attributeValue; }); } } } if (e != null) { throw e; } this.Connection.WriteOk(); }
public void CallGetOrSetProperty_MustVisitProperty() { var valueProp = typeof(ValueBox).GetProperty(nameof(ValueBox.Value)); var pv = ReflectionPropertyVisitor.Instance; var val = new ValueBox(); pv.SetValue(val, "123", valueProp); Assert.AreEqual("123", val.Value); var v = (string)pv.GetValue(val, valueProp); Assert.AreEqual("123", v); }
public void ShowValueBox() { if (FIsInteger) { ValueBox.Text = FValue.ToString("f0", TimelinerPlugin.GNumberFormat); } else { ValueBox.Text = FValue.ToString("f4", TimelinerPlugin.GNumberFormat); } ValueBox.SelectAll(); ValueBox.Show(); ValueBox.Focus(); }
public void GetOrSetPropery_MustEqualOrSetInstanceValue() { var visitor = CompilePropertyVisitor.Instance; var valueProp = typeof(ValueBox).GetProperty(nameof(ValueBox.Value)); var obj = new ValueBox(); visitor.SetValue(obj, 123, valueProp); Assert.AreEqual(123, obj.Value); var val = (int)visitor.GetValue(obj, valueProp); Assert.AreEqual(123, val); }
private void addButton_Click(object sender, RoutedEventArgs e) { if (Int32.TryParse(ValueBox.Text, out int val)) { _map.Add(val, ""); TreeView.ItemsSource = _map.Root; DeleteMinimumButton.IsEnabled = true; } else { MessageBox.Show("Необходимо ввести число!", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } ValueBox.Clear(); }
/// <summary> /// Shows contents of selected template /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OutputDGV_SelectionChanged(object sender, EventArgs e) { if (OutputDGV.SelectedRows.Count == 0 || OutputDGV.SelectedRows[0].Tag == null) { return; } AvailableDGV.ClearSelection(); ValueBox.Clear(); foreach (var item in ((ConfigFile)OutputDGV.SelectedRows[0].Tag).PropertyList) { ValueBox.AppendText(item.Name + "- " + item.Value + Environment.NewLine); } }
private static MvcHtmlString GenerateValueBox(ValueBox valueBox) { TagBuilder div = new TagBuilder("div"); div.AddCssClass("valuebox_div"); System.Text.StringBuilder innerHtml = new System.Text.StringBuilder(); TagBuilder iconLink = new TagBuilder("a"); iconLink.AddCssClass(valueBox.ImageCssClass); iconLink.MergeAttribute("href", "#"); iconLink.MergeAttribute("tabIndex", "-1"); iconLink.MergeAttribute("target", "_blank"); if (valueBox.Icon.IsNotNullAndEmpty()) { iconLink.MergeAttribute("style", "background-image:url('../content/images/{0}')".FormatWith(new object[] { valueBox.Icon })); } innerHtml.AppendLine(iconLink.ToString()); TagBuilder nameTextBox = new TagBuilder("input"); nameTextBox.GenerateId(valueBox.Name); nameTextBox.MergeAttribute("name", valueBox.Name); nameTextBox.MergeAttribute("type", valueBox.Type); nameTextBox.MergeAttribute("value", valueBox.Text); nameTextBox.MergeAttributes <string, object>(valueBox.HtmlAttributes); innerHtml.AppendLine(nameTextBox.ToString(TagRenderMode.SelfClosing)); if (valueBox.IsComplex) { TagBuilder buttonSpan = new TagBuilder("span"); buttonSpan.AddCssClass("valuebox_button"); innerHtml.AppendLine(buttonSpan.ToString()); TagBuilder hiddenInput = new TagBuilder("input"); hiddenInput.GenerateId(valueBox.HiddenInputName); hiddenInput.MergeAttribute("name", valueBox.HiddenInputName); hiddenInput.MergeAttribute("type", "hidden"); hiddenInput.MergeAttribute("value", valueBox.BusinessID); innerHtml.AppendLine(hiddenInput.ToString(TagRenderMode.SelfClosing)); } div.InnerHtml = innerHtml.ToString(); return(MvcHtmlString.Create(div.ToString())); }
private void AddCheat_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(AddressBox.Text) && !string.IsNullOrWhiteSpace(ValueBox.Text)) { var watch = Watch.GenerateWatch( MemoryDomains["System Bus"], AddressBox.ToRawInt().Value, WatchSize.Byte, Client.Common.DisplayType.Hex, false, GameGenieCode.Text); Global.CheatList.Add(new Cheat( watch, ValueBox.ToRawInt().Value, CompareBox.ToRawInt() )); } }
private void AddCheatButton_Click(object sender, EventArgs e) { string name; var address = 0; var value = 0; if (!string.IsNullOrWhiteSpace(cheatname.Text)) { name = cheatname.Text; } else { _processing = true; GGCodeMaskBox.TextMaskFormat = MaskFormat.IncludeLiterals; name = GGCodeMaskBox.Text; GGCodeMaskBox.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; _processing = false; } if (!string.IsNullOrWhiteSpace(AddressBox.Text)) { address = int.Parse(AddressBox.Text, NumberStyles.HexNumber); } if (!string.IsNullOrWhiteSpace(ValueBox.Text)) { value = ValueBox.ToRawInt() ?? 0; } var watch = Watch.GenerateWatch( MemoryDomains["MD CART"], address, Watch.WatchSize.Word, Watch.DisplayType.Hex, name, true ); Global.CheatList.Add(new Cheat( watch, value )); }
/// <summary> /// Closes all open upvalues pointing to stack locations >= index. /// </summary> private void CloseUpValues( int index ) { int i; for( i = numOpenUpValues - 1; i >= 0; i-- ) { var rec = openUpValues[i]; if( rec.StackIndex < index ) break; var stk = stack[rec.StackIndex]; var asUpValRef = stk.RefVal as Value[]; if( asUpValRef == null ) { //values initially close to simple values rec.UpValueStorage[rec.UpValueIndex] = stk; if( !(stk.RefVal is ValueBox) ) { //keep track of where we closed this value to //if another open value closes on this slot, we //need to properly box it and fix both references stack[rec.StackIndex].RefVal = rec.UpValueStorage; stack[rec.StackIndex].NumVal = rec.UpValueIndex; } } else { //the value's already been closed to a simple value int upIdx = (int)stk.NumVal; var box = new ValueBox { Value = asUpValRef[upIdx] }; asUpValRef[upIdx].RefVal = box; rec.UpValueStorage[rec.UpValueIndex].RefVal = box; //we don't want to go through this path each time //so we put the box on the stack, any further upvalues //closing on this slot will take the short path above stack[rec.StackIndex].RefVal = box; } openUpValues[i].UpValueStorage = null; } //restore the original stack values (ToDo: find out if this is necessary) for( int j = i + 1; j < numOpenUpValues; j++ ) { var stkIdx = openUpValues[j].StackIndex; var stk = stack[stkIdx]; var asUpValRef = stk.RefVal as Value[]; if( asUpValRef != null ) { stack[stkIdx] = asUpValRef[(int)stk.NumVal]; continue; } var asBox = stk.RefVal as ValueBox; if( asBox != null ) { stack[stkIdx] = asBox.Value; continue; } } //and... done! numOpenUpValues = i + 1; }
private Function CreateClosure( Proto proto, Value[] parentUpValues ) { var stackBase = call.StackBase; var upValDesc = proto.UpValues; if( upValDesc == null ) //we don't wrap simple protos in full closures return proto; var upValues = new Value[upValDesc.Length]; for( int i = 0; i < upValDesc.Length; i++ ) { var desc = upValDesc[i]; if( desc.Kind == UpValueKind.StackPointing ) { //create an open upvalue int stackIndex = stackBase + desc.Index; upValues[i].RefVal = Value.OpenUpValueTag; upValues[i].NumVal = stackIndex; RegisterOpenUpvalue( upValues, i, stackIndex ); } else { var parentVal = parentUpValues[desc.Index]; if( parentVal.RefVal == Value.OpenUpValueTag ) { RegisterOpenUpvalue( upValues, i, (int)parentVal.NumVal ); } else if( desc.Kind != UpValueKind.ValueCopying ) { //this is the pint where we need to force simple upvalues closed var asClosed = parentVal.RefVal as ValueBox; if( asClosed == null ) { asClosed = new ValueBox() { Value = parentVal }; parentVal.RefVal = asClosed; parentUpValues[desc.Index].RefVal = asClosed; } } upValues[i] = parentVal; } } return new Closure() { Proto = proto, UpValues = upValues }; }
public override IEnumerable<Pair<string,object>> GetAttributes(string uri, NodeType nodeType) { using (this.AcquireCommandContext(false)) { var lastReadLine = new ValueBox<string>(this.lastLineRead); try { this.SendCommand(DefaultTryCount, @"getattributes -t={0} ""{1}""", TextNetworkProtocol.GetNodeTypeName(nodeType), uri).ProcessError(); } catch { ReadReady(); throw; } foreach (var attribute in TextNetworkProtocol.ReadAttributes(this.ReadNextLine, lastReadLine)) { yield return attribute; } } }