Skip to content

Commit 67ebe47

Browse files
committed
Load user types based also on the XML file modification time.
1 parent 870c845 commit 67ebe47

File tree

2 files changed

+37
-7
lines changed

2 files changed

+37
-7
lines changed

Visual_Studio_2015/GraphicalDebugging/ExpressionLoader.cs

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,11 +2688,27 @@ public override MemoryReader.Converter<double> GetMemoryConverter(MemoryReader m
26882688
int sizeOf;
26892689
}
26902690

2691-
private static void ReloadUserTypes(string userTypesPath, Loaders loaders)
2691+
private static bool ReloadUserTypes(Loaders loaders,
2692+
string userTypesPath,
2693+
bool isChanged,
2694+
DateTime lastWriteTime,
2695+
out DateTime newWriteTime)
26922696
{
2693-
loaders.RemoveUserDefined();
2697+
newWriteTime = new DateTime(0);
26942698

2695-
if (System.IO.File.Exists(userTypesPath))
2699+
bool fileExists = System.IO.File.Exists(userTypesPath);
2700+
bool newerFile = false;
2701+
if (fileExists)
2702+
{
2703+
newWriteTime = (new System.IO.FileInfo(userTypesPath)).LastWriteTime;
2704+
newerFile = newWriteTime > lastWriteTime;
2705+
}
2706+
bool update = isChanged || newerFile;
2707+
2708+
if (update)
2709+
loaders.RemoveUserDefined();
2710+
2711+
if (update && fileExists)
26962712
{
26972713
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
26982714
doc.Load(userTypesPath);
@@ -2717,23 +2733,35 @@ private static void ReloadUserTypes(string userTypesPath, Loaders loaders)
27172733
}
27182734
}
27192735
}
2736+
2737+
return update;
27202738
}
27212739

27222740
public static void ReloadUserTypes(GeneralOptionPage options)
27232741
{
27242742
if (options == null)
27252743
return;
27262744

2727-
if (options.isUserTypesPathCppChanged)
2745+
DateTime wtCpp;
2746+
if (ReloadUserTypes(Instance.loadersCpp,
2747+
options.UserTypesPathCpp,
2748+
options.isUserTypesPathCppChanged,
2749+
options.userTypesCppWriteTime,
2750+
out wtCpp))
27282751
{
2729-
ReloadUserTypes(options.UserTypesPathCpp, Instance.loadersCpp);
27302752
options.isUserTypesPathCppChanged = false;
2753+
options.userTypesCppWriteTime = wtCpp;
27312754
}
27322755

2733-
if (options.isUserTypesPathCSChanged)
2756+
DateTime wtCS;
2757+
if (ReloadUserTypes(Instance.loadersCS,
2758+
options.UserTypesPathCS,
2759+
options.isUserTypesPathCSChanged,
2760+
options.userTypesCSWriteTime,
2761+
out wtCS))
27342762
{
2735-
ReloadUserTypes(options.UserTypesPathCS, Instance.loadersCS);
27362763
options.isUserTypesPathCSChanged = false;
2764+
options.userTypesCSWriteTime = wtCS;
27372765
}
27382766
}
27392767

Visual_Studio_2015/GraphicalDebugging/GeneralOptionPage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public class GeneralOptionPage : DialogPage
1717

1818
public bool isUserTypesPathCppChanged = false;
1919
public bool isUserTypesPathCSChanged = false;
20+
public System.DateTime userTypesCppWriteTime = new System.DateTime(0);
21+
public System.DateTime userTypesCSWriteTime = new System.DateTime(0);
2022

2123
[Category("Data Access")]
2224
[DisplayName("Enable Direct Memory Access")]

0 commit comments

Comments
 (0)