Example #1
0
 public string GetDefaultFileContent(IOpenFile openFile)
 {
     return @"// File:    " + Path.GetFileName(openFile.AbsolutePath) + @"
     // Version: 1.0.0
     // Author:  " + Environment.UserName + @"
     //
     ";
 }
Example #2
0
        private bool OpenFileAsync(string filename)
        {
            Logs.Write(String.Format("Openning file {0}", filename));

            IOpenFile  file = GetOpenFileForName(filename);
            PlayerData playerData;
            FileInfo   fi = new FileInfo(filename);

            if (!file.Open(filename, out playerData))
            {
                Logs.Write("Failed to open pt ({0})", filename);
                if (InvokeRequired)
                {
                    BeginInvoke(new Action(() =>
                    {
                        OpenFileComplete(playerData, fi.Name, false);
                    }));
                }
                return(false);
            }

            for (int i = 0, l = playerData.Instruments.Count; i < l; i++)
            {
                InstrumentData instrument = playerData.Instruments[i];

                if (instrument == null || instrument.InsNum == 0)
                {
                    continue;
                }

                bool res = m_audioPlayer.LoadSound(instrument.InsNum, fi.Directory + "\\" + instrument.Name, i == 0 ? 1 : 0);
                if (!res)
                {
                    Logs.Write("Failed to load sound {0} - {1}", instrument.InsNum, instrument.Name);
                }
            }

            if (InvokeRequired)
            {
                BeginInvoke(new Action(() =>
                {
                    OpenFileComplete(playerData, fi.Name, true);
                }));
            }

            return(true);
        }
        private void ConfigureNewGame()
        {
            IOpenFile openFile = this.ServiceLocator.Resolve <IOpenFile>();

            openFile.Filter.Add("Text", "*.txt");

            openFile.ShowDialog(false);
            string file = openFile.FileName;

            TextReader reader = new StreamReader(file);

            for (int i = 0; i < _buzzwords.Length; i++)
            {
                _buzzwords[i] = reader.ReadLine();
            }

            this.IsHost = true;
        }
        public string GetDefaultFileContent(IOpenFile openFile)
        {
            return this._asmProvider.GetDefaultFileContent(openFile) + @"

            #segment code
            ; ========================================================================
            ; user unit test code function
            ; ========================================================================
            :unit_test

            ; enter unit test code here. you can jump to .pass or .fail
            ; to signal success or failure

            ; unit tests will also fail after 1,000,000 cycles by default

            .pass:
            set a, UNIT_TEST_PASS
            hwi [debugger_device]

            .fail:
            set a, UNIT_TEST_FAIL
            hwi [debugger_device]

            .hang:
            set pc, .hang

            ; ========================================================================
            ; unit test support code (debugger device interface)
            ; ========================================================================
            #define NO_DEVICE 0xffff
            #define TRIGGER_BREAKPOINT 0
            #define OUTPUT_DIAG_WORD 1
            #define OUTPUT_DIAG_WORD_ZSTRING 2
            #define OUTPUT_DIAG_WORD_PSTRING 3
            #define UNIT_TEST_PASS 4
            #define UNIT_TEST_FAIL 5
            #define SET_PROCESSOR_SPEED 6
            #define GET_PROCESSOR_SPEED 7
            #define RESET_CYCLE_COUNTER 8
            #define GET_CYCLE_COUNTER 9

            #segment data
            :debugger_device
            dat 0

            #segment boot
            :detect_debugger
            hwn z
            .loop
            sub z, 1
            hwq z
            ife b,0xdeb9
            ife a,0x1111
                set pc, .found
            ifn z, 0
            set pc, .loop
            .notfound
            set z, NO_DEVICE
            .found
            set [debugger_device], z
            set pc, unit_test
            ";
        }
 /// <summary>
 /// Close the IR device. It can still be opened again in the future (unlike Dispose).
 /// </summary>
 public void Close()
 {
     _openDeviceHandle?.Dispose();
     _openDeviceHandle = null;
 }
 // this forces modifying AddressFileProcessor, though it was specifically required not to
 // I opted this way since it just felt natural to abstract away and inject the resultant
 // interfaces into constructor (though probably will break "production code" ) while
 // testing also becomes easier
 public CSVReaderWriter(IOpenFile fileOpener, IReadFile fileReader, IWriteFile fileWriter)
 {
     _fileOpener = fileOpener;
     _fileReader = fileReader;
     _fileWriter = fileWriter;
 }
 public MainWindowViewModel(IFile file, IMessageBox messageBox, ISaveFile saveFile, IOpenFile openFile, IPath path)
 {
     this.file       = file;
     this.messageBox = messageBox;
     this.saveFile   = saveFile;
     this.openFile   = openFile;
     this.path       = path;
 }
Example #8
0
 public string GetDefaultFileContent(IOpenFile openFile)
 {
     return "10 REM file " + Path.GetFileName(openFile.AbsolutePath) + " created " + DateTime.Now.ToLongDateString() + " by " + Environment.UserName + Environment.NewLine;
 }
 public override Object CreateEditorControl(IOpenFile file)
 {
     return new View.Editor() { DataContext = file };
 }
 public string GetDefaultFileContent(IOpenFile openFile)
 {
     return null;
 }
Example #11
0
 public JsonManager(ISaveFile saveFileDialog, IOpenFile openFileDialog)
 {
     _saveFileDialog = saveFileDialog;
     _openFileDialog = openFileDialog;
 }