Browse Source

Add some comments

pull/624/head
olegbevz 11 years ago
parent
commit
05637b70a9
  1. 11
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/AssemblyInfoProvider.cs
  2. 1
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/AssemblyInfoViewModel.cs
  3. 2
      src/Main/Base/Test/ProjectOptions/AssemblyInfoProviderTests.cs

11
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/AssemblyInfoProvider.cs

@ -21,7 +21,6 @@ using System.Collections.Generic; @@ -21,7 +21,6 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp;
using Attribute = ICSharpCode.NRefactory.CSharp.Attribute;
@ -81,9 +80,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -81,9 +80,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
if (syntaxTree == null)
throw new Exception("Can't read assembly info syntax tree.");
var assemblyInfo = new AssemblyInfo();
assemblyInfo.JitOptimization = true;
var assemblyInfo = new AssemblyInfo {JitOptimization = true};
foreach (var attributeSection in syntaxTree.Children.OfType<AttributeSection>())
{
foreach (var attribute in attributeSection.Attributes)
@ -170,7 +168,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -170,7 +168,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
/// <param name="fileName">Source file name</param>
public void MergeAssemblyInfo(AssemblyInfo assemblyInfo, string fileName)
{
var content = string.Empty;
string content;
using (var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read))
{
@ -194,6 +192,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -194,6 +192,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
if (syntaxTree == null)
throw new Exception("Can't read assembly info syntax tree.");
// Add missing namespaces
AddNamespaceUsingIfNotExist(syntaxTree, "System");
AddNamespaceUsingIfNotExist(syntaxTree, "System.Reflection");
@ -203,6 +202,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -203,6 +202,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
if (assemblyInfo.Guid.HasValue || assemblyInfo.ComVisible)
AddNamespaceUsingIfNotExist(syntaxTree, "System.Runtime.InteropServices");
// Update assembly info attributes
SetAttributeValueOrAddAttributeIfNotDefault(syntaxTree, AssemblyTitle, assemblyInfo.Title);
SetAttributeValueOrAddAttributeIfNotDefault(syntaxTree, AssemblyDescription, assemblyInfo.Description);
SetAttributeValueOrAddAttributeIfNotDefault(syntaxTree, AssemblyCompany, assemblyInfo.Company);
@ -236,7 +236,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -236,7 +236,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
using (var streamReader = new StreamReader(stream))
{
var codeParser = new CSharpParser();
return codeParser.Parse(streamReader);
}
}

1
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/AssemblyInfo/AssemblyInfoViewModel.cs

@ -126,7 +126,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -126,7 +126,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
set
{
assemblyInfo.NeutralLanguage = value == NONE_LANGUAGE_CODE ? null : value;
OnPropertyChanged();
}
}

2
src/Main/Base/Test/ProjectOptions/AssemblyInfoProviderTests.cs

@ -374,7 +374,7 @@ using System.Reflection; @@ -374,7 +374,7 @@ using System.Reflection;
WriteAssemblyInfoFile(assemblyInfo, string.Empty));
}
[TestCase]
[TestCase]
public void WriteDefaultAssemblyInfoToEmptyAssemblyInfoFileTest()
{
var assemblyInfoFile = "using System;";

Loading…
Cancel
Save