Esempio n. 1
0
        /// <summary>
        /// Occurs when a file is found that matches the search pattern
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnFileFound(object sender, SearchEventArgs e)
        {
            try
            {
                _file = e.File;

//				if (_outputWindow != null)
//					_outputWindow.Write("Searching for SnapIns...\nSearching for SnapIns in '" + _file.Name + "'\n\n");

//				System.Diagnostics.Trace.WriteLine("Searching for SnapIns in '" + _file.FullName + "'", this.GetType().Name);

                RuntimeClassProvider provider = new RuntimeClassProvider();
                provider.PublicClassDiscovered += new RuntimeClassProviderEventHandler(this.OnPublicClassDiscovered);

                switch (_algorithm)
                {
                case SnapInLocationAlgorithms.LocateUsingEnumeration:
                    provider.DiscoverTypesUsingEnumeration(e.File);
                    break;

                case SnapInLocationAlgorithms.LocateUsingMetadata:
                    provider.DiscoverTypesUsingMetaData(e.File);
                    break;
                }
                ;
            }
            catch (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
        }
		/// <summary>
		/// Occurs when a file is found that matches the search pattern
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void OnFileFound(object sender, SearchEventArgs e)
		{
			try
			{	
				_file = e.File;

//				if (_outputWindow != null)							
//					_outputWindow.Write("Searching for SnapIns...\nSearching for SnapIns in '" + _file.Name + "'\n\n");
			
//				System.Diagnostics.Trace.WriteLine("Searching for SnapIns in '" + _file.FullName + "'", this.GetType().Name);
				
				RuntimeClassProvider provider = new RuntimeClassProvider();
				provider.PublicClassDiscovered += new RuntimeClassProviderEventHandler(this.OnPublicClassDiscovered);

				switch(_algorithm)
				{
				case SnapInLocationAlgorithms.LocateUsingEnumeration:
					provider.DiscoverTypesUsingEnumeration(e.File);
					break;
				case SnapInLocationAlgorithms.LocateUsingMetadata:
					provider.DiscoverTypesUsingMetaData(e.File);
					break;
				};							
			}
			catch(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
		}