예제 #1
0
        void ParserThread()
        {
            BeginInvoke(new MethodInvoker(delegate { StatusText.Text = "Loading mscorlib..."; }));
            myProjectContent.AddReferencedContent(pcRegistry.Mscorlib);

            // do one initial parser step to enable code-completion while other
            // references are loading
            ParseStep();

            string[] referencedAssemblies =
            {
                "System", "System.Data", "System.Drawing", "System.Xml", "System.Windows.Forms"
            };
            foreach (string assemblyName in referencedAssemblies)
            {
                {                 // block for anonymous method
                    string assemblyNameCopy = assemblyName;
                    BeginInvoke(new MethodInvoker(delegate { StatusText.Text = "Loading " + assemblyNameCopy + "..."; }));
                }
                myProjectContent.AddReferencedContent(pcRegistry.GetProjectContentForReference(assemblyName, assemblyName));
            }
            BeginInvoke(new MethodInvoker(delegate { StatusText.Text = "Ready"; }));

            // Parse the current file every 2 seconds
            while (!IsDisposed)
            {
                ParseStep();

                Thread.Sleep(2000);
            }
        }
예제 #2
0
        void ParserThread()
        {
            try
            {
                //return;
                BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading mscorlib..."; }));
                myProjectContent.AddReferencedContent(pcRegistry.Mscorlib);

                // do one initial parser step to enable code-completion while other
                // references are loading
                ParseStep();


                foreach (string assemblyName in refList.Items)
                {
                    string assemblyNameCopy = assemblyName.Replace(".dll", "");
                    { // block for anonymous method
                        BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading " + assemblyNameCopy + "..."; }));
                    }
                    myProjectContent.AddReferencedContent(pcRegistry.GetProjectContentForReference(assemblyNameCopy, assemblyName));
                }
                BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Ready"; }));

                // Parse the current file every 2 seconds
                while (!IsDisposed)
                {
                    ParseStep();

                    Thread.Sleep(2000);
                }
            }
            catch {  }
        }
예제 #3
0
        void ParserThread()
        {
            try
            {
                BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading mscorlib..."; }));
                myProjectContent.AddReferencedContent(pcRegistry.Mscorlib);

                // do one initial parser step to enable code-completion while other
                // references are loading
                ParseStep();

                string[] referencedAssemblies =
                {
                    "System", "System.Data", "System.Drawing", "System.Xml", "System.Windows.Forms"
                };
                foreach (string assemblyName in referencedAssemblies)
                {
                    { // block for anonymous method
                        string assemblyNameCopy = assemblyName;
                        BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading " + assemblyNameCopy + "..."; }));
                    }
                    myProjectContent.AddReferencedContent(pcRegistry.GetProjectContentForReference(assemblyName, assemblyName));
                }
                BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Ready"; }));
            }
            catch (ThreadAbortException)
            {
                // Meh.
            }
            catch (Exception E)
            {
                if (E.ToString().Contains("CSharpCodeCompletion"))
                {
                    // Chances are that directory wasn't created
                    // (Happened on Eric's machine)
                    try
                    {
                        System.IO.Directory.CreateDirectory(System.IO.Path.GetTempPath() + (System.IO.Path.GetTempPath().EndsWith(@"\") ? "" : @"\" + "CSharpCodeCompletion"));
                    }
                    catch
                    {
                    }
                }
            }

            // Parse the current file every 2 seconds
            while (!IsDisposed)
            {
                ParseStep();

                Thread.Sleep(2000);
            }
        }
예제 #4
0
        void ParserThread()
        {
            try
            {
                BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading mscorlib..."; }));
                myProjectContent.AddReferencedContent(pcRegistry.Mscorlib);

                // do one initial parser step to enable code-completion while other
                // references are loading
                ParseStep();

                //string[] referencedAssemblies = {
                //	"System", "System.Data", "System.Drawing", "System.Xml", "System.Windows.Forms", "Microsoft.VisualBasic"
                //};

                foreach (string assemblyName in referencedAssemblies.ToArray())
                {
                    string assemblyNameCopy = assemblyName; // copy for anonymous method
                    BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Loading " + assemblyNameCopy + "..."; }));
                    Dom.IProjectContent referenceProjectContent = pcRegistry.GetProjectContentForReference(assemblyName, assemblyName);
                    myProjectContent.AddReferencedContent(referenceProjectContent);
                    if (referenceProjectContent is Dom.ReflectionProjectContent)
                    {
                        (referenceProjectContent as Dom.ReflectionProjectContent).InitializeReferences();
                    }
                }
                if (IsVisualBasic)
                {
                    myProjectContent.DefaultImports = new Dom.DefaultUsing(myProjectContent);
                    myProjectContent.DefaultImports.Usings.Add("System");
                    myProjectContent.DefaultImports.Usings.Add("System.Text");
                    myProjectContent.DefaultImports.Usings.Add("Microsoft.VisualBasic");
                }
                BeginInvoke(new MethodInvoker(delegate { parserThreadLabel.Text = "Ready"; }));

                // Parse the current file every 2 seconds
                while (!IsDisposed)
                {
                    ParseStep();

                    Thread.Sleep(2000);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("in MainForm.ParserThread: " + ex.Message);
            }
        }
예제 #5
0
        public void Load()
        {
            _csProjectContent.Language = Dom.LanguageProperties.CSharp;
            _csProjectContent.AddReferencedContent(_pcRegistry.Mscorlib);

            string[] referencedAssemblies =
            {
                "System",
                "System.Data",
                "System.Drawing",
                "System.Xml",
                "System.Windows.Forms",
                "Gordago.Trader"
            };
            foreach (string assemblyName in referencedAssemblies)
            {
                if (LoadReferencedAssembly != null)
                {
                    this.LoadReferencedAssembly(this, new LoadReferencedAssembliesEventArgs(assemblyName));
                }
                _csProjectContent.AddReferencedContent(_pcRegistry.GetProjectContentForReference(assemblyName, assemblyName));
            }
        }
예제 #6
0
		static void CreateDefaultProjectContent()
		{
			LoggingService.Info("Creating default project content");
			//LoggingService.Debug("Stacktrace is:\n" + Environment.StackTrace);
			defaultProjectContent = new DefaultProjectContent();
			defaultProjectContent.AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib);
		}
예제 #7
0
 private DefaultProjectContent CreateDefaultProjectContent()
 {
     var projectContent = new DefaultProjectContent() { Language = LanguageProperties.CSharp };
     projectContent.AddReferencedContent(_projectContentRegistry.Mscorlib);
     return projectContent;
 }
예제 #8
0
		static void CreateDefaultProjectContent()
		{
			LoggingService.Info("Creating default project content");
			//LoggingService.Debug("Stacktrace is:\n" + Environment.StackTrace);
			defaultProjectContent = new DefaultProjectContent();
			defaultProjectContent.AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib);
#if ModifiedForAltaxo
      IList<string> defaultReferences = AddInTree.BuildItems<string>("/SharpDevelop/Services/ParserService/SingleFileGacReferences", null, false);
      foreach (string defaultReference in defaultReferences)
      {
        ReferenceProjectItem item = new ReferenceProjectItem(null, defaultReference);
        defaultProjectContent.AddReferencedContent(AssemblyParserService.GetProjectContentForReference(item));
      }
#endif
		}
예제 #9
0
		static void CreateDefaultProjectContent()
		{
			LoggingService.Info("Creating default project content");
			//LoggingService.Debug("Stacktrace is:\n" + Environment.StackTrace);
			defaultProjectContent = new DefaultProjectContent();
			defaultProjectContent.AddReferencedContent(defaultProjectContentRegistry.Mscorlib);
			Thread t = new Thread(new ThreadStart(CreateDefaultProjectContentReferences));
			t.IsBackground = true;
			t.Priority = ThreadPriority.BelowNormal;
			t.Name = "CreateDefaultPC";
			t.Start();
		}