private void btn_ClearAll_Click(object sender, RoutedEventArgs e) { if (osParent == null && GetOSMainWindowInstance() == null) { MessageBox.Show("Please open the os before clearing interrupts"); return; } OperatingSystemMainWindow os = GetOSMainWindowInstance(); OSCore core = os.OsCore; txt_Int1Location.Text = ""; txt_Int2Location.Text = ""; txt_Int3Location.Text = ""; txt_Int4Location.Text = ""; txt_Int5Location.Text = ""; txt_Int6Location.Text = ""; core.Handles.PINT1 = null; core.Handles.VINT1 = null; core.Handles.PINT2 = null; core.Handles.VINT2 = null; core.Handles.PINT3 = null; core.Handles.VINT3 = null; core.Handles.PINT4 = null; core.Handles.VINT4 = null; core.Handles.PINT5 = null; core.Handles.VINT5 = null; core.Handles.PINT6 = null; core.Handles.VINT6 = null; }
private void btn_Int6Trigger_Click(object sender, RoutedEventArgs e) { OperatingSystemMainWindow os = GetOSMainWindowInstance(); OSCore core = os.OsCore; if (core.Handles.PINT6 == null || core.Handles.VINT6 == null) { MessageBox.Show("Interrupt 6 is not registered"); return; } core.Handles.VINT6.Fire(); }
/// <summary> /// This function creates the Operating System core /// </summary> private void CreateOsCore() { OSFlags?flags = CreateOsFlags(); // create the operating system flags from selected UI options if (flags == null) // if the flags are invalid { MessageBox.Show("An error occurred while creating the operating system core : Invalid flags"); return; } osCore = new OSCore(flags.Value); //create the operating system core globalFlags = flags.Value; // save the creation flags }
private async Task <bool> DeserializeObjectLib(string fileName) { if (string.IsNullOrEmpty(fileName)) { return(true); } string json = String.Empty; StreamReader reader = new StreamReader(fileName); osCore = null; while ((json = reader.ReadLine()) != null) { JsonSerializerSettings settings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, Formatting = Formatting.None }; OSCore core = JsonConvert.DeserializeObject <OSCore>(json, settings); osCore = core; if (osCore != null) { break; } } processes.Add(osCore.Scheduler.RunningProcess); processes.AddRange(osCore.Scheduler.ReadyQueue); processes.AddRange(osCore.Scheduler.WaitingQueue); processes = processes.Where(x => x != null).ToList(); //dynamic window = GetMainWindowInstance(); //List<SimulatorProgram> programs = new List<SimulatorProgram>(); //string ProgramsToLoad = "Please load the following programs before running the OS: \n "; //foreach (SimulatorProcess process in processes) //{ // if (programs.Any(x => x.Name == process.ProgramName)) // continue; // programs.Add(process.Program); // ProgramsToLoad += process.ProgramName + "\n"; //} //window.ProgramList.AddRange(programs); //programList = programs; await UpdateInterface(); await UpdateMainWindowInterface(); //MessageBox.Show(ProgramsToLoad); return(true); }
private void txt_Int1Location_TextChanged(object sender, TextChangedEventArgs e) { if (osParent == null && GetOSMainWindowInstance() == null) { MessageBox.Show("Please open the os before clearing interrupts"); return; } OperatingSystemMainWindow os = GetOSMainWindowInstance(); OSCore core = os.OsCore; uint address = 0; if (uint.TryParse(txt_Int1Location.Text, out address)) { core.Handles.SetPolledInterrupt(1, (int)address); core.Handles.SetVectoredInterrupt(1, (int)address); } }
private void SerializeObjectLib(OSCore serializableObject, string filePath) { if (serializableObject == null || filePath.Equals(String.Empty)) { return; } JsonSerializerSettings settings = new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects, ReferenceLoopHandling = ReferenceLoopHandling.Serialize, Formatting = Formatting.None }; StreamWriter writer = new StreamWriter(filePath, false); //JsonSerializer serializer = JsonSerializer.Create(settings); string json = JsonConvert.SerializeObject(serializableObject, settings); json = Regex.Replace(json, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1"); // remove all whitespace from the string writer.WriteLine(json); writer.Flush(); writer.Close(); writer.Dispose(); }