private static IntegerAddress ReadIntegerAddress(StreamReader reader, ref int lineCount) { string[] intLine = reader.ReadLine().Split(','); ++lineCount; if (intLine.Count() != 5) { throw new FormatException("Invalid integer address line at line " + lineCount); } IntegerAddress intAddr; try { string desc = intLine[1]; int address = Convert.ToInt32(intLine[2]); int offset = Convert.ToInt32(intLine[3]); decimal multiply = Convert.ToDecimal(intLine[4]); intAddr = new IntegerAddress(address, desc, offset, multiply); } catch { throw new FormatException("Invalid integer address line at line " + lineCount); } return(intAddr); }
public void EditY(IntegerAddress i, IWin32Window f) { IIntFormManager intManager = new IntFormManager(i); intManager.Attach(this); IntegerAddressForm intForm = new IntegerAddressForm(intManager, sharedManager, "PuzzLearn - Edit Y", i); intForm.ShowDialog(f); }
private void editCoord(object coord, string title, IWin32Window f) { IntegerAddress ia = (IntegerAddress)coord; IntFormManager im = new IntFormManager(ia); im.Attach(this); IntegerAddressForm iaf = new IntegerAddressForm(im, sharedManager, title, ia); iaf.ShowDialog(f); }
public bool Confirm(string addressString, string description, decimal offsetDecimal, decimal multFactor) { if (addressString == "" || description == "") { return(false); } int address = Convert.ToInt32(addressString, 16); int offset = (int)Math.Round(offsetDecimal); newAddress = new IntegerAddress(address, description, offset, multFactor); Notify(); return(true); }
public void Update(IntegerAddress newStruct, IntegerAddress oldStruct) { if (oldStruct == null) { if (xPending) { xPending = false; xAddresses.Add(newStruct); } else { yAddresses.Add(newStruct); } } else { oldStruct.CopyValues(newStruct); } }
private static void WriteIntegerAddress(IntegerAddress ia, StringBuilder builder) { builder.Append((int)ia.Type + d + ia.Description + d + ia.Address + d + ia.Offset + d + ia.Multiply + n); }
public IntegerAddressForm(IIntFormManager ifm, ISharedManager sm, string title = "Integer Address", IntegerAddress ia = null) { intManager = ifm; sharedManager = sm; InitializeComponent(); Text = title; if (ia != null) { AddressTextBox.Text = ia.Address.ToString("X"); DescriptionTextBox.Text = ia.Description; OffsetUpDown.Value = ia.Offset; MultiplicationFactorUpDown.Value = ia.Multiply; } }
public IntFormManager(IntegerAddress oa = null) { observers = new List <IStructureObserver <IntegerAddress> >(); oldAddress = oa; }
public void CopyValues(IntegerAddress copyInt) { offset = copyInt.offset; multiply = copyInt.multiply; base.CopyValues(copyInt); }
public IntegerAddress(IntegerAddress copy) : base(copy) { offset = copy.offset; multiply = copy.multiply; }
public void DeleteY(IntegerAddress i) { yAddresses.Remove(i); }
public void DeleteX(IntegerAddress i) { xAddresses.Remove(i); }