コード例 #1
0
        public override void Save(Bookmark[] bookmarks)
        {
            if (bookmarks == null)
            {
                throw new ArgumentNullException(nameof(bookmarks));
            }
            if (bookmarks.Length == 0)
            {
                return;
            }
            var filename = pickSaveFilename.GetFilename(null, "xml", PickFilenameConstants.XmlFilenameFilter);

            if (filename == null)
            {
                return;
            }
            var settingsService = settingsServiceFactory.Value.Create();

            new BookmarksSerializer(settingsService, bookmarkLocationSerializerService.Value).Save(bookmarks);
            try {
                settingsService.Save(filename);
            }
            catch (Exception ex) {
                messageBoxService.Show(ex);
            }
        }
コード例 #2
0
        void OnPickNetExecutableFileName()
        {
            if (pickSaveFilename == null)
            {
                throw new InvalidOperationException();
            }
            var newFileName = pickSaveFilename.GetFilename(FileName, GetExtension(FileName), PickFilenameConstants.DotNetAssemblyOrModuleFilter);

            if (newFileName == null)
            {
                return;
            }
            FileName = newFileName;
        }
コード例 #3
0
ファイル: ReplEditor.cs プロジェクト: weimingtom/dnSpy
        void SaveToFile(string filenameNoExtension, string fileExtension, string filesFilter, string fileContents)
        {
            if (fileExtension.Length > 0 && fileExtension[0] == '.')
            {
                fileExtension = fileExtension.Substring(1);
            }
            var filename = pickSaveFilename.GetFilename(filenameNoExtension + "." + fileExtension, fileExtension, filesFilter);

            if (filename == null)
            {
                return;
            }
            try {
                File.WriteAllText(filename, fileContents);
            }
            catch (Exception ex) {
                MsgBox.Instance.Show(ex);
            }
        }
コード例 #4
0
        public void SaveText()
        {
            if (!CanSaveText)
            {
                return;
            }
            var vm       = SelectedOutputBufferVM;
            var filename = pickSaveFilename.GetFilename(GetFilename(vm), "txt", TEXTFILES_FILTER);

            if (filename == null)
            {
                return;
            }
            try {
                File.WriteAllText(filename, vm.GetText());
            }
            catch (Exception ex) {
                MsgBox.Instance.Show(ex);
            }
        }
コード例 #5
0
        void SaveBreakpoints(IEnumerable <ModuleBreakpointVM> vms)
        {
            if (!vms.Any())
            {
                return;
            }
            var filename = pickSaveFilename.GetFilename(null, "xml", PickFilenameConstants.XmlFilenameFilter);

            if (filename is null)
            {
                return;
            }
            var settingsService = settingsServiceFactory.Value.Create();

            new BreakpointsSerializer(settingsService).Save(vms.Select(a => a.ModuleBreakpoint).ToArray());
            try {
                settingsService.Save(filename);
            }
            catch (Exception ex) {
                messageBoxService.Show(ex);
            }
        }