Browse Source

Add some comments

pull/624/head
olegbevz 12 years ago
parent
commit
05637b70a9
  1. 9
      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

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

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

Loading…
Cancel
Save