本文整理汇总了C#中IFrameworkHandle.?.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# IFrameworkHandle.?.SendMessage方法的具体用法?C# IFrameworkHandle.?.SendMessage怎么用?C# IFrameworkHandle.?.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFrameworkHandle
的用法示例。
在下文中一共展示了IFrameworkHandle.?.SendMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReloadCMakeCache
public void ReloadCMakeCache(IFrameworkHandle log = null)
{
var cMakeCacheFileName = Path.Combine(CMakeCacheDir, CMakeCacheFile);
var newInfo = new FileInfo(cMakeCacheFileName);
if (_cmakeCacheInfo != null)
{
log?.SendMessage(TestMessageLevel.Informational,
"CMakeCache.ReloadCMakeCache: comparing already loaded cache");
if (_cmakeCacheInfo.FullName == newInfo.FullName &&
_cmakeCacheInfo.LastWriteTime == newInfo.LastWriteTime &&
newInfo.Exists)
{
log?.SendMessage(TestMessageLevel.Informational,
"CMakeCache.ReloadCMakeCache: cache did not change, not reloading");
return;
}
}
log?.SendMessage(TestMessageLevel.Informational,
$"CMakeCache.ReloadCMakeCache: reloading cmake cache from \"{cMakeCacheFileName}\"");
_cmakeCacheInfo = newInfo;
_cacheEntries.Clear();
if (!File.Exists(cMakeCacheFileName))
{
log?.SendMessage(TestMessageLevel.Error, $"cache not found at:\"{cMakeCacheFileName}\"");
return;
}
var stream = new FileStream(cMakeCacheFileName, FileMode.Open,
FileAccess.Read, FileShare.ReadWrite);
var r = new StreamReader(stream);
while (!r.EndOfStream)
{
var line = r.ReadLine();
if (null == line)
{
continue;
}
line = line.TrimStart(' ');
if (line.Length == 0 || line.StartsWith("#") || line.StartsWith("//"))
{
continue;
}
var c = CacheEntryRegex.Split(line);
if (c.Length != 5)
{
log?.SendMessage(TestMessageLevel.Error, "cache load: element count != 5: (" + c.Length + ")" + line);
var count = 0;
foreach (var asdf in c)
{
log?.SendMessage(TestMessageLevel.Error, "v" + count + ": " + asdf);
count++;
}
continue;
}
CMakeCacheEntryType myType;
if (!Enum.TryParse(c[2], out myType))
{
log?.SendMessage(TestMessageLevel.Error, "cache load: error parsing enum Type: " + c[2]);
continue;
}
var entry = new CMakeCacheEntry()
{
Name = c[1],
//Type = myType,
Value = c[3]
};
_cacheEntries.Add(entry.Name, entry);
}
r.Close();
stream.Close();
r.Dispose();
stream.Dispose();
CacheChanged?.Invoke();
}