Browse Source

Remove unnecessary usage of Assembly.GetEntryAssembly

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1618 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 19 years ago
parent
commit
821cae6ee3
  1. 2
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 5
      src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs
  3. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Configuration/AssemblyInfo.cs
  4. 2
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/AbstractSegment.cs
  5. 6
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs
  6. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/AbstractMargin.cs
  7. 2
      src/Libraries/NRefactory/Project/Configuration/AssemblyInfo.cs
  8. 6
      src/Libraries/NRefactory/Project/Src/Lexer/AbstractLexer.cs
  9. 6
      src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs
  10. 2
      src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs
  11. 7
      src/Libraries/NRefactory/Project/Src/Parser/AbstractParser.cs
  12. 2
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs
  13. 4
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs
  14. 2
      src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG
  15. 2
      src/Libraries/NRefactory/Project/Src/Parser/Frames/Parser.frame
  16. 2
      src/Libraries/NRefactory/Project/Src/Parser/Frames/Parser.frame.new
  17. 2
      src/Libraries/NRefactory/Project/Src/Parser/Frames/Parser.frame.old
  18. 1747
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs
  19. 9
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG
  20. 2
      src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs
  21. 2
      src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs
  22. 5
      src/Main/Base/Project/Src/Gui/Dialogs/SharpDevelopAboutPanels.cs
  23. 3
      src/Main/Base/Project/Src/Project/Solution/Solution.cs
  24. 4
      src/Main/Core/Project/Src/AddInTree/AddIn/AddInReference.cs
  25. 4
      src/Main/Core/Project/Src/Services/StringParser/StringParser.cs
  26. 13
      src/Main/StartUp/Project/Dialogs/ExceptionBox.cs
  27. 2
      src/Main/StartUp/Project/Dialogs/SplashScreen.cs

2
AddIns/ICSharpCode.SharpDevelop.addin

@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
addInManagerHidden = "true">
<Manifest>
<Identity name = "SharpDevelop" version = "@EntryAssemblyVersion"/>
<Identity name = "SharpDevelop" version = "@SharpDevelopCoreVersion"/>
</Manifest>
<Runtime>

5
src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs

@ -202,9 +202,8 @@ namespace ICSharpCode.StartPage @@ -202,9 +202,8 @@ namespace ICSharpCode.StartPage
PopulateLeftMenu();
LeftMenuSelectedItem = "";
Version v = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
VersionText = "milestone " + v.Major + "." + v.Minor;
VersionStatus = "Beta";
VersionText = "version " + RevisionClass.Version;
VersionStatus = "";
RightBoxHtml = "";

2
src/Libraries/ICSharpCode.TextEditor/Project/Configuration/AssemblyInfo.cs

@ -9,7 +9,7 @@ using System; @@ -9,7 +9,7 @@ using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: CLSCompliant(false)]
[assembly: CLSCompliant(true)]
[assembly: StringFreezing()]
[assembly: AssemblyTitle("ICSharpCode.TextEditor")]

2
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/AbstractSegment.cs

@ -15,7 +15,9 @@ namespace ICSharpCode.TextEditor.Document @@ -15,7 +15,9 @@ namespace ICSharpCode.TextEditor.Document
/// </summary>
public class AbstractSegment : ISegment
{
[CLSCompliant(false)]
protected int offset = -1;
[CLSCompliant(false)]
protected int length = -1;
#region ICSharpCode.TextEditor.Document.ISegment interface implementation

6
src/Libraries/ICSharpCode.TextEditor/Project/Src/Document/HighlightingStrategy/TextWord.cs

@ -94,15 +94,15 @@ namespace ICSharpCode.TextEditor.Document @@ -94,15 +94,15 @@ namespace ICSharpCode.TextEditor.Document
static TextWord spaceWord = new SpaceTextWord();
static TextWord tabWord = new TabTextWord();
public bool hasDefaultColor;
bool hasDefaultColor;
static public TextWord Space {
public static TextWord Space {
get {
return spaceWord;
}
}
static public TextWord Tab {
public static TextWord Tab {
get {
return tabWord;
}

4
src/Libraries/ICSharpCode.TextEditor/Project/Src/Gui/AbstractMargin.cs

@ -24,8 +24,10 @@ namespace ICSharpCode.TextEditor @@ -24,8 +24,10 @@ namespace ICSharpCode.TextEditor
/// </summary>
public abstract class AbstractMargin
{
[CLSCompliant(false)]
protected Rectangle drawingPosition = new Rectangle(0, 0, 0, 0);
protected TextArea textArea;
[CLSCompliant(false)]
protected TextArea textArea;
public Rectangle DrawingPosition {
get {

2
src/Libraries/NRefactory/Project/Configuration/AssemblyInfo.cs

@ -9,7 +9,7 @@ using System; @@ -9,7 +9,7 @@ using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: CLSCompliant(false)]
[assembly: CLSCompliant(true)]
[assembly: StringFreezing()]
// Information about this assembly is defined by the following

6
src/Libraries/NRefactory/Project/Src/Lexer/AbstractLexer.cs

@ -23,6 +23,7 @@ namespace ICSharpCode.NRefactory.Parser @@ -23,6 +23,7 @@ namespace ICSharpCode.NRefactory.Parser
int col = 1;
int line = 1;
[CLSCompliant(false)]
protected Errors errors = new Errors();
protected Token lastToken = null;
@ -31,14 +32,15 @@ namespace ICSharpCode.NRefactory.Parser @@ -31,14 +32,15 @@ namespace ICSharpCode.NRefactory.Parser
string[] specialCommentTags = null;
protected Hashtable specialCommentHash = null;
protected List<TagComment> tagComments = new List<TagComment>();
List<TagComment> tagComments = new List<TagComment>();
protected StringBuilder sb = new StringBuilder();
[CLSCompliant(false)]
protected SpecialTracker specialTracker = new SpecialTracker();
// used for the original value of strings (with escape sequences).
protected StringBuilder originalValue = new StringBuilder();
protected bool skipAllComments = false;
bool skipAllComments = false;
public bool SkipAllComments {
get {

6
src/Libraries/NRefactory/Project/Src/Lexer/CSharp/Lexer.cs

@ -744,7 +744,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -744,7 +744,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
if (specialCommentHash.ContainsKey(tag)) {
Location p = new Location(Col, Line);
string comment = ch + ReadToEndOfLine();
tagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
this.TagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
sb.Append(comment);
break;
}
@ -755,7 +755,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -755,7 +755,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
void ReadSingleLineComment(CommentType commentType)
{
if (skipAllComments) {
if (this.SkipAllComments) {
SkipToEndOfLine();
} else {
specialTracker.StartComment(commentType, new Location(Col, Line));
@ -767,7 +767,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -767,7 +767,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
void ReadMultiLineComment()
{
int nextChar;
if (skipAllComments) {
if (this.SkipAllComments) {
while ((nextChar = ReaderRead()) != -1) {
char ch = (char)nextChar;
if (ch == '*' && ReaderPeek() == '/') {

2
src/Libraries/NRefactory/Project/Src/Lexer/VBNet/Lexer.cs

@ -563,7 +563,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -563,7 +563,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
if (specialCommentHash.ContainsKey(tag)) {
Location p = new Location(Col, Line);
string comment = ch + ReadToEndOfLine();
tagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
this.TagComments.Add(new TagComment(tag, comment, p, new Location(Col, Line)));
sb.Append(comment);
break;
}

7
src/Libraries/NRefactory/Project/Src/Parser/AbstractParser.cs

@ -10,20 +10,21 @@ using ICSharpCode.NRefactory.Ast; @@ -10,20 +10,21 @@ using ICSharpCode.NRefactory.Ast;
namespace ICSharpCode.NRefactory.Parser
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1708:IdentifiersShouldDifferByMoreThanCase")]
public abstract class AbstractParser : IParser
{
protected const int MinErrDist = 2;
protected const string ErrMsgFormat = "-- line {0} col {1}: {2}"; // 0=line, 1=column, 2=text
protected Errors errors;
private Errors errors;
private ILexer lexer;
protected int errDist = MinErrDist;
[CLSCompliant(false)]
protected CompilationUnit compilationUnit;
protected bool parseMethodContents = true;
bool parseMethodContents = true;
public bool ParseMethodBodies {
get {

2
src/Libraries/NRefactory/Project/Src/Parser/CSharp/CSharpParser.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp @@ -40,7 +40,7 @@ namespace ICSharpCode.NRefactory.Parser.CSharp
public void Error(string s)
{
if (errDist >= MinErrDist) {
errors.Error(la.line, la.col, s);
this.Errors.Error(la.line, la.col, s);
}
errDist = 0;
}

4
src/Libraries/NRefactory/Project/Src/Parser/CSharp/Parser.cs

@ -2432,7 +2432,7 @@ out Statement stmt) { @@ -2432,7 +2432,7 @@ out Statement stmt) {
BlockStatement blockStmt = new BlockStatement();
blockStmt.StartLocation = t.EndLocation;
compilationUnit.BlockStart(blockStmt);
if (!parseMethodContents) lexer.SkipCurrentBlock(0);
if (!ParseMethodBodies) lexer.SkipCurrentBlock(0);
while (StartOf(20)) {
Statement();
@ -5238,7 +5238,7 @@ out t); @@ -5238,7 +5238,7 @@ out t);
default: s = "error " + errorNumber; break;
}
errors.Error(line, col, s);
this.Errors.Error(line, col, s);
}
private bool StartOf(int s)

2
src/Libraries/NRefactory/Project/Src/Parser/CSharp/cs.ATG

@ -1187,7 +1187,7 @@ Block<out Statement stmt> /* not BlockStatement because of EmbeddedStatement */ @@ -1187,7 +1187,7 @@ Block<out Statement stmt> /* not BlockStatement because of EmbeddedStatement */
"{" (. BlockStatement blockStmt = new BlockStatement();
blockStmt.StartLocation = t.EndLocation;
compilationUnit.BlockStart(blockStmt);
if (!parseMethodContents) lexer.SkipCurrentBlock(0);
if (!ParseMethodBodies) lexer.SkipCurrentBlock(0);
.)
{ Statement }
"}" (.

2
src/Libraries/NRefactory/Project/Src/Parser/Frames/Parser.frame

@ -34,7 +34,7 @@ partial class Parser : AbstractParser @@ -34,7 +34,7 @@ partial class Parser : AbstractParser
-->errors
default: s = "error " + errorNumber; break;
}
errors.Error(line, col, s);
this.Errors.Error(line, col, s);
}
private bool StartOf(int s)

2
src/Libraries/NRefactory/Project/Src/Parser/Frames/Parser.frame.new

@ -47,7 +47,7 @@ internal class Parser : AbstractParser @@ -47,7 +47,7 @@ internal class Parser : AbstractParser
-->errors
default: s = "error " + errorNumber; break;
}
errors.Error(line, col, s);
this.Errors.Error(line, col, s);
}
} // end Parser

2
src/Libraries/NRefactory/Project/Src/Parser/Frames/Parser.frame.old

@ -34,7 +34,7 @@ partial class Parser : AbstractParser @@ -34,7 +34,7 @@ partial class Parser : AbstractParser
-->errors
default: s = "error " + errorNumber; break;
}
errors.Error(line, col, s);
this.Errors.Error(line, col, s);
}
private bool StartOf(int s)

1747
src/Libraries/NRefactory/Project/Src/Parser/VBNet/Parser.cs

File diff suppressed because it is too large Load Diff

9
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNET.ATG

@ -765,13 +765,12 @@ StructureMemberDecl<ModifierList m, List<AttributeSection> attributes> @@ -765,13 +765,12 @@ StructureMemberDecl<ModifierList m, List<AttributeSection> attributes>
compilationUnit.AddChild(methodDeclaration);
.)
(. if (parseMethodContents) { .)
(. if (ParseMethodBodies) { .)
Block<out stmt>
"End" "Sub"
(. } else {
// don't parse method body
lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
if (t.kind != Tokens.Sub) throw new ApplicationException("Failed to skip sub");
}
.)
@ -784,13 +783,12 @@ StructureMemberDecl<ModifierList m, List<AttributeSection> attributes> @@ -784,13 +783,12 @@ StructureMemberDecl<ModifierList m, List<AttributeSection> attributes>
(. Location constructorEndLocation = t.EndLocation; .)
EOL
(. if (parseMethodContents) { .)
(. if (ParseMethodBodies) { .)
Block<out stmt>
"End" "Sub"
(. } else {
// don't parse method body
lexer.SkipCurrentBlock(Tokens.Sub); stmt = new BlockStatement();
if (t.kind != Tokens.Sub) throw new ApplicationException("Failed to skip sub");
}
.)
@ -865,13 +863,12 @@ StructureMemberDecl<ModifierList m, List<AttributeSection> attributes> @@ -865,13 +863,12 @@ StructureMemberDecl<ModifierList m, List<AttributeSection> attributes>
compilationUnit.AddChild(methodDeclaration);
if (parseMethodContents) { .)
if (ParseMethodBodies) { .)
Block<out stmt>
"End" "Function"
(. } else {
// don't parse method body
lexer.SkipCurrentBlock(Tokens.Function); stmt = new BlockStatement();
if (t.kind != Tokens.Function) throw new ApplicationException("Failed to skip function");
}
methodDeclaration.Body = (BlockStatement)stmt;
methodDeclaration.Body.StartLocation = methodDeclaration.EndLocation;

2
src/Libraries/NRefactory/Project/Src/Parser/VBNet/VBNetParser.cs

@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.Parser.VB @@ -52,7 +52,7 @@ namespace ICSharpCode.NRefactory.Parser.VB
public void Error(string s)
{
if (errDist >= MinErrDist) {
errors.Error(la.line, la.col, s);
this.Errors.Error(la.line, la.col, s);
}
errDist = 0;
}

2
src/Main/Base/Project/Src/Dom/NRefactoryResolver/NRefactoryResolver.cs

@ -976,7 +976,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver @@ -976,7 +976,7 @@ namespace ICSharpCode.SharpDevelop.Dom.NRefactoryResolver
LocalLookupVariable SearchVariable(string name)
{
if (!lookupTableVisitor.Variables.ContainsKey(name))
if (lookupTableVisitor == null || !lookupTableVisitor.Variables.ContainsKey(name))
return null;
List<LocalLookupVariable> variables = lookupTableVisitor.Variables[name];
if (variables.Count <= 0) {

5
src/Main/Base/Project/Src/Gui/Dialogs/SharpDevelopAboutPanels.cs

@ -35,9 +35,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -35,9 +35,8 @@ namespace ICSharpCode.SharpDevelop.Gui
public AboutSharpDevelopTabPage()
{
Version v = Assembly.GetEntryAssembly().GetName().Version;
versionTextBox.Text = v.Major + "." + v.Minor + "." + v.Build;
buildTextBox.Text = v.Revision.ToString();
versionTextBox.Text = RevisionClass.Version;
buildTextBox.Text = RevisionClass.Revision;
versionLabel.Location = new System.Drawing.Point(8, 8);
versionLabel.Text = ResourceService.GetString("Dialog.About.label1Text");

3
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -319,8 +319,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -319,8 +319,7 @@ namespace ICSharpCode.SharpDevelop.Project
// we need to specify UTF8 because MsBuild needs the BOM
using (StreamWriter sw = new StreamWriter(fileName, false, Encoding.UTF8)) {
sw.WriteLine("Microsoft Visual Studio Solution File, Format Version 9.00");
Version v = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
sw.WriteLine("# SharpDevelop " + v.Major + "." + v.Minor + "." + v.Build + "." + v.Revision);
sw.WriteLine("# SharpDevelop " + RevisionClass.Version + "." + RevisionClass.Revision);
sw.Write(projectSection.ToString());
sw.Write(globalSection.ToString());

4
src/Main/Core/Project/Src/AddInTree/AddIn/AddInReference.cs

@ -103,9 +103,9 @@ namespace ICSharpCode.Core @@ -103,9 +103,9 @@ namespace ICSharpCode.Core
if (version == null || version.Length == 0)
return new Version(0,0,0,0);
if (version.StartsWith("@")) {
if (version == "@EntryAssemblyVersion") {
if (version == "@SharpDevelopCoreVersion") {
if (entryVersion == null)
entryVersion = System.Reflection.Assembly.GetEntryAssembly().GetName().Version;
entryVersion = new Version(RevisionClass.Version + "." + RevisionClass.Revision);
return entryVersion;
}
if (hintPath != null) {

4
src/Main/Core/Project/Src/Services/StringParser/StringParser.cs

@ -42,16 +42,18 @@ namespace ICSharpCode.Core @@ -42,16 +42,18 @@ namespace ICSharpCode.Core
static StringParser()
{
Assembly entryAssembly = Assembly.GetEntryAssembly();
properties = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
stringTagProviders = new Dictionary<string, IStringTagProvider>(StringComparer.InvariantCultureIgnoreCase);
propertyObjects = new Dictionary<string, object>();
// entryAssembly == null might happen in unit test mode
Assembly entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly != null) {
string exeName = entryAssembly.Location;
propertyObjects["exe"] = FileVersionInfo.GetVersionInfo(exeName);
}
properties["USER"] = Environment.UserName;
properties["Version"] = RevisionClass.Version + "." + RevisionClass.Revision;
// Maybe test for Mono?
if (IntPtr.Size == 4) {

13
src/Main/StartUp/Project/Dialogs/ExceptionBox.cs

@ -51,7 +51,7 @@ namespace ICSharpCode.SharpDevelop @@ -51,7 +51,7 @@ namespace ICSharpCode.SharpDevelop
exceptionTextBox.Text = getClipboardString();
try {
ResourceManager resources = new ResourceManager("Resources.BitmapResources", Assembly.GetEntryAssembly());
ResourceManager resources = new ResourceManager("Resources.BitmapResources", typeof(ExceptionBox).Assembly);
this.pictureBox.Image = (Bitmap)resources.GetObject("ErrorReport");
} catch {}
}
@ -67,7 +67,9 @@ namespace ICSharpCode.SharpDevelop @@ -67,7 +67,9 @@ namespace ICSharpCode.SharpDevelop
string getClipboardString()
{
string str = "";
str += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine;
Version v = typeof(ExceptionBox).Assembly.GetName().Version;
str += "SharpDevelop Version : " + v.ToString() + Environment.NewLine;
str += ".NET Version : " + Environment.Version.ToString() + Environment.NewLine;
str += "OS Version : " + Environment.OSVersion.ToString() + Environment.NewLine;
string cultureName = null;
try {
@ -91,8 +93,8 @@ namespace ICSharpCode.SharpDevelop @@ -91,8 +93,8 @@ namespace ICSharpCode.SharpDevelop
}
} catch {}
str += "Working Set Memory : " + (Environment.WorkingSet / 1024) + "kb" + Environment.NewLine;
Version v = Assembly.GetEntryAssembly().GetName().Version;
str += "SharpDevelop Version : " + v.Major + "." + v.Minor + "." + v.Build + "." + v.Revision + Environment.NewLine;
str += "GC Heap Memory : " + (GC.GetTotalMemory(false) / 1024) + "kb" + Environment.NewLine;
str += Environment.NewLine;
if (message != null) {
@ -122,8 +124,7 @@ namespace ICSharpCode.SharpDevelop @@ -122,8 +124,7 @@ namespace ICSharpCode.SharpDevelop
{
CopyInfoToClipboard();
Version v = Assembly.GetEntryAssembly().GetName().Version;
StartUrl("http://www.icsharpcode.net/OpenSource/SD/BugReporting.aspx?version=" + v.Major + "." + v.Minor + "." + v.Revision + "." + v.Build);
StartUrl("http://www.icsharpcode.net/OpenSource/SD/BugReporting.aspx?version=" + RevisionClass.Version + "." + RevisionClass.Revision);
/*
string text = "This version of SharpDevelop is an internal build, " +

2
src/Main/StartUp/Project/Dialogs/SplashScreen.cs

@ -46,7 +46,7 @@ namespace ICSharpCode.SharpDevelop @@ -46,7 +46,7 @@ namespace ICSharpCode.SharpDevelop
#else
string versionText = VersionText;
#endif
using (Stream stream = Assembly.GetEntryAssembly().GetManifestResourceStream("Resources.SplashScreen.jpg")) {
using (Stream stream = typeof(SplashScreenForm).Assembly.GetManifestResourceStream("Resources.SplashScreen.jpg")) {
bitmap = new Bitmap(stream);
}
this.ClientSize = bitmap.Size;

Loading…
Cancel
Save