Exemple #1
0
        public void SelectFile(IMainWin win)
        {
            Cache.IncUserActionCounter();

            OpenFileDialog dlg = new OpenFileDialog
            {
                DefaultExt = ".txt",
                Filter     = "TXT Files (*.txt)|*.txt"
            };

            bool?success = dlg.ShowDialog();

            if (success == true)
            {
                var circuit = CircuitFactory.GetFromFile(dlg.FileName);

                if (circuit.success)
                {
                    win.SpawnResultWindow(dlg.FileName, circuit.circuit);
                }
                else
                {
                    Console.WriteLine(circuit.error);
                    win.SetErrorText(circuit.error);
                }
            }
        }
Exemple #2
0
        public static Circuit GetFullAdderCircuit()
        {
            SetTestPaths();
            string filePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            return(CircuitFactory.GetFromFile(filePath + "../../../../Circuits/Circuit1_FullAdder.txt").circuit);
        }