Ejemplo n.º 1
0
        private void ParseFile(int file, IEnumerable <MethodBlock> filePoints)
        {
            var filePath = Services.getService <IReportService>().Report.ResolveFilePath(file);

            if (filePath == null || !File.Exists(filePath))
            {
                return;
            }

            var sourceViewer = GetFileTextBox(file);

            if (sourceViewer == null)
            {
                sourceViewer = new ViewControl
                {
                    Dock        = DockStyle.Fill,
                    Document    = CreateDocument(filePath),
                    BorderStyle = BorderStyle.FixedSingle
                };
                sourceViewer.View.ViewStyle.HideInactiveCursor    = false;
                sourceViewer.View.ViewStyle.HideInactiveSelection = false;

                var record = new FileTag
                {
                    FileId = file
                };

                var page = new TabPage
                {
                    Tag  = record,
                    Text = Path.GetFileName(filePath)
                };
                page.Controls.Add(sourceViewer);

                pnTabs.TabPages.Add(page);

                pnTabs.SelectedTab = page;
            }

            List <MethodBlock> bList;

            if (Settings.Default.HighlightAllFile)
            {
                bList = new List <MethodBlock>();

                ReportHelper.ForEachBlock(Services.getService <IReportService>().Report,
                                          bd => { if (bd.File == file)
                                                  {
                                                      bList.Add(bd);
                                                  }
                                          });
            }
            else
            {
                sourceViewer.Document.RemoveStylizerAll();
                bList = new List <MethodBlock>(filePoints);
            }

            sourceViewer.Document.Add(new BlockStylizer(bList.ToArray()));
        }
Ejemplo n.º 2
0
Archivo: Plug.cs Proyecto: devjerome/3P
        internal static void DoPlugStart()
        {
            if (OnPlugReady != null)
            {
                OnPlugReady();
            }

            // subscribe to static events
            ProEnvironment.OnEnvironmentChange += FileExplorer.RebuildFileList;
            ProEnvironment.OnEnvironmentChange += DataBase.UpdateDatabaseInfo;
            DataBase.OnDatabaseInfoUpdated     += AutoComplete.RefreshStaticItems;

            ParserHandler.OnParseStarted += () => { CodeExplorer.Refreshing = true; };
            ParserHandler.OnParseEnded   += AutoComplete.RefreshDynamicItems;
            ParserHandler.OnParseEnded   += CodeExplorer.UpdateCodeExplorer;

            AutoComplete.OnUpdatedStaticItems += Parser.UpdateKnownStaticItems;

            Keywords.Import();
            Snippets.Init();
            FileTag.Import();

            // initialize the list of objects of the autocompletion form
            AutoComplete.RefreshStaticItems();

            // Simulates a OnDocumentSwitched when we start this dll
            IsCurrentFileProgress = Abl.IsCurrentProgressFile; // to correctly init isPreviousProgress
            DoNppBufferActivated(true);                        // triggers OnEnvironmentChange via ProEnvironment.Current.ReComputeProPath();

            // Make sure to give the focus to scintilla on startup
            WinApi.SetForegroundWindow(Npp.HandleNpp);
        }
Ejemplo n.º 3
0
Archivo: Plug.cs Proyecto: devjerome/3P
        /// <summary>
        /// Called on Npp shutdown
        /// </summary>
        internal static void DoNppShutDown()
        {
            try {
                if (OnShutDown != null)
                {
                    OnShutDown();
                }

                // clean up timers
                ReccurentAction.CleanAll();
                DelayedAction.CleanAll();

                // export modified conf
                FileTag.Export();

                // save config (should be done but just in case)
                CodeExplorer.UpdateMenuItemChecked();
                FileExplorer.UpdateMenuItemChecked();
                Config.Save();

                // remember the most used keywords
                Keywords.SaveRanking();

                // close every form
                AutoComplete.ForceClose();
                InfoToolTip.ForceClose();
                Appli.ForceClose();
                FileExplorer.ForceClose();
                CodeExplorer.ForceClose();
                UserCommunication.ForceClose();
                AppliMenu.ForceCloseMenu();
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Stop");
            }
        }
Ejemplo n.º 4
0
        public bool VerifyFile(CheckUpdateDto data)
        {
            FileTag fileTags = new FileTag();
            SlideTagExCollection     slideTags = new SlideTagExCollection();
            LibrarianContentManifest libraryContentManifest = new LibrarianContentManifest();

            using (Stream stream = new FileStream(data.FileUrl, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (PresentationDocument openXmlDoc = PresentationDocument.Open(stream, false))
                {
                    var presentationPart = openXmlDoc.PresentationPart;
                    fileTags  = _tagManagerService.GetFileTag(presentationPart);
                    slideTags = _tagManagerService.GetSlideTags(presentationPart);
                    libraryContentManifest = XmlUtils.Deserialize <LibrarianContentManifest>(_filesService.GetCustomXmlPart(presentationPart));

                    if (fileTags != null)
                    {
                        return(true);
                    }

                    if (slideTags.Count > 0)
                    {
                        return(true);
                    }

                    if (libraryContentManifest != null)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Ejemplo n.º 5
0
 private void BtDeleteOnButtonPressed(object sender, EventArgs eventArgs)
 {
     if (FileTag.DeleteFileTags(_filename, _locFileTagObject.CorrectionNumber))
     {
         UpdateInfo();
     }
 }
Ejemplo n.º 6
0
Archivo: Plug.cs Proyecto: massreuy/3P
        /// <summary>
        /// Called on Npp shutdown
        /// </summary>
        internal static void DoNppShutDown()
        {
            try {
                if (OnShutDown != null)
                {
                    OnShutDown();
                }

                // clean up timers
                RecurentAction.CleanAll();
                DelayedAction.CleanAll();
                AsapButDelayableAction.CleanAll();

                // Triggered when the resolution of an assembly fails, gives us the opportunity to feed the required assembly
                AppDomain.CurrentDomain.AssemblyResolve -= LibLoader.AssemblyResolver;

                // catch unhandled errors to log them
                AppDomain.CurrentDomain.UnhandledException -= ErrorHandler.UnhandledErrorHandler;
                Application.ThreadException           -= ErrorHandler.ThreadErrorHandler;
                TaskScheduler.UnobservedTaskException -= ErrorHandler.UnobservedErrorHandler;

                // unsubscribe to static events
                ProEnvironment.OnEnvironmentChange -= FileExplorer.Instance.RebuildFileList;
                ProEnvironment.OnEnvironmentChange -= DataBase.Instance.UpdateDatabaseInfo;
                ProEnvironment.OnEnvironmentChange -= ParserHandler.ClearStaticData;

                Keywords.Instance.OnImport         -= AutoCompletion.SetStaticItems;
                DataBase.Instance.OnDatabaseUpdate -= AutoCompletion.SetStaticItems;
                AutoCompletion.OnUpdateStaticItems -= ParserHandler.UpdateKnownStaticItems;

                ParserHandler.OnEndSendCompletionItems -= AutoCompletion.SetDynamicItems;
                ParserHandler.OnStart -= CodeExplorer.Instance.OnStart;
                ParserHandler.OnEndSendParserItems       -= CodeExplorer.Instance.OnParseEndParserItems;
                ParserHandler.OnEndSendCodeExplorerItems -= CodeExplorer.Instance.OnParseEndCodeExplorerItems;
                ParserHandler.OnEnd -= CodeExplorer.Instance.OnParseEnd;

                ProExecutionHandleCompilation.OnEachCompilationOk -= FilesInfo.ProExecutionHandleCompilationOnEachCompilationOk;

                // export modified conf
                FileTag.Export();

                // save config (should be done but just in case)
                Config.Save();

                // remember the most used keywords
                Keywords.Instance.SaveRanking();

                // close every form
                FileExplorer.Instance.ForceClose();
                CodeExplorer.Instance.ForceClose();
                AutoCompletion.ForceClose();
                InfoToolTip.ForceClose();
                Appli.ForceClose();
                UserCommunication.ForceClose();
                AppliMenu.ForceClose();
            } catch (Exception e) {
                ErrorHandler.ShowErrors(e, "Stop");
            }
        }
Ejemplo n.º 7
0
 private void BtOkOnButtonPressed(object sender, EventArgs buttonPressedEventArgs)
 {
     Save(_filename);
     Save(FileTag.LastTag);
     UpdateInfo();
     FileTag.Export();
     Appli.ToggleView();
 }
 public FileSearchParameters(string rootPath, string fileName, string fileContent, FileTag fileTag, FileType fileType)
 {
     RootPath    = rootPath;
     FileName    = fileName;
     FileContent = fileContent;
     FileTag     = fileTag;
     FileType    = fileType;
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 按类别清理文件
        /// </summary>
        /// <param name="tag">文件类别</param>
        /// <param name="repository"></param>
        /// <returns></returns>
        private async Task CleanFilesWithTagAsync(FileTag tag, IFileInfoRepository repository)
        {
            List <Domain.AggregatesModel.FileInfoAggregate.FileInfo> notUsedFileInfos;

            switch (tag)
            {
            case FileTag.App:
            case FileTag.AppOriginal:
            case FileTag.AppThumbnail:
                notUsedFileInfos = await repository.GetNotUsedAppImagesAsync(tag);

                break;

            case FileTag.AppVideo:
                notUsedFileInfos = await repository.GetNotUsedAppVideosAsync(tag);

                break;

            case FileTag.Chat:
            case FileTag.ChatThumbnail:
            case FileTag.ChatVideo:
                // 删除早于距当前时间超过任务执行间隔的聊天文件
                var oldestTime = DateTime.UtcNow.AddHours(-_chatCleanSettings.IntervalHours);
                notUsedFileInfos = await repository.GetAllChatFileInfosAsync(oldestTime);

                break;

            default:
                return;
            }

            notUsedFileInfos.ForEach(fi =>
            {
                var delResult = false;

                // 由于聊天文件是统一删除,因此如果类别是聊天中的任意一种,则删除所有聊天文件
                // app内文件按传入类别删除
                if (tag == FileTag.Chat || tag == FileTag.ChatThumbnail || tag == FileTag.ChatVideo)
                {
                    delResult = DeleteFile(fi.Name, FileTag.Chat) && DeleteFile(fi.Name, FileTag.ChatThumbnail) && DeleteFile(fi.Name, FileTag.ChatVideo);
                }
                else
                {
                    delResult = DeleteFile(fi.Name, tag);
                }

                // 如果删除文件成功则删除数据库数据
                if (delResult)
                {
                    repository.Remove(fi);
                }
            });
        }
Ejemplo n.º 10
0
Archivo: Plug.cs Proyecto: massreuy/3P
        internal static void DoPlugStart()
        {
            if (OnPlugReady != null)
            {
                OnPlugReady();
            }

            // subscribe to static events
            ProEnvironment.OnEnvironmentChange += FileExplorer.Instance.RebuildFileList;
            ProEnvironment.OnEnvironmentChange += DataBase.Instance.UpdateDatabaseInfo;
            ProEnvironment.OnEnvironmentChange += ParserHandler.ClearStaticData;

            Keywords.Instance.OnImport         += AutoCompletion.SetStaticItems;
            DataBase.Instance.OnDatabaseUpdate += AutoCompletion.SetStaticItems;
            AutoCompletion.OnUpdateStaticItems += ParserHandler.UpdateKnownStaticItems;

            ParserHandler.OnEndSendCompletionItems += AutoCompletion.SetDynamicItems;
            ParserHandler.OnStart += CodeExplorer.Instance.OnStart;
            ParserHandler.OnEndSendParserItems       += CodeExplorer.Instance.OnParseEndParserItems;
            ParserHandler.OnEndSendCodeExplorerItems += CodeExplorer.Instance.OnParseEndCodeExplorerItems;
            ParserHandler.OnEnd += CodeExplorer.Instance.OnParseEnd;

            ProExecutionHandleCompilation.OnEachCompilationOk += FilesInfo.ProExecutionHandleCompilationOnEachCompilationOk;

            // Clear the %temp% directory if we didn't do it properly last time
            Utils.DeleteDirectory(Config.FolderTemp, true);

            //Snippets.Init();
            FileTag.Import();

            // ask to disable the default autocompletion
            DelayedAction.StartNew(100, () => {
                if (!Npp.ConfXml.AskToDisableAutocompletionAndRestart())
                {
                    // check if an update was done
                    UpdateHandler.CheckForUpdateDone();
                }
            });

            // start checking for new updates
            UpdateHandler.StartCheckingForUpdate(); // async

            // Try to update the configuration from the distant shared folder
            ShareExportConf.StartCheckingForUpdates();

            // ReSharper disable once ObjectCreationAsStatement
            RecurentAction.StartNew(User.Ping, 1000 * 60 * 120);

            // Make sure to give the focus to scintilla on startup
            Sci.GrabFocus();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Call this method to update the content of the form according to the current document
        /// </summary>
        public void UpdateInfo()
        {
            _filename = Npp.CurrentFile.FileName;

            // populate combobox
            var list = new List <ItemCombo> {
                new ItemCombo {
                    DisplayText = "Last info", Nb = FileTag.LastTag
                },
                new ItemCombo {
                    DisplayText = "Default info", Nb = FileTag.DefaultTag
                }
            };

            cb_info.DisplayMember = "DisplayText";
            cb_info.ValueMember   = "Nb";

            if (FileTag.Contains(_filename))
            {
                var currentList = FileTag.GetFileTagsList(_filename);
                _locFileTagObject = currentList.Last();

                var i           = 2;
                var lastItemPos = 0;
                foreach (var fileTag in currentList.OrderByDescending(o => o.CorrectionNumber).ToList())
                {
                    list.Add(new ItemCombo {
                        DisplayText = _filename + " # " + fileTag.CorrectionNumber, Nb = fileTag.CorrectionNumber
                    });
                    if (fileTag.CorrectionNumber.Equals(_locFileTagObject.CorrectionNumber))
                    {
                        lastItemPos = i;
                    }
                    i++;
                }

                cb_info.DataSource    = list;
                cb_info.SelectedIndex = lastItemPos;
            }
            else
            {
                _locFileTagObject = FileTag.GetFileTags(Config.Instance.UseDefaultValuesInsteadOfLastValuesInEditTags ? FileTag.DefaultTag : FileTag.LastTag, "");

                cb_info.DataSource    = list;
                cb_info.SelectedIndex = Config.Instance.UseDefaultValuesInsteadOfLastValuesInEditTags ? 1 : 0;
            }

            UpdateView();
            ActiveControl = cb_info;
        }
Ejemplo n.º 12
0
        /// <summary>
        /// called when the user changes the value of the combo box
        /// </summary>
        private void SelectedIndexChanged(YamuiComboBox sender)
        {
            var val = cb_info.SelectedValue.ToString();

            if (val.Equals(FileTag.LastTag) || val.Equals(FileTag.DefaultTag))
            {
                _locFileTagObject = FileTag.GetFileTags(val, "");
            }
            else
            {
                _locFileTagObject = FileTag.GetFileTags(_filename, val);
                FileTag.SetFileTags(_filename, _locFileTagObject.CorrectionNumber, _locFileTagObject.CorrectionDate, _locFileTagObject.CorrectionDecription, _locFileTagObject.ApplicationName, _locFileTagObject.ApplicationVersion, _locFileTagObject.WorkPackage, _locFileTagObject.BugId);
            }
            UpdateView();
        }
Ejemplo n.º 13
0
        //PRIVATE METHOD
        private bool CheckFileForUpdates(FileTag fileTag, SlideTagExCollection slideTags, CheckUpdateDto fileInfo)
        {
            bool updatesExist = false;

            if (fileTag != null)
            {
                updatesExist = CheckContentForUpdates(fileTag.File.ContentType, fileTag.File.LastModDate.ToUniversalTime(), fileInfo);
            }

            if (slideTags != null)
            {
                updatesExist |= CheckSlidesForUpdates(slideTags, isLibraryFile, fileInfo);
            }

            return(updatesExist);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 从磁盘删除文件
        /// </summary>
        /// <param name="name">文件名</param>
        /// <param name="tag">文件类别</param>
        /// <returns>删除成功返回true,否则返回false</returns>
        private bool DeleteFile(string name, FileTag tag)
        {
            var folder   = GetFolderByTag(tag);
            var filePath = Path.Combine(folder, name);

            try
            {
                System.IO.File.Delete(filePath);
                _logger.LogError("deleted {File}", filePath);
                return(true);
            }
            catch (Exception ex)
            {
                _logger.LogError("delete {File} failed: {@DeleteFileException}", filePath, ex);
                return(false);
            }
        }
Ejemplo n.º 15
0
        public FileTagCollection GetFileData(XElement fileElement)
        {
            FileTagCollection result = new FileTagCollection();

            var tagElements = fileElement.Descendants("tag");

            foreach (var te in tagElements)
            {
                FileTag tag = new FileTag()
                {
                    Key   = te.Attribute("key").Value,
                    Value = te.Attribute("value").Value
                };
                result.Add(tag);
            }

            return(result);
        }
        public FileTag GetFileTag(PresentationPart presentationPart)
        {
            FileTag fileTag = null;

            if (presentationPart.UserDefinedTagsPart != null)
            {
                var tagList = presentationPart.UserDefinedTagsPart.TagList;

                foreach (Tag tag in tagList.ChildElements)
                {
                    if (tag.Name.Value.Equals(PL_TAG))
                    {
                        fileTag = XmlUtils.Deserialize <FileTag>(tag.Val.ToString());
                    }
                }
            }

            return(fileTag);
        }
Ejemplo n.º 17
0
        public string AddFileR(TagDto tagDto, File fileInDb)
        {
            var tagInDb = ExistName(tagDto.Name, true).FirstOrDefault();

            if (tagInDb == null)
            {
                var createdTag = CreateNew(tagDto);
                if (createdTag == null)
                {
                    return("Tag not created!");
                }

                var newTag     = createdTag;
                var newFileTag = new FileTag
                {
                    FileId = fileInDb.Id,
                    TagId  = newTag.Id
                };
                Context.FileTags.AddAsync(newFileTag);

                return(null);
            }

            if (string.IsNullOrEmpty(tagDto.Name))
            {
                return("You send a null or empty Tag!");
            }

            var typeHasClub = fileInDb.FileTags.Any(cr => cr.TagId == tagInDb.Id);

            if (!typeHasClub)
            {
                var newFileTag = new FileTag
                {
                    FileId = fileInDb.Id,
                    TagId  = tagInDb.Id
                };
                Context.FileTags.AddAsync(newFileTag);
            }

            return(null);
        }
Ejemplo n.º 18
0
 public void SetFileTag(List <ListedItem> selectedItems, FileTag selectedTag)
 {
     if (selectedItems == null || selectedItems.Count == 0)
     {
         return;
     }
     else if (selectedItems.Count == 1)
     {
         selectedItems.First().FileTag = selectedTag?.Uid;
     }
     else
     {
         var tag = selectedItems.First().FileTag;
         if (selectedTag != null || selectedItems.All(x => x.FileTag == tag))
         {
             foreach (var item in selectedItems)
             {
                 item.FileTag = selectedTag?.Uid;
             }
         }
     }
 }
Ejemplo n.º 19
0
        protected override bool SetExecutionInfo()
        {
            if (!base.SetExecutionInfo())
            {
                return(false);
            }

            // prolint, we need to copy the StartProlint program
            var fileToExecute = "prolint_" + DateTime.Now.ToString("yyMMdd_HHmmssfff") + ".p";

            _prolintOutputPath = Path.Combine(_localTempDir, "prolint.log");

            StringBuilder prolintProgram = new StringBuilder();

            prolintProgram.AppendLine("&SCOPED-DEFINE PathFileToProlint " + Files.First().CompiledSourcePath.ProQuoter());
            prolintProgram.AppendLine("&SCOPED-DEFINE PathProlintOutputFile " + _prolintOutputPath.ProQuoter());
            prolintProgram.AppendLine("&SCOPED-DEFINE PathToStartProlintProgram " + Config.FileStartProlint.ProQuoter());
            prolintProgram.AppendLine("&SCOPED-DEFINE UserName " + Config.Instance.UserName.ProQuoter());
            prolintProgram.AppendLine("&SCOPED-DEFINE PathActualFilePath " + Files.First().SourcePath.ProQuoter());
            var filename = Npp.CurrentFile.FileName;

            if (FileTag.Contains(filename))
            {
                var fileInfo = FileTag.GetLastFileTag(filename);
                prolintProgram.AppendLine("&SCOPED-DEFINE FileApplicationName " + fileInfo.ApplicationName.ProQuoter());
                prolintProgram.AppendLine("&SCOPED-DEFINE FileApplicationVersion " + fileInfo.ApplicationVersion.ProQuoter());
                prolintProgram.AppendLine("&SCOPED-DEFINE FileWorkPackage " + fileInfo.WorkPackage.ProQuoter());
                prolintProgram.AppendLine("&SCOPED-DEFINE FileBugID " + fileInfo.BugId.ProQuoter());
                prolintProgram.AppendLine("&SCOPED-DEFINE FileCorrectionNumber " + fileInfo.CorrectionNumber.ProQuoter());
                prolintProgram.AppendLine("&SCOPED-DEFINE FileDate " + fileInfo.CorrectionDate.ProQuoter());
            }
            var encoding = TextEncodingDetect.GetFileEncoding(Config.FileStartProlint);

            Utils.FileWriteAllText(Path.Combine(_localTempDir, fileToExecute), Utils.ReadAllText(Config.FileStartProlint, encoding).Replace(@"/*<inserted_3P_values>*/", prolintProgram.ToString()), encoding);

            SetPreprocessedVar("CurrentFilePath", fileToExecute.ProQuoter());

            return(true);
        }
Ejemplo n.º 20
0
        //update file tags
        public bool AddOrUpdateFileTags(int fileId, List <Tag> tags)
        {
            using (var _dc = new DataContext())
            {
                bool result = false;

                var entities = _dc.FileTags.Where(x => x.FileId == fileId);

                //if there are any tags, remove them all so we can insert the new ones
                if (entities != null)
                {
                    foreach (var item in entities)
                    {
                        _dc.FileTags.Remove(item);
                    }

                    result = Convert.ToBoolean(_dc.SaveChanges());
                }

                //insert new tags, if any
                if (tags.Count() > 0)
                {
                    foreach (var tag in tags)
                    {
                        var entity = new FileTag();
                        entity.FileId    = fileId;
                        entity.TagId     = tag.TagId;
                        entity.DateAdded = DateTimeOffset.Now;

                        _dc.FileTags.Add(entity);

                        result = Convert.ToBoolean(_dc.SaveChanges());
                    }
                }

                return(result);
            }
        }
 public Task <List <FileInfo> > GetNotUsedAppVideosAsync(FileTag tag)
 {
     return(_context.FileInfos.FromSqlRaw("EXECUTE dbo.GetNotUsedAppVideos {0}", tag).ToListAsync());
 }
 public async Task <FileInfo> GetFileInfoAsync(string name, FileTag tag)
 {
     return(await _context.FileInfos.FirstOrDefaultAsync(f => f.Name.ToLower() == name.ToLower() && f.Tag == tag));
 }
Ejemplo n.º 23
0
        private AppliMenu()
        {
            // List of item that can be assigned to a shortcut
            ShortcutableItemList = new List <MenuItem> {
                // add the main menu here, so it can appear in the list of shortcut to set
                new MenuItem(null, "Open main menu", ImageResources.Logo20x20, item => ShowMainMenu(), "Show_main_menu_", "Alt+C")
                {
                    Generic = true
                }
            };

            #region Progress tools

            _progressTools = new List <MenuItem> {
                new MenuItem(this, "Progress desktop", ImageResources.ProDesktop, item => ProMisc.OpenProDesktop(), "Pro_desktop", "")
                {
                    Generic = true
                },
                new MenuItem(this, "Open in the AppBuilder", ImageResources.SendToAppbuilder, item => ProMisc.OpenCurrentInAppbuilder(), "Send_appbuilder", "Alt+O"),
                new MenuItem(true)
                {
                    Generic = true
                },                                   // --------------------------
                new MenuItem(this, "PROLINT code", ImageResources.ProlintCode, item => ProMisc.StartProgressExec(ExecutionType.Prolint), "Prolint", "F12"),
                new MenuItem(this, "Deploy current file", ImageResources.Deploy, item => ProMisc.DeployCurrentFile(), "Deploy", "Ctrl+Alt+Prior")
                {
                    Generic = true
                },
                new MenuItem(this, "Generate DEBUG-LIST", ImageResources.ExtDbg, item => ProMisc.StartProgressExec(ExecutionType.GenerateDebugfile, compilation => compilation.CompileWithDebugList = true), "Generate_debug-list", null),
                new MenuItem(this, "Generate LISTING", ImageResources.ExtLis, item => ProMisc.StartProgressExec(ExecutionType.GenerateDebugfile, compilation => compilation.CompileWithListing      = true), "Generate_listing", null),
                new MenuItem(this, "Generate XREF", ImageResources.ExtXrf, item => ProMisc.StartProgressExec(ExecutionType.GenerateDebugfile, compilation => compilation.CompileWithXref            = true), "Generate_xref", null),
                new MenuItem(this, "Generate XREF-XML", ImageResources.ExtXml, item => ProMisc.StartProgressExec(ExecutionType.GenerateDebugfile, compilation => {
                    compilation.CompileWithXref = true;
                    compilation.UseXmlXref      = true;
                }), "Generate_xrefxml", null),
            };

            #endregion

            #region Generate code

            _generateCodeMenuList = new List <MenuItem> {
                new MenuItem(this, "Insert new internal procedure", ImageResources.Procedure, item => ProGenerateCode.Factory.InsertCode <ParsedProcedure>(), "Insert_new_procedure", "Alt+P"),
                new MenuItem(this, "Insert new function", ImageResources.Function, item => ProGenerateCode.Factory.InsertCode <ParsedImplementation>(), "Insert_new_function", "Alt+F"),
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Delete existing internal procedure", ImageResources.DeleteProcedure, item => ProGenerateCode.Factory.DeleteCode <ParsedProcedure>(), "Delete_procedure", ""),
                new MenuItem(this, "Delete existing function", ImageResources.DeleteFunction, item => ProGenerateCode.Factory.DeleteCode <ParsedImplementation>(), "Delete_function", ""),
                new MenuItem(true), // --------------------------
                new MenuItem(this, "Synchronize function prototypes", ImageResources.Synchronize, item => ProGenerateCode.Factory.UpdateFunctionPrototypesIfNeeded(), "Synchronize_prototypes", "Alt+S")
            };

            #endregion

            #region Edit code

            _editCodeList = new List <MenuItem> {
                new MenuItem(this, "Display parser errors", ImageResources.DisplayParserResults, item => ProCodeFormat.DisplayParserErrors(), "Check_parser_errors", null),
                new MenuItem(this, "Toggle comment line", ImageResources.ToggleComment, item => ProMisc.ToggleComment(), "Toggle_Comment", "Ctrl+Q"),
                new MenuItem(this, "Correct document indentation", ImageResources.IndentCode, item => ProCodeFormat.CorrectCodeIndentation(), "Reindent_document", "Ctrl+I")
                //new MenuItem(this, "Format document", ImageResources.FormatCode, CodeBeautifier.CorrectCodeIndentation, "Format_document", "Ctrl+I"),
            };

            #endregion

            #region Misc

            _miscMenuList = new List <MenuItem> {
                new MenuItem(this, "Edit current file info", ImageResources.FileInfo, item => Appli.Appli.GoToPage(PageNames.FileInfo), "Edit_file_info", "Ctrl+Shift+M"),
                new MenuItem(this, "Insert title block", ImageResources.TitleBlock, item => FileTag.AddTitleBlockAtCaret(), "Insert_title_block", "Ctrl+Alt+M"),
                new MenuItem(this, "Surround with modification tags", ImageResources.ModificationTag, item => FileTag.SurroundSelectionWithTag(), "Modif_tags", "Ctrl+M")
                //new MenuItem(this, "Insert mark", ImageResources.InsertMark, null, "Insert_mark", "Ctrl+T"),
            };

            #endregion

            #region database tools

            _databaseTools = new List <MenuItem> {
                new MenuItem(this, "Open data administration", ImageResources.DataAdmin, item => ProMisc.OpenDbAdmin(), "Data_admin", "")
                {
                    Generic = true
                },
                new MenuItem(this, "Open progress dictionary", ImageResources.Dictionary, item => ProMisc.OpenDictionary(), "Data_dictionary", "")
                {
                    Generic = true
                },
                new MenuItem(true)
                {
                    Generic = true
                },                                   // --------------------------
                new MenuItem(this, "Explore and modify your data", ImageResources.DataDigger, item => ProMisc.OpenDataDigger(), "Data_digger", "")
                {
                    Generic = true
                },
                new MenuItem(this, "Explore (read-only) your data", ImageResources.DataReader, item => ProMisc.OpenDataReader(), "Data_reader", "")
                {
                    Generic = true
                }
            };

            #endregion

            #region Main menu

            var goToDefItem = new MenuItem(this, "Go to definition", ImageResources.GoToDefinition, item => ProMisc.GoToDefinition(false), "Go_To_Definition", "Ctrl+B")
            {
                Generic = true
            };
            goToDefItem.SubText = "Middle click  /  " + goToDefItem.SubText;
            var goToPreviousJump = new MenuItem(this, "Go to previous jump point", ImageResources.GoBackward, item => Npp.GoBackFromDefinition(), "Go_Backwards", "Ctrl+Shift+B")
            {
                Generic = true
            };
            goToPreviousJump.SubText = "Ctrl + Middle click  /  " + goToPreviousJump.SubText;

            MainMenuList = new List <MenuItem> {
                new MenuItem(this, "Show main window", ImageResources.MainWindow, item => Appli.Appli.ToggleView(), "Open_main_window", "Alt+Space")
                {
                    Generic = true
                },
                new MenuItem(this, "Show autocompletion at caret", ImageResources.Autocompletion, item => AutoCompletion.OnShowCompleteSuggestionList(), "Show_Suggestion_List", "Ctrl+Space")
                {
                    Generic = true
                },
                new MenuItem(true)
                {
                    Generic = true
                },                                   // --------------------------
                new MenuItem(this, "Open 4GL help", ImageResources.ProgressHelp, item => ProMisc.Open4GlHelp(), "Open_4GL_help", "F1")
                {
                    Generic = true
                },
                new MenuItem(this, "Check syntax", ImageResources.CheckCode, item => ProMisc.StartProgressExec(ExecutionType.CheckSyntax), "Check_syntax", "Shift+F1"),
                new MenuItem(this, "Run program", ImageResources.RunCode, item => ProMisc.StartProgressExec(ExecutionType.Run), "Run_program", "Ctrl+F1"),
                new MenuItem(this, "Compile", ImageResources.CompileCode, item => ProMisc.StartProgressExec(ExecutionType.Compile), "Compile", "Alt+F1"),
                new MenuItem(this, "Compile options", ImageResources.CompileOptions, item => ProMisc.OpenCompilationOptions(), "Compile_options", null),
                new MenuItem(this, "Progress tools", ImageResources.ProgressTools, item => ShowProgressToolsMenu(), "Progress_tools", "Alt+T")
                {
                    Generic  = true,
                    Children = _progressTools.Cast <FilteredTypeTreeListItem>().ToList()
                },
                new MenuItem(true)
                {
                    Generic = true
                },                                   // --------------------------
                new MenuItem(this, "Start searching files", ImageResources.Search, item => FileExplorer.FileExplorer.Instance.StartSearch(), "Search_file", "Alt+Q")
                {
                    Generic = true
                },
                goToDefItem,
                goToPreviousJump,
                //new MenuItem(this, "New 4GL file", ImageResources.GenerateCode, ShowNewFileAtCursor, "New_file", "Ctrl+Shift+N") {
                //    Children = GenerateCodeMenuList.Select(item => (YamuiMenuItem)item).ToList(),
                //},
                new MenuItem(true)
                {
                    Generic = true
                },                                   // --------------------------
                new MenuItem(this, "Switch environment", ImageResources.Env, item => ShowEnvMenu(), "Switch_env", "Ctrl+E")
                {
                    Generic = true
                },
                new MenuItem(this, "Database tools", ImageResources.DatabaseTools, item => ShowDatabaseToolsMenu(), "DatabaseTools", "Alt+D")
                {
                    Generic  = true,
                    Children = _databaseTools.Cast <FilteredTypeTreeListItem>().ToList()
                },
                new MenuItem(this, "Generate and revise code", ImageResources.GenerateCode, item => ShowGenerateCodeMenu(), "Generate_code", "Alt+Insert")
                {
                    Generic  = true,
                    Children = _generateCodeMenuList.Cast <FilteredTypeTreeListItem>().ToList()
                },
                new MenuItem(this, "Edit code", ImageResources.EditCode, item => ShowEditCodeMenu(), "Edit_code", "Alt+E")
                {
                    Generic  = true,
                    Children = _editCodeList.Cast <FilteredTypeTreeListItem>().ToList()
                },
                new MenuItem(this, "Miscellaneous", ImageResources.Miscellaneous, item => ShowMiscMenu(), "Miscellaneous", "Alt+M")
                {
                    Generic  = true,
                    Children = _miscMenuList.Cast <FilteredTypeTreeListItem>().ToList()
                },
                new MenuItem(true)
                {
                    Generic = true
                },                                   // --------------------------
                new MenuItem(this, "Options", ImageResources.ShowOptions, item => Appli.Appli.GoToPage(PageNames.OptionsGeneral), "Go_to_options", null)
                {
                    Generic = true
                }
            };

            #endregion

            #region special dev

            if (Config.IsDevelopper)
            {
                MainMenuList.Add(
                    new MenuItem(this, "Tests", ImageResources.Tests, null, null, null, new List <MenuItem> {
                    new MenuItem(this, "DebugTest1", ImageResources.TestTube, item => PlugDebug.DebugTest1(), "DebugTest1", "Ctrl+OemQuotes")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "DebugTest2", ImageResources.TestTube, item => PlugDebug.DebugTest2(), "DebugTest2", "Alt+OemQuotes")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "DebugTest3", ImageResources.TestTube, item => PlugDebug.DebugTest3(), "DebugTest3", "Shift+OemQuotes")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "Parse current file", ImageResources.TestTube, item => PlugDebug.ParseCurrentFile(), "ParseCurrentFile", "")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "Parse reference file", ImageResources.TestTube, item => PlugDebug.ParseReferenceFile(), "ParseReferenceFile", "")
                    {
                        Generic = true
                    },
                    new MenuItem(this, "Parse all files", ImageResources.TestTube, item => PlugDebug.ParseAllFiles(), "ParseAllFiles", "")
                    {
                        Generic = true
                    }
                })
                {
                    Generic = true
                });
            }

            #endregion
        }
Ejemplo n.º 24
0
        private void ParseFile(uint file, IEnumerable<CoverageReport.InnerBlock> filePoints)
        {
            string filePath = Services.GetService<ICoverageReportService>().Report.GetFilePath(file);
            if (filePath == null || !File.Exists(filePath))
                return;

            ViewControl sourceViewer = GetFileTextBox(file);

            if (sourceViewer == null)
            {
                sourceViewer = new ViewControl();
                sourceViewer.Dock = DockStyle.Fill;
                sourceViewer.Document = CreateDocument(filePath);
                sourceViewer.BorderStyle = BorderStyle.FixedSingle;
                sourceViewer.View.ViewStyle.HideInactiveCursor = false;
                sourceViewer.View.ViewStyle.HideInactiveSelection = false;

                FileTag record = new FileTag();
                record.fileId = file;

                TabPage page = new TabPage();
                page.Tag = record;
                page.Text = Path.GetFileName(filePath);
                page.Controls.Add(sourceViewer);

                pnTabs.TabPages.Add(page);

                pnTabs.SelectedTab = page;
            }

            List<CoverageReport.InnerBlock> bList;

            if (Settings.Default.HighlightAllFile)
            {
                bList = new List<CoverageReport.InnerBlock>();

                Services.GetService<ICoverageReportService>().Report.ForEachBlock(
                    delegate(CoverageReport.InnerBlock bd)
                    {
                        if (bd.fileId == file) bList.Add(bd);
                    });
            }
            else
            {
                sourceViewer.Document.removeStylizers();
                bList = new List<CoverageReport.InnerBlock>(filePoints);
            }

            sourceViewer.Document.addStylizer(new BlockStylizer(bList.ToArray()));
        }
        public bool SetTags(CheckUpdateDto data, bool overwriteExistingTags)
        {
            bool setTags = false;

            using (Stream stream = new FileStream(data.FileUrl, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite))
            {
                using (PresentationDocument openXmlDoc = PresentationDocument.Open(stream, true))
                {
                    var presentationPart           = openXmlDoc.PresentationPart;
                    SlideTagExCollection slideTags = GetSlideTags(presentationPart);
                    var libraryFileSlides          = _fileService.GetFileSlidesInfo(data);

                    if (overwriteExistingTags || !slideTags.Any())
                    {
                        var fileInfo = _fileService.GetFileInfo(data);

                        FileTag fileTag = new FileTag();
                        fileTag.Library.Environment = data.ServerInfo.EnvironmentName;
                        fileTag.Library.ShortName   = data.ServerInfo.ShortLibraryName;
                        fileTag.File.Id             = int.Parse(data.FileId);
                        fileTag.File.ContentType    = ContentType.File;
                        fileTag.File.LastModDate    = fileInfo.LastModDate.Value.ToLocalTime();

                        TagList tagList = new TagList();
                        tagList.Append(new Tag()
                        {
                            Name = PL_TAG,
                            Val  = XmlUtils.Serialize(fileTag)
                        });

                        if (presentationPart.UserDefinedTagsPart == null)
                        {
                            presentationPart.AddNewPart <UserDefinedTagsPart>();
                            presentationPart.UserDefinedTagsPart.TagList = tagList;
                        }

                        foreach (var slidePart in presentationPart.SlideParts)
                        {
                            var slideId = presentationPart.Presentation.SlideIdList.Where(s => ((SlideId)s).RelationshipId == presentationPart.GetIdOfPart(slidePart)).Select(s => (SlideId)s).FirstOrDefault();

                            var slideInfo = libraryFileSlides.Slides.Where(x => x.SlidePptId == slideId.Id).FirstOrDefault();

                            SlideTag slideTag = new SlideTag(fileTag);
                            slideTag.Slide.Id          = slideInfo.SlideId;
                            slideTag.Slide.LastModDate = ((DateTime)slideInfo.LastModDate).ToLocalTime();

                            Tag slideObjectTag = new Tag()
                            {
                                Name = PL_TAG, Val = XmlUtils.Serialize(slideTag)
                            };
                            UserDefinedTagsPart userDefinedTagsPart1 = slidePart.AddNewPart <UserDefinedTagsPart>();
                            if (userDefinedTagsPart1.TagList == null)
                            {
                                userDefinedTagsPart1.TagList = new TagList();
                            }

                            userDefinedTagsPart1.TagList.Append(slideObjectTag);

                            var id = slidePart.GetIdOfPart(userDefinedTagsPart1);

                            if (slidePart.Slide.CommonSlideData == null)
                            {
                                slidePart.Slide.CommonSlideData = new CommonSlideData();
                            }
                            if (slidePart.Slide.CommonSlideData.CustomerDataList == null)
                            {
                                slidePart.Slide.CommonSlideData.CustomerDataList = new CustomerDataList();
                            }
                            CustomerDataTags tags = new CustomerDataTags
                            {
                                Id = id
                            };
                            slidePart.Slide.CommonSlideData.CustomerDataList.AppendChild(tags);

                            slidePart.Slide.Save();
                        }
                    }
                    else if (presentationPart.UserDefinedTagsPart == null)
                    {
                        FileTag fileTag = new FileTag();
                        fileTag.Library.Environment = data.ServerInfo.EnvironmentName;
                        fileTag.Library.ShortName   = data.ServerInfo.ShortLibraryName;
                        fileTag.File.Id             = -1;
                        fileTag.File.ContentType    = ContentType.Undefined;
                        fileTag.File.LastModDate    = DateTime.Now;

                        TagList tagList = new TagList();
                        tagList.Append(new Tag()
                        {
                            Name = PL_TAG,
                            Val  = XmlUtils.Serialize(fileTag)
                        });

                        if (presentationPart.UserDefinedTagsPart == null)
                        {
                            presentationPart.AddNewPart <UserDefinedTagsPart>();
                            presentationPart.UserDefinedTagsPart.TagList = tagList;
                        }

                        foreach (var slidePart in presentationPart.SlideParts)
                        {
                            var slideId = presentationPart.Presentation.SlideIdList.Where(s => ((SlideId)s).RelationshipId == presentationPart.GetIdOfPart(slidePart)).Select(s => (SlideId)s).FirstOrDefault();

                            var slideInfo = libraryFileSlides.Slides.Where(x => x.SlidePptId == slideId.Id).FirstOrDefault();

                            var index = libraryFileSlides.Slides.IndexOf(slideInfo);

                            SlideTag slideTag = new SlideTag(data.ServerInfo.EnvironmentName, data.ServerInfo.ShortLibraryName, libraryFileSlides.Slides[index], -1);

                            Tag slideObjectTag = new Tag()
                            {
                                Name = PL_TAG, Val = XmlUtils.Serialize(slideTag)
                            };

                            if (slidePart.UserDefinedTagsParts.Count() > 0)
                            {
                                var customerDataPart = slidePart.UserDefinedTagsParts.FirstOrDefault().TagList;

                                customerDataPart.ReplaceChild(slideObjectTag, customerDataPart.FirstChild);

                                slidePart.Slide.Save();
                            }
                        }
                    }

                    setTags = true;
                }
            }

            return(setTags);
        }
Ejemplo n.º 26
0
 public FileInfo(string name, FileTag tag) : this()
 {
     Name = name;
     Tag  = tag;
 }
Ejemplo n.º 27
0
 // 根据类别获取文件存储路径
 private string GetFolderByTag(FileTag tag)
 {
     return(_streamingSettings.GetType().GetProperty(tag.ToString()).GetValue(_streamingSettings, null).ToString());
 }
Ejemplo n.º 28
0
 public BindedTagVM(FileTag bindedTagModel, Guid?targetId = null)
 {
     Model           = bindedTagModel;
     _fileTagService = ServiceLocator.GetService <IFileTagService>();
     _targetId       = targetId;
 }
Ejemplo n.º 29
0
        public object CheckForUpdates(CheckUpdateDto data)
        {
            bool    updatesExist               = false;
            bool    showConfirmation           = true;
            FileTag fileTags                   = new FileTag();
            SlideTagExCollection     slideTags = new SlideTagExCollection();
            LibrarianContentManifest libraryContentManifest = new LibrarianContentManifest();

            using (Stream stream = new FileStream(data.FileUrl, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                using (PresentationDocument openXmlDoc = PresentationDocument.Open(stream, false))
                {
                    var presentationPart = openXmlDoc.PresentationPart;
                    fileTags  = _tagManagerService.GetFileTag(presentationPart);
                    slideTags = _tagManagerService.GetSlideTags(presentationPart);

                    if (fileTags != null)
                    {
                        data.FileId = fileTags.File.Id.ToString();

                        if (data.AskFirst)
                        {
                            if (fileTags != null && fileTags.File.ContentType == ContentType.File)
                            {
                                return(new CheckUpdateResponseDto()
                                {
                                    FileId = data.FileId,
                                    StatusCode = (HttpStatusCode)CheckUpdateStatusCode.HasNewVersion,
                                    StatusText = System.Enum.GetName(typeof(CheckUpdateStatusCode), CheckUpdateStatusCode.HasNewVersion)
                                });
                            }
                            else
                            {
                                return(new CheckUpdateResponseDto()
                                {
                                    FileId = data.FileId,
                                    StatusCode = (HttpStatusCode)CheckUpdateStatusCode.CheckUpdate,
                                    StatusText = System.Enum.GetName(typeof(CheckUpdateStatusCode), CheckUpdateStatusCode.CheckUpdate)
                                });
                            }
                        }

                        if (data.IsConfirm)
                        {
                            updatesExist = CheckFileForUpdates(fileTags, slideTags, data);

                            if (!isExcuted)
                            {
                                return(new CheckUpdateResponseDto()
                                {
                                    StatusCode = HttpStatusCode.BadRequest,
                                    StatusText = Message.ExcuteFailed
                                });
                            }

                            if (slideTags.Count > 0)
                            {
                                _downloadLatestVersion = true;
                                return(new
                                {
                                    FileId = data.FileId,
                                    StatusCode = 215,
                                    Value = UpdateListOfSlides(slideTags)
                                });
                            }

                            updatesExist     = slideTags.Count > 0;
                            showConfirmation = updatesExist;
                        }
                        else
                        {
                            showConfirmation = false;
                        }
                    }
                    else if (slideTags != null && slideTags.Count > 0)
                    {
                        data.FileId = slideTags.FirstOrDefault().File.Id.ToString();

                        if (data.AskFirst)
                        {
                            return(new CheckUpdateResponseDto()
                            {
                                FileId = data.FileId,
                                StatusCode = (HttpStatusCode)CheckUpdateStatusCode.CheckUpdate,
                                StatusText = System.Enum.GetName(typeof(CheckUpdateStatusCode), CheckUpdateStatusCode.CheckUpdate)
                            });
                        }

                        if (data.IsConfirm)
                        {
                            updatesExist = CheckSlidesForUpdates(slideTags, false, data);

                            if (!isExcuted)
                            {
                                return(new CheckUpdateResponseDto()
                                {
                                    StatusCode = HttpStatusCode.BadRequest,
                                    StatusText = Message.ExcuteFailed
                                });
                            }

                            if (slideTags.Count > 0)
                            {
                                _downloadLatestVersion = true;
                                return(new
                                {
                                    FileId = data.FileId,
                                    StatusCode = 215,
                                    Value = UpdateListOfSlides(slideTags)
                                });
                            }

                            updatesExist     = slideTags.Count > 0;
                            showConfirmation = updatesExist;
                        }
                        else
                        {
                            showConfirmation = false;
                        }
                    }
                    else
                    {
                        libraryContentManifest = XmlUtils.Deserialize <LibrarianContentManifest>(_filesService.GetCustomXmlPart(presentationPart));

                        if (libraryContentManifest != null)
                        {
                            data.FileName = libraryContentManifest.Filename;
                            data.FileId   = libraryContentManifest.ContentId;

                            if (data.AskFirst)
                            {
                                return(new CheckUpdateResponseDto()
                                {
                                    FileName = data.FileName,
                                    FileId = data.FileId,
                                    StatusCode = (HttpStatusCode)CheckUpdateStatusCode.HasNewVersion,
                                    StatusText = System.Enum.GetName(typeof(CheckUpdateStatusCode), CheckUpdateStatusCode.HasNewVersion)
                                });
                            }

                            updatesExist = CheckManifestForUpdates(libraryContentManifest, data);

                            if (!isExcuted)
                            {
                                return(new CheckUpdateResponseDto()
                                {
                                    StatusCode = HttpStatusCode.BadRequest,
                                    StatusText = Message.ExcuteFailed
                                });
                            }
                        }
                        else
                        {
                            showConfirmation = false;
                        }
                    }
                }
            }

            if (showConfirmation && !updatesExist)
            {
                return(new CheckUpdateResponseDto()
                {
                    FileId = data.FileId,
                    StatusCode = (HttpStatusCode)CheckUpdateStatusCode.UptoDate,
                    StatusText = System.Enum.GetName(typeof(CheckUpdateStatusCode), CheckUpdateStatusCode.UptoDate)
                });
            }

            if (updatesExist)
            {
                if (fileTags != null && _downloadLatestVersion)
                {
                    _filesService.GetLatestFile(data);
                }
                else if (slideTags != null && slideTags.Count > 0)
                {
                    return(new
                    {
                        FileId = data.FileId,
                        StatusCode = 215,
                        Value = UpdateListOfSlides(slideTags)
                    });
                }
                else if (libraryContentManifest != null)
                {
                    return(new CheckUpdateResponseDto()
                    {
                        FileId = libraryContentManifest.ContentId,
                        StatusCode = (HttpStatusCode)CheckUpdateStatusCode.UpdatedAvailable,
                        StatusText = System.Enum.GetName(typeof(CheckUpdateStatusCode), CheckUpdateStatusCode.UpdatedAvailable)
                    });
                }
            }

            return(updatesExist);
        }
Ejemplo n.º 30
0
        private void ParseFile(int file, IEnumerable<MethodBlock> filePoints)
        {
            var filePath = Services.getService<IReportService>().Report.ResolveFilePath(file);
            if (filePath == null || !File.Exists(filePath))
                return;

            var sourceViewer = GetFileTextBox(file);
            if (sourceViewer == null)
            {
                sourceViewer = new ViewControl
                {
                    Dock = DockStyle.Fill,
                    Document = CreateDocument(filePath),
                    BorderStyle = BorderStyle.FixedSingle
                };
                sourceViewer.View.ViewStyle.HideInactiveCursor = false;
                sourceViewer.View.ViewStyle.HideInactiveSelection = false;

                var record = new FileTag
                {
                    FileId = file
                };

                var page = new TabPage
                {
                    Tag = record,
                    Text = Path.GetFileName(filePath)
                };
                page.Controls.Add(sourceViewer);

                pnTabs.TabPages.Add(page);

                pnTabs.SelectedTab = page;
            }

            List<MethodBlock> bList;

            if (Settings.Default.HighlightAllFile)
            {
                bList = new List<MethodBlock>();

                ReportHelper.ForEachBlock(Services.getService<IReportService>().Report,
                    bd => { if (bd.File == file) bList.Add(bd); });
            }
            else
            {
                sourceViewer.Document.RemoveStylizerAll();
                bList = new List<MethodBlock>(filePoints);
            }

            sourceViewer.Document.Add(new BlockStylizer(bList.ToArray()));
        }
Ejemplo n.º 31
0
 /// <summary>
 /// Save the info
 /// </summary>
 /// <param name="filename"></param>
 private void Save(string filename)
 {
     UpdateModel();
     FileTag.SetFileTags(filename, _locFileTagObject.CorrectionNumber, _locFileTagObject.CorrectionDate, _locFileTagObject.CorrectionDecription, _locFileTagObject.ApplicationName, _locFileTagObject.ApplicationVersion, _locFileTagObject.WorkPackage, _locFileTagObject.BugId);
 }