Browse Source

Merged 3.0 to trunk.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@3969 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
4c1d3f2ab8
  1. 4
      data/templates/project/CSharp/SharpDevelopCustomTool.xpt
  2. 6
      src/AddIns/DisplayBindings/HexEditor/Project/Src/Util/BufferManager.cs
  3. 14
      src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs
  4. 25
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeNameTestFixture.cs
  5. 6
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/InsideAttributeValueTestFixture.cs
  6. 8
      src/AddIns/DisplayBindings/XmlEditor/Test/Parser/NamespaceDeclarationTestFixture.cs
  7. 11
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs
  8. 63
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/WatchPad.cs
  9. 1
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewVarNode.cs
  10. 7
      src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs
  11. 4
      src/AddIns/Misc/Profiler/Controller/Controller.csproj
  12. 7
      src/AddIns/Misc/Profiler/Controller/Data/TempFileDatabase.cs
  13. 59
      src/AddIns/Misc/Profiler/Controller/DetectBinaryType.cs
  14. 158
      src/AddIns/Misc/Profiler/Controller/ExtendedRegistry.cs
  15. 3
      src/AddIns/Misc/Profiler/Controller/Profiler.cs
  16. 32
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs
  17. 2
      src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs
  18. 15
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SvnGuiWrapper.cs
  19. 3
      src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj
  20. 17
      src/Libraries/TreeViewAdv/Aga.Controls/Tree/TreeViewAdv.Input.cs
  21. 100
      src/Libraries/TreeViewAdv/Aga.Controls/Tree/TreeViewAdv.cs
  22. 3
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs
  23. 25
      src/Tools/UpdateAssemblyInfo/Main.cs
  24. BIN
      src/Tools/UpdateAssemblyInfo/bin/Debug/UpdateAssemblyInfo.exe
  25. 24
      src/Tools/UpdateSetupInfo/Main.cs

4
data/templates/project/CSharp/SharpDevelopCustomTool.xpt

@ -125,8 +125,8 @@ namespace ${StandardNamespace} @@ -125,8 +125,8 @@ namespace ${StandardNamespace}
// This makes the generation code much more concise.
// EasyCodeDom classes derive from the System.CodeDom types or have an implicit conversion operator, so
// use can use EasyCodeDom objects whereever CodeDom is expected.
EasyCompileUnit ccu = new EasyCompileUnit();
EasyTypeDeclaration generatedClass = ccu.AddNamespace(targetNamespace).AddType(className);
CodeCompileUnit ccu = new CodeCompileUnit();
CodeTypeDeclaration generatedClass = ccu.AddNamespace(targetNamespace).AddType(className);
EasyMethod m = generatedClass.AddMethod("Create");
m.ReturnType = Easy.TypeRef(doc.DocumentElement.Name);
m.Attributes = MemberAttributes.Static | MemberAttributes.Public;

6
src/AddIns/DisplayBindings/HexEditor/Project/Src/Util/BufferManager.cs

@ -67,12 +67,12 @@ namespace HexEditor.Util @@ -67,12 +67,12 @@ namespace HexEditor.Util
while (reader.PeekChar() != -1) {
this.buffer.AddRange(reader.ReadBytes(524288));
UpdateProgress((int)((this.buffer.Count * 100) / reader.BaseStream.Length));
UpdateProgress((int)(((double)this.buffer.Count / (double)reader.BaseStream.Length) * 100));
}
reader.Close();
} catch (Exception) {
MessageService.ShowErrorFormatted("${res:FileUtilityService.ErrorWhileLoading}", currentFile.FileName);
} catch (OutOfMemoryException) {
MessageService.ShowErrorFormatted("${res:FileUtilityService.FileSizeTooBig}");
}
} else {
MessageService.ShowErrorFormatted("${res:Fileutility.CantFindFileError}", currentFile.FileName);

14
src/AddIns/DisplayBindings/XmlEditor/Project/Src/XmlParser.cs

@ -118,7 +118,7 @@ namespace ICSharpCode.XmlEditor @@ -118,7 +118,7 @@ namespace ICSharpCode.XmlEditor
/// </summary>
public static bool IsNamespaceDeclaration(string xml, int index)
{
if (xml.Length == 0) {
if (String.IsNullOrEmpty(xml)) {
return false;
}
@ -185,7 +185,7 @@ namespace ICSharpCode.XmlEditor @@ -185,7 +185,7 @@ namespace ICSharpCode.XmlEditor
/// </summary>
public static string GetAttributeName(string xml, int index)
{
if (xml.Length == 0) {
if (String.IsNullOrEmpty(xml)) {
return String.Empty;
}
@ -203,9 +203,7 @@ namespace ICSharpCode.XmlEditor @@ -203,9 +203,7 @@ namespace ICSharpCode.XmlEditor
{
string name = GetAttributeNameAtIndex(xml, index);
QualifiedName qualifiedName = GetQualifiedName(name);
if (qualifiedName == null)
return null;
if (String.IsNullOrEmpty(qualifiedName.Namespace) && includeNamespace) {
if (qualifiedName != null && String.IsNullOrEmpty(qualifiedName.Namespace) && includeNamespace) {
QualifiedNameCollection namespaces = new QualifiedNameCollection();
XmlElementPath path = GetActiveElementStartPathAtIndex(xml, index, namespaces);
qualifiedName.Namespace = GetNamespaceForPrefix(namespaces, path.Elements.LastPrefix);
@ -228,6 +226,10 @@ namespace ICSharpCode.XmlEditor @@ -228,6 +226,10 @@ namespace ICSharpCode.XmlEditor
/// </summary>
public static string GetAttributeNameAtIndex(string xml, int index)
{
if (String.IsNullOrEmpty(xml)) {
return String.Empty;
}
index = GetCorrectedIndex(xml.Length, index);
bool ignoreWhitespace = true;
@ -310,7 +312,7 @@ namespace ICSharpCode.XmlEditor @@ -310,7 +312,7 @@ namespace ICSharpCode.XmlEditor
/// </summary>
public static bool IsInsideAttributeValue(string xml, int index)
{
if (xml.Length == 0) {
if (String.IsNullOrEmpty(xml)) {
return false;
}

25
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/AttributeNameTestFixture.cs

@ -114,6 +114,31 @@ namespace XmlEditor.Tests.Parser @@ -114,6 +114,31 @@ namespace XmlEditor.Tests.Parser
QualifiedName name = XmlParser.GetQualifiedAttributeName(text, text.Length);
Assert.AreEqual(expectedName, name);
}
[Test]
public void GetQualifiedAttributeNameWithEmptyString()
{
Assert.IsNull(XmlParser.GetQualifiedAttributeNameAtIndex(String.Empty, 0, true));
}
[Test]
public void GetAttributeNameAtIndexWithNullString()
{
Assert.AreEqual(String.Empty, XmlParser.GetAttributeNameAtIndex(null, 0));
}
[Test]
public void GetAttributeNameWithNullString()
{
Assert.AreEqual(String.Empty, XmlParser.GetAttributeName(null, 0));
}
[Test]
public void GetQualifiedAttributeNameWithSingleXmlCharacter()
{
Assert.IsNull(XmlParser.GetQualifiedAttributeNameAtIndex("<", 0, true));
}
}
}

6
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/InsideAttributeValueTestFixture.cs

@ -104,5 +104,11 @@ namespace XmlEditor.Tests.Parser @@ -104,5 +104,11 @@ namespace XmlEditor.Tests.Parser
string xml = "<foo a=\"''\"";
Assert.IsFalse(XmlParser.IsInsideAttributeValue(xml, xml.Length));
}
[Test]
public void NullString()
{
Assert.IsFalse(XmlParser.IsInsideAttributeValue(null, 0));
}
}
}

8
src/AddIns/DisplayBindings/XmlEditor/Test/Parser/NamespaceDeclarationTestFixture.cs

@ -115,6 +115,12 @@ namespace XmlEditor.Tests.Parser @@ -115,6 +115,12 @@ namespace XmlEditor.Tests.Parser
string text = " ";
bool isNamespace = XmlParser.IsNamespaceDeclaration(text, text.Length);
Assert.IsFalse(isNamespace, "Namespace should not be recognised.");
}
}
[Test]
public void NullString()
{
Assert.IsFalse(XmlParser.IsNamespaceDeclaration(null, 0));
}
}
}

11
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/LocalVarPad.cs

@ -51,11 +51,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -51,11 +51,22 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
{
TreeViewAdv localVarList;
Process debuggedProcess;
static LocalVarPad instance;
readonly TreeColumn nameColumn = new TreeColumn();
readonly TreeColumn valColumn = new TreeColumn();
readonly TreeColumn typeColumn = new TreeColumn();
public LocalVarPad()
{
instance = this;
}
/// <remarks>Always check if Instance is null, might be null if pad is not opened!</remarks>
public static LocalVarPad Instance {
get { return instance; }
}
/// <remarks>
/// This is not used anywhere, but it is neccessary to be overridden in children of AbstractPadContent.
/// </remarks>

63
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/Pads/WatchPad.cs

@ -75,11 +75,16 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -75,11 +75,16 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
public override void SetValue(TreeNodeAdv node, object value)
{
if (((TreeViewVarNode)node).Content is ValueNode)
((ValueNode)((TreeViewVarNode)node).Content).SetName(value.ToString());
else {
if (((TreeViewVarNode)node).Content is TextNode)
((TextNode)((TreeViewVarNode)node).Content).SetName(value.ToString());
if (string.IsNullOrEmpty(value as string))
MessageBox.Show("You can not set name to an empty string!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
else
{
if (((TreeViewVarNode)node).Content is ValueNode)
((ValueNode)((TreeViewVarNode)node).Content).SetName(value.ToString());
else {
if (((TreeViewVarNode)node).Content is TextNode)
((TextNode)((TreeViewVarNode)node).Content).SetName(value.ToString());
}
}
}
public override void MouseDown(TreeNodeAdvMouseEventArgs args)
@ -93,6 +98,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -93,6 +98,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
ContextMenuStrip menu = ((IContextMenu)content).GetContextMenu();
if (menu != null) {
menu.Show(args.Node.Tree, args.Location);
args.Handled = true;
}
} else {
base.MouseDown(args);
@ -105,6 +111,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -105,6 +111,17 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
TreeViewAdv watchList;
Process debuggedProcess;
List<TextNode> watches;
static WatchPad instance;
/// <remarks>Always check if Instance is null, might be null if pad is not opened!</remarks>
public static WatchPad Instance {
get { return instance; }
}
public WatchPad()
{
instance = this;
}
public List<TextNode> Watches {
get { return watches; }
@ -154,17 +171,43 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -154,17 +171,43 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
watchList.NodeControls.Add(typeControl);
watchList.AutoRowHeight = true;
watchList.MouseDoubleClick += new MouseEventHandler(watchList_DoubleClick);
watchList.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/WatchPad/ContextMenu");
watchList.MouseDoubleClick += new MouseEventHandler(watchList_DoubleClick);
watchList.ContextMenuStrip = MenuService.CreateContextMenu(this, "/SharpDevelop/Pads/WatchPad/ContextMenu");
watchList.AllowDrop = true;
watchList.DragEnter += new DragEventHandler(watchList_DragEnter);
watchList.DragDrop += new DragEventHandler(watchList_DragDrop);
watches = new List<TextNode>();
ResourceService.LanguageChanged += delegate { OnLanguageChanged(); };
OnLanguageChanged();
}
void watchList_DragDrop(object sender, DragEventArgs e)
{
watchList.BeginUpdate();
TextNode text = new TextNode(e.Data.GetData(DataFormats.StringFormat).ToString());
TreeViewVarNode node = new TreeViewVarNode(this.debuggedProcess, this.watchList, text);
watches.Add(text);
watchList.Root.Children.Add(node);
watchList.EndUpdate();
node.IsSelected = true;
this.RefreshPad();
}
void watchList_DragEnter(object sender, DragEventArgs e)
{
if(e.Data.GetDataPresent(DataFormats.StringFormat)) {
e.Effect = DragDropEffects.Copy;
}
else {
e.Effect = DragDropEffects.None;
}
}
void watchList_DoubleClick(object sender, MouseEventArgs e)
{
if (watchList.SelectedNode == null)

1
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/Adapters/TreeViewVarNode.cs

@ -82,6 +82,7 @@ namespace Debugger.AddIn.TreeModel @@ -82,6 +82,7 @@ namespace Debugger.AddIn.TreeModel
ContextMenuStrip menu = ((IContextMenu)content).GetContextMenu();
if (menu != null) {
menu.Show(args.Node.Tree, args.Location);
args.Handled = true;
}
} else {
base.MouseDown(args);

7
src/AddIns/Misc/Debugger/Debugger.AddIn/Project/Src/TreeModel/ValueNode.cs

@ -15,6 +15,7 @@ using ICSharpCode.Core; @@ -15,6 +15,7 @@ using ICSharpCode.Core;
using ICSharpCode.Core.WinForms;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Debugging;
using ICSharpCode.SharpDevelop.Gui.Pads;
using ICSharpCode.SharpDevelop.Services;
namespace Debugger.AddIn.TreeModel
@ -232,7 +233,13 @@ namespace Debugger.AddIn.TreeModel @@ -232,7 +233,13 @@ namespace Debugger.AddIn.TreeModel
hexView.Text = ResourceService.GetString("MainWindow.Windows.Debug.LocalVariables.ShowInHexadecimal");
hexView.Checked = DebuggingOptions.Instance.ShowValuesInHexadecimal;
hexView.Click += delegate {
// refresh all pads that use ValueNode for display
DebuggingOptions.Instance.ShowValuesInHexadecimal = !DebuggingOptions.Instance.ShowValuesInHexadecimal;
// always check if instance is null, might be null if pad is not opened
if (LocalVarPad.Instance != null)
LocalVarPad.Instance.RefreshPad();
if (WatchPad.Instance != null)
WatchPad.Instance.RefreshPad();
};
menu.Items.AddRange(new ToolStripItem[] {

4
src/AddIns/Misc/Profiler/Controller/Controller.csproj

@ -30,14 +30,14 @@ @@ -30,14 +30,14 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DefineConstants>DEBUG;TRACE;PUBLIC_EXTENDEDREGISTRY</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>PdbOnly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DefineConstants>TRACE;PUBLIC_EXTENDEDREGISTRY</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DebugSymbols>false</DebugSymbols>

7
src/AddIns/Misc/Profiler/Controller/Data/TempFileDatabase.cs

@ -167,7 +167,9 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -167,7 +167,9 @@ namespace ICSharpCode.Profiler.Controller.Data
this.currentWrite = null;
}
this.file.Flush();
this.mmf = MemoryMappedFile.Open(file);//Name, FileAccess.Read, FileShare.ReadWrite);
if (this.streamInfos.Count > 0)
this.mmf = MemoryMappedFile.Open(file);//Name, FileAccess.Read, FileShare.ReadWrite);
}
/// <summary>
@ -175,7 +177,8 @@ namespace ICSharpCode.Profiler.Controller.Data @@ -175,7 +177,8 @@ namespace ICSharpCode.Profiler.Controller.Data
/// </summary>
public void Close()
{
this.mmf.Close();
if (this.mmf != null)
this.mmf.Close();
this.file.Close();
}

59
src/AddIns/Misc/Profiler/Controller/DetectBinaryType.cs

@ -16,6 +16,65 @@ namespace ICSharpCode.Profiler.Controller @@ -16,6 +16,65 @@ namespace ICSharpCode.Profiler.Controller
/// </summary>
static class DetectBinaryType
{
public static bool IsDotNetExecutable(string exeName)
{
try {
using (FileStream f = new FileStream(exeName, FileMode.Open, FileAccess.Read)) {
BinaryReader r = new BinaryReader(f);
f.Position = 0x3c; // jump to position in MSDOS stub that specifies the PE header location
int peHeaderStart = r.ReadInt32(); // jump to pe header
f.Position = peHeaderStart;
if (r.ReadInt32() != 0x00004550) {
Debug.WriteLine(".NET detection failed: invalid PE signature");
return false;
}
int optionalHeaderStart = peHeaderStart + 4 + 20;
f.Position = optionalHeaderStart; // jump to 'Optional' Header
int dotNetHeaderOffset;
switch (r.ReadInt16()) {
case 0x10b: // PE32 Header
dotNetHeaderOffset = 208;
break;
case 0x20b: // PE32+ Header
dotNetHeaderOffset = 224;
break;
default:
Debug.WriteLine(".NET detection failed: invalid PE magic number");
return false;
}
f.Position = peHeaderStart + 4 + 16;
ushort sizeOfOptionalHeader = r.ReadUInt16();
if (sizeOfOptionalHeader < dotNetHeaderOffset + 8) {
Debug.WriteLine(".NET detection failed: optional header too short, this can't be a .NET image");
return false;
}
f.Position = optionalHeaderStart + dotNetHeaderOffset;
uint cliHeaderRVA = r.ReadUInt32();
uint cliHeaderSize = r.ReadUInt32();
if (cliHeaderRVA == 0 || cliHeaderSize == 0) {
Debug.WriteLine(".NET detection failed: image has no CLI header");
return false;
}
return true;
}
} catch (IOException ex) {
Debug.WriteLine(".NET detection failed: " + ex.ToString());
return false;
} catch (ArgumentException ex) {
Debug.WriteLine(".NET detection failed: " + ex.ToString());
return false;
}
}
public static bool RunsAs64Bit(string exeName)
{
if (!ExtendedRegistry.Is64BitWindows) {

158
src/AddIns/Misc/Profiler/Controller/ExtendedRegistry.cs

@ -16,9 +16,13 @@ namespace ICSharpCode.Profiler.Controller @@ -16,9 +16,13 @@ namespace ICSharpCode.Profiler.Controller
/// <summary>
/// Provides access to 32-bit Windows Registry on 32-bit systems and 32-bit and 64-bit views of the Windows Registry on 64-bit systems.
/// </summary>
public class ExtendedRegistry
#if PUBLIC_EXTENDEDREGISTRY
public
#endif
class ExtendedRegistry
{
static class NativeMethods {
static class NativeMethods
{
// internal static readonly UIntPtr HKEY_CLASSES_ROOT = new UIntPtr(0x80000000);
internal static readonly UIntPtr HKEY_CURRENT_USER = new UIntPtr(0x80000001);
internal static readonly UIntPtr HKEY_LOCAL_MACHINE = new UIntPtr(0x80000002);
@ -27,14 +31,14 @@ namespace ICSharpCode.Profiler.Controller @@ -27,14 +31,14 @@ namespace ICSharpCode.Profiler.Controller
// internal static readonly UIntPtr HKEY_CURRENT_CONFIG = new UIntPtr(0x80000005);
// internal static readonly UIntPtr HKEY_DYN_DATA = new UIntPtr(0x80000006);
// [DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
// internal static extern int RegOpenKeyEx(HKEY hKey, string subKey, uint options, RegSAM samDesired, out HKEY hKeyResult);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
internal static extern int RegOpenKeyEx(HKEY hKey, string subKey, uint options, RegSAM samDesired, out HKEY hKeyResult);
[DllImport("advapi32.dll")]
internal static extern int RegCloseKey(HKEY hKey);
// [DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
// internal static extern int RegQueryValueEx(HKEY hkey, string valueName, IntPtr reserved, out uint type, IntPtr buffer, ref uint bufferLength);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
internal static extern int RegQueryValueEx(HKEY hkey, string valueName, IntPtr reserved, out uint type, IntPtr buffer, ref uint bufferLength);
[DllImport("advapi32.dll", CharSet = CharSet.Unicode)]
internal static extern int RegCreateKeyEx(HKEY hkey, string subKey, uint reserved, string lpClass, uint options, RegSAM samDesired, IntPtr securityAttributes, out HKEY result, out uint disposition);
@ -54,47 +58,49 @@ namespace ICSharpCode.Profiler.Controller @@ -54,47 +58,49 @@ namespace ICSharpCode.Profiler.Controller
[DllImport("kernel32", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
internal static extern bool IsWow64Process(IntPtr hProcess, out bool wow64Process);
[Flags]
internal enum RegOption
{
NonVolatile = 0x0,
Volatile = 0x1,
CreateLink = 0x2,
BackupRestore = 0x4,
OpenLink = 0x8
}
[Flags]
internal enum RegSAM
{
QueryValue = 0x0001,
SetValue = 0x0002,
CreateSubKey = 0x0004,
EnumerateSubKeys = 0x0008,
Notify = 0x0010,
CreateLink = 0x0020,
WOW64_32Key = 0x0200,
WOW64_64Key = 0x0100,
Read = 0x00020019,
Write = 0x00020006,
Execute = 0x00020019,
AllAccess = 0x000f003f
}
internal const uint REG_SZ = 0x1;
internal enum RegResult
{
CreatedNewKey = 0x00000001,
OpenedExistingKey = 0x00000002
}
}
[Flags]
enum RegOption
{
NonVolatile = 0x0,
Volatile = 0x1,
CreateLink = 0x2,
BackupRestore = 0x4,
OpenLink = 0x8
}
[Flags]
enum RegSAM
{
QueryValue = 0x0001,
SetValue = 0x0002,
CreateSubKey = 0x0004,
EnumerateSubKeys = 0x0008,
Notify = 0x0010,
CreateLink = 0x0020,
WOW64_32Key = 0x0200,
WOW64_64Key = 0x0100,
Read = 0x00020019,
Write = 0x00020006,
Execute = 0x00020019,
AllAccess = 0x000f003f
}
const uint REG_SZ = 0x1;
const int ERROR_MORE_DATA = 234;
const int ERROR_FILE_NOT_FOUND = 2;
enum RegResult
{
CreatedNewKey = 0x00000001,
OpenedExistingKey = 0x00000002
}
UIntPtr rootKey;
NativeMethods.RegSAM keyType;
RegSAM keyType;
ExtendedRegistry(UIntPtr rootKey, NativeMethods.RegSAM keyType) {
ExtendedRegistry(UIntPtr rootKey, RegSAM keyType) {
this.rootKey = rootKey;
this.keyType = keyType;
}
@ -115,12 +121,12 @@ namespace ICSharpCode.Profiler.Controller @@ -115,12 +121,12 @@ namespace ICSharpCode.Profiler.Controller
UIntPtr keyPtr;
uint dummy;
IntPtr ptr = IntPtr.Zero;
int errorCode = NativeMethods.RegCreateKeyEx(rootKey, subkey, 0x0, null, 0x0, NativeMethods.RegSAM.CreateSubKey | NativeMethods.RegSAM.SetValue | keyType, IntPtr.Zero, out keyPtr, out dummy);
int errorCode = NativeMethods.RegCreateKeyEx(rootKey, subkey, 0x0, null, 0x0, RegSAM.CreateSubKey | RegSAM.SetValue | keyType, IntPtr.Zero, out keyPtr, out dummy);
if (errorCode != 0)
throw ExceptionForError(errorCode);
try {
if (errorCode != 0)
throw ExceptionForError(errorCode);
ptr = Marshal.StringToHGlobalUni(value);
errorCode = NativeMethods.RegSetValueEx(keyPtr, valueName, 0, NativeMethods.REG_SZ, ptr, (uint)((value.Length + 1) * 2));
errorCode = NativeMethods.RegSetValueEx(keyPtr, valueName, 0, REG_SZ, ptr, (uint)((value.Length + 1) * 2));
if (errorCode != 0)
throw ExceptionForError(errorCode);
} finally {
@ -143,6 +149,54 @@ namespace ICSharpCode.Profiler.Controller @@ -143,6 +149,54 @@ namespace ICSharpCode.Profiler.Controller
}
}
/// <summary>
/// Gets a value from the registry.
/// </summary>
/// <param name="subkey">The key containing the value.</param>
/// <param name="valueName">The name of the value, use null for "(Default)".</param>
/// <returns>null, if the key does not exist or the value does not exist.
/// Otherwise, the value as string (currently, only REG_SZ is supported).</returns>
public object GetValue(string subkey, string valueName)
{
if (subkey == null)
throw new ArgumentNullException("subkey");
object result;
UIntPtr keyPtr;
IntPtr buffer = IntPtr.Zero;
int errorCode = NativeMethods.RegOpenKeyEx(rootKey, subkey, 0x0, RegSAM.Read | keyType, out keyPtr);
if (errorCode == ERROR_FILE_NOT_FOUND)
return null;
if (errorCode != 0)
throw ExceptionForError(errorCode);
try {
uint type;
uint bufferLength = 0;
// detect length of string
errorCode = NativeMethods.RegQueryValueEx(keyPtr, valueName, IntPtr.Zero, out type, IntPtr.Zero, ref bufferLength);
if (errorCode == ERROR_FILE_NOT_FOUND)
return null;
if (errorCode != 0 && errorCode != ERROR_MORE_DATA)
throw ExceptionForError(errorCode);
if (type != REG_SZ)
throw new NotSupportedException("Unsupported data type: " + type);
buffer = Marshal.AllocHGlobal((int)bufferLength);
errorCode = NativeMethods.RegQueryValueEx(keyPtr, valueName, IntPtr.Zero, out type, buffer, ref bufferLength);
if (errorCode != 0)
throw ExceptionForError(errorCode);
result = Marshal.PtrToStringUni(buffer);
} finally {
if (buffer != IntPtr.Zero)
Marshal.FreeHGlobal(buffer);
errorCode = NativeMethods.RegCloseKey(keyPtr);
}
// check error code from RegCloseKey (but only if there was no other exception)
if (errorCode != 0)
throw ExceptionForError(errorCode);
return result;
}
/// <summary>
/// Deletes a key in the Windows Registry. The key must have no sub keys. All values of the key are deleted.
/// </summary>
@ -154,7 +208,7 @@ namespace ICSharpCode.Profiler.Controller @@ -154,7 +208,7 @@ namespace ICSharpCode.Profiler.Controller
int retVal = (Environment.OSVersion.Version >= new Version(5,2))
? NativeMethods.RegDeleteKeyEx(rootKey, subkey, keyType, 0)
: NativeMethods.RegDeleteKey(rootKey, subkey);
if (retVal != 0 && retVal != 2) // 2=key not found
if (retVal != 0 && retVal != ERROR_FILE_NOT_FOUND)
throw ExceptionForError(retVal);
}
@ -162,28 +216,28 @@ namespace ICSharpCode.Profiler.Controller @@ -162,28 +216,28 @@ namespace ICSharpCode.Profiler.Controller
/// Gets the 32-bit view of HKEY_CURRENT_USER.
/// </summary>
public static ExtendedRegistry CurrentUser32 {
get { return new ExtendedRegistry(ExtendedRegistry.NativeMethods.HKEY_CURRENT_USER, NativeMethods.RegSAM.WOW64_32Key); }
get { return new ExtendedRegistry(NativeMethods.HKEY_CURRENT_USER, RegSAM.WOW64_32Key); }
}
/// <summary>
/// Gets the 32-bit view of HKEY_LOCAL_MACHINE.
/// </summary>
public static ExtendedRegistry LocalMachine32 {
get { return new ExtendedRegistry(ExtendedRegistry.NativeMethods.HKEY_LOCAL_MACHINE, NativeMethods.RegSAM.WOW64_32Key); }
get { return new ExtendedRegistry(NativeMethods.HKEY_LOCAL_MACHINE, RegSAM.WOW64_32Key); }
}
/// <summary>
/// Gets the 64-bit view of HKEY_CURRENT_USER.
/// </summary>
public static ExtendedRegistry CurrentUser64 {
get { return new ExtendedRegistry(ExtendedRegistry.NativeMethods.HKEY_CURRENT_USER, NativeMethods.RegSAM.WOW64_64Key); }
get { return new ExtendedRegistry(NativeMethods.HKEY_CURRENT_USER, RegSAM.WOW64_64Key); }
}
/// <summary>
/// Gets the 64-bit view of HKEY_LOCAL_MACHINE.
/// </summary>
public static ExtendedRegistry LocalMachine64 {
get { return new ExtendedRegistry(ExtendedRegistry.NativeMethods.HKEY_LOCAL_MACHINE, NativeMethods.RegSAM.WOW64_64Key); }
get { return new ExtendedRegistry(NativeMethods.HKEY_LOCAL_MACHINE, RegSAM.WOW64_64Key); }
}
/// <summary>

3
src/AddIns/Misc/Profiler/Controller/Profiler.cs

@ -225,6 +225,9 @@ namespace ICSharpCode.Profiler.Controller @@ -225,6 +225,9 @@ namespace ICSharpCode.Profiler.Controller
if (info == null)
throw new ArgumentNullException("info");
if (!DetectBinaryType.IsDotNetExecutable(info.FileName))
throw new ProfilerException("File is not a valid .NET executable file!");
this.is64Bit = DetectBinaryType.RunsAs64Bit(info.FileName);

32
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/Dialogs/ProfileExecutableForm.xaml.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
using System;
using ICSharpCode.Profiler.Controller;
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Windows;
using ICSharpCode.Core;
using ICSharpCode.Profiler.AddIn.OptionsPanels;
using ICSharpCode.Profiler.AddIn.Views;
@ -30,7 +30,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs @@ -30,7 +30,7 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs
void btnStartClick(object sender, RoutedEventArgs e)
{
try {
try {
if (!File.Exists(txtExePath.Text))
throw new FileNotFoundException("file '" + txtExePath.Text + "' was not found!");
if (!Directory.Exists(txtWorkingDir.Text))
@ -43,19 +43,23 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs @@ -43,19 +43,23 @@ namespace ICSharpCode.Profiler.AddIn.Dialogs
Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
var runner = CreateRunner(txtExePath.Text, txtWorkingDir.Text, txtArgs.Text, new ProfilingDataSQLiteWriter(outputPath));
if (runner != null) {
runner.RunFinished += delegate {
string title = Path.GetFileName(outputPath);
ProfilingDataProvider provider = new ProfilingDataSQLiteProvider(outputPath);
WorkbenchSingleton.SafeThreadCall(() => WorkbenchSingleton.Workbench.ShowView(new WpfViewer(provider, title)));
};
try {
var runner = CreateRunner(txtExePath.Text, txtWorkingDir.Text, txtArgs.Text, new ProfilingDataSQLiteWriter(outputPath));
if (runner != null) {
runner.RunFinished += delegate {
string title = Path.GetFileName(outputPath);
ProfilingDataProvider provider = new ProfilingDataSQLiteProvider(outputPath);
WorkbenchSingleton.SafeThreadCall(() => WorkbenchSingleton.Workbench.ShowView(new WpfViewer(provider, title)));
};
runner.Run();
}
runner.Run();
this.Close();
} catch (ProfilerException ex) {
MessageService.ShowError(ex.Message);
}
this.Close();
} catch (ArgumentNullException) {
MessageService.ShowError("Invalid data, please try again!");
} catch (FileNotFoundException ex) {

2
src/AddIns/Misc/Profiler/Frontend/AddIn/Src/ProfilerRunner.cs

@ -5,9 +5,9 @@ @@ -5,9 +5,9 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.Core;
using System;
using System.Diagnostics;
using ICSharpCode.Core;
using ICSharpCode.Profiler.AddIn.OptionsPanels;
using ICSharpCode.Profiler.Controller.Data;
using ICSharpCode.SharpDevelop.Gui;

15
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SvnGuiWrapper.cs

@ -5,11 +5,11 @@ @@ -5,11 +5,11 @@
// <version>$Revision$</version>
// </file>
using ICSharpCode.Profiler.Controller;
using System;
using System.Diagnostics;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using Microsoft.Win32;
@ -22,19 +22,16 @@ namespace ICSharpCode.Svn @@ -22,19 +22,16 @@ namespace ICSharpCode.Svn
/// </summary>
public static class SvnGuiWrapper
{
static string GetPathFromRegistry(RegistryKey key, string valueName)
static string GetPathFromRegistry(ExtendedRegistry registry, string valueName)
{
if (key == null) return null;
using (key) {
return key.GetValue(valueName) as string;
}
return registry.GetValue("SOFTWARE\\TortoiseSVN", valueName) as string;
}
static string GetPathFromRegistry(string valueName)
{
string r = GetPathFromRegistry(Registry.CurrentUser.OpenSubKey("SOFTWARE\\TortoiseSVN"), valueName);
if (r != null) return r;
return GetPathFromRegistry(Registry.LocalMachine.OpenSubKey("SOFTWARE\\TortoiseSVN"), valueName);
bool is64Bit = ExtendedRegistry.Is64BitWindows;
return GetPathFromRegistry(is64Bit ? ExtendedRegistry.CurrentUser64 : ExtendedRegistry.CurrentUser32, valueName)
?? GetPathFromRegistry(is64Bit ? ExtendedRegistry.LocalMachine64 : ExtendedRegistry.LocalMachine32, valueName);
}
static void Proc(string command, string fileName, MethodInvoker callback)

3
src/AddIns/Misc/SubversionAddIn/Project/SubversionAddIn.csproj

@ -42,6 +42,9 @@ @@ -42,6 +42,9 @@
<None Include="ICSharpCode.Svn.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="..\..\Profiler\Controller\ExtendedRegistry.cs">
<Link>Src\Gui\ExtendedRegistry.cs</Link>
</Compile>
<Compile Include="Src\Gui\HistoryViewDisplayBinding\InfoPanel.cs" />
<Compile Include="Src\Gui\HistoryViewDisplayBinding\InfoPanel.Designer.cs">
<DependentUpon>InfoPanel.cs</DependentUpon>

17
src/Libraries/TreeViewAdv/Aga.Controls/Tree/TreeViewAdv.Input.cs

@ -21,9 +21,9 @@ namespace Aga.Controls.Tree @@ -21,9 +21,9 @@ namespace Aga.Controls.Tree
protected override bool IsInputKey(Keys keyData)
{
if (((keyData & Keys.Up) == Keys.Up)
|| ((keyData & Keys.Down) == Keys.Down)
|| ((keyData & Keys.Left) == Keys.Left)
|| ((keyData & Keys.Right) == Keys.Right))
|| ((keyData & Keys.Down) == Keys.Down)
|| ((keyData & Keys.Left) == Keys.Left)
|| ((keyData & Keys.Right) == Keys.Right))
return true;
else
return base.IsInputKey(keyData);
@ -102,7 +102,7 @@ namespace Aga.Controls.Tree @@ -102,7 +102,7 @@ namespace Aga.Controls.Tree
{
TreeNodeAdvMouseEventArgs args = new TreeNodeAdvMouseEventArgs(e);
args.ViewLocation = new Point(e.X + OffsetX,
e.Y + _rowLayout.GetRowBounds(FirstVisibleRow).Y - ColumnHeaderHeight);
e.Y + _rowLayout.GetRowBounds(FirstVisibleRow).Y - ColumnHeaderHeight);
args.ModifierKeys = ModifierKeys;
args.Node = GetNodeAt(e.Location);
NodeControlInfo info = GetNodeControlInfoAt(args.Node, e.Location);
@ -155,8 +155,11 @@ namespace Aga.Controls.Tree @@ -155,8 +155,11 @@ namespace Aga.Controls.Tree
if (args.Node != null && args.Control != null)
args.Control.MouseDown(args);
if (!args.Handled)
if (!args.Handled) {
Input.MouseDown(args);
base.ContextMenuStrip = _cms;
} else
base.ContextMenuStrip = null;
base.OnMouseDown(e);
}
@ -218,7 +221,7 @@ namespace Aga.Controls.Tree @@ -218,7 +221,7 @@ namespace Aga.Controls.Tree
SetCursor(e);
UpdateToolTip(e);
if (ItemDragMode && Dist(e.Location, ItemDragStart) > ItemDragSensivity
&& CurrentNode != null && CurrentNode.IsSelected)
&& CurrentNode != null && CurrentNode.IsSelected)
{
ItemDragMode = false;
_toolTip.Active = false;
@ -380,7 +383,7 @@ namespace Aga.Controls.Tree @@ -380,7 +383,7 @@ namespace Aga.Controls.Tree
{
Size ms = btc.GetActualSize(args.Node, _measureContext);
if (ms.Width > args.ControlBounds.Size.Width || ms.Height > args.ControlBounds.Size.Height
|| args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
|| args.ControlBounds.Right - OffsetX > DisplayRectangle.Width)
msg = btc.GetLabel(args.Node);
}

100
src/Libraries/TreeViewAdv/Aga.Controls/Tree/TreeViewAdv.cs

@ -41,7 +41,15 @@ namespace Aga.Controls.Tree @@ -41,7 +41,15 @@ namespace Aga.Controls.Tree
private IncrementalSearch _search;
private List<TreeNodeAdv> _expandingNodes = new List<TreeNodeAdv>();
private AbortableThreadPool _threadPool = new AbortableThreadPool();
private ContextMenuStrip _cms;
public new ContextMenuStrip ContextMenuStrip {
set {
base.ContextMenuStrip = value;
_cms = value;
}
}
#region Public Events
[Category("Action")]
@ -182,11 +190,11 @@ namespace Aga.Controls.Tree @@ -182,11 +190,11 @@ namespace Aga.Controls.Tree
{
InitializeComponent();
SetStyle(ControlStyles.AllPaintingInWmPaint
| ControlStyles.UserPaint
| ControlStyles.OptimizedDoubleBuffer
| ControlStyles.ResizeRedraw
| ControlStyles.Selectable
, true);
| ControlStyles.UserPaint
| ControlStyles.OptimizedDoubleBuffer
| ControlStyles.ResizeRedraw
| ControlStyles.Selectable
, true);
if (Application.RenderWithVisualStyles)
@ -308,7 +316,7 @@ namespace Aga.Controls.Tree @@ -308,7 +316,7 @@ namespace Aga.Controls.Tree
point.X += OffsetX;
foreach (NodeControlInfo info in GetNodeControls(node))
if (info.Bounds.Contains(point))
return info;
return info;
if (FullRowSelect)
return new NodeControlInfo(null, Rectangle.Empty, node);
@ -383,7 +391,7 @@ namespace Aga.Controls.Tree @@ -383,7 +391,7 @@ namespace Aga.Controls.Tree
CreateRowMap();
int row = -1;
if (node.Row < FirstVisibleRow)
row = node.Row;
else
@ -433,10 +441,10 @@ namespace Aga.Controls.Tree @@ -433,10 +441,10 @@ namespace Aga.Controls.Tree
Rectangle clientRect = ClientRectangle;
_hScrollBar.SetBounds(clientRect.X, clientRect.Bottom - hBarSize,
clientRect.Width - vBarSize, hBarSize);
clientRect.Width - vBarSize, hBarSize);
_vScrollBar.SetBounds(clientRect.Right - vBarSize, clientRect.Y,
vBarSize, clientRect.Height - hBarSize);
vBarSize, clientRect.Height - hBarSize);
}
private void SafeUpdateScrollBars()
@ -483,10 +491,10 @@ namespace Aga.Controls.Tree @@ -483,10 +491,10 @@ namespace Aga.Controls.Tree
switch (BorderStyle)
{
case BorderStyle.FixedSingle:
res.Style |= 0x800000;
break;
res.Style |= 0x800000;
break;
case BorderStyle.Fixed3D:
res.ExStyle |= 0x200;
res.ExStyle |= 0x200;
break;
}
return res;
@ -580,10 +588,10 @@ namespace Aga.Controls.Tree @@ -580,10 +588,10 @@ namespace Aga.Controls.Tree
bool isLastControl = true;
for (int k = i + 1; k < NodeControls.Count; k++)
if (NodeControls[k].ParentColumn == col)
{
isLastControl = false;
break;
}
{
isLastControl = false;
break;
}
width = right - x;
if (!isLastControl)
@ -669,26 +677,26 @@ namespace Aga.Controls.Tree @@ -669,26 +677,26 @@ namespace Aga.Controls.Tree
IEnumerable items = Model.GetChildren(GetPath(parentNode));
if (items != null)
foreach (object obj in items)
{
bool found = false;
if (obj != null)
{
bool found = false;
if (obj != null)
for (int i = 0; i < oldNodes.Count; i++)
if (object.Equals(obj, oldNodes[i].Tag))
{
for (int i = 0; i < oldNodes.Count; i++)
if (object.Equals(obj, oldNodes[i].Tag))
{
oldNodes[i].RightBounds = oldNodes[i].Height = null;
AddNode(parentNode, -1, oldNodes[i]);
oldNodes.RemoveAt(i);
found = true;
break;
}
oldNodes[i].RightBounds = oldNodes[i].Height = null;
AddNode(parentNode, -1, oldNodes[i]);
oldNodes.RemoveAt(i);
found = true;
break;
}
if (!found)
AddNewNode(parentNode, obj, -1);
if (performFullUpdate)
FullUpdate();
}
if (!found)
AddNewNode(parentNode, obj, -1);
if (performFullUpdate)
FullUpdate();
}
}
}
@ -860,7 +868,7 @@ namespace Aga.Controls.Tree @@ -860,7 +868,7 @@ namespace Aga.Controls.Tree
_contentWidth = 0;
foreach (TreeColumn col in _columns)
if (col.IsVisible)
_contentWidth += col.Width;
_contentWidth += col.Width;
}
}
@ -945,10 +953,10 @@ namespace Aga.Controls.Tree @@ -945,10 +953,10 @@ namespace Aga.Controls.Tree
for (int i = Selection.Count - 1; i >= 0; i--)
if (!IsMyNode(Selection[i]))
{
flag = true;
Selection.RemoveAt(i);
}
{
flag = true;
Selection.RemoveAt(i);
}
if (flag)
OnSelectionChanged();
@ -1158,7 +1166,7 @@ namespace Aga.Controls.Tree @@ -1158,7 +1166,7 @@ namespace Aga.Controls.Tree
UpdateSelection();
SmartFullUpdate();
}
//else
//else
// throw new ArgumentException("Path not found");
}
@ -1186,10 +1194,10 @@ namespace Aga.Controls.Tree @@ -1186,10 +1194,10 @@ namespace Aga.Controls.Tree
{
for (int n = 0; n < e.Children.Length; n++)
if (parent.Nodes[i].Tag == e.Children[n])
{
parent.Nodes.RemoveAt(i);
break;
}
{
parent.Nodes.RemoveAt(i);
break;
}
}
}
}
@ -1246,9 +1254,9 @@ namespace Aga.Controls.Tree @@ -1246,9 +1254,9 @@ namespace Aga.Controls.Tree
{
foreach (object obj in e.Children)
if (node.Tag == obj)
{
node.Height = node.RightBounds = null;
}
{
node.Height = node.RightBounds = null;
}
}
}
}

3
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/MemberLookupHelper.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace ICSharpCode.SharpDevelop.Dom
@ -873,7 +874,7 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -873,7 +874,7 @@ namespace ICSharpCode.SharpDevelop.Dom
[System.Diagnostics.ConditionalAttribute("DEBUG")]
internal static void Log(string text)
{
Console.WriteLine(text);
Debug.WriteLine(text);
}
[System.Diagnostics.ConditionalAttribute("DEBUG")]

25
src/Tools/UpdateAssemblyInfo/Main.cs

@ -54,9 +54,8 @@ namespace UpdateAssemblyInfo @@ -54,9 +54,8 @@ namespace UpdateAssemblyInfo
Console.WriteLine("Working directory must be SharpDevelop\\src!");
return 2;
}
File.Copy(Path.Combine(subversionLibraryDir, "SharpSvn.dll"),
Path.Combine(exeDir, "SharpSvn.dll"),
true);
FileCopy(Path.Combine(subversionLibraryDir, "SharpSvn.dll"),
Path.Combine(exeDir, "SharpSvn.dll"));
RetrieveRevisionNumber();
string versionNumber = GetMajorVersion() + "." + revisionNumber;
UpdateStartup();
@ -69,6 +68,16 @@ namespace UpdateAssemblyInfo @@ -69,6 +68,16 @@ namespace UpdateAssemblyInfo
}
}
static void FileCopy(string source, string target)
{
if (File.Exists(target)) {
// don't copy file if it is up-to-date: repeatedly copying a 3 MB file slows down the build
if (File.GetLastWriteTimeUtc(source) == File.GetLastWriteTimeUtc(target))
return;
}
File.Copy(source, target, true);
}
static void UpdateStartup()
{
string content;
@ -189,10 +198,12 @@ namespace UpdateAssemblyInfo @@ -189,10 +198,12 @@ namespace UpdateAssemblyInfo
// Change working dir so that the subversion libraries can be found
Environment.CurrentDirectory = Path.Combine(Environment.CurrentDirectory, subversionLibraryDir);
SvnWorkingCopyClient client = new SvnWorkingCopyClient();
SvnWorkingCopyVersion version;
if (client.GetVersion(oldWorkingDir, out version)) {
revisionNumber = version.Start.ToString(CultureInfo.InvariantCulture);
using (SvnClient client = new SvnClient()) {
client.Info(
oldWorkingDir,
(sender, info) => {
revisionNumber = info.Revision.ToString(CultureInfo.InvariantCulture);
});
}
} catch (Exception e) {
Console.WriteLine("Reading revision number with SharpSvn failed: " + e.ToString());

BIN
src/Tools/UpdateAssemblyInfo/bin/Debug/UpdateAssemblyInfo.exe

Binary file not shown.

24
src/Tools/UpdateSetupInfo/Main.cs

@ -78,13 +78,23 @@ namespace UpdateSetupInfo @@ -78,13 +78,23 @@ namespace UpdateSetupInfo
previousRevisionFolder = Path.Combine(setupProjectFolder, @"bin");
previousRevisionFileName = Path.Combine(previousRevisionFolder, "REVISION");
File.Copy(Path.Combine(Path.Combine(applicationFolder, subversionLibraryDir), "SharpSvn.dll"),
Path.Combine(applicationFolder, "SharpSvn.dll"), true);
FileCopy(Path.Combine(Path.Combine(applicationFolder, subversionLibraryDir), "SharpSvn.dll"),
Path.Combine(applicationFolder, "SharpSvn.dll"));
// Set current directory to a folder that is in the repository.
Environment.CurrentDirectory = setupProjectFolder;
}
static void FileCopy(string source, string target)
{
if (File.Exists(target)) {
// don't copy file if it is up-to-date: repeatedly copying a 3 MB file slows down the build
if (File.GetLastWriteTimeUtc(source) == File.GetLastWriteTimeUtc(target))
return;
}
File.Copy(source, target, true);
}
public static int Main(string[] args)
{
try {
@ -164,10 +174,12 @@ namespace UpdateSetupInfo @@ -164,10 +174,12 @@ namespace UpdateSetupInfo
// Set working directory so msvcp70.dll and msvcr70.dll can be found
Environment.CurrentDirectory = Path.Combine(applicationFolder, subversionLibraryDir);
SvnWorkingCopyClient client = new SvnWorkingCopyClient();
SvnWorkingCopyVersion version;
if (client.GetVersion(oldWorkingDir, out version)) {
revisionNumber = version.Start.ToString(CultureInfo.InvariantCulture);
using (SvnClient client = new SvnClient()) {
client.Info(
oldWorkingDir,
(sender, info) => {
revisionNumber = info.Revision.ToString(CultureInfo.InvariantCulture);
});
}
} catch (Exception e) {
Console.WriteLine("Reading revision number with Svn.Net failed: " + e.ToString());

Loading…
Cancel
Save