コード例 #1
0
ファイル: ResourceElementVM.cs プロジェクト: ottrur/dnSpy
        void PickRawBytes()
        {
            if (openFile == null)
            {
                throw new InvalidOperationException();
            }
            var newBytes = openFile.Open();

            if (newBytes != null)
            {
                Data = newBytes;
            }
        }
コード例 #2
0
        void FillData()
        {
            if (openFile == null)
            {
                throw new InvalidOperationException();
            }
            var newBytes = openFile.Open(PickFilenameConstants.ImagesFilter);

            if (newBytes != null)
            {
                Data = newBytes;
            }
        }
コード例 #3
0
        void FillData()
        {
            if (openFile == null)
            {
                throw new InvalidOperationException();
            }
            var newBytes = openFile.Open("Images|*.png;*.gif;*.bmp;*.dib;*.jpg;*.jpeg;*.jpe;*.jif;*.jfif;*.jfi;*.ico;*.cur|All files (*.*)|*.*");

            if (newBytes != null)
            {
                Data = newBytes;
            }
        }
コード例 #4
0
        public void CallsFileOpenerInReadMode()
        {
            var filePath = "filePath";
            var openMode = CSVReaderWriter.Mode.Read;

            _csvReaderWriter.Open(filePath, openMode);
            A.CallTo(() => _fileOpener.Open(filePath, openMode)).MustHaveHappened(Repeated.Exactly.Once);
        }
コード例 #5
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);
        }
コード例 #6
0
 public void Open(string fileName, Mode mode)
 {
     _streamHandler = _fileOpener.Open(fileName, mode);
 }