public static void SaveDFAMachine(DFAMachine machine, string dir) { JsonSerializer json = new JsonSerializer(); string machinestr = JsonConvert.SerializeObject(machine); File.WriteAllText(dir, machinestr); }
public MachineEditWindow(DFAMachine containingmachine) { InitializeComponent(); ContainingMachine = containingmachine; Title = "Edit machine: " + containingmachine.Name; Task.Run(NotificationChangeLoop); InvalidateMachineGraph(); }
private void MachineControl_MouseDoubleClick(object sender, MouseButtonEventArgs e) { MachineEditWindow editwindow = new MachineEditWindow(ContainingMachine); editwindow.ShowDialog(); ContainingMachine = editwindow.ContainingMachine; Dragging = false; e.Handled = true; }
public MachineControl(DFAMachine containingmachine) { InitializeComponent(); Margin = new Thickness(containingmachine.Location.X, containingmachine.Location.Y, 0, 0); ContainingMachine = containingmachine; MouseDoubleClick += MachineControl_MouseDoubleClick; MachineName.Text = containingmachine.Name; MouseDown += MachineControl_MouseDown; MouseMove += MachineControl_MouseMove; MouseUp += MachineControl_MouseUp; }
public static DFAMachine LoadDFAMachine(string dir) { string content = File.ReadAllText(dir); DFAMachine machine = JsonConvert.DeserializeObject <DFAMachine>(content); foreach (Edge <char> edge in machine.Edges) { edge.GetConditions.RemoveAt(0); } machine.ReconstructRefs(); return(machine); }
private void OpenMachineMenuItem_Click(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog(); dlg.DefaultExt = "dmf"; dlg.Filter = "DFA machine file | *.dmf"; try { if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ContainingMachine = FileDAL.LoadDFAMachine(dlg.FileName); } InvalidateMachineGraph(); } catch { System.Windows.MessageBox.Show("There was a problem loading the machine. machine file may be corrupted.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public DFAMachineBroker(DFAMachine machine) { ContainingMachine = machine; }
public DFAMachineDebugger(DFAMachine m) { ContainingMachine = m; }