当前位置: 首页>>代码示例>>C#>>正文


C# IFrameworkHandle.?.SendMessage方法代码示例

本文整理汇总了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();
 }
开发者ID:smkanadl,项目名称:CTestTestAdapter,代码行数:73,代码来源:CMakeCache.cs


注:本文中的IFrameworkHandle.?.SendMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。