Exemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="LanguageID"></param>
 /// <param name="load_files_options"></param>
 public CSyntacticUnitsInfoProvider(LANGUAGES LanguageID, CLoadFilesOptions load_files_options)
     : base(load_files_options)
 {
     m_Extension             = CAvailableExtentions.GetExtention(LanguageID);
     m_SynUnitsCollection    = new CSyntacticUnitsCollection();
     m_CountOfSyntacticUnits = 0;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Конструктор по умолчанию
 /// </summary>
 public CModifiableSourceFilesList(ICloneExtension ext)
     : base(new CLoadFilesOptions())
 {
     m_CodeUnitsCountInModifiedFiles = 0;
     m_CancellationToken             = new CancellationTokenSource();
     m_FilesCollection = new CSourceFilesCollection();
     m_ext             = ext;
 }
Exemplo n.º 3
0
 public static ISourceFileContentLoader Create(CTokenizerParms args, ICloneExtension ext)
 {
     if (CCodeUnit.IsUseTokens())
     {
         return(new CTokenSourceFileContentLoader(args, ext));
     }
     else
     {
         return(new CEntireRowSourceFileContentLoader(args));
     }
 }
Exemplo n.º 4
0
        private void ChooseLangComboBox_DropDownClosed(object sender, EventArgs e)
        {
            ComboBox lang_combobox = sender as ComboBox;

            if (lang_combobox.SelectedIndex > -1)
            {
                ICloneExtension extension = lang_combobox.SelectedItem as ICloneExtension;
                ChoosenFilesExtensionsTextBox.Text = extension.GetSourceFileExtentions();
                ChooseLangComboBox_Validating(ChooseLangComboBox, new CancelEventArgs());
                ChoosenFilesExtensionsTextBox_Validating(ChoosenFilesExtensionsTextBox, new CancelEventArgs());
            }
        }
Exemplo n.º 5
0
        public void GetExtentionTest1()
        {
            LANGUAGES       Lang   = LANGUAGES.LANGUAGE_C_PLUS_PLUS;
            ICloneExtension actual = CAvailableExtentions.GetExtention(Lang);

            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.LanguageID(), Lang);

            Lang   = LANGUAGES.LANGUAGE_C_SHARP;
            actual = CAvailableExtentions.GetExtention(Lang);
            Assert.IsNotNull(actual);
            Assert.AreEqual(actual.LanguageID(), Lang);
        }
Exemplo n.º 6
0
        //protected CBaseCloneSearchExecutor()
        //   : this(CAvailableCloneSearchAlgorithms.GetAlgorithm(CloneSearchAlgoritms.HashBucketAlgorithm))
        //{}

        public CBaseCloneSearchExecutor(CBaseCloneSearchStrategy search_algorithm, ICloneExtension ext)
        {
            m_ext = ext;
            m_ProcessedClonesCounter = 0;
            m_ReportingCounter       = 0;
            m_MessageEventArgs       = new MessageEventArgs();
            m_LoadFilesOptions       = new CLoadFilesOptions();
            m_FilesList           = new CModifiableSourceFilesList(m_ext);
            m_CloneSearchProvider = new CCloneSearchProvider(search_algorithm);
            InitBackgroundThread();
            m_CloneSearchProvider.InitCloneSearchCallbacks(new EventHandler(ReportCloneSearchStart), new EventHandler(ReportCloneSearchProgress), new EventHandler(ReportCloneSearchEnd));
            //m_FilesList.InitFilesListBuildingCallbacks(new EventHandler(ReportFilesListBuildingStart), null, new EventHandler(ReportFilesListBuildingEnd));
            //m_FilesList.InitLoadFilesCallbacks(new EventHandler(ReportLoadFilesStart), new EventHandler(ReportLoadFilesProgress), null);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Проверка загруженной сборки и создание экземпляра класса,
        /// реализующего интерфейс <see cref="ICloneExtensions.Interfaces.ICloneExtension"/>, если такой найден
        /// </summary>
        /// <param name="assembly">Сборка</param>
        /// <param name="Language">Идентификатор языка программирования, для которого загружается плагин</param>
        private static void ExamineAssembly(Assembly assembly, LANGUAGES Language)
        {
            foreach (Type type in assembly.GetTypes())
            {
                if (type.IsPublic)
                {
                    if ((type.Attributes & TypeAttributes.Abstract) != TypeAttributes.Abstract)
                    {
                        Type iface = type.GetInterface("ICloneExtensions.Interfaces.ICloneExtension", true);

                        if (iface != null)
                        {
                            ICloneExtension extention = (ICloneExtension)Activator.CreateInstance(type);
                            m_ExtentionsList.Add(Language, extention);
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        private void PrepareLoadFilesOptions()
        {
            ICloneExtension     Ext              = ChooseLangComboBox.SelectedItem as ICloneExtension;
            CICloneEncodingInfo EncodeInfo       = CodeEncodingComboBox.SelectedItem as CICloneEncodingInfo;
            CLoadFilesOptions   LoadFilesOptions = new CLoadFilesOptions(CodeLocationTextBox.Text, ChoosenFilesExtensionsTextBox.Text, EncodeInfo.GetEncodingInfo().GetEncoding(), new CCodePreProcessingOptions(Ext.GetCommentSymbols()));

            LoadFilesOptions.SetSkippingFolders(Properties.Settings.Default.CSWSkippingFolders);
            LoadFilesOptions.SetIsUseParallelExtensions(Properties.Settings.Default.CSWIsUseParallelExtensions);

            m_CloneSearchExecutor.SetLoadFilesOptions(LoadFilesOptions);
            if (AutomaticKminCalculationCheckBox.Checked)
            {
                CCodeSizeDetector Counter = new CCodeSizeDetector(Ext.LanguageID(), new CLoadFilesOptions(CodeLocationTextBox.Text, ChoosenFilesExtensionsTextBox.Text));
                //Counter.LoadFilesProgress += new EventHandler(ReportProgress);
                CSyntacticInfo info = Counter.Calculate();
                CCodeFragment.SetKmin(info.Kmin);
            }
            else
            {
                CCodeFragment.SetKmin((long)KminValue.Value);
            }
            m_CloneSearchExecutor.Extension = Ext;
        }
Exemplo n.º 9
0
 public void GetExtentionTest4()
 {
     ICloneExtension actual = CAvailableExtentions.GetExtention(LANGUAGES.LANGUAGE_JAVA);
 }
Exemplo n.º 10
0
 public void GetExtentionTest2()
 {
     ICloneExtension actual = CAvailableExtentions.GetExtention(LANGUAGES.LANGUAGE_UNKNOWN);
 }
Exemplo n.º 11
0
 public CTokenSourceFileContentLoader(CTokenizerParms args, ICloneExtension ext)
 {
     m_args = args;
     m_ext  = ext;
 }