{ // 获取包含Hugging Face文本的span元素 const spans = link.querySelectorAll('span.whitespace-nowrap, span.hidden.whitespace-nowrap'); spans.forEach(span => { if (span.textContent && span.textContent.trim().match(/Hugging\s*Face/i)) { span.textContent = 'AI快站'; } }); }); // 替换logo图片的alt属性 document.querySelectorAll('img[alt*="Hugging"], img[alt*="Face"]').forEach(img => { if (img.alt.match(/Hugging\s*Face/i)) { img.alt = 'AI快站 logo'; } }); } // 替换导航栏中的链接 function replaceNavigationLinks() { // 已替换标记,防止重复运行 if (window._navLinksReplaced) { return; } // 已经替换过的链接集合,防止重复替换 const replacedLinks = new Set(); // 只在导航栏区域查找和替换链接 const headerArea = document.querySelector('header') || document.querySelector('nav'); if (!headerArea) { return; } // 在导航区域内查找链接 const navLinks = headerArea.querySelectorAll('a'); navLinks.forEach(link => { // 如果已经替换过,跳过 if (replacedLinks.has(link)) return; const linkText = link.textContent.trim(); const linkHref = link.getAttribute('href') || ''; // 替换Spaces链接 - 仅替换一次 if ( (linkHref.includes('/spaces') || linkHref === '/spaces' || linkText === 'Spaces' || linkText.match(/^s*Spacess*$/i)) && linkText !== 'OCR模型免费转Markdown' && linkText !== 'OCR模型免费转Markdown' ) { link.textContent = 'OCR模型免费转Markdown'; link.href = 'https://fast360.xyz'; link.setAttribute('target', '_blank'); link.setAttribute('rel', 'noopener noreferrer'); replacedLinks.add(link); } // 删除Posts链接 else if ( (linkHref.includes('/posts') || linkHref === '/posts' || linkText === 'Posts' || linkText.match(/^s*Postss*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } // 替换Docs链接 - 仅替换一次 else if ( (linkHref.includes('/docs') || linkHref === '/docs' || linkText === 'Docs' || linkText.match(/^s*Docss*$/i)) && linkText !== '模型下载攻略' ) { link.textContent = '模型下载攻略'; link.href = '/'; replacedLinks.add(link); } // 删除Enterprise链接 else if ( (linkHref.includes('/enterprise') || linkHref === '/enterprise' || linkText === 'Enterprise' || linkText.match(/^s*Enterprises*$/i)) ) { if (link.parentNode) { link.parentNode.removeChild(link); } replacedLinks.add(link); } }); // 查找可能嵌套的Spaces和Posts文本 const textNodes = []; function findTextNodes(element) { if (element.nodeType === Node.TEXT_NODE) { const text = element.textContent.trim(); if (text === 'Spaces' || text === 'Posts' || text === 'Enterprise') { textNodes.push(element); } } else { for (const child of element.childNodes) { findTextNodes(child); } } } // 只在导航区域内查找文本节点 findTextNodes(headerArea); // 替换找到的文本节点 textNodes.forEach(node => { const text = node.textContent.trim(); if (text === 'Spaces') { node.textContent = node.textContent.replace(/Spaces/g, 'OCR模型免费转Markdown'); } else if (text === 'Posts') { // 删除Posts文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } else if (text === 'Enterprise') { // 删除Enterprise文本节点 if (node.parentNode) { node.parentNode.removeChild(node); } } }); // 标记已替换完成 window._navLinksReplaced = true; } // 替换代码区域中的域名 function replaceCodeDomains() { // 特别处理span.hljs-string和span.njs-string元素 document.querySelectorAll('span.hljs-string, span.njs-string, span[class*="hljs-string"], span[class*="njs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换hljs-string类的span中的域名(移除多余的转义符号) document.querySelectorAll('span.hljs-string, span[class*="hljs-string"]').forEach(span => { if (span.textContent && span.textContent.includes('huggingface.co')) { span.textContent = span.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 替换pre和code标签中包含git clone命令的域名 document.querySelectorAll('pre, code').forEach(element => { if (element.textContent && element.textContent.includes('git clone')) { const text = element.innerHTML; if (text.includes('huggingface.co')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 处理特定的命令行示例 document.querySelectorAll('pre, code').forEach(element => { const text = element.innerHTML; if (text.includes('huggingface.co')) { // 针对git clone命令的专门处理 if (text.includes('git clone') || text.includes('GIT_LFS_SKIP_SMUDGE=1')) { element.innerHTML = text.replace(/huggingface.co/g, 'aifasthub.com'); } } }); // 特别处理模型下载页面上的代码片段 document.querySelectorAll('.flex.border-t, .svelte_hydrator, .inline-block').forEach(container => { const content = container.innerHTML; if (content && content.includes('huggingface.co')) { container.innerHTML = content.replace(/huggingface.co/g, 'aifasthub.com'); } }); // 特别处理模型仓库克隆对话框中的代码片段 try { // 查找包含"Clone this model repository"标题的对话框 const cloneDialog = document.querySelector('.svelte_hydration_boundary, [data-target="MainHeader"]'); if (cloneDialog) { // 查找对话框中所有的代码片段和命令示例 const codeElements = cloneDialog.querySelectorAll('pre, code, span'); codeElements.forEach(element => { if (element.textContent && element.textContent.includes('huggingface.co')) { if (element.innerHTML.includes('huggingface.co')) { element.innerHTML = element.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { element.textContent = element.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); } // 更精确地定位克隆命令中的域名 document.querySelectorAll('[data-target]').forEach(container => { const codeBlocks = container.querySelectorAll('pre, code, span.hljs-string'); codeBlocks.forEach(block => { if (block.textContent && block.textContent.includes('huggingface.co')) { if (block.innerHTML.includes('huggingface.co')) { block.innerHTML = block.innerHTML.replace(/huggingface.co/g, 'aifasthub.com'); } else { block.textContent = block.textContent.replace(/huggingface.co/g, 'aifasthub.com'); } } }); }); } catch (e) { // 错误处理但不打印日志 } } // 当DOM加载完成后执行替换 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); }); } else { replaceHeaderBranding(); replaceNavigationLinks(); replaceCodeDomains(); // 只在必要时执行替换 - 3秒后再次检查 setTimeout(() => { if (!window._navLinksReplaced) { console.log('[Client] 3秒后重新检查导航链接'); replaceNavigationLinks(); } }, 3000); } // 增加一个MutationObserver来处理可能的动态元素加载 const observer = new MutationObserver(mutations => { // 检查是否导航区域有变化 const hasNavChanges = mutations.some(mutation => { // 检查是否存在header或nav元素变化 return Array.from(mutation.addedNodes).some(node => { if (node.nodeType === Node.ELEMENT_NODE) { // 检查是否是导航元素或其子元素 if (node.tagName === 'HEADER' || node.tagName === 'NAV' || node.querySelector('header, nav')) { return true; } // 检查是否在导航元素内部 let parent = node.parentElement; while (parent) { if (parent.tagName === 'HEADER' || parent.tagName === 'NAV') { return true; } parent = parent.parentElement; } } return false; }); }); // 只在导航区域有变化时执行替换 if (hasNavChanges) { // 重置替换状态,允许再次替换 window._navLinksReplaced = false; replaceHeaderBranding(); replaceNavigationLinks(); } }); // 开始观察document.body的变化,包括子节点 if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })(); \n"},"old_contents":{"kind":"string","value":"\n\n\n \n \n @ViewData[\"Title\"] - FilterLists\n \n\n \n \n \n \n\n\n@RenderBody()\n\n\n@RenderSection(\"scripts\", false)\n\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673618,"cells":{"commit":{"kind":"string","value":"35d147f46bbec5ceeb0941711ff5e3457a2b6e45"},"subject":{"kind":"string","value":"Fix incorrect namespace name."},"repos":{"kind":"string","value":"github/VisualStudio,github/VisualStudio,github/VisualStudio"},"old_file":{"kind":"string","value":"src/GitHub.App/Infrastructure/ExportWrappers.cs"},"new_file":{"kind":"string","value":"src/GitHub.App/Infrastructure/ExportWrappers.cs"},"new_contents":{"kind":"string","value":"using System.ComponentModel.Composition;\nusing Octokit.Internal;\nusing System;\nusing System.Net.Http;\n\nnamespace GitHub.Infrastructure\n{\n /// \n /// Since VS doesn't support dynamic component registration, we have to implement wrappers\n /// for types we don't control in order to export them.\n /// \n [Export(typeof(IHttpClient))]\n public class ExportedHttpClient : HttpClientAdapter\n {\n public ExportedHttpClient() :\n base(HttpMessageHandlerFactory.CreateDefault)\n {}\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.ComponentModel.Composition;\nusing Octokit.Internal;\nusing System;\nusing System.Net.Http;\n\nnamespace GitHub.Logging\n{\n /// \n /// Since VS doesn't support dynamic component registration, we have to implement wrappers\n /// for types we don't control in order to export them.\n /// \n [Export(typeof(IHttpClient))]\n public class ExportedHttpClient : HttpClientAdapter\n {\n public ExportedHttpClient() :\n base(HttpMessageHandlerFactory.CreateDefault)\n {}\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673619,"cells":{"commit":{"kind":"string","value":"1e28cb9ac2707f554e3d7e961335ba9ef8ba15f0"},"subject":{"kind":"string","value":"Change StatusUpdater job to run every hour."},"repos":{"kind":"string","value":"LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform"},"old_file":{"kind":"string","value":"src/CompetitionPlatform/ScheduledJobs/JobScheduler.cs"},"new_file":{"kind":"string","value":"src/CompetitionPlatform/ScheduledJobs/JobScheduler.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Common.Log;\nusing CompetitionPlatform.Data.AzureRepositories.Log;\nusing Quartz;\nusing Quartz.Impl;\n\nnamespace CompetitionPlatform.ScheduledJobs\n{\n public static class JobScheduler\n {\n public static async void Start(string connectionString, ILog log)\n {\n var schedFact = new StdSchedulerFactory();\n\n var sched = await schedFact.GetScheduler();\n await sched.Start();\n\n var job = JobBuilder.Create()\n .WithIdentity(\"myJob\", \"group1\")\n .Build();\n\n var trigger = TriggerBuilder.Create()\n .WithIdentity(\"myTrigger\", \"group1\")\n .WithSimpleSchedule(x => x\n .WithIntervalInHours(1)\n .RepeatForever())\n .Build();\n\n job.JobDataMap[\"connectionString\"] = connectionString;\n job.JobDataMap[\"log\"] = log;\n\n await sched.ScheduleJob(job, trigger);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Common.Log;\nusing CompetitionPlatform.Data.AzureRepositories.Log;\nusing Quartz;\nusing Quartz.Impl;\n\nnamespace CompetitionPlatform.ScheduledJobs\n{\n public static class JobScheduler\n {\n public static async void Start(string connectionString, ILog log)\n {\n var schedFact = new StdSchedulerFactory();\n\n var sched = await schedFact.GetScheduler();\n await sched.Start();\n\n var job = JobBuilder.Create()\n .WithIdentity(\"myJob\", \"group1\")\n .Build();\n\n var trigger = TriggerBuilder.Create()\n .WithIdentity(\"myTrigger\", \"group1\")\n .WithSimpleSchedule(x => x\n .WithIntervalInSeconds(50)\n .RepeatForever())\n .Build();\n\n job.JobDataMap[\"connectionString\"] = connectionString;\n job.JobDataMap[\"log\"] = log;\n\n await sched.ScheduleJob(job, trigger);\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673620,"cells":{"commit":{"kind":"string","value":"b18633f85ee169203e980827d2d5fd972a8220b3"},"subject":{"kind":"string","value":"Add pickable flag to the SimplePlaneAnnotation."},"repos":{"kind":"string","value":"stevefsp/Lizitt-Unity3D-Utilities"},"old_file":{"kind":"string","value":"Source/Lizitt/Utils/Core/Editor/SimplePlaneAnnotationEditor.cs"},"new_file":{"kind":"string","value":"Source/Lizitt/Utils/Core/Editor/SimplePlaneAnnotationEditor.cs"},"new_contents":{"kind":"string","value":"/*\n * Copyright (c) 2015 Stephen A. Pratt\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nusing UnityEditor;\nusing UnityEngine;\n\nnamespace com.lizitt.u3d.editor\n{\n public static class SimplePlaneAnnotationEditor\n {\n private static readonly Vector3 MarkerSize = new Vector3(1, 0.01f, 1);\n\n#if UNITY_5_0_0 || UNITY_5_0_1\n [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)]\n#else\n [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy \n | GizmoType.Pickable)]\n#endif\n static void DrawGizmo(SimplePlaneAnnotation item, GizmoType type)\n {\n#if UNITY_5_0_0 || UNITY_5_0_1\n if (!(AnnotationUtil.drawAlways || (type & GizmoType.SelectedOrChild) != 0))\n#else\n if (!(AnnotationUtil.drawAlways || (type & GizmoType.InSelectionHierarchy) != 0))\n#endif\n return;\n\n Gizmos.color = item.Color;\n Gizmos.matrix = item.transform.localToWorldMatrix;\n Gizmos.DrawCube(item.PositionOffset, MarkerSize);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"/*\n * Copyright (c) 2015 Stephen A. Pratt\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\nusing UnityEditor;\nusing UnityEngine;\n\nnamespace com.lizitt.u3d.editor\n{\n public static class SimplePlaneAnnotationEditor\n {\n private static readonly Vector3 MarkerSize = new Vector3(1, 0.01f, 1);\n\n#if UNITY_5_0_0 || UNITY_5_0_1\n [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)]\n#else\n [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)]\n#endif\n static void DrawGizmo(SimplePlaneAnnotation item, GizmoType type)\n {\n#if UNITY_5_0_0 || UNITY_5_0_1\n if (!(AnnotationUtil.drawAlways || (type & GizmoType.SelectedOrChild) != 0))\n#else\n if (!(AnnotationUtil.drawAlways || (type & GizmoType.InSelectionHierarchy) != 0))\n#endif\n return;\n\n Gizmos.color = item.Color;\n Gizmos.matrix = item.transform.localToWorldMatrix;\n Gizmos.DrawCube(item.PositionOffset, MarkerSize);\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673621,"cells":{"commit":{"kind":"string","value":"6a50c7bde5843d5f0ee625259b9d87c1cd902e86"},"subject":{"kind":"string","value":"Fix new office name clearing after adding"},"repos":{"kind":"string","value":"aregaz/starcounterdemo,aregaz/starcounterdemo"},"old_file":{"kind":"string","value":"src/RealEstateAgencyFranchise/CorporationJson.json.cs"},"new_file":{"kind":"string","value":"src/RealEstateAgencyFranchise/CorporationJson.json.cs"},"new_contents":{"kind":"string","value":"using RealEstateAgencyFranchise.Database;\nusing Starcounter;\n\nnamespace RealEstateAgencyFranchise\n{\n partial class CorporationJson : Json\n {\n static CorporationJson()\n {\n DefaultTemplate.Offices.ElementType.InstanceType = typeof(AgencyOfficeJson);\n }\n\n void Handle(Input.SaveTrigger action)\n {\n Transaction.Commit();\n }\n\n void Handle(Input.NewOfficeTrigger action)\n {\n new Office()\n {\n Corporation = this.Data as Corporation,\n Address = new Address(),\n Trend = 0,\n Name = this.NewOfficeName\n };\n\n this.NewOfficeName = \"\";\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using RealEstateAgencyFranchise.Database;\nusing Starcounter;\n\nnamespace RealEstateAgencyFranchise\n{\n partial class CorporationJson : Json\n {\n static CorporationJson()\n {\n DefaultTemplate.Offices.ElementType.InstanceType = typeof(AgencyOfficeJson);\n }\n\n void Handle(Input.SaveTrigger action)\n {\n Transaction.Commit();\n }\n\n void Handle(Input.NewOfficeTrigger action)\n {\n new Office()\n {\n Corporation = this.Data as Corporation,\n Address = new Address(),\n Trend = 0,\n Name = this.NewOfficeName\n };\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673622,"cells":{"commit":{"kind":"string","value":"5e7c91cb36e843edb2880963334e6f2ab1ddb735"},"subject":{"kind":"string","value":"Apply SerializableAttribute to custom exception"},"repos":{"kind":"string","value":"ritterim/silverpop-dotnet-api,kendaleiv/silverpop-dotnet-api,billboga/silverpop-dotnet-api,kendaleiv/silverpop-dotnet-api"},"old_file":{"kind":"string","value":"src/Silverpop.Client/TransactClientException.cs"},"new_file":{"kind":"string","value":"src/Silverpop.Client/TransactClientException.cs"},"new_contents":{"kind":"string","value":"using System;\n\nnamespace Silverpop.Client\n{\n [Serializable]\n public class TransactClientException : Exception\n {\n public TransactClientException()\n {\n }\n\n public TransactClientException(string message)\n : base(message)\n {\n }\n\n public TransactClientException(string message, Exception innerException)\n : base(message, innerException)\n {\n }\n }\n}"},"old_contents":{"kind":"string","value":"using System;\n\nnamespace Silverpop.Client\n{\n public class TransactClientException : Exception\n {\n public TransactClientException()\n {\n }\n\n public TransactClientException(string message)\n : base(message)\n {\n }\n\n public TransactClientException(string message, Exception innerException)\n : base(message, innerException)\n {\n }\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673623,"cells":{"commit":{"kind":"string","value":"51ded03151085f1f3a609108697c1f3b44f11451"},"subject":{"kind":"string","value":"fix echant channel resources"},"repos":{"kind":"string","value":"Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns"},"old_file":{"kind":"string","value":"TCC.Core/TemplateSelectors/ChannelLabelDataTemplateSelector.cs"},"new_file":{"kind":"string","value":"TCC.Core/TemplateSelectors/ChannelLabelDataTemplateSelector.cs"},"new_contents":{"kind":"string","value":"using System.Windows;\nusing System.Windows.Controls;\nusing TCC.Data;\n\nnamespace TCC.TemplateSelectors\n{\n public class ChannelLabelDataTemplateSelector : DataTemplateSelector\n {\n public DataTemplate NormalChannelDataTemplate { get; set; }\n public DataTemplate WhisperChannelDataTemplate { get; set; }\n public DataTemplate MegaphoneChannelDataTemplate { get; set; }\n public DataTemplate EnchantChannelDataTemplate { get; set; }\n public override DataTemplate SelectTemplate(object item, DependencyObject container)\n {\n var m = item as ChatMessage;\n if (m == null) return null;\n switch (m.Channel)\n {\n case ChatChannel.SentWhisper:\n case ChatChannel.ReceivedWhisper:\n return WhisperChannelDataTemplate;\n case ChatChannel.Megaphone:\n return MegaphoneChannelDataTemplate;\n //case ChatChannel.Enchant12:\n // return EnchantChannelDataTemplate;\n //case ChatChannel.Enchant15:\n // return EnchantChannelDataTemplate;\n default:\n return NormalChannelDataTemplate;\n }\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.Windows;\nusing System.Windows.Controls;\nusing TCC.Data;\n\nnamespace TCC.TemplateSelectors\n{\n public class ChannelLabelDataTemplateSelector : DataTemplateSelector\n {\n public DataTemplate NormalChannelDataTemplate { get; set; }\n public DataTemplate WhisperChannelDataTemplate { get; set; }\n public DataTemplate MegaphoneChannelDataTemplate { get; set; }\n public DataTemplate EnchantChannelDataTemplate { get; set; }\n public override DataTemplate SelectTemplate(object item, DependencyObject container)\n {\n var m = item as ChatMessage;\n if (m == null) return null;\n switch (m.Channel)\n {\n case ChatChannel.SentWhisper:\n case ChatChannel.ReceivedWhisper:\n return WhisperChannelDataTemplate;\n case ChatChannel.Megaphone:\n return MegaphoneChannelDataTemplate;\n case ChatChannel.Enchant12:\n return EnchantChannelDataTemplate;\n case ChatChannel.Enchant15:\n return EnchantChannelDataTemplate;\n default:\n return NormalChannelDataTemplate;\n }\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673624,"cells":{"commit":{"kind":"string","value":"13d05d3f665d6039f4ccbb2c0a9653123909d97b"},"subject":{"kind":"string","value":"add Scope.HasVariable()"},"repos":{"kind":"string","value":"maul-esel/CobaltAHK,maul-esel/CobaltAHK"},"old_file":{"kind":"string","value":"CobaltAHK/ExpressionTree/Scope.cs"},"new_file":{"kind":"string","value":"CobaltAHK/ExpressionTree/Scope.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\n\nnamespace CobaltAHK.ExpressionTree\n{\n\tpublic class Scope\n\t{\n\t\tpublic Scope() : this(null)\n\t\t{\n\t\t\tLoadBuiltinFunctions();\n\t\t}\n\n\t\tpublic Scope(Scope parentScope)\n\t\t{\n\t\t\tparent = parentScope;\n\t\t}\n\n\t\tprivate void LoadBuiltinFunctions()\n\t\t{\n\t\t\tvar flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly;\n\t\t\tvar methods = typeof(IronAHK.Rusty.Core).GetMethods(flags);\n\n\t\t\tforeach (var method in methods) {\n\t\t\t\tvar paramList = method.GetParameters();\n\t\t\t\tif (HasFunction(method.Name) || paramList.Any(p => p.ParameterType.IsByRef)) {\n\t\t\t\t\tcontinue; // skips byRef and overloads // todo: support overloads!\n\t\t\t\t}\n\n\t\t\t\tvar prms = paramList.Select(p => Expression.Parameter(p.ParameterType, p.Name)).ToArray();\n\t\t\t\tvar types = paramList.Select(p => p.ParameterType).ToList();\n\t\t\t\ttypes.Add(method.ReturnType);\n\n\t\t\t\tvar lambda = Expression.Lambda(Expression.GetFuncType(types.ToArray()),\n\t\t\t\t Expression.Call(method, prms),\n\t\t\t\t prms);\n\t\t\t\tAddFunction(method.Name, lambda);\n\t\t\t}\n\t\t}\n\n\t\tprotected readonly Scope parent;\n\n\t\tpublic bool IsRoot { get { return parent == null; } }\n\n\t\tprotected readonly IDictionary functions = new Dictionary();\n\n\t\tpublic virtual void AddFunction(string name, LambdaExpression func) {\n\t\t\tfunctions[name.ToLower()] = func;\n\t\t}\n\n\t\tprotected virtual bool HasFunction(string name)\n\t\t{\n\t\t\treturn functions.ContainsKey(name.ToLower());\n\t\t}\n\n\t\tpublic virtual LambdaExpression ResolveFunction(string name)\n\t\t{\n\t\t\tif (HasFunction(name)) {\n\t\t\t\treturn functions[name.ToLower()];\n\n\t\t\t} else if (parent != null) {\n\t\t\t\treturn parent.ResolveFunction(name);\n\t\t\t}\n\t\t\tthrow new FunctionNotFoundException(name);\n\t\t}\n\n\t\tprotected readonly IDictionary variables = new Dictionary();\n\n\t\tpublic virtual void AddVariable(string name, ParameterExpression variable)\n\t\t{\n\t\t\tvariables[name.ToLower()] = variable;\n\t\t}\n\n\t\tprotected virtual bool HasVariable(string name)\n\t\t{\n\t\t\treturn variables.ContainsKey(name.ToLower());\n\t\t}\n\n\t\tpublic virtual ParameterExpression ResolveVariable(string name)\n\t\t{\n\t\t\tif (!variables.ContainsKey(name.ToLower())) {\n\t\t\t\tAddVariable(name, Expression.Parameter(typeof(object), name));\n\t\t\t}\n\t\t\treturn variables[name.ToLower()];\n\t\t}\n\t}\n\n\tpublic class FunctionNotFoundException : System.Exception\n\t{\n\t\tpublic FunctionNotFoundException(string func) : base(\"Function '\" + func + \"' was not found!\") { }\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\n\nnamespace CobaltAHK.ExpressionTree\n{\n\tpublic class Scope\n\t{\n\t\tpublic Scope() : this(null)\n\t\t{\n\t\t\tLoadBuiltinFunctions();\n\t\t}\n\n\t\tpublic Scope(Scope parentScope)\n\t\t{\n\t\t\tparent = parentScope;\n\t\t}\n\n\t\tprivate void LoadBuiltinFunctions()\n\t\t{\n\t\t\tvar flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly;\n\t\t\tvar methods = typeof(IronAHK.Rusty.Core).GetMethods(flags);\n\n\t\t\tforeach (var method in methods) {\n\t\t\t\tvar paramList = method.GetParameters();\n\t\t\t\tif (HasFunction(method.Name) || paramList.Any(p => p.ParameterType.IsByRef)) {\n\t\t\t\t\tcontinue; // skips byRef and overloads // todo: support overloads!\n\t\t\t\t}\n\n\t\t\t\tvar prms = paramList.Select(p => Expression.Parameter(p.ParameterType, p.Name)).ToArray();\n\t\t\t\tvar types = paramList.Select(p => p.ParameterType).ToList();\n\t\t\t\ttypes.Add(method.ReturnType);\n\n\t\t\t\tvar lambda = Expression.Lambda(Expression.GetFuncType(types.ToArray()),\n\t\t\t\t Expression.Call(method, prms),\n\t\t\t\t prms);\n\t\t\t\tAddFunction(method.Name, lambda);\n\t\t\t}\n\t\t}\n\n\t\tprotected readonly Scope parent;\n\n\t\tpublic bool IsRoot { get { return parent == null; } }\n\n\t\tprotected readonly IDictionary functions = new Dictionary();\n\n\t\tpublic virtual void AddFunction(string name, LambdaExpression func) {\n\t\t\tfunctions[name.ToLower()] = func;\n\t\t}\n\n\t\tprotected virtual bool HasFunction(string name)\n\t\t{\n\t\t\treturn functions.ContainsKey(name.ToLower());\n\t\t}\n\n\t\tpublic virtual LambdaExpression ResolveFunction(string name)\n\t\t{\n\t\t\tif (HasFunction(name)) {\n\t\t\t\treturn functions[name.ToLower()];\n\n\t\t\t} else if (parent != null) {\n\t\t\t\treturn parent.ResolveFunction(name);\n\t\t\t}\n\t\t\tthrow new FunctionNotFoundException(name);\n\t\t}\n\n\t\tprotected readonly IDictionary variables = new Dictionary();\n\n\t\tpublic virtual void AddVariable(string name, ParameterExpression variable)\n\t\t{\n\t\t\tvariables[name.ToLower()] = variable;\n\t\t}\n\n\t\tpublic virtual ParameterExpression ResolveVariable(string name)\n\t\t{\n\t\t\tif (!variables.ContainsKey(name.ToLower())) {\n\t\t\t\tAddVariable(name, Expression.Parameter(typeof(object), name));\n\t\t\t}\n\t\t\treturn variables[name.ToLower()];\n\t\t}\n\t}\n\n\tpublic class FunctionNotFoundException : System.Exception\n\t{\n\t\tpublic FunctionNotFoundException(string func) : base(\"Function '\" + func + \"' was not found!\") { }\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673625,"cells":{"commit":{"kind":"string","value":"fca5ae088e2c3864cc1e728fba8cfbc7b434bf95"},"subject":{"kind":"string","value":"Use NDes.options for binarycache test executable"},"repos":{"kind":"string","value":"lucasg/Dependencies,lucasg/Dependencies,lucasg/Dependencies"},"old_file":{"kind":"string","value":"test/binarycache-test/Program.cs"},"new_file":{"kind":"string","value":"test/binarycache-test/Program.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Diagnostics;\nusing System.Collections.Generic;\n\nusing Dependencies.ClrPh;\nusing NDesk.Options;\n\nnamespace Dependencies\n{\n namespace Test\n {\n class Program\n {\n static void ShowHelp(OptionSet p)\n {\n Console.WriteLine(\"Usage: binarycache [options] \");\n Console.WriteLine();\n Console.WriteLine(\"Options:\");\n p.WriteOptionDescriptions(Console.Out);\n }\n\n static void Main(string[] args)\n {\n bool is_verbose = false;\n bool show_help = false;\n\n OptionSet opts = new OptionSet() {\n { \"v|verbose\", \"redirect debug traces to console\", v => is_verbose = v != null },\n { \"h|help\", \"show this message and exit\", v => show_help = v != null },\n };\n\n List eps = opts.Parse(args);\n\n if (show_help)\n {\n ShowHelp(opts);\n return;\n }\n\n if (is_verbose)\n {\n // Redirect debug log to the console\n Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));\n Debug.AutoFlush = true;\n }\n\n // always the first call to make\n Phlib.InitializePhLib();\n\n BinaryCache.Instance.Load();\n\n foreach ( var peFilePath in eps)\n {\n PE Pe = BinaryCache.LoadPe(peFilePath);\n Console.WriteLine(\"Loaded PE file : {0:s}\", Pe.Filepath);\n }\n\n\n BinaryCache.Instance.Unload();\n }\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Diagnostics;\nusing Dependencies.ClrPh;\n\nnamespace Dependencies\n{\n namespace Test\n {\n class Program\n {\n static void Main(string[] args)\n {\n // always the first call to make\n Phlib.InitializePhLib();\n\n // Redirect debug log to the console\n Debug.Listeners.Add(new TextWriterTraceListener(Console.Out));\n Debug.AutoFlush = true;\n\n BinaryCache.Instance.Load();\n\n foreach ( var peFilePath in args )\n {\n PE Pe = BinaryCache.LoadPe(peFilePath);\n }\n\n\n BinaryCache.Instance.Unload();\n }\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673626,"cells":{"commit":{"kind":"string","value":"3bcef6c182601f3c6ea7f556b3d1091f62e5d0c3"},"subject":{"kind":"string","value":"Update Program.cs"},"repos":{"kind":"string","value":"Metapyziks/Ziks.WebServer"},"old_file":{"kind":"string","value":"Examples/SimpleExample/Program.cs"},"new_file":{"kind":"string","value":"Examples/SimpleExample/Program.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Reflection;\nusing System.Threading.Tasks;\nusing Ziks.WebServer;\n\nnamespace SimpleExample\n{\n public class Program : IProgram\n {\n [STAThread]\n static void Main( string[] args )\n {\n var server = new Server();\n\n server.AddPrefix( \"http://+:8080/\" );\n server.AddControllers( Assembly.GetExecutingAssembly() );\n\n Task.Run( server.Run );\n\n Console.ReadKey( true );\n\n server.Stop();\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Reflection;\nusing System.Threading.Tasks;\nusing Ziks.WebServer;\n\nnamespace SimpleExample\n{\n public interface IProgram\n {\n void WriteLine( string message );\n }\n\n public class Program : IProgram\n {\n [STAThread]\n static void Main( string[] args )\n {\n var program = new Program();\n program.Run();\n }\n\n public void Run()\n {\n var server = new Server();\n\n server.AddPrefix( \"http://+:8080/\" );\n\n server.Components.Add( this );\n server.AddControllers( Assembly.GetExecutingAssembly() );\n\n Task.Run( () => server.Run() );\n\n Console.ReadKey( true );\n\n server.Stop();\n }\n\n public void WriteLine( string message )\n {\n Console.WriteLine( message );\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673627,"cells":{"commit":{"kind":"string","value":"fe1e451812fc298a0d591ed374dc03f1cd0f3341"},"subject":{"kind":"string","value":"Fix wrong dirtyness propagation"},"repos":{"kind":"string","value":"cbovar/ConvNetSharp"},"old_file":{"kind":"string","value":"src/ConvNetSharp.Flow/Ops/Assign.cs"},"new_file":{"kind":"string","value":"src/ConvNetSharp.Flow/Ops/Assign.cs"},"new_contents":{"kind":"string","value":"using System;\nusing ConvNetSharp.Volume;\n\nnamespace ConvNetSharp.Flow.Ops\n{\n /// \n /// Assignment: valueOp = op\n /// \n /// \n public class Assign : Op where T : struct, IEquatable, IFormattable\n {\n private long _lastComputeStep;\n\n public Assign(Op valueOp, Op op)\n {\n if (!(valueOp is Variable))\n {\n throw new ArgumentException(\"Assigned Op should be a Variable\", nameof(valueOp));\n }\n\n AddParent(valueOp);\n AddParent(op);\n }\n\n public override string Representation => \"->\";\n\n public override void Differentiate()\n {\n throw new NotImplementedException();\n }\n\n public override Volume Evaluate(Session session)\n {\n if(!this.IsDirty)\n {\n return base.Evaluate(session);\n }\n this.IsDirty = false;\n\n this.Result = this.Parents[1].Evaluate(session);\n ((Variable)this.Parents[0]).SetValue(this.Result);\n\n return base.Evaluate(session);\n }\n\n public override string ToString()\n {\n return $\"({this.Parents[0]} <- {this.Parents[1]})\";\n }\n }\n}"},"old_contents":{"kind":"string","value":"using System;\nusing ConvNetSharp.Volume;\n\nnamespace ConvNetSharp.Flow.Ops\n{\n /// \n /// Assignment: valueOp = op\n /// \n /// \n public class Assign : Op where T : struct, IEquatable, IFormattable\n {\n private long _lastComputeStep;\n\n public Assign(Op valueOp, Op op)\n {\n if (!(valueOp is Variable))\n {\n throw new ArgumentException(\"Assigned Op should be a Variable\", nameof(valueOp));\n }\n\n AddParent(valueOp);\n AddParent(op);\n }\n\n public override string Representation => \"->\";\n\n public override void Differentiate()\n {\n throw new NotImplementedException();\n }\n\n public override Volume Evaluate(Session session)\n {\n if (this._lastComputeStep == session.Step)\n {\n return this.Parents[0].Evaluate(session);\n }\n this._lastComputeStep = session.Step;\n\n this.Result = this.Parents[1].Evaluate(session);\n ((Variable)this.Parents[0]).SetValue(this.Result);\n\n return base.Evaluate(session);\n }\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673628,"cells":{"commit":{"kind":"string","value":"a77306567b8ae26bafced6d2b32b9a73c2c42e6c"},"subject":{"kind":"string","value":"Swap Dictionary with ConcurrentDictionary in InMemoryBackgroundJobStore"},"repos":{"kind":"string","value":"zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,verdentk/aspnetboilerplate,verdentk/aspnetboilerplate,AlexGeller/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,AlexGeller/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,zclmoon/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,andmattia/aspnetboilerplate,beratcarsi/aspnetboilerplate,andmattia/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,Nongzhsh/aspnetboilerplate,luchaoshuai/aspnetboilerplate,virtualcca/aspnetboilerplate,ryancyq/aspnetboilerplate,AlexGeller/aspnetboilerplate"},"old_file":{"kind":"string","value":"src/Abp/BackgroundJobs/InMemoryBackgroundJobStore.cs"},"new_file":{"kind":"string","value":"src/Abp/BackgroundJobs/InMemoryBackgroundJobStore.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Abp.Timing;\n\nnamespace Abp.BackgroundJobs\n{\n /// \n /// In memory implementation of .\n /// It's used if is not implemented by actual persistent store\n /// and job execution is enabled () for the application.\n /// \n public class InMemoryBackgroundJobStore : IBackgroundJobStore\n {\n private readonly ConcurrentDictionary _jobs;\n private long _lastId;\n\n /// \n /// Initializes a new instance of the class.\n /// \n public InMemoryBackgroundJobStore()\n {\n _jobs = new ConcurrentDictionary();\n }\n\n public Task GetAsync(long jobId)\n {\n return Task.FromResult(_jobs[jobId]);\n }\n\n public Task InsertAsync(BackgroundJobInfo jobInfo)\n {\n jobInfo.Id = Interlocked.Increment(ref _lastId);\n _jobs[jobInfo.Id] = jobInfo;\n\n return Task.FromResult(0);\n }\n\n public Task> GetWaitingJobsAsync(int maxResultCount)\n {\n var waitingJobs = _jobs.Values\n .Where(t => !t.IsAbandoned && t.NextTryTime <= Clock.Now)\n .OrderByDescending(t => t.Priority)\n .ThenBy(t => t.TryCount)\n .ThenBy(t => t.NextTryTime)\n .Take(maxResultCount)\n .ToList();\n\n return Task.FromResult(waitingJobs);\n }\n\n public Task DeleteAsync(BackgroundJobInfo jobInfo)\n {\n _jobs.TryRemove(jobInfo.Id, out _);\n\n return Task.FromResult(0);\n }\n\n public Task UpdateAsync(BackgroundJobInfo jobInfo)\n {\n if (jobInfo.IsAbandoned)\n {\n return DeleteAsync(jobInfo);\n }\n\n return Task.FromResult(0);\n }\n }\n}"},"old_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Abp.Timing;\n\nnamespace Abp.BackgroundJobs\n{\n /// \n /// In memory implementation of .\n /// It's used if is not implemented by actual persistent store\n /// and job execution is enabled () for the application.\n /// \n public class InMemoryBackgroundJobStore : IBackgroundJobStore\n {\n private readonly Dictionary _jobs;\n private long _lastId;\n\n /// \n /// Initializes a new instance of the class.\n /// \n public InMemoryBackgroundJobStore()\n {\n _jobs = new Dictionary();\n }\n\n public Task GetAsync(long jobId)\n {\n return Task.FromResult(_jobs[jobId]);\n }\n\n public Task InsertAsync(BackgroundJobInfo jobInfo)\n {\n jobInfo.Id = Interlocked.Increment(ref _lastId);\n _jobs[jobInfo.Id] = jobInfo;\n\n return Task.FromResult(0);\n }\n\n public Task> GetWaitingJobsAsync(int maxResultCount)\n {\n var waitingJobs = _jobs.Values\n .Where(t => !t.IsAbandoned && t.NextTryTime <= Clock.Now)\n .OrderByDescending(t => t.Priority)\n .ThenBy(t => t.TryCount)\n .ThenBy(t => t.NextTryTime)\n .Take(maxResultCount)\n .ToList();\n\n return Task.FromResult(waitingJobs);\n }\n\n public Task DeleteAsync(BackgroundJobInfo jobInfo)\n {\n if (!_jobs.ContainsKey(jobInfo.Id))\n {\n return Task.FromResult(0);\n }\n\n _jobs.Remove(jobInfo.Id);\n\n return Task.FromResult(0);\n }\n\n public Task UpdateAsync(BackgroundJobInfo jobInfo)\n {\n if (jobInfo.IsAbandoned)\n {\n return DeleteAsync(jobInfo);\n }\n\n return Task.FromResult(0);\n }\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673629,"cells":{"commit":{"kind":"string","value":"4883acbef61dd86afff2b3e1ab486a2943a4fcf0"},"subject":{"kind":"string","value":"Update src/Abp/Configuration/Startup/IMultiTenancyConfig.cs"},"repos":{"kind":"string","value":"beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,verdentk/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate"},"old_file":{"kind":"string","value":"src/Abp/Configuration/Startup/IMultiTenancyConfig.cs"},"new_file":{"kind":"string","value":"src/Abp/Configuration/Startup/IMultiTenancyConfig.cs"},"new_contents":{"kind":"string","value":"using System.Collections;\nusing Abp.Collections;\nusing Abp.MultiTenancy;\n\nnamespace Abp.Configuration.Startup\n{\n /// \n /// Used to configure multi-tenancy.\n /// \n public interface IMultiTenancyConfig\n {\n /// \n /// Is multi-tenancy enabled?\n /// Default value: false.\n /// \n bool IsEnabled { get; set; }\n\n /// \n /// Ignore feature check for host users\n /// Default value: false.\n /// \n bool IgnoreFeatureCheckForHostUsers { get; set; }\n\n /// \n /// A list of contributors for tenant resolve process.\n /// \n ITypeList Resolvers { get; }\n\n /// \n /// TenantId resolve key\n /// Default value: \"Abp.TenantId\"\n /// \n string TenantIdResolveKey { get; set; }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.Collections;\nusing Abp.Collections;\nusing Abp.MultiTenancy;\n\nnamespace Abp.Configuration.Startup\n{\n /// \n /// Used to configure multi-tenancy.\n /// \n public interface IMultiTenancyConfig\n {\n /// \n /// Is multi-tenancy enabled?\n /// Default value: false.\n /// \n bool IsEnabled { get; set; }\n\n /// \n /// Ignore feature check for host users\n /// Default value: false.\n /// \n bool IgnoreFeatureCheckForHostUsers { get; set; }\n\n /// \n /// A list of contributors for tenant resolve process.\n /// \n ITypeList Resolvers { get; }\n\n /// \n /// TenantId resolve key, default value is Abp.TenantId\n /// \n string TenantIdResolveKey { get; set; }\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673630,"cells":{"commit":{"kind":"string","value":"2cc9326f0b657fb0383633739f98c2dfd1fcd699"},"subject":{"kind":"string","value":"Add Clock.SecondsLeftAfterLatestMove"},"repos":{"kind":"string","value":"Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training"},"old_file":{"kind":"string","value":"src/ChessVariantsTraining/Models/Variant960/Clock.cs"},"new_file":{"kind":"string","value":"src/ChessVariantsTraining/Models/Variant960/Clock.cs"},"new_contents":{"kind":"string","value":"using MongoDB.Bson.Serialization.Attributes;\nusing System.Diagnostics;\n\nnamespace ChessVariantsTraining.Models.Variant960\n{\n public class Clock\n {\n double secondsLimit;\n Stopwatch stopwatch;\n TimeControl timeControl;\n\n [BsonElement(\"secondsLeftAfterLatestMove\")]\n public double SecondsLeftAfterLatestMove\n {\n get;\n set;\n }\n\n public Clock(TimeControl tc)\n {\n timeControl = tc;\n secondsLimit = tc.InitialSeconds;\n SecondsLeftAfterLatestMove = secondsLimit;\n }\n\n public void Start()\n {\n stopwatch.Start();\n }\n\n public void Pause()\n {\n stopwatch.Stop();\n }\n\n public void AddIncrement()\n {\n secondsLimit += timeControl.Increment;\n }\n\n public void MoveMade()\n {\n Pause();\n AddIncrement();\n SecondsLeftAfterLatestMove = GetSecondsLeft();\n }\n\n public double GetSecondsLeft()\n {\n return secondsLimit - stopwatch.Elapsed.TotalSeconds;\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.Diagnostics;\n\nnamespace ChessVariantsTraining.Models.Variant960\n{\n public class Clock\n {\n double secondsLimit;\n Stopwatch stopwatch;\n TimeControl timeControl;\n\n public Clock(TimeControl tc)\n {\n timeControl = tc;\n secondsLimit = tc.InitialSeconds;\n }\n\n public void Start()\n {\n stopwatch.Start();\n }\n\n public void Pause()\n {\n stopwatch.Stop();\n }\n\n public void AddIncrement()\n {\n secondsLimit += timeControl.Increment;\n }\n\n public double GetSecondsLeft()\n {\n return secondsLimit - stopwatch.Elapsed.TotalSeconds;\n }\n }\n}\n"},"license":{"kind":"string","value":"agpl-3.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673631,"cells":{"commit":{"kind":"string","value":"4102b5857d71cabae340c069d09cb96e2cfe59e4"},"subject":{"kind":"string","value":"Make sure multi-line output works when invoked with <<...>> output templates."},"repos":{"kind":"string","value":"JornWildt/ZimmerBot"},"old_file":{"kind":"string","value":"ZimmerBot.Core/Request.cs"},"new_file":{"kind":"string","value":"ZimmerBot.Core/Request.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Generic;\r\nusing CuttingEdge.Conditions;\r\n\r\nnamespace ZimmerBot.Core\r\n{\r\n public class Request\r\n {\r\n public enum EventEnum { Welcome }\r\n\r\n public string Input { get; set; }\r\n\r\n public Dictionary State { get; set; }\r\n\r\n public string SessionId { get; set; }\r\n\r\n public string UserId { get; set; }\r\n\r\n public string RuleId { get; set; }\r\n\r\n public string RuleLabel { get; set; }\r\n\r\n public EventEnum? EventType { get; set; }\r\n\r\n public string BotId { get; set; }\r\n\r\n public Request()\r\n : this(\"default\", \"default\")\r\n {\r\n }\r\n\r\n\r\n public Request(string sessionId, string userId)\r\n {\r\n Condition.Requires(sessionId, nameof(sessionId)).IsNotNullOrEmpty();\r\n Condition.Requires(userId, nameof(userId)).IsNotNullOrEmpty();\r\n\r\n SessionId = sessionId;\r\n UserId = userId;\r\n }\r\n\r\n\r\n public Request(Request src, string input)\r\n {\r\n Input = input;\r\n State = src.State;\r\n SessionId = src.SessionId;\r\n UserId = src.UserId;\r\n RuleId = src.RuleId;\r\n RuleLabel = src.RuleLabel;\r\n EventType = src.EventType;\r\n BotId = src.BotId;\r\n }\r\n }\r\n}\r\n"},"old_contents":{"kind":"string","value":"using System.Collections.Generic;\r\nusing CuttingEdge.Conditions;\r\n\r\nnamespace ZimmerBot.Core\r\n{\r\n public class Request\r\n {\r\n public enum EventEnum { Welcome }\r\n\r\n public string Input { get; set; }\r\n\r\n public Dictionary State { get; set; }\r\n\r\n public string SessionId { get; set; }\r\n\r\n public string UserId { get; set; }\r\n\r\n public string RuleId { get; set; }\r\n\r\n public string RuleLabel { get; set; }\r\n\r\n public EventEnum? EventType { get; set; }\r\n\r\n public string BotId { get; set; }\r\n\r\n public Request()\r\n : this(\"default\", \"default\")\r\n {\r\n }\r\n\r\n\r\n public Request(string sessionId, string userId)\r\n {\r\n Condition.Requires(sessionId, nameof(sessionId)).IsNotNullOrEmpty();\r\n Condition.Requires(userId, nameof(userId)).IsNotNullOrEmpty();\r\n\r\n SessionId = sessionId;\r\n UserId = userId;\r\n }\r\n\r\n\r\n public Request(Request src, string input)\r\n {\r\n Input = input;\r\n State = src.State;\r\n SessionId = src.SessionId;\r\n UserId = src.UserId;\r\n State = src.State;\r\n RuleId = src.RuleId;\r\n RuleLabel = src.RuleLabel;\r\n }\r\n }\r\n}\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673632,"cells":{"commit":{"kind":"string","value":"fc9aa4cd88eacd1f3f40c7029be79d0a9232c2fa"},"subject":{"kind":"string","value":"Make ConsoleHost internals visible to powershell-tests"},"repos":{"kind":"string","value":"JamesWTruher/PowerShell-1,PaulHigin/PowerShell,PaulHigin/PowerShell,bingbing8/PowerShell,PaulHigin/PowerShell,KarolKaczmarek/PowerShell,jsoref/PowerShell,kmosher/PowerShell,PaulHigin/PowerShell,bingbing8/PowerShell,kmosher/PowerShell,kmosher/PowerShell,jsoref/PowerShell,kmosher/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,TravisEz13/PowerShell,TravisEz13/PowerShell,TravisEz13/PowerShell,kmosher/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,jsoref/PowerShell,JamesWTruher/PowerShell-1,bmanikm/PowerShell,KarolKaczmarek/PowerShell,JamesWTruher/PowerShell-1,jsoref/PowerShell,bingbing8/PowerShell,bmanikm/PowerShell,jsoref/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,bingbing8/PowerShell,KarolKaczmarek/PowerShell,daxian-dbw/PowerShell,daxian-dbw/PowerShell,bingbing8/PowerShell,bmanikm/PowerShell,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1"},"old_file":{"kind":"string","value":"src/Microsoft.PowerShell.ConsoleHost/AssemblyInfo.cs"},"new_file":{"kind":"string","value":"src/Microsoft.PowerShell.ConsoleHost/AssemblyInfo.cs"},"new_contents":{"kind":"string","value":"using System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\n#if !CORECLR\nusing System.Runtime.ConstrainedExecution;\nusing System.Security.Permissions;\n#endif\n\n[assembly:InternalsVisibleTo(\"powershell-tests\")]\n\n[assembly:AssemblyCulture(\"\")]\n[assembly:NeutralResourcesLanguage(\"en-US\")]\n\n#if !CORECLR\n[assembly:AssemblyConfiguration(\"\")]\n[assembly:AssemblyInformationalVersionAttribute (@\"10.0.10011.16384\")]\n[assembly:ReliabilityContractAttribute(Consistency.MayCorruptAppDomain, Cer.MayFail)]\n[assembly:AssemblyTitle(\"Microsoft.PowerShell.ConsoleHost\")]\n[assembly:AssemblyDescription(\"Microsoft Windows PowerShell Console Host\")]\n\n[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.5\")]\n[assembly:System.Reflection.AssemblyFileVersion(\"10.0.10011.16384\")]\n[assembly:AssemblyKeyFileAttribute(@\"..\\signing\\visualstudiopublic.snk\")]\n[assembly:System.Reflection.AssemblyDelaySign(true)]\n#endif\n[assembly:System.Runtime.InteropServices.ComVisible(false)]\n[assembly:System.Reflection.AssemblyVersion(\"3.0.0.0\")]\n[assembly:System.Reflection.AssemblyProduct(\"Microsoft (R) Windows (R) Operating System\")]\n[assembly:System.Reflection.AssemblyCopyright(\"Copyright (c) Microsoft Corporation. All rights reserved.\")]\n[assembly:System.Reflection.AssemblyCompany(\"Microsoft Corporation\")]\n\ninternal static class AssemblyStrings\n{\n internal const string AssemblyVersion = @\"3.0.0.0\";\n internal const string AssemblyCopyright = \"Copyright (C) 2006 Microsoft Corporation. All rights reserved.\";\n}\n"},"old_contents":{"kind":"string","value":"using System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\n#if !CORECLR\nusing System.Runtime.ConstrainedExecution;\nusing System.Security.Permissions;\n#endif\n\n[assembly:AssemblyCulture(\"\")]\n[assembly:NeutralResourcesLanguage(\"en-US\")]\n\n#if !CORECLR\n[assembly:AssemblyConfiguration(\"\")]\n[assembly:AssemblyInformationalVersionAttribute (@\"10.0.10011.16384\")]\n[assembly:ReliabilityContractAttribute(Consistency.MayCorruptAppDomain, Cer.MayFail)]\n[assembly:AssemblyTitle(\"Microsoft.PowerShell.ConsoleHost\")]\n[assembly:AssemblyDescription(\"Microsoft Windows PowerShell Console Host\")]\n\n[assembly:System.Runtime.Versioning.TargetFrameworkAttribute(\".NETFramework,Version=v4.5\")]\n[assembly:System.Reflection.AssemblyFileVersion(\"10.0.10011.16384\")]\n[assembly:AssemblyKeyFileAttribute(@\"..\\signing\\visualstudiopublic.snk\")]\n[assembly:System.Reflection.AssemblyDelaySign(true)]\n#endif\n[assembly:System.Runtime.InteropServices.ComVisible(false)]\n[assembly:System.Reflection.AssemblyVersion(\"3.0.0.0\")]\n[assembly:System.Reflection.AssemblyProduct(\"Microsoft (R) Windows (R) Operating System\")]\n[assembly:System.Reflection.AssemblyCopyright(\"Copyright (c) Microsoft Corporation. All rights reserved.\")]\n[assembly:System.Reflection.AssemblyCompany(\"Microsoft Corporation\")]\n\ninternal static class AssemblyStrings\n{\n internal const string AssemblyVersion = @\"3.0.0.0\";\n internal const string AssemblyCopyright = \"Copyright (C) 2006 Microsoft Corporation. All rights reserved.\";\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673633,"cells":{"commit":{"kind":"string","value":"f1192418c70c1bd8db6a8d05b23f6bf7645f5d5e"},"subject":{"kind":"string","value":"remove unused dependency on System.Threading.Tasks"},"repos":{"kind":"string","value":"biboudis/LambdaMicrobenchmarking"},"old_file":{"kind":"string","value":"LambdaMicrobenchmarking/Script.cs"},"new_file":{"kind":"string","value":"LambdaMicrobenchmarking/Script.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nnamespace LambdaMicrobenchmarking\n{\n\n public static class Script\n {\n public static Script Of(params Tuple>[] actions)\n {\n return Script.Of(actions);\n }\n\n public static Script Of(String name, Func action)\n {\n return Of(Tuple.Create(name, action));\n }\n }\n\n public class Script\n {\n static public int Iterations\n {\n get { return Run.iterations; }\n set { Run.iterations = value; }\n }\n\n static public int WarmupIterations\n {\n get { return Run.warmups; }\n set { Run.warmups = value; }\n }\n\n public static double MinRunningSecs\n {\n get { return Run.minimumSecs; }\n set { Run.minimumSecs = value; }\n }\n\n private List>> actions { get; set; }\n\n private Script(params Tuple>[] actions)\n {\n this.actions = actions.ToList();\n }\n\n public static Script Of(params Tuple>[] actions)\n {\n return new Script(actions);\n }\n\n public Script Of(String name, Func action)\n {\n actions.Add(Tuple.Create(name,action));\n return this;\n }\n\n public Script WithHead()\n {\n Console.WriteLine(Run.FORMAT, \"Benchmark\", \"Mean\", \"Mean-Error\", \"Sdev\", \"Unit\", \"Count\");\n return this;\n }\n\n public Script RunAll()\n {\n actions.Select(action => new Run(action)).ToList().ForEach(run => run.Measure());\n return this;\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LambdaMicrobenchmarking\n{\n\n public static class Script\n {\n public static Script Of(params Tuple>[] actions)\n {\n return Script.Of(actions);\n }\n\n public static Script Of(String name, Func action)\n {\n return Of(Tuple.Create(name, action));\n }\n }\n\n public class Script\n {\n static public int Iterations\n {\n get { return Run.iterations; }\n set { Run.iterations = value; }\n }\n\n static public int WarmupIterations\n {\n get { return Run.warmups; }\n set { Run.warmups = value; }\n }\n\n public static double MinRunningSecs\n {\n get { return Run.minimumSecs; }\n set { Run.minimumSecs = value; }\n }\n\n private List>> actions { get; set; }\n\n private Script(params Tuple>[] actions)\n {\n this.actions = actions.ToList();\n }\n\n public static Script Of(params Tuple>[] actions)\n {\n return new Script(actions);\n }\n\n public Script Of(String name, Func action)\n {\n actions.Add(Tuple.Create(name,action));\n return this;\n }\n\n public Script WithHead()\n {\n Console.WriteLine(Run.FORMAT, \"Benchmark\", \"Mean\", \"Mean-Error\", \"Sdev\", \"Unit\", \"Count\");\n return this;\n }\n\n public Script RunAll()\n {\n actions.Select(action => new Run(action)).ToList().ForEach(run => run.Measure());\n return this;\n }\n }\n}\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673634,"cells":{"commit":{"kind":"string","value":"168baae3d25bf647a61056aa762e6b3c581869b6"},"subject":{"kind":"string","value":"update storage size and limit peck"},"repos":{"kind":"string","value":"ASOS/woodpecker"},"old_file":{"kind":"string","value":"src/Woodpecker.Core/Sql/AzureSqlStorageSizePecker.cs"},"new_file":{"kind":"string","value":"src/Woodpecker.Core/Sql/AzureSqlStorageSizePecker.cs"},"new_contents":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace Woodpecker.Core.Sql\r\n{\r\n public class AzureSqlStorageSizePecker : AzureSqlDmvPeckerBase\r\n {\r\n private const string _query = @\"\r\nselect @@servername [collection_server_name] \r\n , db_name() [collection_database_name]\r\n     , getutcdate() [collection_time_utc]  \r\n     , df.file_id  \r\n , df.type_desc [file_type_desc] \r\n , convert(bigint, df.size) *8 [size_kb] \r\n , convert(bigint, df.max_size) *8 [max_size_kb] \r\nfrom sys.database_files df;\";\r\n\r\n protected override string GetQuery()\r\n {\r\n return _query;\r\n }\r\n\r\n protected override IEnumerable GetRowKeyFieldNames()\r\n {\r\n return new[] { \"collection_server_name\", \"collection_database_name\", \"file_id\" };\r\n }\r\n\r\n protected override string GetUtcTimestampFieldName()\r\n {\r\n return \"collection_time_utc\";\r\n }\r\n }\r\n}\r\n"},"old_contents":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\nusing System.Threading.Tasks;\r\n\r\nnamespace Woodpecker.Core.Sql\r\n{\r\n public class AzureSqlStorageSizePecker : AzureSqlDmvPeckerBase\r\n {\r\n private const string DatabaseWaitInlineSqlNotSoBad = @\"select @@servername [server_name] \r\n-- varchar(128) \r\n , db_name() [database_name] -- varchar(128) \r\n , db_id() [database_id] -- int \r\n , getutcdate() [collection_time_utc]                -- datetime\r\n , df.file_id -- int \r\n , df.type_desc [file_type_desc] -- varchar(60) \r\n , convert(bigint, df.size) *8 [size_kb] -- bigint \r\n , convert(bigint, df.max_size) *8 [max_size_kb] -- bigint \r\nfrom sys.database_files df; \";\r\n\r\n protected override string GetQuery()\r\n {\r\n return DatabaseWaitInlineSqlNotSoBad;\r\n }\r\n\r\n protected override IEnumerable GetRowKeyFieldNames()\r\n {\r\n return new[] { \"server_name\", \"database_name\", \"file_id\"};\r\n }\r\n\r\n protected override string GetUtcTimestampFieldName()\r\n {\r\n return \"collection_time_utc\";\r\n }\r\n }\r\n}\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673635,"cells":{"commit":{"kind":"string","value":"d87c31ee01abb55c97a043c43d95a81f7d5f4368"},"subject":{"kind":"string","value":"Use PredefinedErrorTypeNames instead of literals"},"repos":{"kind":"string","value":"modulexcite/DartVS,DartVS/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS"},"old_file":{"kind":"string","value":"DanTup.DartVS.Vsix/Taggers/ErrorSquiggleTagger.cs"},"new_file":{"kind":"string","value":"DanTup.DartVS.Vsix/Taggers/ErrorSquiggleTagger.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.ComponentModel.Composition;\nusing System.Linq;\nusing System.Reactive.Linq;\nusing DanTup.DartAnalysis;\nusing DanTup.DartAnalysis.Json;\nusing Microsoft.VisualStudio.Text;\nusing Microsoft.VisualStudio.Text.Adornments;\nusing Microsoft.VisualStudio.Text.Tagging;\nusing Microsoft.VisualStudio.Utilities;\n\nnamespace DanTup.DartVS\n{\n\t[Export(typeof(ITaggerProvider))]\n\t[ContentType(DartContentTypeDefinition.DartContentType)]\n\t[TagType(typeof(ErrorTag))]\n\tinternal sealed class ErrorSquiggleTagProvider : ITaggerProvider\n\t{\n\t\t[Import]\n\t\tITextDocumentFactoryService textDocumentFactory = null;\n\n\t\t[Import]\n\t\tDartAnalysisService analysisService = null;\n\n\t\tpublic ITagger CreateTagger(ITextBuffer buffer) where T : ITag\n\t\t{\n\t\t\treturn new ErrorSquiggleTagger(buffer, textDocumentFactory, analysisService) as ITagger;\n\t\t}\n\t}\n\n\tclass ErrorSquiggleTagger : AnalysisNotificationTagger\n\t{\n\t\tpublic ErrorSquiggleTagger(ITextBuffer buffer, ITextDocumentFactoryService textDocumentFactory, DartAnalysisService analysisService)\n\t\t\t: base(buffer, textDocumentFactory, analysisService)\n\t\t{\n\t\t\tthis.Subscribe();\n\t\t}\n\n\t\tprotected override ITagSpan CreateTag(AnalysisError error)\n\t\t{\n\t\t\t// syntax error: red\n\t\t\t// compiler error: blue\n\t\t\t// other error: purple\n\t\t\t// warning: red\n\t\t\tvar squiggleType = error.Severity == AnalysisErrorSeverity.Error ? PredefinedErrorTypeNames.SyntaxError\n\t\t\t\t: error.Severity == AnalysisErrorSeverity.Warning ? PredefinedErrorTypeNames.CompilerError\n\t\t\t\t: PredefinedErrorTypeNames.OtherError;\n\n\t\t\treturn new TagSpan(new SnapshotSpan(buffer.CurrentSnapshot, error.Location.Offset, error.Location.Length), new ErrorTag(squiggleType, error.Message));\n\t\t}\n\n\t\tprotected override IDisposable Subscribe(Action updateSourceData)\n\t\t{\n\t\t\treturn this.analysisService.AnalysisErrorsNotification.Where(en => en.File == textDocument.FilePath).Subscribe(updateSourceData);\n\t\t}\n\n\t\tprotected override AnalysisError[] GetDataToTag(AnalysisErrorsNotification notification)\n\t\t{\n\t\t\treturn notification.Errors.Where(e => e.Location.File == textDocument.FilePath).ToArray();\n\t\t}\n\n\t\tprotected override Tuple GetOffsetAndLength(AnalysisError data)\n\t\t{\n\t\t\treturn Tuple.Create(data.Location.Offset, data.Location.Length);\n\t\t}\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.ComponentModel.Composition;\nusing System.Linq;\nusing System.Reactive.Linq;\nusing DanTup.DartAnalysis;\nusing DanTup.DartAnalysis.Json;\nusing Microsoft.VisualStudio.Text;\nusing Microsoft.VisualStudio.Text.Tagging;\nusing Microsoft.VisualStudio.Utilities;\n\nnamespace DanTup.DartVS\n{\n\t[Export(typeof(ITaggerProvider))]\n\t[ContentType(DartContentTypeDefinition.DartContentType)]\n\t[TagType(typeof(ErrorTag))]\n\tinternal sealed class ErrorSquiggleTagProvider : ITaggerProvider\n\t{\n\t\t[Import]\n\t\tITextDocumentFactoryService textDocumentFactory = null;\n\n\t\t[Import]\n\t\tDartAnalysisService analysisService = null;\n\n\t\tpublic ITagger CreateTagger(ITextBuffer buffer) where T : ITag\n\t\t{\n\t\t\treturn new ErrorSquiggleTagger(buffer, textDocumentFactory, analysisService) as ITagger;\n\t\t}\n\t}\n\n\tclass ErrorSquiggleTagger : AnalysisNotificationTagger\n\t{\n\t\tpublic ErrorSquiggleTagger(ITextBuffer buffer, ITextDocumentFactoryService textDocumentFactory, DartAnalysisService analysisService)\n\t\t\t: base(buffer, textDocumentFactory, analysisService)\n\t\t{\n\t\t\tthis.Subscribe();\n\t\t}\n\n\t\tprotected override ITagSpan CreateTag(AnalysisError error)\n\t\t{\n\t\t\t// syntax error: red\n\t\t\t// compiler error: blue\n\t\t\t// other error: purple\n\t\t\t// warning: red\n\t\t\tvar squiggleType = error.Severity == AnalysisErrorSeverity.Error ? \"syntax error\"\n\t\t\t\t: error.Severity == AnalysisErrorSeverity.Warning ? \"compiler error\"\n\t\t\t\t: \"other error\";\n\n\t\t\treturn new TagSpan(new SnapshotSpan(buffer.CurrentSnapshot, error.Location.Offset, error.Location.Length), new ErrorTag(squiggleType, error.Message));\n\t\t}\n\n\t\tprotected override IDisposable Subscribe(Action updateSourceData)\n\t\t{\n\t\t\treturn this.analysisService.AnalysisErrorsNotification.Where(en => en.File == textDocument.FilePath).Subscribe(updateSourceData);\n\t\t}\n\n\t\tprotected override AnalysisError[] GetDataToTag(AnalysisErrorsNotification notification)\n\t\t{\n\t\t\treturn notification.Errors.Where(e => e.Location.File == textDocument.FilePath).ToArray();\n\t\t}\n\n\t\tprotected override Tuple GetOffsetAndLength(AnalysisError data)\n\t\t{\n\t\t\treturn Tuple.Create(data.Location.Offset, data.Location.Length);\n\t\t}\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673636,"cells":{"commit":{"kind":"string","value":"aef22f3fd61183a5b7c270d631b204a737965dda"},"subject":{"kind":"string","value":"Make minor version a constant"},"repos":{"kind":"string","value":"paladique/nodejstools,lukedgr/nodejstools,kant2002/nodejstools,paladique/nodejstools,munyirik/nodejstools,paulvanbrenk/nodejstools,mjbvz/nodejstools,paladique/nodejstools,AustinHull/nodejstools,lukedgr/nodejstools,munyirik/nodejstools,Microsoft/nodejstools,munyirik/nodejstools,mjbvz/nodejstools,paulvanbrenk/nodejstools,kant2002/nodejstools,kant2002/nodejstools,kant2002/nodejstools,Microsoft/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,AustinHull/nodejstools,kant2002/nodejstools,paladique/nodejstools,paulvanbrenk/nodejstools,lukedgr/nodejstools,Microsoft/nodejstools,AustinHull/nodejstools,paulvanbrenk/nodejstools,munyirik/nodejstools,paladique/nodejstools,mjbvz/nodejstools,Microsoft/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,munyirik/nodejstools,AustinHull/nodejstools,AustinHull/nodejstools,paulvanbrenk/nodejstools,Microsoft/nodejstools"},"old_file":{"kind":"string","value":"Nodejs/Product/AssemblyVersion.cs"},"new_file":{"kind":"string","value":"Nodejs/Product/AssemblyVersion.cs"},"new_contents":{"kind":"string","value":"//*********************************************************//\n// Copyright (c) Microsoft. All rights reserved.\n//\n// Apache 2.0 License\n//\n// You may obtain a copy of the License at\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n// implied. See the License for the specific language governing\n// permissions and limitations under the License.\n//\n//*********************************************************//\n\nusing System.Reflection;\n\n// If you get compiler errors CS0579, \"Duplicate '' attribute\", check your\n// Properties\\AssemblyInfo.cs file and remove any lines duplicating the ones below.\n// (See also AssemblyInfoCommon.cs in this same directory.)\n\n#if !SUPPRESS_COMMON_ASSEMBLY_VERSION \n[assembly: AssemblyVersion(AssemblyVersionInfo.StableVersion)] \n#endif \n[assembly: AssemblyFileVersion(AssemblyVersionInfo.Version)] \n\nclass AssemblyVersionInfo {\n\n // This version string (and the comment for StableVersion) should be\n // updated manually between major releases (e.g. from 1.0 to 2.0).\n // Servicing branches and minor releases should retain the value.\n public const string ReleaseVersion = \"1.0\";\n\n // This version string (and the comment for Version) should be updated\n // manually between minor releases (e.g. from 1.0 to 1.1).\n // Servicing branches and prereleases should retain the value.\n public const string FileVersion = \"1.2\";\n\n // This version should never change from \"4100.00\"; BuildRelease.ps1\n // will replace it with a generated value.\n public const string BuildNumber = \"4100.00\";\n#if DEV14\n public const string VSMajorVersion = \"14\";\n const string VSVersionSuffix = \"2015\";\n#elif DEV15\n public const string VSMajorVersion = \"15\";\n const string VSVersionSuffix = \"15\";\n#else\n#error Unrecognized VS Version.\n#endif\n\n public const string VSVersion = VSMajorVersion + \".0\";\n\n // Defaults to \"1.0.0.(2012|2013|2015)\"\n public const string StableVersion = ReleaseVersion + \".0.\" + VSVersionSuffix;\n\n // Defaults to \"1.2.4100.00\"\n public const string Version = FileVersion + \".\" + BuildNumber;\n}"},"old_contents":{"kind":"string","value":"//*********************************************************//\n// Copyright (c) Microsoft. All rights reserved.\n//\n// Apache 2.0 License\n//\n// You may obtain a copy of the License at\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n// implied. See the License for the specific language governing\n// permissions and limitations under the License.\n//\n//*********************************************************//\n\nusing System.Reflection;\n\n// If you get compiler errors CS0579, \"Duplicate '' attribute\", check your\n// Properties\\AssemblyInfo.cs file and remove any lines duplicating the ones below.\n// (See also AssemblyInfoCommon.cs in this same directory.)\n\n#if !SUPPRESS_COMMON_ASSEMBLY_VERSION \n[assembly: AssemblyVersion(AssemblyVersionInfo.StableVersion)] \n#endif \n[assembly: AssemblyFileVersion(AssemblyVersionInfo.Version)] \n\nclass AssemblyVersionInfo {\n\n // This version string (and the comment for StableVersion) should be\n // updated manually between major releases (e.g. from 1.0 to 2.0).\n // Servicing branches and minor releases should retain the value.\n public const string ReleaseVersion = \"1.0\";\n\n // This version string (and the comment for StableVersion) should be\n // updated manually between minor releases.\n // Servicing branches should retain the value\n public const string MinorVersion = \"0\";\n\n // This version string (and the comment for Version) should be updated\n // manually between minor releases (e.g. from 1.0 to 1.1).\n // Servicing branches and prereleases should retain the value.\n public const string FileVersion = \"1.2\";\n\n // This version should never change from \"4100.00\"; BuildRelease.ps1\n // will replace it with a generated value.\n public const string BuildNumber = \"4100.00\";\n#if DEV14\n public const string VSMajorVersion = \"14\";\n const string VSVersionSuffix = \"2015\";\n#elif DEV15\n public const string VSMajorVersion = \"15\";\n const string VSVersionSuffix = \"15\";\n#else\n#error Unrecognized VS Version.\n#endif\n\n public const string VSVersion = VSMajorVersion + \".0\";\n\n // Defaults to \"1.0.0.(2012|2013|2015)\"\n public const string StableVersion = ReleaseVersion + \".\" + MinorVersion + \".\" + VSVersionSuffix;\n\n // Defaults to \"1.2.4100.00\"\n public const string Version = FileVersion + \".\" + BuildNumber;\n}"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673637,"cells":{"commit":{"kind":"string","value":"9bf9c6b2871d7ff710063d4056d6da5563c4117b"},"subject":{"kind":"string","value":"Fix : Un-Stealth rogues for this quest otherwise the mobs arent aggroed."},"repos":{"kind":"string","value":"TheNoobCompany/LevelingQuestsTNB"},"old_file":{"kind":"string","value":"Profiles/Quester/Scripts/11661.cs"},"new_file":{"kind":"string","value":"Profiles/Quester/Scripts/11661.cs"},"new_contents":{"kind":"string","value":"WoWUnit unit = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.Entry, questObjective.IsDead), questObjective.IgnoreNotSelectable, questObjective.IgnoreBlackList,\n\tquestObjective.AllowPlayerControlled);\n\t\nObjectManager.Me.UnitAura(115191).TryCancel(); //Remove Stealth from rogue\n\nif (unit.IsValid && unit.Position.DistanceTo(questObjective.Position) <=8)\n{\n\tMovementManager.Face(unit);\n\tInteract.InteractWith(unit.GetBaseAddress);\n\tnManager.Wow.Helpers.Fight.StartFight(unit.Guid);\n\t\n}\n\nelse\n{\n\tList liste = new List();\n\tliste.Add(ObjectManager.Me.Position);\n\tliste.Add(questObjective.Position);\n\t\n\tMovementManager.Go(liste);\n\n}\n\n"},"old_contents":{"kind":"string","value":"WoWUnit unit = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.Entry, questObjective.IsDead), questObjective.IgnoreNotSelectable, questObjective.IgnoreBlackList,\n\tquestObjective.AllowPlayerControlled);\n\t\nif (unit.IsValid && unit.Position.DistanceTo(questObjective.Position) <=8)\n{\n\tMovementManager.Face(unit);\n\tInteract.InteractWith(unit.GetBaseAddress);\n\tnManager.Wow.Helpers.Fight.StartFight(unit.Guid);\n\t\n}\n\nelse\n{\n\tList liste = new List();\n\tliste.Add(ObjectManager.Me.Position);\n\tliste.Add(questObjective.Position);\n\t\n\tMovementManager.Go(liste);\n\n}\n\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673638,"cells":{"commit":{"kind":"string","value":"6b3c88e1488e28255890ef6eb488deb85586c5f2"},"subject":{"kind":"string","value":"change measuring method."},"repos":{"kind":"string","value":"Codeer-Software/LambdicSql"},"old_file":{"kind":"string","value":"Project/Performance/SelectTime.cs"},"new_file":{"kind":"string","value":"Project/Performance/SelectTime.cs"},"new_contents":{"kind":"string","value":"using Dapper;\nusing LambdicSql;\nusing LambdicSql.SqlServer;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Data.SqlClient;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Windows.Forms;\n\nnamespace Performance\n{\n class TableValues\n {\n public int IntVal { get; set; }\n public float FloatVal { get; set; }\n public double DoubleVal { get; set; }\n public decimal DecimalVal { get; set; }\n public string StringVal { get; set; }\n }\n class DB\n {\n public TableValues TableValues { get; set; }\n }\n\n [TestClass]\n public class SelectTime\n {\n [TestMethod]\n public void CheckLambdicSql()\n {\n var adaptor = new SqlServerAdapter(TestEnvironment.ConnectionString);\n\n var times = new List();\n for (int i = 0; i < 10; i++)\n {\n Stopwatch watch = new Stopwatch();\n watch.Start();\n var datas = Sql.Query().SelectFrom(db => db.TableValues).ToExecutor(adaptor).Read().ToList();\n watch.Stop();\n times.Add(watch.ElapsedMilliseconds);\n }\n MessageBox.Show(string.Join(Environment.NewLine, times.Select(e=>e.ToString())) + Environment.NewLine + times.Average().ToString());\n }\n\n [TestMethod]\n public void CheckDapper()\n {\n using (var connection = new SqlConnection(TestEnvironment.ConnectionString))\n {\n var times = new List();\n for (int i = 0; i < 10; i++)\n {\n Stopwatch watch = new Stopwatch();\n watch.Start();\n var datas = connection.Query(\"select IntVal, FloatVal, DoubleVal, DecimalVal, StringVal from TableValues;\").ToList();\n watch.Stop();\n times.Add(watch.ElapsedMilliseconds);\n }\n MessageBox.Show(string.Join(Environment.NewLine, times.Select(e => e.ToString())) + Environment.NewLine + times.Average().ToString());\n }\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using Dapper;\nusing LambdicSql;\nusing LambdicSql.SqlServer;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Data.SqlClient;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Windows.Forms;\n\nnamespace Performance\n{\n class TableValues\n {\n public int IntVal { get; set; }\n public float FloatVal { get; set; }\n public double DoubleVal { get; set; }\n public decimal DecimalVal { get; set; }\n public string StringVal { get; set; }\n }\n class DB\n {\n public TableValues TableValues { get; set; }\n }\n\n [TestClass]\n public class SelectTime\n {\n [TestMethod]\n public void CheckLambdicSql()\n {\n var executor = Sql.Query().SelectFrom(db => db.TableValues).ToExecutor(new SqlServerAdapter(TestEnvironment.ConnectionString));\n\n var times = new List();\n for (int i = 0; i < 10; i++)\n {\n Stopwatch watch = new Stopwatch();\n watch.Start();\n var datas = executor.Read().ToList();\n watch.Stop();\n times.Add(watch.ElapsedMilliseconds);\n }\n MessageBox.Show(string.Join(Environment.NewLine, times.Select(e=>e.ToString())) + Environment.NewLine + times.Average().ToString());\n }\n\n [TestMethod]\n public void CheckDapper()\n {\n using (var connection = new SqlConnection(TestEnvironment.ConnectionString))\n {\n var times = new List();\n for (int i = 0; i < 10; i++)\n {\n Stopwatch watch = new Stopwatch();\n watch.Start();\n var datas = connection.Query(\"select IntVal, FloatVal, DoubleVal, DecimalVal, StringVal from TableValues;\").ToList();\n watch.Stop();\n times.Add(watch.ElapsedMilliseconds);\n }\n MessageBox.Show(string.Join(Environment.NewLine, times.Select(e => e.ToString())) + Environment.NewLine + times.Average().ToString());\n }\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673639,"cells":{"commit":{"kind":"string","value":"bfe837d00f70c2787e42318b712a16e546aba9c5"},"subject":{"kind":"string","value":"Build script now creates individual zip file packages to align with the NuGet packages and semantic versioning."},"repos":{"kind":"string","value":"autofac/Autofac.Extras.AttributeMetadata"},"old_file":{"kind":"string","value":"Properties/VersionAssemblyInfo.cs"},"new_file":{"kind":"string","value":"Properties/VersionAssemblyInfo.cs"},"new_contents":{"kind":"string","value":"//------------------------------------------------------------------------------\r\n// \r\n// This code was generated by a tool.\r\n// Runtime Version:4.0.30319.18033\r\n//\r\n// Changes to this file may cause incorrect behavior and will be lost if\r\n// the code is regenerated.\r\n// \r\n//------------------------------------------------------------------------------\r\n\r\nusing System;\r\nusing System.Reflection;\r\nusing System.Resources;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n[assembly: AssemblyVersion(\"3.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"3.0.0.0\")]\r\n[assembly: AssemblyConfiguration(\"Release built on 2013-02-28 02:03\")]\r\n[assembly: AssemblyCopyright(\"Copyright © 2013 Autofac Contributors\")]\r\n\r\n\r\n"},"old_contents":{"kind":"string","value":"//------------------------------------------------------------------------------\r\n// \r\n// This code was generated by a tool.\r\n// Runtime Version:4.0.30319.18033\r\n//\r\n// Changes to this file may cause incorrect behavior and will be lost if\r\n// the code is regenerated.\r\n// \r\n//------------------------------------------------------------------------------\r\n\r\nusing System;\r\nusing System.Reflection;\r\nusing System.Resources;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n[assembly: AssemblyVersion(\"3.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"3.0.0.0\")]\r\n[assembly: AssemblyConfiguration(\"Release built on 2013-02-22 14:39\")]\r\n[assembly: AssemblyCopyright(\"Copyright © 2013 Autofac Contributors\")]\r\n\r\n\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673640,"cells":{"commit":{"kind":"string","value":"71ef2ebd4f155cace5712b1f2e6d527142706145"},"subject":{"kind":"string","value":"Refactor KeyHelper"},"repos":{"kind":"string","value":"danielchalmers/SteamAccountSwitcher"},"old_file":{"kind":"string","value":"SteamAccountSwitcher/KeyHelper.cs"},"new_file":{"kind":"string","value":"SteamAccountSwitcher/KeyHelper.cs"},"new_contents":{"kind":"string","value":"using System.Windows.Input;\n\nnamespace SteamAccountSwitcher\n{\n internal static class KeyHelper\n {\n public static int KeyToInt(Key key)\n {\n switch (key)\n {\n case Key.D1:\n return 1;\n case Key.D2:\n return 2;\n case Key.D3:\n return 3;\n case Key.D4:\n return 4;\n case Key.D5:\n return 5;\n case Key.D6:\n return 6;\n case Key.D7:\n return 7;\n case Key.D8:\n return 8;\n case Key.D9:\n return 9;\n case Key.D0:\n return 10;\n }\n return 0;\n }\n }\n}"},"old_contents":{"kind":"string","value":"using System.Windows.Input;\n\nnamespace SteamAccountSwitcher\n{\n internal static class KeyHelper\n {\n public static int KeyToInt(Key key)\n {\n var num = 0;\n switch (key)\n {\n case Key.D1:\n num = 1;\n break;\n case Key.D2:\n num = 2;\n break;\n case Key.D3:\n num = 3;\n break;\n case Key.D4:\n num = 4;\n break;\n case Key.D5:\n num = 5;\n break;\n case Key.D6:\n num = 6;\n break;\n case Key.D7:\n num = 7;\n break;\n case Key.D8:\n num = 8;\n break;\n case Key.D9:\n num = 9;\n break;\n case Key.D0:\n num = 10;\n break;\n }\n return num;\n }\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673641,"cells":{"commit":{"kind":"string","value":"fdb7d6e5f40b5c86d6e3b597132663f27fdedbd7"},"subject":{"kind":"string","value":"bump version"},"repos":{"kind":"string","value":"RainwayApp/warden"},"old_file":{"kind":"string","value":"Warden/Properties/AssemblyInfo.cs"},"new_file":{"kind":"string","value":"Warden/Properties/AssemblyInfo.cs"},"new_contents":{"kind":"string","value":"using System.Reflection;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following\r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly.\r\n[assembly: AssemblyTitle(\"Warden.NET\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"Rainway, Inc.\")]\r\n[assembly: AssemblyProduct(\"Warden.NET\")]\r\n[assembly: AssemblyCopyright(\"Copyright © 2017\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible\r\n// to COM components. If you need to access a type in this assembly from\r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"69bd1ac4-362a-41d0-8e84-a76064d90b4b\")]\r\n\r\n// Version information for an assembly consists of the following four values:\r\n//\r\n// Major Version\r\n// Minor Version\r\n// Build Number\r\n// Revision\r\n//\r\n// You can specify all the values or you can default the Build and Revision Numbers\r\n// by using the '*' as shown below:\r\n// [assembly: AssemblyVersion(\"1.0.*\")]\r\n[assembly: AssemblyVersion(\"3.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"3.0.0.0\")]\r\n"},"old_contents":{"kind":"string","value":"using System.Reflection;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following\r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly.\r\n[assembly: AssemblyTitle(\"Warden.NET\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"Rainway, Inc.\")]\r\n[assembly: AssemblyProduct(\"Warden.NET\")]\r\n[assembly: AssemblyCopyright(\"Copyright © 2017\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible\r\n// to COM components. If you need to access a type in this assembly from\r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"69bd1ac4-362a-41d0-8e84-a76064d90b4b\")]\r\n\r\n// Version information for an assembly consists of the following four values:\r\n//\r\n// Major Version\r\n// Minor Version\r\n// Build Number\r\n// Revision\r\n//\r\n// You can specify all the values or you can default the Build and Revision Numbers\r\n// by using the '*' as shown below:\r\n// [assembly: AssemblyVersion(\"1.0.*\")]\r\n[assembly: AssemblyVersion(\"2.1.0.0\")]\r\n[assembly: AssemblyFileVersion(\"2.1.0.0\")]\r\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673642,"cells":{"commit":{"kind":"string","value":"2517146d62b1e6cea55d5ac83b84cd14d2a9710e"},"subject":{"kind":"string","value":"Correct home member"},"repos":{"kind":"string","value":"alvachien/achihapi"},"old_file":{"kind":"string","value":"src/hihapi/Controllers/Home/HomeMembersController.cs"},"new_file":{"kind":"string","value":"src/hihapi/Controllers/Home/HomeMembersController.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Linq;\nusing System.IO;\nusing System.Collections.Generic;\nusing Microsoft.AspNetCore.OData.Routing.Controllers;\nusing Microsoft.AspNetCore.OData.Query;\nusing Microsoft.AspNetCore.OData.Results;\nusing Microsoft.AspNetCore.OData.Formatter;\nusing Microsoft.EntityFrameworkCore;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing hihapi.Models;\nusing Microsoft.AspNetCore.Authorization;\n\nnamespace hihapi.Controllers\n{\n public class HomeMembersController : ODataController\n {\n private readonly hihDataContext _context;\n\n public HomeMembersController(hihDataContext context)\n {\n _context = context;\n }\n\n /// GET: /HomeMembers\n /// \n /// Adds support for getting home member, for example:\n /// \n /// GET /HomeMembers\n /// GET /HomeMembers?$filter=Host eq 'abc'\n /// GET /HomeMembers?\n /// \n /// \n [EnableQuery]\n [Authorize]\n public IQueryable Get()\n {\n return _context.HomeMembers;\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Linq;\nusing System.IO;\nusing System.Collections.Generic;\nusing Microsoft.AspNetCore.OData.Routing.Controllers;\nusing Microsoft.AspNetCore.OData.Query;\nusing Microsoft.AspNetCore.OData.Results;\nusing Microsoft.AspNetCore.OData.Formatter;\nusing Microsoft.EntityFrameworkCore;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Http;\nusing Microsoft.AspNetCore.Mvc;\nusing Newtonsoft.Json;\nusing Newtonsoft.Json.Linq;\nusing hihapi.Models;\nusing Microsoft.AspNetCore.Authorization;\n\nnamespace hihapi.Controllers\n{\n public class HomeMembersController : ODataController\n {\n private readonly hihDataContext _context;\n\n public HomeMembersController(hihDataContext context)\n {\n _context = context;\n }\n\n /// GET: /HomeMembers\n /// \n /// Adds support for getting home member, for example:\n /// \n /// GET /HomeMembers\n /// GET /HomeMembers?$filter=Host eq 'abc'\n /// GET /HomeMembers?\n /// \n /// \n [EnableQuery]\n [Authorize]\n public IQueryable Get()\n {\n return _context.HomeDefines;\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673643,"cells":{"commit":{"kind":"string","value":"1b0b0e01cf2e5c1f3751fb6b19be7f2808bf1e69"},"subject":{"kind":"string","value":"Change indent to 2 spaces"},"repos":{"kind":"string","value":"12joan/hangman"},"old_file":{"kind":"string","value":"hangman.cs"},"new_file":{"kind":"string","value":"hangman.cs"},"new_contents":{"kind":"string","value":"using System;\n\nnamespace Hangman {\n public class Hangman {\n public static void Main(string[] args) {\n // char key = Console.ReadKey(true).KeyChar;\n\n // var game = new Game(\"HANG THE MAN\");\n // bool wasCorrect = game.GuessLetter(key);\n // Console.WriteLine(wasCorrect.ToString());\n\n // var output = game.ShownWord();\n // Console.WriteLine(output);\n\n var table = new Table(\n Console.WindowWidth, // width\n 2 // spacing\n );\n\n var output = table.Draw();\n\n Console.WriteLine(output);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\n\nnamespace Hangman {\n public class Hangman {\n public static void Main(string[] args) {\n // char key = Console.ReadKey(true).KeyChar;\n\n // var game = new Game(\"HANG THE MAN\");\n // bool wasCorrect = game.GuessLetter(key);\n // Console.WriteLine(wasCorrect.ToString());\n\n // var output = game.ShownWord();\n // Console.WriteLine(output);\n\n var table = new Table(\n Console.WindowWidth, // width\n 2 // spacing\n );\n\n var output = table.Draw();\n\n Console.WriteLine(output);\n }\n }\n}\n"},"license":{"kind":"string","value":"unlicense"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673644,"cells":{"commit":{"kind":"string","value":"c8beb9a949e44304afcb1c5a0332cd9bc0cc76a4"},"subject":{"kind":"string","value":"Fix Russian comment"},"repos":{"kind":"string","value":"IEVin/PropertyChangedNotificator"},"old_file":{"kind":"string","value":"src/Core/Properties/AssemblyInfo.cs"},"new_file":{"kind":"string","value":"src/Core/Properties/AssemblyInfo.cs"},"new_contents":{"kind":"string","value":"using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following \r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly.\r\n[assembly: AssemblyTitle(\"Core\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"\")]\r\n[assembly: AssemblyProduct(\"Core\")]\r\n[assembly: AssemblyCopyright(\"Copyright © 2013\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible \r\n// to COM components. If you need to access a type in this assembly from \r\n// COM, set the ComVisible attribute to true on that type.\r\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n[assembly: Guid(\"6a968165-a5a8-46cd-b3ac-ccabdc718d28\")]\r\n\r\n// Version information for an assembly consists of the following four values:\r\n//\r\n// Major Version\r\n// Minor Version \r\n// Build Number\r\n// Revision\r\n//\r\n// You can specify all the values or you can default the Build and Revision Numbers \r\n// by using the '*' as shown below:\r\n// [assembly: AssemblyVersion(\"1.0.*\")]\r\n[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\r\n"},"old_contents":{"kind":"string","value":"using System.Reflection;\r\nusing System.Runtime.CompilerServices;\r\nusing System.Runtime.InteropServices;\r\n\r\n// Управление общими сведениями о сборке осуществляется с помощью \r\n// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,\r\n// связанные со сборкой.\r\n[assembly: AssemblyTitle(\"Core\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\n[assembly: AssemblyCompany(\"\")]\r\n[assembly: AssemblyProduct(\"Core\")]\r\n[assembly: AssemblyCopyright(\"Copyright © 2013\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Параметр ComVisible со значением FALSE делает типы в сборке невидимыми \r\n// для COM-компонентов. Если требуется обратиться к типу в этой сборке через \r\n// COM, задайте атрибуту ComVisible значение TRUE для этого типа.\r\n[assembly: ComVisible(false)]\r\n\r\n// Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM\r\n[assembly: Guid(\"6a968165-a5a8-46cd-b3ac-ccabdc718d28\")]\r\n\r\n// Сведения о версии сборки состоят из следующих четырех значений:\r\n//\r\n// Основной номер версии\r\n// Дополнительный номер версии \r\n// Номер построения\r\n// Редакция\r\n//\r\n// Можно задать все значения или принять номер построения и номер редакции по умолчанию, \r\n// используя \"*\", как показано ниже:\r\n// [assembly: AssemblyVersion(\"1.0.*\")]\r\n[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673645,"cells":{"commit":{"kind":"string","value":"ecaf050b609a7dbf10d6b6c33ab9059a15384fdb"},"subject":{"kind":"string","value":"Modify translation instructions page per request"},"repos":{"kind":"string","value":"BloomBooks/PhotoStoryToBloomConverter,BloomBooks/PhotoStoryToBloomConverter"},"old_file":{"kind":"string","value":"PhotoStoryToBloomConverter/SpAppMetadata.cs"},"new_file":{"kind":"string","value":"PhotoStoryToBloomConverter/SpAppMetadata.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Text;\nusing PhotoStoryToBloomConverter.Utilities;\n\nnamespace PhotoStoryToBloomConverter\n{\n\tpublic enum SpAppMetadataGraphic\n\t{\n\t\t[Description(\"gray-background\")]\n\t\tGrayBackground,\n\t\t[Description(\"front-cover-graphic\")]\n\t\tFrontCoverGraphic\n\t}\n\n\tpublic class SpAppMetadata\n\t{\n\t\tpublic SpAppMetadataGraphic Graphic { get; set; }\n\t\tpublic string ScriptureReference { get; set; }\n\t\tpublic string TitleIdeasHeading { get; set; }\n\t\tpublic List TitleIdeas { get; }\n\n\t\tprivate const string kIntro = \"CONTENT FOR THE TITLE SLIDE (slide #0) in SP APP\";\n\t\tprivate const string kInstructions = @\"INSTRUCTIONS:\nAfter \"\"Graphic=\"\" type either \"\"gray-background\"\" or \"\"front-cover-picture\"\" in English to indicate your choice for the title slide image.\nAfter \"\"ScriptureReference=\"\" type a Scripture reference or a subtitle for your story in the LWC.\nAfter \"\"TitleIdeasHeading=\"\" type something like \"\"Ideas for the story title:\"\" in the LWC.\nAfter \"\"TitleIdea1=\"\" type a sample title in the LWC. (Always complete this line providing a title example.)\nAfter \"\"TitleIdea2=\"\" type another sample title in the LWC. (Or leave this line blank.)\nAfter \"\"TitleIdea3=\"\" type another sample title in the LWC. (Or leave this line blank.)\";\n\n\t\tpublic SpAppMetadata(string scriptureReference, string titleIdeasHeading, List titleIdeas)\n\t\t{\n\t\t\tScriptureReference = scriptureReference;\n\t\t\tTitleIdeasHeading = titleIdeasHeading;\n\t\t\tTitleIdeas = titleIdeas;\n\t\t}\n\n\t\tpublic string EnsureOneLine(string possibleMultiLine)\n\t\t{\n\t\t\treturn string.Join(\"; \", possibleMultiLine.Split('\\n'));\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\tvar sb = new StringBuilder($\"{kIntro}\\n\\n\" +\n\t\t\t\t$\"Graphic={Graphic.ToDescriptionString()}\\n\" +\n\t\t\t\t$\"ScriptureReference ={EnsureOneLine(ScriptureReference) }\\n\" + \n\t\t\t\t$\"TitleIdeasHeading ={TitleIdeasHeading}\"\n\t\t\t);\n\t\t\tfor (int i = 0; i < TitleIdeas.Count; i++)\n\t\t\t\tsb.Append($\"\\nTitleIdea{i + 1}={TitleIdeas[i]}\");\n\t\t\tsb.Append(\"\\n\\n\");\n\t\t\tsb.Append(kInstructions);\n\t\t\treturn sb.ToString();\n\t\t}\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Text;\nusing PhotoStoryToBloomConverter.Utilities;\n\nnamespace PhotoStoryToBloomConverter\n{\n\tpublic enum SpAppMetadataGraphic\n\t{\n\t\t[Description(\"gray-background\")]\n\t\tGrayBackground,\n\t\t[Description(\"front-cover-graphic\")]\n\t\tFrontCoverGraphic\n\t}\n\n\tpublic class SpAppMetadata\n\t{\n\t\tpublic SpAppMetadataGraphic Graphic { get; set; }\n\t\tpublic string ScriptureReference { get; set; }\n\t\tpublic string TitleIdeasHeading { get; set; }\n\t\tpublic List TitleIdeas { get; }\n\n\t\tprivate const string kIntro = \"Video Title Slide Content\";\n\n\t\tpublic SpAppMetadata(string scriptureReference, string titleIdeasHeading, List titleIdeas)\n\t\t{\n\t\t\tScriptureReference = scriptureReference;\n\t\t\tTitleIdeasHeading = titleIdeasHeading;\n\t\t\tTitleIdeas = titleIdeas;\n\t\t}\n\n\t\tpublic string EnsureOneLine(string possibleMultiLine)\n\t\t{\n\t\t\treturn string.Join(\"; \", possibleMultiLine.Split('\\n'));\n\t\t}\n\n\t\tpublic override string ToString()\n\t\t{\n\t\t\tvar sb = new StringBuilder($\"{kIntro}\\n\" +\n\t\t\t\t$\"Graphic={Graphic.ToDescriptionString()}\\n\" +\n\t\t\t\t$\"ScriptureReference ={EnsureOneLine(ScriptureReference) }\\n\" + \n\t\t\t\t$\"TitleIdeasHeading ={TitleIdeasHeading}\"\n\t\t\t);\n\t\t\tfor (int i = 0; i < TitleIdeas.Count; i++)\n\t\t\t\tsb.Append($\"\\nTitleIdea{i + 1}={TitleIdeas[i]}\");\n\t\t\treturn sb.ToString();\n\t\t}\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673646,"cells":{"commit":{"kind":"string","value":"fb65aa332bced912b27438d6e2677a52c06ec996"},"subject":{"kind":"string","value":"use max camera positions instead of last character position"},"repos":{"kind":"string","value":"virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,whoa-algebraic/game-off-2016"},"old_file":{"kind":"string","value":"Assets/Scripts/CameraFollowPlayer.cs"},"new_file":{"kind":"string","value":"Assets/Scripts/CameraFollowPlayer.cs"},"new_contents":{"kind":"string","value":"using UnityEngine;\nusing System.Collections;\n\npublic class CameraFollowPlayer : MonoBehaviour {\n public Transform PlayerCharacter;\n public float horizontalEdgeBuffer;\n public float verticalEdgeBuffer;\n\t\n private int mapTileHorizontalUnits = 4;\n private int mapTileVerticalUnits = 2;\n private float unitSize = 5;\n\n private float maxLeft;\n private float maxRight;\n private float maxTop;\n private float maxBottom;\n\n void Start() {\n maxLeft = mapTileHorizontalUnits * (unitSize * -1f) + horizontalEdgeBuffer;\n maxRight = mapTileHorizontalUnits * unitSize - horizontalEdgeBuffer;\n maxTop = mapTileVerticalUnits * unitSize - verticalEdgeBuffer;\n maxBottom = mapTileVerticalUnits * (unitSize * -1f) + verticalEdgeBuffer;\n }\n \n\tvoid Update () {\n float playerX = PlayerCharacter.position.x;\n float playerY = PlayerCharacter.position.y;\n\n if(playerX < maxLeft) {\n playerX = maxLeft;\n }\n\n if(playerX > maxRight) {\n playerX = maxRight;\n }\n\n if(playerY < maxBottom) {\n playerY = maxBottom;\n }\n\n if(playerY > maxTop) {\n playerY = maxTop;\n }\n\n Vector3 newPosition = new Vector3(playerX, playerY, -10);\n transform.position = newPosition;\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using UnityEngine;\nusing System.Collections;\n\npublic class CameraFollowPlayer : MonoBehaviour {\n public Transform PlayerCharacter;\n public float horizontalEdgeBuffer;\n public float verticalEdgeBuffer;\n\t\n private int mapTileHorizontalUnits = 4;\n private int mapTileVerticalUnits = 2;\n private float unitSize = 5;\n\n private float maxLeft;\n private float maxRight;\n private float maxTop;\n private float maxBottom;\n\n private Vector3 lastPosition;\n\n void Start() {\n maxLeft = mapTileHorizontalUnits * (unitSize * -1f) + horizontalEdgeBuffer;\n maxRight = mapTileHorizontalUnits * unitSize - horizontalEdgeBuffer;\n maxTop = mapTileVerticalUnits * unitSize - verticalEdgeBuffer;\n maxBottom = mapTileVerticalUnits * (unitSize * -1f) + verticalEdgeBuffer;\n }\n \n\tvoid Update () {\n float playerX = PlayerCharacter.position.x;\n float playerY = PlayerCharacter.position.y;\n Vector3 newPosition = new Vector3(lastPosition.x, lastPosition.y, -10);\n\n if(playerX >= maxLeft && playerX <= maxRight) {\n newPosition.x = playerX;\n }\n\n if(playerY >= maxBottom && playerY <= maxTop) {\n newPosition.y = playerY;\n }\n \n transform.position = newPosition;\n lastPosition = newPosition;\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673647,"cells":{"commit":{"kind":"string","value":"6d91c0f375369c182312bfde644cae26443339a9"},"subject":{"kind":"string","value":"Resolve inspection issue"},"repos":{"kind":"string","value":"ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu"},"old_file":{"kind":"string","value":"osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs"},"new_file":{"kind":"string","value":"osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs"},"new_contents":{"kind":"string","value":"// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text.\n\n#nullable disable\n\nusing System;\nusing osu.Game.Rulesets.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Osu.Difficulty.Evaluators;\nusing osu.Game.Rulesets.Osu.Difficulty.Preprocessing;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace osu.Game.Rulesets.Osu.Difficulty.Skills\n{\n /// \n /// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.\n /// \n public class Speed : OsuStrainSkill\n {\n private double skillMultiplier => 1375;\n private double strainDecayBase => 0.3;\n\n private double currentStrain;\n private double currentRhythm;\n\n protected override int ReducedSectionCount => 5;\n protected override double DifficultyMultiplier => 1.04;\n private readonly double greatWindow;\n\n private readonly List objectStrains = new List();\n\n public Speed(Mod[] mods, double hitWindowGreat)\n : base(mods)\n {\n greatWindow = hitWindowGreat;\n }\n\n private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);\n\n protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);\n\n protected override double StrainValueAt(DifficultyHitObject current)\n {\n currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime);\n currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier;\n\n currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow);\n\n double totalStrain = currentStrain * currentRhythm;\n\n objectStrains.Add(totalStrain);\n\n return totalStrain;\n }\n\n public double RelevantNoteCount()\n {\n if (objectStrains.Count == 0)\n return 0;\n\n double maxStrain = objectStrains.Max();\n\n if (maxStrain == 0)\n return 0;\n\n return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0)))));\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.\n// See the LICENCE file in the repository root for full licence text.\n\n#nullable disable\n\nusing System;\nusing osu.Game.Rulesets.Difficulty.Preprocessing;\nusing osu.Game.Rulesets.Mods;\nusing osu.Game.Rulesets.Osu.Difficulty.Evaluators;\nusing osu.Game.Rulesets.Osu.Difficulty.Preprocessing;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace osu.Game.Rulesets.Osu.Difficulty.Skills\n{\n /// \n /// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit.\n /// \n public class Speed : OsuStrainSkill\n {\n private double skillMultiplier => 1375;\n private double strainDecayBase => 0.3;\n\n private double currentStrain;\n private double currentRhythm;\n\n protected override int ReducedSectionCount => 5;\n protected override double DifficultyMultiplier => 1.04;\n private readonly double greatWindow;\n\n private List objectStrains = new List();\n\n public Speed(Mod[] mods, double hitWindowGreat)\n : base(mods)\n {\n greatWindow = hitWindowGreat;\n }\n\n private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000);\n\n protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime);\n\n protected override double StrainValueAt(DifficultyHitObject current)\n {\n currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime);\n currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier;\n\n currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow);\n\n double totalStrain = currentStrain * currentRhythm;\n\n objectStrains.Add(totalStrain);\n\n return totalStrain;\n }\n\n public double RelevantNoteCount()\n {\n if (objectStrains.Count == 0)\n return 0;\n\n double maxStrain = objectStrains.Max();\n\n if (maxStrain == 0)\n return 0;\n\n return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0)))));\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673648,"cells":{"commit":{"kind":"string","value":"7756e6a7591f2644ed91eca805d4dbb4efbcf31b"},"subject":{"kind":"string","value":"Update IEventTelemeter.cs"},"repos":{"kind":"string","value":"tiksn/TIKSN-Framework"},"old_file":{"kind":"string","value":"TIKSN.Core/Analytics/Telemetry/IEventTelemeter.cs"},"new_file":{"kind":"string","value":"TIKSN.Core/Analytics/Telemetry/IEventTelemeter.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace TIKSN.Analytics.Telemetry\n{\n public interface IEventTelemeter\n {\n Task TrackEventAsync(string name);\n\n Task TrackEventAsync(string name, IDictionary properties);\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Threading.Tasks;\n\nnamespace TIKSN.Analytics.Telemetry\n{\n public interface IEventTelemeter\n {\n Task TrackEvent(string name);\n\n Task TrackEvent(string name, IDictionary properties);\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673649,"cells":{"commit":{"kind":"string","value":"0ea6e3a9c2477ae09173202fb0e66f70d15cd232"},"subject":{"kind":"string","value":"make the sequence add method null safe."},"repos":{"kind":"string","value":"signumsoftware/framework,signumsoftware/framework,avifatal/framework,AlejandroCano/framework,AlejandroCano/framework,avifatal/framework"},"old_file":{"kind":"string","value":"Signum.Utilities/DataStructures/Sequence.cs"},"new_file":{"kind":"string","value":"Signum.Utilities/DataStructures/Sequence.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Generic;\r\n\r\nnamespace Signum.Utilities.DataStructures\r\n{\r\n public class Sequence : List\r\n {\r\n public void Add(IEnumerable collection)\r\n {\r\n if (collection != null)\r\n {\r\n AddRange(collection);\r\n }\r\n }\r\n }\r\n}\r\n"},"old_contents":{"kind":"string","value":"using System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Text;\r\n\r\nnamespace Signum.Utilities.DataStructures\r\n{\r\n public class Sequence : List\r\n {\r\n public void Add(IEnumerable collection)\r\n {\r\n AddRange(collection);\r\n }\r\n }\r\n}\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673650,"cells":{"commit":{"kind":"string","value":"268d1461e786b7e5d5c05916ad4c315f9d71a4b7"},"subject":{"kind":"string","value":"update version"},"repos":{"kind":"string","value":"prodot/ReCommended-Extension"},"old_file":{"kind":"string","value":"Sources/ReCommendedExtension/Properties/AssemblyInfo.cs"},"new_file":{"kind":"string","value":"Sources/ReCommendedExtension/Properties/AssemblyInfo.cs"},"new_contents":{"kind":"string","value":"using System.Reflection;\nusing ReCommendedExtension;\n\n// General Information about an assembly is controlled through the following\n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]\n[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"prodot GmbH\")]\n[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]\n[assembly: AssemblyCopyright(\"© 2012-2019 prodot GmbH\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n[assembly: AssemblyVersion(\"3.5.1.0\")]\n[assembly: AssemblyFileVersion(\"3.5.1\")]"},"old_contents":{"kind":"string","value":"using System.Reflection;\nusing ReCommendedExtension;\n\n// General Information about an assembly is controlled through the following\n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]\n[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"prodot GmbH\")]\n[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]\n[assembly: AssemblyCopyright(\"© 2012-2019 prodot GmbH\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n[assembly: AssemblyVersion(\"3.5.0.0\")]\n[assembly: AssemblyFileVersion(\"3.5.0\")]"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673651,"cells":{"commit":{"kind":"string","value":"a1d0a9c2b014d384543a9ec2db3de9568e25bfd4"},"subject":{"kind":"string","value":"Add containing type names (for nested classes)"},"repos":{"kind":"string","value":"ulrichb/Roflcopter,ulrichb/Roflcopter"},"old_file":{"kind":"string","value":"Src/Roflcopter.Plugin/ShortNameTypeMemberFqnProvider.cs"},"new_file":{"kind":"string","value":"Src/Roflcopter.Plugin/ShortNameTypeMemberFqnProvider.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Linq;\nusing JetBrains.Annotations;\nusing JetBrains.Application.DataContext;\nusing JetBrains.ProjectModel;\nusing JetBrains.ReSharper.Features.Environment.CopyFqn;\nusing JetBrains.ReSharper.Psi;\nusing JetBrains.ReSharper.Psi.DataContext;\nusing JetBrains.UI.Avalon.TreeListView;\n\nnamespace Roflcopter.Plugin\n{\n /// \n /// A provider for which returns [type name].[member].\n /// \n [SolutionComponent]\n public class ShortNameTypeMemberFqnProvider : IFqnProvider\n {\n public bool IsApplicable([NotNull] IDataContext dataContext)\n {\n // Will be called in the CopyFqnAction to determine if _any_ provider has sth. to provide.\n\n var typeMembers = GetTypeMembers(dataContext);\n\n return typeMembers.Any();\n }\n\n public IEnumerable GetSortedFqns([NotNull] IDataContext dataContext)\n {\n var typeMembers = GetTypeMembers(dataContext);\n\n foreach (var typeMember in typeMembers)\n {\n var containingType = typeMember.GetContainingType();\n\n if (containingType != null)\n {\n var containingTypePath = containingType.PathName(x => x.ShortName, x => x.GetContainingType());\n\n yield return new PresentableFqn($\"{containingTypePath}.{typeMember.ShortName}\");\n }\n }\n }\n\n public int Priority => -10; // The lower the value, the _higher_ it is ranked. Yes, really.\n\n private static IEnumerable GetTypeMembers(IDataContext dataContext)\n {\n var data = dataContext.GetData(PsiDataConstants.DECLARED_ELEMENTS);\n\n if (data == null)\n return new ITypeMember[0];\n\n return data.OfType();\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Linq;\nusing JetBrains.Annotations;\nusing JetBrains.Application.DataContext;\nusing JetBrains.ProjectModel;\nusing JetBrains.ReSharper.Features.Environment.CopyFqn;\nusing JetBrains.ReSharper.Psi;\nusing JetBrains.ReSharper.Psi.DataContext;\n\nnamespace Roflcopter.Plugin\n{\n /// \n /// A provider for which returns [type(shortname)].[member(shortname)].\n /// \n [SolutionComponent]\n public class ShortNameTypeMemberFqnProvider : IFqnProvider\n {\n public bool IsApplicable([NotNull] IDataContext dataContext)\n {\n // Will be called in the CopyFqnAction to determine if _any_ provider has sth. to provide.\n\n var typeMembers = GetTypeMembers(dataContext);\n\n return typeMembers.Any();\n }\n\n public IEnumerable GetSortedFqns([NotNull] IDataContext dataContext)\n {\n var typeMembers = GetTypeMembers(dataContext);\n\n foreach (var typeMember in typeMembers)\n {\n var containingType = typeMember.GetContainingType();\n\n if (containingType != null)\n yield return new PresentableFqn($\"{containingType.ShortName}.{typeMember.ShortName}\");\n }\n }\n\n public int Priority => -10; // The lower the value, the _higher_ it is ranked. Yes, really.\n\n private static IEnumerable GetTypeMembers(IDataContext dataContext)\n {\n var data = dataContext.GetData(PsiDataConstants.DECLARED_ELEMENTS);\n\n if (data == null)\n return new ITypeMember[0];\n\n return data.OfType();\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673652,"cells":{"commit":{"kind":"string","value":"df29c9f2de8e6d94f4eef717a8e10e85e01b7dfa"},"subject":{"kind":"string","value":"Fix GostKeyValue name"},"repos":{"kind":"string","value":"AlexMAS/GostCryptography"},"old_file":{"kind":"string","value":"Source/GostCryptography/Xml/GostKeyValue.cs"},"new_file":{"kind":"string","value":"Source/GostCryptography/Xml/GostKeyValue.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Security.Cryptography.Xml;\nusing System.Xml;\n\nusing GostCryptography.Base;\n\nnamespace GostCryptography.Xml\n{\n\t/// \n\t/// Параметры открытого ключа цифровой подписи ГОСТ Р 34.10.\n\t/// \n\tpublic sealed class GostKeyValue : KeyInfoClause\n\t{\n\t\t/// \n\t\t/// Наименование ключа.\n\t\t/// \n\t\tpublic const string NameValue = \"urn:ietf:params:xml:ns:cpxmlsec:GOSTKeyValue\";\n\n\t\t/// \n\t\t/// Устаревшее наименование ключа.\n\t\t/// \n\t\tpublic const string ObsoleteNameValue = \"http://www.w3.org/2000/09/xmldsig# KeyValue/GostKeyValue\";\n\n\t\t/// \n\t\t/// Известные наименования ключа.\n\t\t/// \n\t\tpublic static readonly string[] KnownNames = { NameValue, ObsoleteNameValue };\n\n\n\t\t/// \n\t\tpublic GostKeyValue()\n\t\t{\n\t\t}\n\n\t\t/// \n\t\tpublic GostKeyValue(GostAsymmetricAlgorithm publicKey)\n\t\t{\n\t\t\tPublicKey = publicKey;\n\t\t}\n\n\n\t\t/// \n\t\t/// Открытый ключ.\n\t\t/// \n\t\tpublic GostAsymmetricAlgorithm PublicKey { get; set; }\n\n\n\t\t/// \n\t\tpublic override void LoadXml(XmlElement element)\n\t\t{\n\t\t\tif (element == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException(nameof(element));\n\t\t\t}\n\n\t\t\tPublicKey.FromXmlString(element.OuterXml);\n\t\t}\n\n\t\t/// \n\t\tpublic override XmlElement GetXml()\n\t\t{\n\t\t\tvar document = new XmlDocument { PreserveWhitespace = true };\n\t\t\tvar element = document.CreateElement(\"KeyValue\", SignedXml.XmlDsigNamespaceUrl);\n\t\t\telement.InnerXml = PublicKey.ToXmlString(false);\n\t\t\treturn element;\n\t\t}\n\t}\n}"},"old_contents":{"kind":"string","value":"using System;\nusing System.Security.Cryptography.Xml;\nusing System.Xml;\n\nusing GostCryptography.Base;\n\nnamespace GostCryptography.Xml\n{\n\t/// \n\t/// Параметры открытого ключа цифровой подписи ГОСТ Р 34.10.\n\t/// \n\tpublic sealed class GostKeyValue : KeyInfoClause\n\t{\n\t\t/// \n\t\t/// Наименование ключа.\n\t\t/// \n\t\tpublic const string NameValue = \"urn:ietf:params:xml:ns:cpxmlsec:GOSTKeyValue\";\n\n\t\t/// \n\t\t/// Устаревшее наименование ключа.\n\t\t/// \n\t\tpublic const string ObsoleteNameValue = \"http://www.w3.org/2000/09/xmldsig#KeyValue/GostKeyValue\";\n\n\t\t/// \n\t\t/// Известные наименования ключа.\n\t\t/// \n\t\tpublic static readonly string[] KnownNames = { NameValue, ObsoleteNameValue };\n\n\n\t\t/// \n\t\tpublic GostKeyValue()\n\t\t{\n\t\t}\n\n\t\t/// \n\t\tpublic GostKeyValue(GostAsymmetricAlgorithm publicKey)\n\t\t{\n\t\t\tPublicKey = publicKey;\n\t\t}\n\n\n\t\t/// \n\t\t/// Открытый ключ.\n\t\t/// \n\t\tpublic GostAsymmetricAlgorithm PublicKey { get; set; }\n\n\n\t\t/// \n\t\tpublic override void LoadXml(XmlElement element)\n\t\t{\n\t\t\tif (element == null)\n\t\t\t{\n\t\t\t\tthrow new ArgumentNullException(nameof(element));\n\t\t\t}\n\n\t\t\tPublicKey.FromXmlString(element.OuterXml);\n\t\t}\n\n\t\t/// \n\t\tpublic override XmlElement GetXml()\n\t\t{\n\t\t\tvar document = new XmlDocument { PreserveWhitespace = true };\n\t\t\tvar element = document.CreateElement(\"KeyValue\", SignedXml.XmlDsigNamespaceUrl);\n\t\t\telement.InnerXml = PublicKey.ToXmlString(false);\n\t\t\treturn element;\n\t\t}\n\t}\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673653,"cells":{"commit":{"kind":"string","value":"2050ffbadfdeb7e5fb9a460789a4708979a98aa1"},"subject":{"kind":"string","value":"Tidy up with method sig overloads - reducing noise before the code gets too mad."},"repos":{"kind":"string","value":"davidwhitney/XdtExtract,davidwhitney/XdtExtract"},"old_file":{"kind":"string","value":"src/XdtExtract/AppConfigComparer.cs"},"new_file":{"kind":"string","value":"src/XdtExtract/AppConfigComparer.cs"},"new_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Linq;\nusing System.Xml.Linq;\n\nnamespace XdtExtract\n{\n\n public class AppConfigComparer\n {\n public IEnumerable Compare(string @base, string comparison)\n {\n return Compare(XDocument.Parse(@base), XDocument.Parse(comparison));\n }\n\n public IEnumerable Compare(XDocument @base, XDocument comparison)\n {\n var diffs = new List();\n\n var baseDocSettings = @base.AppSettings().Select(x => new { Source = \"base\", Node = x });\n var comparisonDocSettings = comparison.AppSettings().Select(x => new { Source = \"comparison\", Node = x });\n var groups = baseDocSettings.Union(comparisonDocSettings).GroupBy(x => x.Node.Attributes().Key());\n\n foreach (var group in groups)\n {\n if (group.Count() == 1)\n {\n diffs.Add(new Diff\n {\n XPath = \"/configuration/appSettings/add[@key='\" + @group.Key + \"']\",\n Operation = @group.First().Source == \"base\" ? Operation.Remove : Operation.Add\n });\n }\n }\n\n\n return diffs;\n }\n }\n\n public static class XDocumentExtensions\n {\n public static IEnumerable AppSettings(this XDocument src)\n {\n return src.Descendants().Where(x => x.Name == \"appSettings\").Descendants();\n }\n\n public static XElement SettingOrDefault(this IEnumerable src, string key)\n {\n return src.SingleOrDefault(x => x.Attributes().Single(attr => attr.Name == \"key\").Value == key);\n } \n\n public static string Key(this IEnumerable src)\n {\n return src.Single(x => x.Name == \"key\").Value;\n } \n }\n\n public class Diff\n {\n public string XPath { get; set; }\n public Operation Operation { get; set; }\n }\n\n public enum Operation\n {\n Add,\n Remove,\n Modify\n }\n}"},"old_contents":{"kind":"string","value":"using System.Collections.Generic;\nusing System.Linq;\nusing System.Xml.Linq;\n\nnamespace XdtExtract\n{\n\n public class AppConfigComparer\n {\n public IEnumerable Compare(string baseConfig, string comparisonConfig)\n {\n var baseDoc = XDocument.Parse(baseConfig);\n var comparisonDoc = XDocument.Parse(comparisonConfig); \n \n var diffs = new List();\n\n var baseDocSettings = baseDoc.AppSettings().Select(x => new { Source = \"base\", Node = x });\n var comparisonDocSettings = comparisonDoc.AppSettings().Select(x => new { Source = \"comparison\", Node = x });\n var groups = baseDocSettings.Union(comparisonDocSettings).GroupBy(x => x.Node.Attributes().Key());\n\n foreach (var group in groups)\n {\n if (group.Count() == 1)\n {\n diffs.Add(new Diff\n {\n XPath = \"/configuration/appSettings/add[@key='\" + @group.Key + \"']\",\n Operation = @group.First().Source == \"base\" ? Operation.Remove : Operation.Add\n });\n\n continue;\n }\n\n\n }\n\n\n return diffs;\n }\n }\n\n public static class XDocumentExtensions\n {\n public static IEnumerable AppSettings(this XDocument src)\n {\n return src.Descendants().Where(x => x.Name == \"appSettings\").Descendants();\n }\n\n public static XElement SettingOrDefault(this IEnumerable src, string key)\n {\n return src.SingleOrDefault(x => x.Attributes().Single(attr => attr.Name == \"key\").Value == key);\n } \n\n public static string Key(this IEnumerable src)\n {\n return src.Single(x => x.Name == \"key\").Value;\n } \n }\n\n public class Diff\n {\n public string XPath { get; set; }\n public Operation Operation { get; set; }\n }\n\n public enum Operation\n {\n Add,\n Remove,\n Modify\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673654,"cells":{"commit":{"kind":"string","value":"ef46b30ae2878c745246e71978f33232a9d6850a"},"subject":{"kind":"string","value":"Add conditional business rule execution based on successful validation rule execution"},"repos":{"kind":"string","value":"peasy/Samples,peasy/Samples,peasy/Samples"},"old_file":{"kind":"string","value":"Orders.com.BLL/Services/OrdersDotComServiceBase.cs"},"new_file":{"kind":"string","value":"Orders.com.BLL/Services/OrdersDotComServiceBase.cs"},"new_contents":{"kind":"string","value":"using Peasy;\nusing Peasy.Core;\nusing Orders.com.BLL.DataProxy;\nusing System.Collections.Generic;\nusing System.ComponentModel.DataAnnotations;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Orders.com.BLL.Services\n{\n public abstract class OrdersDotComServiceBase : BusinessServiceBase where T : IDomainObject, new()\n {\n public OrdersDotComServiceBase(IOrdersDotComDataProxy dataProxy) : base(dataProxy)\n {\n }\n\n protected override IEnumerable GetAllErrorsForInsert(T entity, ExecutionContext context)\n {\n var validationErrors = GetValidationResultsForInsert(entity, context);\n if (!validationErrors.Any())\n {\n var businessRuleErrors = GetBusinessRulesForInsert(entity, context).GetValidationResults();\n validationErrors.Concat(businessRuleErrors);\n }\n return validationErrors;\n }\n\n protected override async Task> GetAllErrorsForInsertAsync(T entity, ExecutionContext context)\n {\n var validationErrors = GetValidationResultsForInsert(entity, context);\n if (!validationErrors.Any())\n {\n var businessRuleErrors = await GetBusinessRulesForInsertAsync(entity, context);\n validationErrors.Concat(await businessRuleErrors.GetValidationResultsAsync());\n }\n return validationErrors;\n }\n\n protected override IEnumerable GetAllErrorsForUpdate(T entity, ExecutionContext context)\n {\n var validationErrors = GetValidationResultsForUpdate(entity, context);\n if (!validationErrors.Any())\n {\n var businessRuleErrors = GetBusinessRulesForUpdate(entity, context).GetValidationResults();\n validationErrors.Concat(businessRuleErrors);\n }\n return validationErrors;\n }\n\n protected override async Task> GetAllErrorsForUpdateAsync(T entity, ExecutionContext context)\n {\n var validationErrors = GetValidationResultsForUpdate(entity, context);\n if (!validationErrors.Any())\n {\n var businessRuleErrors = await GetBusinessRulesForUpdateAsync(entity, context);\n validationErrors.Concat(await businessRuleErrors.GetValidationResultsAsync());\n }\n return validationErrors;\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using Peasy;\nusing Peasy.Core;\nusing Orders.com.BLL.DataProxy;\n\nnamespace Orders.com.BLL.Services\n{\n public abstract class OrdersDotComServiceBase : BusinessServiceBase where T : IDomainObject, new()\n {\n public OrdersDotComServiceBase(IOrdersDotComDataProxy dataProxy) : base(dataProxy)\n {\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673655,"cells":{"commit":{"kind":"string","value":"da527aa9548e9eb2ac1174b9b6e74e69fe6accca"},"subject":{"kind":"string","value":"Change ConfigurationGenerationAttributeBase to invoke generation only on local build"},"repos":{"kind":"string","value":"nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke"},"old_file":{"kind":"string","value":"source/Nuke.Common/CI/ConfigurationGenerationAttributeBase.cs"},"new_file":{"kind":"string","value":"source/Nuke.Common/CI/ConfigurationGenerationAttributeBase.cs"},"new_contents":{"kind":"string","value":"// Copyright 2019 Maintainers of NUKE.\n// Distributed under the MIT License.\n// https://github.com/nuke-build/nuke/blob/master/LICENSE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing Nuke.Common.Execution;\nusing Nuke.Common.Tooling;\n\nnamespace Nuke.Common.CI\n{\n [AttributeUsage(AttributeTargets.Class)]\n public abstract class ConfigurationGenerationAttributeBase : Attribute, IOnBeforeLogo\n {\n public const string ConfigurationParameterName = \"configure-build-server\";\n\n public bool AutoGenerate { get; set; } = true;\n\n public void OnBeforeLogo(NukeBuild build, IReadOnlyCollection executableTargets)\n {\n if (!EnvironmentInfo.GetParameter(ConfigurationParameterName))\n {\n if (NukeBuild.IsLocalBuild && AutoGenerate)\n {\n Logger.LogLevel = LogLevel.Trace;\n\n var assembly = Assembly.GetEntryAssembly().NotNull(\"assembly != null\");\n ProcessTasks.StartProcess(\n assembly.Location,\n $\"--{ConfigurationParameterName} --host {HostType}\",\n logInvocation: false,\n logOutput: false)\n .AssertZeroExitCode();\n }\n\n return;\n }\n\n if (NukeBuild.Host == HostType)\n {\n Generate(build, executableTargets);\n Environment.Exit(0);\n }\n }\n\n protected abstract HostType HostType { get; }\n\n protected abstract void Generate(NukeBuild build, IReadOnlyCollection executableTargets);\n }\n}\n"},"old_contents":{"kind":"string","value":"// Copyright 2019 Maintainers of NUKE.\n// Distributed under the MIT License.\n// https://github.com/nuke-build/nuke/blob/master/LICENSE\n\nusing System;\nusing System.Collections.Generic;\nusing System.Reflection;\nusing Nuke.Common.Execution;\nusing Nuke.Common.Tooling;\n\nnamespace Nuke.Common.CI\n{\n public abstract class ConfigurationGenerationAttributeBase : Attribute, IOnBeforeLogo\n {\n public const string ConfigurationParameterName = \"configure-build-server\";\n\n public bool AutoGenerate { get; set; } = true;\n\n public void OnBeforeLogo(NukeBuild build, IReadOnlyCollection executableTargets)\n {\n if (!EnvironmentInfo.GetParameter(ConfigurationParameterName))\n {\n if (AutoGenerate)\n {\n var assembly = Assembly.GetEntryAssembly().NotNull(\"assembly != null\");\n ProcessTasks.StartProcess(\n assembly.Location,\n $\"--{ConfigurationParameterName} --host {HostType}\",\n logInvocation: false,\n logOutput: false);\n }\n\n return;\n }\n\n Generate(build, executableTargets);\n\n Environment.Exit(0);\n }\n\n protected abstract HostType HostType { get; }\n\n protected abstract void Generate(NukeBuild build, IReadOnlyCollection executableTargets);\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673656,"cells":{"commit":{"kind":"string","value":"86f2f65af34065e2c9a10f81a931c4a9a0f0b8b1"},"subject":{"kind":"string","value":"Use local datetime"},"repos":{"kind":"string","value":"drasticactions/WinMasto"},"old_file":{"kind":"string","value":"WinMasto/Tools/Converters/CreatedTimeConverter.cs"},"new_file":{"kind":"string","value":"WinMasto/Tools/Converters/CreatedTimeConverter.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Windows.UI.Xaml.Data;\nusing PrettyPrintNet;\n\nnamespace WinMasto.Tools.Converters\n{\n public class CreatedTimeConverter : IValueConverter\n {\n public object Convert(object value, Type targetType, object parameter, string language)\n {\n var accountDateTime = (DateTime) value;\n return accountDateTime.ToLocalTime().ToString(\"g\");\n //var timespan = DateTime.UtcNow.Subtract(accountDateTime);\n //return timespan.ToPrettyString(2, UnitStringRepresentation.Compact);\n }\n\n public object ConvertBack(object value, Type targetType, object parameter, string language)\n {\n throw new NotImplementedException();\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Windows.UI.Xaml.Data;\nusing PrettyPrintNet;\n\nnamespace WinMasto.Tools.Converters\n{\n public class CreatedTimeConverter : IValueConverter\n {\n public object Convert(object value, Type targetType, object parameter, string language)\n {\n var accountDateTime = (DateTime) value;\n var timespan = DateTime.UtcNow.Subtract(accountDateTime);\n return timespan.ToPrettyString(2, UnitStringRepresentation.Compact);\n }\n\n public object ConvertBack(object value, Type targetType, object parameter, string language)\n {\n throw new NotImplementedException();\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673657,"cells":{"commit":{"kind":"string","value":"ac8569202f27518afc57c5a7f14c0ee433b6b6f8"},"subject":{"kind":"string","value":"Update sys version to v2.0-a2 #259"},"repos":{"kind":"string","value":"FanrayMedia/Fanray,FanrayMedia/Fanray,FanrayMedia/Fanray"},"old_file":{"kind":"string","value":"src/Fan/Helpers/SysVersion.cs"},"new_file":{"kind":"string","value":"src/Fan/Helpers/SysVersion.cs"},"new_contents":{"kind":"string","value":"namespace Fan.Helpers\n{\n public class SysVersion\n {\n public static string CurrentVersion = \"v2.0-a2\";\n }\n}\n"},"old_contents":{"kind":"string","value":"namespace Fan.Helpers\n{\n public class SysVersion\n {\n public static string CurrentVersion = \"v2.0-a1\";\n }\n}\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673658,"cells":{"commit":{"kind":"string","value":"00b6f898914f32fdf8026aff77f65db0744cddb6"},"subject":{"kind":"string","value":"add missing using statement ref"},"repos":{"kind":"string","value":"manigandham/serilog-sinks-googlecloudlogging"},"old_file":{"kind":"string","value":"src/TestWeb/HomeController.cs"},"new_file":{"kind":"string","value":"src/TestWeb/HomeController.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Logging;\nusing Serilog;\n\nnamespace TestWeb\n{\n public class HomeController : Controller\n {\n private readonly ILogger _logger;\n private readonly ILoggerFactory _loggerFactory;\n\n public HomeController(ILogger logger, ILoggerFactory loggerFactory)\n {\n _logger = logger;\n _loggerFactory = loggerFactory;\n }\n\n public string Index()\n {\n Log.Information(\"Testing info message with serilog\");\n Log.Debug(\"Testing debug message with serilog\");\n\n _logger.LogInformation(\"Testing info message with ILogger abstraction\");\n _logger.LogDebug(\"Testing debug message with ILogger abstraction\");\n _logger.LogDebug(eventId: new Random().Next(), message: \"Testing message with random event ID\");\n _logger.LogInformation(\"Test message with a Dictionary {myDict}\", new Dictionary\n {\n { \"myKey\", \"myValue\" },\n { \"mySecondKey\", \"withAValue\" }\n });\n\n // ASP.NET Logger Factor accepts string log names, but these must follow the rules for Google Cloud logging:\n // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry\n // Names must only include upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period. No spaces!\n var logger = _loggerFactory.CreateLogger(\"AnotherLogger\");\n logger.LogInformation(\"Testing info message with ILoggerFactor abstraction and custom log name\");\n\n return $\"Logged messages, visit GCP log viewer at https://console.cloud.google.com/logs/viewer?project={Program.GCP_PROJECT_ID}\";\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing Microsoft.AspNetCore.Mvc;\nusing Microsoft.Extensions.Logging;\nusing Serilog;\n\nnamespace TestWeb\n{\n public class HomeController : Controller\n {\n private readonly ILogger _logger;\n private readonly ILoggerFactory _loggerFactory;\n\n public HomeController(ILogger logger, ILoggerFactory loggerFactory)\n {\n _logger = logger;\n _loggerFactory = loggerFactory;\n }\n\n public string Index()\n {\n Log.Information(\"Testing info message with serilog\");\n Log.Debug(\"Testing debug message with serilog\");\n\n _logger.LogInformation(\"Testing info message with ILogger abstraction\");\n _logger.LogDebug(\"Testing debug message with ILogger abstraction\");\n _logger.LogDebug(eventId: new Random().Next(), message: \"Testing message with random event ID\");\n _logger.LogInformation(\"Test message with a Dictionary {myDict}\", new Dictionary { { \"myKey\", \"myValue\" },\n { \"mySecondKey\", \"withAValue\" } });\n\n // ASP.NET Logger Factor accepts string log names, but these must follow the rules for Google Cloud logging:\n // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry\n // Names must only include upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period. No spaces!\n var logger = _loggerFactory.CreateLogger(\"AnotherLogger\");\n logger.LogInformation(\"Testing info message with ILoggerFactor abstraction and custom log name\");\n\n return $\"Logged messages, visit GCP log viewer at https://console.cloud.google.com/logs/viewer?project={Program.GCP_PROJECT_ID}\";\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673659,"cells":{"commit":{"kind":"string","value":"95d486c19b0064f653be1226e8bdc463efed4244"},"subject":{"kind":"string","value":"Add Json Constructor for WebInput"},"repos":{"kind":"string","value":"LibertyLocked/webscripthook,LibertyLocked/webscripthook,LibertyLocked/webscripthook,LibertyLocked/webscripthook"},"old_file":{"kind":"string","value":"webscripthook-plugin/WebInput.cs"},"new_file":{"kind":"string","value":"webscripthook-plugin/WebInput.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing GTA;\nusing GTA.Math;\nusing GTA.Native;\nusing Newtonsoft.Json;\n\nnamespace WebScriptHook\n{\n delegate object WebFunction(string arg, params object[] args);\n\n class WebInput\n {\n public string Cmd { get; set; } \n public string Arg { get; set; }\n public object[] Args { get; set; }\n public string UID { get; private set; }\n\n [JsonConstructor]\n public WebInput(string Cmd, string Arg, object[] Args, string UID)\n {\n this.Cmd = Cmd;\n this.Arg = Arg;\n this.Args = Args;\n this.UID = UID;\n }\n\n public object Execute()\n {\n if (string.IsNullOrEmpty(Cmd)) return null;\n\n WebFunction func = FunctionConvert.GetFunction(Cmd);\n if (func != null)\n {\n return func(Arg, Args);\n }\n else\n {\n return null;\n }\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing GTA;\nusing GTA.Math;\nusing GTA.Native;\n\nnamespace WebScriptHook\n{\n delegate object WebFunction(string arg, params object[] args);\n\n class WebInput\n {\n public string Cmd { get; set; } \n public string Arg { get; set; }\n public object[] Args { get; set; }\n public string UID { get; set; }\n\n public object Execute()\n {\n if (string.IsNullOrEmpty(Cmd)) return null;\n\n WebFunction func = FunctionConvert.GetFunction(Cmd);\n if (func != null)\n {\n return func(Arg, Args);\n }\n else\n {\n return null;\n }\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673660,"cells":{"commit":{"kind":"string","value":"3ee36bb8221323c5e29f9f56f22c55593960c262"},"subject":{"kind":"string","value":"Apply license terms uniformly"},"repos":{"kind":"string","value":"Lightstreamer/Lightstreamer-example-StockList-client-winphone,Weswit/Lightstreamer-example-StockList-client-winphone"},"old_file":{"kind":"string","value":"WP7StockListDemo/Properties/AssemblyInfo.cs"},"new_file":{"kind":"string","value":"WP7StockListDemo/Properties/AssemblyInfo.cs"},"new_contents":{"kind":"string","value":"using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n[assembly: AssemblyTitle(\"Lightstreamer Windows Phone Demo\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Microsoft\")]\n[assembly: AssemblyProduct(\"Lightstreamer Windows Phone Demo\")]\n[assembly: AssemblyCopyright(\"Copyright © Weswit 2011\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n[assembly: ComVisible(false)]\n\n[assembly: Guid(\"3e0afa5b-ebe3-408b-8c68-d1a45ae7eee8\")]\n\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"},"old_contents":{"kind":"string","value":"#region License\n/*\n* Copyright 2013 Weswit Srl\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n#endregion License\n\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n[assembly: AssemblyTitle(\"Lightstreamer Windows Phone Demo\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Microsoft\")]\n[assembly: AssemblyProduct(\"Lightstreamer Windows Phone Demo\")]\n[assembly: AssemblyCopyright(\"Copyright © Weswit 2011\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n[assembly: ComVisible(false)]\n\n[assembly: Guid(\"3e0afa5b-ebe3-408b-8c68-d1a45ae7eee8\")]\n\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673661,"cells":{"commit":{"kind":"string","value":"4b79613aa31a5a0da573f5b54a0ce55a35f199fd"},"subject":{"kind":"string","value":"Add missing Id"},"repos":{"kind":"string","value":"hishamco/WebForms,hishamco/WebForms"},"old_file":{"kind":"string","value":"samples/WebFormsSample/Pages/Index.htm.cs"},"new_file":{"kind":"string","value":"samples/WebFormsSample/Pages/Index.htm.cs"},"new_contents":{"kind":"string","value":"using My.AspNetCore.WebForms;\nusing My.AspNetCore.WebForms.Controls;\nusing System;\n\nnamespace WebFormsSample.Pages\n{\n public class Index : Page\n {\n private Literal litGreeting;\n\n public Index()\n {\n litGreeting = new Literal()\n {\n Id = \"litGreeting\"\n };\n this.Load += Page_Load;\n this.Controls.Add(litGreeting);\n }\n\n private void Page_Load(object sender, EventArgs e)\n {\n litGreeting.Text = $\"Hello, World! The time on the server is {DateTime.Now}\";\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using My.AspNetCore.WebForms;\nusing My.AspNetCore.WebForms.Controls;\nusing System;\n\nnamespace WebFormsSample.Pages\n{\n public class Index : Page\n {\n private Literal litGreeting;\n\n public Index()\n {\n litGreeting = new Literal();\n\n this.Load += Page_Load;\n this.Controls.Add(litGreeting);\n }\n\n private void Page_Load(object sender, EventArgs e)\n {\n litGreeting.Text = $\"Hello, World! The time on the server is {DateTime.Now}\";\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673662,"cells":{"commit":{"kind":"string","value":"5931c7fb9a8884adaf3087fb831caa103e0cfb86"},"subject":{"kind":"string","value":"Remove trailing slashes when creating LZMAs"},"repos":{"kind":"string","value":"aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore"},"old_file":{"kind":"string","value":"build/tasks/CreateLzma.cs"},"new_file":{"kind":"string","value":"build/tasks/CreateLzma.cs"},"new_contents":{"kind":"string","value":"// Copyright (c) .NET Foundation. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n\nusing System.IO;\nusing Microsoft.Build.Framework;\nusing Microsoft.Build.Utilities;\nusing Microsoft.DotNet.Archive;\n\nnamespace RepoTasks\n{\n public class CreateLzma : Task\n {\n [Required]\n public string OutputPath { get; set; }\n\n [Required]\n public string[] Sources { get; set; }\n\n public override bool Execute()\n {\n var progress = new ConsoleProgressReport();\n using (var archive = new IndexedArchive())\n {\n foreach (var source in Sources)\n {\n if (Directory.Exists(source))\n {\n var trimmedSource = source.TrimEnd(new []{ '\\\\', '/' });\n Log.LogMessage(MessageImportance.High, $\"Adding directory: {trimmedSource}\");\n archive.AddDirectory(trimmedSource, progress);\n }\n else\n {\n Log.LogMessage(MessageImportance.High, $\"Adding file: {source}\");\n archive.AddFile(source, Path.GetFileName(source));\n }\n }\n\n archive.Save(OutputPath, progress);\n }\n\n return true;\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"// Copyright (c) .NET Foundation. All rights reserved.\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\n\nusing System.IO;\nusing Microsoft.Build.Framework;\nusing Microsoft.Build.Utilities;\nusing Microsoft.DotNet.Archive;\n\nnamespace RepoTasks\n{\n public class CreateLzma : Task\n {\n [Required]\n public string OutputPath { get; set; }\n\n [Required]\n public string[] Sources { get; set; }\n\n public override bool Execute()\n {\n var progress = new ConsoleProgressReport();\n using (var archive = new IndexedArchive())\n {\n foreach (var source in Sources)\n {\n if (Directory.Exists(source))\n {\n Log.LogMessage(MessageImportance.High, $\"Adding directory: {source}\");\n archive.AddDirectory(source, progress);\n }\n else\n {\n Log.LogMessage(MessageImportance.High, $\"Adding file: {source}\");\n archive.AddFile(source, Path.GetFileName(source));\n }\n }\n\n archive.Save(OutputPath, progress);\n }\n\n return true;\n }\n }\n}\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673663,"cells":{"commit":{"kind":"string","value":"93cdc05ae158b3268f2812908e4b2fdfde08ff73"},"subject":{"kind":"string","value":"improve NotifyObjectChange: only check binding for ObservableModel context"},"repos":{"kind":"string","value":"minhdu/UIMan"},"old_file":{"kind":"string","value":"Assets/UnuGames/UIMan/Scripts/MVVM/Core/DataContext.cs"},"new_file":{"kind":"string","value":"Assets/UnuGames/UIMan/Scripts/MVVM/Core/DataContext.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Reflection;\nusing UnityEngine;\nusing System.Collections.Generic;\n\nnamespace UnuGames.MVVM {\n\n\t/// \n\t/// Data context.\n\t/// \n\tpublic class DataContext : MonoBehaviour {\n\n#region DataContext Factory\n\t\tstatic List contextsList = new List ();\n\t\tstatic public void NotifyObjectChange (object modelInstance) {\n\t\t\tfor (int i = 0; i < contextsList.Count; i++) {\n\t\t\t\tDataContext context = contextsList [i];\n\t\t\t\tif (context.model != null && context.model is ObservableModel) {\n\t\t\t\t\tPropertyInfo propertyInfo = context.viewModel.IsBindingTo (modelInstance);\n\t\t\t\t\tif (propertyInfo != null) {\n\t\t\t\t\t\tcontext.viewModel.NotifyModelChange (modelInstance);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n#endregion\n\n#region Instance\n\n\t\tpublic ContextType type;\n\t\tpublic ViewModelBehaviour viewModel;\n\t\tpublic object model;\n\n\t\tpublic string propertyName;\n\t\tPropertyInfo propertyInfo;\n\t\tpublic PropertyInfo PropertyInfo {\n\t\t\tget {\n\t\t\t\treturn propertyInfo;\n\t\t\t}\n\t\t}\n\n public void Clear () {\n viewModel = null;\n\t\t\tpropertyName = null;\n\t\t\tpropertyInfo = null;\n }\n\n\t\tvoid Awake () {\n\n\t\t\tif(!contextsList.Contains(this))\n\t\t\t\tcontextsList.Add (this);\n\n\t\t\tInit ();\n\t\t\tRegisterBindingMessage (false);\n\t\t}\n\n\t\t// Subscript for property change event\n\t\tpublic void Init () {\n\t\t\tGetPropertyInfo ();\n\t\t\tif (propertyInfo != null) {\n\t\t\t\tmodel = propertyInfo.GetValue (viewModel, null);\n\t\t\t\tif (model == null && type == ContextType.PROPERTY)\n\t\t\t\t\tmodel = ReflectUtils.GetCachedTypeInstance (propertyInfo.PropertyType);\n\t\t\t\tif (model != null) {\n\t\t\t\t\tviewModel.SubcriptObjectAction (model);\n\t\t\t\t\tviewModel.SubscribeAction (propertyName, viewModel.NotifyModelChange);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Register binding message for child binders\n\t\tvoid RegisterBindingMessage (bool forceReinit = false) {\n\t\t\tBinderBase[] binders = GetComponentsInChildren (true);\n\t\t\tfor (int i = 0; i < binders.Length; i++) {\n\t\t\t\tBinderBase binder = binders [i];\n\t\t\t\tif (binder.mDataContext == this) {\n\t\t\t\t\tbinder.Init (forceReinit);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic PropertyInfo GetPropertyInfo () {\n#if !UNITY_EDITOR\n\t\t\tif(propertyInfo == null)\n\t\t\t\tpropertyInfo = viewModel.GetCachedType ().GetProperty (propertyName);\n#else\n\t\t\tpropertyInfo = viewModel.GetCachedType ().GetProperty (propertyName);\n#endif\n\t\t\treturn propertyInfo;\n\t\t}\n\t}\n\n#endregion\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Reflection;\nusing UnityEngine;\nusing System.Collections.Generic;\n\nnamespace UnuGames.MVVM {\n\n\t/// \n\t/// Data context.\n\t/// \n\tpublic class DataContext : MonoBehaviour {\n\n#region DataContext Factory\n\t\tstatic List contextsList = new List ();\n\t\tstatic public void NotifyObjectChange (object modelInstance) {\n\t\t\tfor (int i = 0; i < contextsList.Count; i++) {\n\t\t\t\tDataContext context = contextsList [i];\n\t\t\t\tPropertyInfo propertyInfo = context.viewModel.IsBindingTo (modelInstance);\n\t\t\t\tif (propertyInfo != null) {\n\t\t\t\t\tcontext.viewModel.NotifyModelChange (modelInstance);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n#endregion\n\n#region Instance\n\n\t\tpublic ContextType type;\n\t\tpublic ViewModelBehaviour viewModel;\n\t\tpublic object model;\n\n\t\tpublic string propertyName;\n\t\tPropertyInfo propertyInfo;\n\t\tpublic PropertyInfo PropertyInfo {\n\t\t\tget {\n\t\t\t\treturn propertyInfo;\n\t\t\t}\n\t\t}\n\n public void Clear () {\n viewModel = null;\n\t\t\tpropertyName = null;\n\t\t\tpropertyInfo = null;\n }\n\n\t\tvoid Awake () {\n\n\t\t\tif(!contextsList.Contains(this))\n\t\t\t\tcontextsList.Add (this);\n\n\t\t\tInit ();\n\t\t\tRegisterBindingMessage (false);\n\t\t}\n\n\t\t// Subscript for property change event\n\t\tpublic void Init () {\n\t\t\tGetPropertyInfo ();\n\t\t\tif (propertyInfo != null) {\n\t\t\t\tmodel = propertyInfo.GetValue (viewModel, null);\n\t\t\t\tif (model == null && type == ContextType.PROPERTY)\n\t\t\t\t\tmodel = ReflectUtils.GetCachedTypeInstance (propertyInfo.PropertyType);\n\t\t\t\tif (model != null) {\n\t\t\t\t\tviewModel.SubcriptObjectAction (model);\n\t\t\t\t\tviewModel.SubscribeAction (propertyName, viewModel.NotifyModelChange);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Register binding message for child binders\n\t\tvoid RegisterBindingMessage (bool forceReinit = false) {\n\t\t\tBinderBase[] binders = GetComponentsInChildren (true);\n\t\t\tfor (int i = 0; i < binders.Length; i++) {\n\t\t\t\tBinderBase binder = binders [i];\n\t\t\t\tif (binder.mDataContext == this) {\n\t\t\t\t\tbinder.Init (forceReinit);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tpublic PropertyInfo GetPropertyInfo () {\n#if !UNITY_EDITOR\n\t\t\tif(propertyInfo == null)\n\t\t\t\tpropertyInfo = viewModel.GetCachedType ().GetProperty (propertyName);\n#else\n\t\t\tpropertyInfo = viewModel.GetCachedType ().GetProperty (propertyName);\n#endif\n\t\t\treturn propertyInfo;\n\t\t}\n\t}\n\n#endregion\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673664,"cells":{"commit":{"kind":"string","value":"21c7ea664a6c071716a69b2f7659a0aebfb80802"},"subject":{"kind":"string","value":"Improve high-dpi."},"repos":{"kind":"string","value":"yas-mnkornym/SylphyHorn,Grabacr07/SylphyHorn,mntone/SylphyHorn"},"old_file":{"kind":"string","value":"source/SylphyHorn/Interop/IconHelper.cs"},"new_file":{"kind":"string","value":"source/SylphyHorn/Interop/IconHelper.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\nusing MetroRadiance.Interop;\n\nnamespace SylphyHorn.Interop\n{\n\tpublic static class IconHelper\n\t{\n\t\tpublic static Icon GetIconFromResource(Uri uri)\n\t\t{\n\t\t\tvar streamResourceInfo = System.Windows.Application.GetResourceStream(uri);\n\t\t\tif (streamResourceInfo == null) throw new ArgumentException(\"Resource not found.\", nameof(uri));\n\n\t\t\tvar dpi = PerMonitorDpi.GetDpi(IntPtr.Zero); // get desktop dpi\n\n\t\t\tusing (var stream = streamResourceInfo.Stream)\n\t\t\t{\n\t\t\t\treturn new Icon(stream, new Size((int)(16 * dpi.ScaleX), (int)(16 * dpi.ScaleY)));\n\t\t\t}\n\t\t}\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Drawing;\nusing System.Linq;\n\nnamespace SylphyHorn.Interop\n{\n\tpublic static class IconHelper\n\t{\n\t\tpublic static Icon GetIconFromResource(Uri uri)\n\t\t{\n\t\t\tvar streamResourceInfo = System.Windows.Application.GetResourceStream(uri);\n\t\t\tif (streamResourceInfo == null) throw new ArgumentException(\"Resource not found.\", nameof(uri));\n\n\t\t\tusing (var stream = streamResourceInfo.Stream)\n\t\t\t{\n\t\t\t\treturn new Icon(stream, new Size(16, 16));\n\t\t\t}\n\t\t}\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673665,"cells":{"commit":{"kind":"string","value":"77ec37d24ea3a6aca58761380c981952fa4ea784"},"subject":{"kind":"string","value":"Refactor normalization tests"},"repos":{"kind":"string","value":"ermshiperete/icu-dotnet,ermshiperete/icu-dotnet,conniey/icu-dotnet,sillsdev/icu-dotnet,sillsdev/icu-dotnet,conniey/icu-dotnet"},"old_file":{"kind":"string","value":"source/icu.net.tests/NormalizerTests.cs"},"new_file":{"kind":"string","value":"source/icu.net.tests/NormalizerTests.cs"},"new_contents":{"kind":"string","value":"// Copyright (c) 2013 SIL International\n// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)\nusing System;\nusing System.Text;\nusing Icu.Collation;\nusing NUnit.Framework;\n\nnamespace Icu.Tests\n{\n\t[TestFixture]\n\tpublic class NormalizerTests\n\t{\n\t\t[TestCase(\"XA\\u0308bc\", Normalizer.UNormalizationMode.UNORM_NFC, Result = \"X\\u00C4bc\")]\n\t\t[TestCase(\"X\\u00C4bc\", Normalizer.UNormalizationMode.UNORM_NFD, Result = \"XA\\u0308bc\")]\n\t\t[TestCase(\"tést\", Normalizer.UNormalizationMode.UNORM_NFD, Result = \"te\\u0301st\")]\n\t\t[TestCase(\"te\\u0301st\", Normalizer.UNormalizationMode.UNORM_NFC, Result = \"tést\")]\n\t\t[TestCase(\"te\\u0301st\", Normalizer.UNormalizationMode.UNORM_NFD, Result = \"te\\u0301st\")]\n\t\tpublic string Normalize(string src, Normalizer.UNormalizationMode mode)\n\t\t{\n\t\t\treturn Normalizer.Normalize(src, mode);\n\t\t}\n\n\t\t[TestCase(\"X\\u00C4bc\", Normalizer.UNormalizationMode.UNORM_NFC, Result = true)]\n\t\t[TestCase(\"XA\\u0308bc\", Normalizer.UNormalizationMode.UNORM_NFC, Result = false)]\n\t\t[TestCase(\"X\\u00C4bc\", Normalizer.UNormalizationMode.UNORM_NFD, Result = false)]\n\t\t[TestCase(\"XA\\u0308bc\", Normalizer.UNormalizationMode.UNORM_NFD, Result = true)]\n\t\tpublic bool IsNormalized(string src, Normalizer.UNormalizationMode expectNormalizationMode)\n\t\t{\n\t\t\treturn Normalizer.IsNormalized(src, expectNormalizationMode);\n\t\t}\n\t}\n}\n"},"old_contents":{"kind":"string","value":"// Copyright (c) 2013 SIL International\n// This software is licensed under the MIT license (http://opensource.org/licenses/MIT)\nusing System;\nusing System.Text;\nusing NUnit.Framework;\n\nnamespace Icu.Tests\n{\n\t[TestFixture]\n\tpublic class NormalizerTests\n\t{\n\t\t[Test]\n\t\tpublic void Normalize_NFC()\n\t\t{\n\t\t\tAssert.That(Normalizer.Normalize(\"XA\\u0308bc\", Normalizer.UNormalizationMode.UNORM_NFC),\n\t\t\t\tIs.EqualTo(\"X\\u00C4bc\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void Normalize_NFD()\n\t\t{\n\t\t\tAssert.That(Normalizer.Normalize(\"X\\u00C4bc\", Normalizer.UNormalizationMode.UNORM_NFD),\n\t\t\t\tIs.EqualTo(\"XA\\u0308bc\"));\n\t\t}\n\n\t\t[Test]\n\t\tpublic void Normalize_NFC2NFC()\n\t\t{\n\t\t\tvar normalizedString = Normalizer.Normalize(\"tést\", Normalizer.UNormalizationMode.UNORM_NFC);\n\t\t\tAssert.That(normalizedString, Is.EqualTo(\"tést\"));\n\t\t\tAssert.That(normalizedString.IsNormalized(NormalizationForm.FormC), Is.True);\n\t\t}\n\n\t\t[Test]\n\t\tpublic void Normalize_NFC2NFD()\n\t\t{\n\t\t\tvar normalizedString = Normalizer.Normalize(\"tést\", Normalizer.UNormalizationMode.UNORM_NFD);\n\t\t\tAssert.That(normalizedString[2], Is.EqualTo('\\u0301'));\n\t\t\tAssert.That(normalizedString, Is.EqualTo(\"te\\u0301st\"));\n\t\t\tAssert.That(normalizedString.IsNormalized(NormalizationForm.FormD), Is.True);\n\t\t}\n\n\t\t[Test]\n\t\tpublic void Normalize_NFD2NFC()\n\t\t{\n\t\t\tvar normalizedString = Normalizer.Normalize(\"te\\u0301st\", Normalizer.UNormalizationMode.UNORM_NFC);\n\t\t\tAssert.That(normalizedString, Is.EqualTo(\"tést\"));\n\t\t\tAssert.That(normalizedString.IsNormalized(NormalizationForm.FormC), Is.True);\n\t\t}\n\n\t\t[Test]\n\t\tpublic void Normalize_NFD2NFD()\n\t\t{\n\t\t\tvar normalizedString = Normalizer.Normalize(\"te\\u0301st\", Normalizer.UNormalizationMode.UNORM_NFD);\n\t\t\tAssert.That(normalizedString, Is.EqualTo(\"te\\u0301st\"));\n\t\t\tAssert.That(normalizedString.IsNormalized(NormalizationForm.FormD), Is.True);\n\t\t}\n\n\t\t[Test]\n\t\tpublic void IsNormalized_NFC()\n\t\t{\n\t\t\tAssert.That(Normalizer.IsNormalized(\"X\\u00C4bc\", Normalizer.UNormalizationMode.UNORM_NFC),\n\t\t\t\tIs.True);\n\t\t\tAssert.That(Normalizer.IsNormalized(\"XA\\u0308bc\", Normalizer.UNormalizationMode.UNORM_NFC),\n\t\t\t\tIs.False);\n\t\t}\n\n\t\t[Test]\n\t\tpublic void IsNormalized_NFD()\n\t\t{\n\t\t\tAssert.That(Normalizer.IsNormalized(\"XA\\u0308bc\", Normalizer.UNormalizationMode.UNORM_NFD),\n\t\t\t\tIs.True);\n\t\t\tAssert.That(Normalizer.IsNormalized(\"X\\u00C4bc\", Normalizer.UNormalizationMode.UNORM_NFD),\n\t\t\t\tIs.False);\n\t\t}\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673666,"cells":{"commit":{"kind":"string","value":"0a72d4024fc0cb0d1c063c077e86d3ab5edbce2e"},"subject":{"kind":"string","value":"Stop prior sounds"},"repos":{"kind":"string","value":"gadauto/OCDEscape"},"old_file":{"kind":"string","value":"Assets/OCDRoomEscape/Scripts/Interaction/PuzzleMaster.cs"},"new_file":{"kind":"string","value":"Assets/OCDRoomEscape/Scripts/Interaction/PuzzleMaster.cs"},"new_contents":{"kind":"string","value":"using UnityEngine;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class PuzzleMaster : MonoBehaviour \n{\n\tpublic float timeBetweenSounds = 15f;\n\tpublic WallManager wallMgr;\n\tpublic List puzzles;\n\t\n\tfloat increment;\n\tfloat weightedIncrementTotal;\n\tbool isGameOver = false;\n\n\t// Use this for initialization\n\tvoid Awake () \n\t{\n\t\tforeach (var puzzle in puzzles) {\n\t\t\tDebug.Log(\"Puzzle added: \"+puzzle);\n\t\t}\n\t}\n\n\tvoid Start()\n\t{\n\t\t// We'll consider the puzzle's weight when determining how much it affects the room movement\n\t\tforeach (var puzzle in puzzles) {\n\t\t\tweightedIncrementTotal += puzzle.puzzleWeight;\n\t\t}\n\t}\n\t\n\tpublic void PuzzleCompleted(Puzzle puzzle)\n\t{\n\t\tif (isGameOver) {\n\t\t\tDebug.Log(\"GAME OVER!!! Let the player know!!\");\n\t\t\treturn;\n\t\t}\n\n\t\tvar growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal;\n\t\t// Notify room of growth increment\n\t\twallMgr.Resize(wallMgr.transformRoom + growthIncrement);\n\t\tKickOffSoundForPuzzle(puzzle);\n\n\t\tif (puzzle.IsResetable() && puzzles.Contains(puzzle)) {\n\t\t\tDebug.Log(\"Puzzle marked for reset\");\n\t\t\tpuzzle.MarkForReset();\n\t\t}\n\n\t\t// Remove the puzzle, but also allow it to remain in the list multiple times\n\t\tpuzzles.Remove(puzzle);\n\t\tDebug.Log(\"Finished puzzle: \"+puzzle+\", \"+puzzles.Count+\" left, room growing to: \"+(wallMgr.transformRoom + growthIncrement));\n\n\t\tif (wallMgr.transformRoom >= 1f) {\n\t\t\t\n\t\t\tStopAllCoroutines(); // Turn off sounds\n\t\t\tisGameOver = true;\n\t\t\tDebug.Log(\"GAME OVER!!!\");\n\t\t}\n\t}\n\n\tprivate void KickOffSoundForPuzzle(Puzzle puzzle) {\n\t\tStopAllCoroutines();\n\t\tAudioSource source = puzzle.SoundForPuzzle();\n\n\t\tif (source) {\n\t\t\tStartCoroutine(PlaySound(source));\n\t\t} else {\n\t\t\tDebug.Log(puzzle+\" does not have an associated AudioSource\");\n\t\t}\n\t}\n\n\tprivate IEnumerator PlaySound(AudioSource source) {\n\t\twhile (true) {\n\t\t\tsource.Play();\n\t\t\tyield return new WaitForSeconds(timeBetweenSounds);\n\t\t}\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using UnityEngine;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class PuzzleMaster : MonoBehaviour \n{\n\tpublic float timeBetweenSounds = 15f;\n\tpublic WallManager wallMgr;\n\tpublic List puzzles;\n\t\n\tfloat increment;\n\tfloat weightedIncrementTotal;\n\tbool isGameOver = false;\n\n\t// Use this for initialization\n\tvoid Awake () \n\t{\n\t\tforeach (var puzzle in puzzles) {\n\t\t\tDebug.Log(\"Puzzle added: \"+puzzle);\n\t\t}\n\t}\n\n\tvoid Start()\n\t{\n\t\t// We'll consider the puzzle's weight when determining how much it affects the room movement\n\t\tforeach (var puzzle in puzzles) {\n\t\t\tweightedIncrementTotal += puzzle.puzzleWeight;\n\t\t}\n\t}\n\t\n\tpublic void PuzzleCompleted(Puzzle puzzle)\n\t{\n\t\tif (isGameOver) {\n\t\t\tDebug.Log(\"GAME OVER!!! Let the player know!!\");\n\t\t\treturn;\n\t\t}\n\n\t\tvar growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal;\n\t\t// Notify room of growth increment\n\t\twallMgr.Resize(wallMgr.transformRoom + growthIncrement);\n\t\tKickOffSoundForPuzzle(puzzle);\n\n\t\tif (puzzle.IsResetable() && puzzles.Contains(puzzle)) {\n\t\t\tDebug.Log(\"Puzzle marked for reset\");\n\t\t\tpuzzle.MarkForReset();\n\t\t}\n\n\t\t// Remove the puzzle, but also allow it to remain in the list multiple times\n\t\tpuzzles.Remove(puzzle);\n\t\tDebug.Log(\"Finished puzzle: \"+puzzle+\", \"+puzzles.Count+\" left, room growing to: \"+(wallMgr.transformRoom + growthIncrement));\n\n\t\tif (wallMgr.transformRoom >= 1f) {\n\t\t\tisGameOver = true;\n\t\t\tDebug.Log(\"GAME OVER!!!\");\n\t\t}\n\t}\n\n\tprivate void KickOffSoundForPuzzle(Puzzle puzzle) {\n\t\tAudioSource source = puzzle.SoundForPuzzle();\n\n\t\tif (source) {\n\t\t\tStartCoroutine(PlaySound(source));\n\t\t} else {\n\t\t\tDebug.Log(puzzle+\" does not have an associated AudioSource\");\n\t\t}\n\t}\n\n\tprivate IEnumerator PlaySound(AudioSource source) {\n\t\twhile (true) {\n\t\t\tsource.Play();\n\t\t\tyield return new WaitForSeconds(timeBetweenSounds);\n\t\t}\n\t}\n}\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673667,"cells":{"commit":{"kind":"string","value":"01c15fe516e6fc599a12eef3936ed56aa4b8f1fc"},"subject":{"kind":"string","value":"Verify that region is set if specified"},"repos":{"kind":"string","value":"appharbor/appharbor-cli"},"old_file":{"kind":"string","value":"src/AppHarbor.Tests/Commands/CreateAppCommandTest.cs"},"new_file":{"kind":"string","value":"src/AppHarbor.Tests/Commands/CreateAppCommandTest.cs"},"new_contents":{"kind":"string","value":"using System.IO;\nusing System.Linq;\nusing AppHarbor.Commands;\nusing AppHarbor.Model;\nusing Moq;\nusing Ploeh.AutoFixture.Xunit;\nusing Xunit;\nusing Xunit.Extensions;\n\nnamespace AppHarbor.Tests.Commands\n{\n\tpublic class CreateAppCommandTest\n\t{\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldThrowWhenNoArguments(CreateAppCommand command)\n\t\t{\n\t\t\tvar exception = Assert.Throws(() => command.Execute(new string[0]));\n\t\t\tAssert.Equal(\"An application name must be provided to create an application\", exception.Message);\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldCreateApplicationWithOnlyName([Frozen]Mock client, CreateAppCommand command)\n\t\t{\n\t\t\tvar arguments = new string[] { \"foo\" };\n\t\t\tVerifyArguments(client, command, arguments);\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldCreateApplicationWithRegion([Frozen]Mock client, CreateAppCommand command, string[] arguments)\n\t\t{\n\t\t\tVerifyArguments(client, command, arguments);\n\t\t}\n\n\t\tprivate static void VerifyArguments(Mock client, CreateAppCommand command, string[] arguments)\n\t\t{\n\t\t\tcommand.Execute(arguments);\n\t\t\tclient.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldSetupApplicationLocallyAfterCreationIfNotConfigured([Frozen]Mock applicationConfiguration, [Frozen]Mock client, CreateAppCommand command, CreateResult result, User user, string[] arguments)\n\t\t{\n\t\t\tclient.Setup(x => x.CreateApplication(It.IsAny(), It.IsAny())).Returns(result);\n\t\t\tclient.Setup(x => x.GetUser()).Returns(user);\n\t\t\tapplicationConfiguration.Setup(x => x.GetApplicationId()).Throws();\n\n\t\t\tcommand.Execute(arguments);\n\t\t\tapplicationConfiguration.Verify(x => x.SetupApplication(result.Id, user), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldNotSetupApplicationIfAlreadyConfigured([Frozen]Mock applicationConfiguration, [Frozen]Mock writer, CreateAppCommand command, string[] arguments, string applicationName)\n\t\t{\n\t\t\tapplicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationName);\n\n\t\t\tcommand.Execute(arguments);\n\n\t\t\twriter.Verify(x => x.WriteLine(\"This directory is already configured to track application \\\"{0}\\\".\", applicationName), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldPrintSuccessMessageAfterCreatingApplication([Frozen]Mock client, [Frozen]Mock writer, Mock command, string applicationName, string applicationSlug)\n\t\t{\n\t\t\tclient.Setup(x => x.CreateApplication(applicationName, null)).Returns(new CreateResult { Id = applicationSlug });\n\n\t\t\tcommand.Object.Execute(new string[] { applicationName });\n\n\t\t\twriter.Verify(x => x.WriteLine(\"Created application \\\"{0}\\\" | URL: https://{0}.apphb.com\", applicationSlug), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldSetRegionIsSpecified([Frozen]Mock client, [Frozen]Mock writer, Mock command, string regionName, string applicationSlug)\n\t\t{\n\t\t\tclient.Setup(x => x.CreateApplication(applicationSlug, regionName)).Returns(new CreateResult { Id = applicationSlug });\n\n\t\t\tcommand.Object.Execute(new string[] { applicationSlug, \"-r\", regionName });\n\n\t\t\tclient.VerifyAll();\n\t\t}\n\t}\n}\n"},"old_contents":{"kind":"string","value":"using System.IO;\nusing System.Linq;\nusing AppHarbor.Commands;\nusing AppHarbor.Model;\nusing Moq;\nusing Ploeh.AutoFixture.Xunit;\nusing Xunit;\nusing Xunit.Extensions;\n\nnamespace AppHarbor.Tests.Commands\n{\n\tpublic class CreateAppCommandTest\n\t{\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldThrowWhenNoArguments(CreateAppCommand command)\n\t\t{\n\t\t\tvar exception = Assert.Throws(() => command.Execute(new string[0]));\n\t\t\tAssert.Equal(\"An application name must be provided to create an application\", exception.Message);\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldCreateApplicationWithOnlyName([Frozen]Mock client, CreateAppCommand command)\n\t\t{\n\t\t\tvar arguments = new string[] { \"foo\" };\n\t\t\tVerifyArguments(client, command, arguments);\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldCreateApplicationWithRegion([Frozen]Mock client, CreateAppCommand command, string[] arguments)\n\t\t{\n\t\t\tVerifyArguments(client, command, arguments);\n\t\t}\n\n\t\tprivate static void VerifyArguments(Mock client, CreateAppCommand command, string[] arguments)\n\t\t{\n\t\t\tcommand.Execute(arguments);\n\t\t\tclient.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldSetupApplicationLocallyAfterCreationIfNotConfigured([Frozen]Mock applicationConfiguration, [Frozen]Mock client, CreateAppCommand command, CreateResult result, User user, string[] arguments)\n\t\t{\n\t\t\tclient.Setup(x => x.CreateApplication(It.IsAny(), It.IsAny())).Returns(result);\n\t\t\tclient.Setup(x => x.GetUser()).Returns(user);\n\t\t\tapplicationConfiguration.Setup(x => x.GetApplicationId()).Throws();\n\n\t\t\tcommand.Execute(arguments);\n\t\t\tapplicationConfiguration.Verify(x => x.SetupApplication(result.Id, user), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldNotSetupApplicationIfAlreadyConfigured([Frozen]Mock applicationConfiguration, [Frozen]Mock writer, CreateAppCommand command, string[] arguments, string applicationName)\n\t\t{\n\t\t\tapplicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationName);\n\n\t\t\tcommand.Execute(arguments);\n\n\t\t\twriter.Verify(x => x.WriteLine(\"This directory is already configured to track application \\\"{0}\\\".\", applicationName), Times.Once());\n\t\t}\n\n\t\t[Theory, AutoCommandData]\n\t\tpublic void ShouldPrintSuccessMessageAfterCreatingApplication([Frozen]Mock client, [Frozen]Mock writer, Mock command, string applicationName, string applicationSlug)\n\t\t{\n\t\t\tclient.Setup(x => x.CreateApplication(applicationName, null)).Returns(new CreateResult { Id = applicationSlug });\n\n\t\t\tcommand.Object.Execute(new string[] { applicationName });\n\n\t\t\twriter.Verify(x => x.WriteLine(\"Created application \\\"{0}\\\" | URL: https://{0}.apphb.com\", applicationSlug), Times.Once());\n\t\t}\n\t}\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673668,"cells":{"commit":{"kind":"string","value":"be20878184318342858b03d85b61ca1643c71906"},"subject":{"kind":"string","value":"Update IndexModule.cs"},"repos":{"kind":"string","value":"LeedsSharp/AppVeyorDemo"},"old_file":{"kind":"string","value":"src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs"},"new_file":{"kind":"string","value":"src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs"},"new_contents":{"kind":"string","value":"namespace AppVeyorDemo.Modules\n{\n using System.Configuration;\n using AppVeyorDemo.Models;\n using Nancy;\n\n public class IndexModule : NancyModule\n {\n public IndexModule()\n {\n Get[\"/\"] = parameters =>\n {\n var model = new IndexViewModel\n {\n HelloName = \"Leeds#\",\n ServerName = ConfigurationManager.AppSettings[\"Server_Name\"]\n };\n\n return View[\"index\", model];\n };\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"namespace AppVeyorDemo.Modules\n{\n using System.Configuration;\n using AppVeyorDemo.Models;\n using Nancy;\n\n public class IndexModule : NancyModule\n {\n public IndexModule()\n {\n Get[\"/\"] = parameters =>\n {\n var model = new IndexViewModel\n {\n HelloName = \"AppVeyor\",\n ServerName = ConfigurationManager.AppSettings[\"Server_Name\"]\n };\n\n return View[\"index\", model];\n };\n }\n }\n}"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673669,"cells":{"commit":{"kind":"string","value":"b9df03da9d552c00887e209bba16e6cc33638a77"},"subject":{"kind":"string","value":"Add public comments to login request handler classes and interfaces"},"repos":{"kind":"string","value":"ZEISS-PiWeb/PiWeb-Api"},"old_file":{"kind":"string","value":"src/Common/Client/ICertificateLoginRequestHandler.cs"},"new_file":{"kind":"string","value":"src/Common/Client/ICertificateLoginRequestHandler.cs"},"new_contents":{"kind":"string","value":"#region Copyright\r\n\r\n/* * * * * * * * * * * * * * * * * * * * * * * * * */\r\n/* Carl Zeiss IMT (IZfM Dresden) */\r\n/* Softwaresystem PiWeb */\r\n/* (c) Carl Zeiss 2016 */\r\n/* * * * * * * * * * * * * * * * * * * * * * * * * */\r\n\r\n#endregion\r\n\r\nnamespace Zeiss.IMT.PiWeb.Api.Common.Client\r\n{\r\n\t#region usings\r\n\r\n\tusing System;\r\n\tusing System.Threading.Tasks;\r\n\tusing PiWebApi.Annotations;\r\n\tusing Zeiss.IMT.PiWeb.Api.Common.Utilities;\r\n\r\n\t#endregion\r\n\r\n\t/// \r\n\t/// Interface that is used as callback handler for requests that need a certificate for authentification.\r\n\t/// \r\n\t/// \r\n\t/// This interface is mainly designed for showing a user interface to the user for choosing the right certificate.\r\n\t/// \r\n\tpublic interface ICertificateLoginRequestHandler : ICacheClearable\r\n\t{\r\n\r\n\t\t#region methods\r\n\r\n\t\t/// \r\n\t\t/// Asynchronous callback if a certificate for a is requested.\r\n\t\t/// \r\n\t\t/// The address for which a certificate is requested.\r\n\t\t/// An option that is used to limit the list of possible certificates to hardware certificates only.\r\n\t\t/// Returns a the certificate that should be used for authentication or null if no certificate should be used.\r\n\t\t/// Throws a if the request should be canceled.\r\n\t\t/// \r\n\t\t/// The usually refers to the base address of a server, since declared endpoints usually do not use different authentications.\r\n\t\t/// \r\n\t\tTask CertificateRequestAsync( [NotNull] Uri uri, bool preferHardwareCertificate = false);\r\n\r\n\t\t/// \r\n\t\t/// Synchronous callback if a certificate for a is requested.\r\n\t\t/// \r\n\t\t/// The address for which a certificate is requested.\r\n\t\t/// An option that is used to limit the list of possible certificates to hardware certificates only.\r\n\t\t/// Returns a the certificate that should be used for authentication or null if no certificate should be used.\r\n\t\t/// Throws a if the request should be canceled.\r\n\t\t/// \r\n\t\t/// This is the synchronous counter part to which stays usually unused by the ,\r\n\t\t/// since its API is fully asynchronous. This mainly exists for purpose of introducing a synchronous API if needed in the future.\r\n\t\t/// The usually refers to the base address of a server, since declared endpoints usually do not use different authentications.\r\n\t\t/// \r\n\t\tCertificateCredential CertificateRequest( [NotNull] Uri uri, bool preferHardwareCertificate = false );\r\n\r\n\t\t#endregion\r\n\t}\r\n}"},"old_contents":{"kind":"string","value":"#region Copyright\r\n\r\n/* * * * * * * * * * * * * * * * * * * * * * * * * */\r\n/* Carl Zeiss IMT (IZfM Dresden) */\r\n/* Softwaresystem PiWeb */\r\n/* (c) Carl Zeiss 2016 */\r\n/* * * * * * * * * * * * * * * * * * * * * * * * * */\r\n\r\n#endregion\r\n\r\nnamespace Zeiss.IMT.PiWeb.Api.Common.Client\r\n{\r\n\t#region usings\r\n\r\n\tusing System;\r\n\tusing System.Threading.Tasks;\r\n\tusing PiWebApi.Annotations;\r\n\tusing Zeiss.IMT.PiWeb.Api.Common.Utilities;\r\n\r\n\t#endregion\r\n\r\n\t/// \r\n\t/// Interface that is used as callback handler for requests that need a certificate for authentification.\r\n\t/// \r\n\t/// \r\n\t/// This interface is mainly designed for showing a user interface to the user for choosing the right certificate.\r\n\t/// \r\n\tpublic interface ICertificateLoginRequestHandler : ICacheClearable\r\n\t{\r\n\t\t#region methods\r\n\r\n\t\t/// \r\n\t\t/// Asynchronous callback if a certificate for a is requested.\r\n\t\t/// \r\n\t\t/// The address for which a certificate is requested.\r\n\t\t/// An option that is used to limit the list of possible certificates to hardware certificates only.\r\n\t\t/// Returns a the certificate that should be used for authentication or null if no certificate should be used.\r\n\t\t/// Throws a if the request should be canceled.\r\n\t\t/// \r\n\t\t/// The usually refers to the base address of a server, since declared endpoints usually do not use different authentications.\r\n\t\t/// \r\n\t\tTask CertificateRequestAsync( [NotNull] Uri uri, bool preferHardwareCertificate = false);\r\n\r\n\t\t/// \r\n\t\t/// Synchronous callback if a certificate for a is requested.\r\n\t\t/// \r\n\t\t/// The address for which a certificate is requested.\r\n\t\t/// An option that is used to limit the list of possible certificates to hardware certificates only.\r\n\t\t/// Returns a the certificate that should be used for authentication or null if no certificate should be used.\r\n\t\t/// Throws a if the request should be canceled.\r\n\t\t/// \r\n\t\t/// This is the synchronous counter part to which stays usually unused by the ,\r\n\t\t/// since its API is fully asynchronous. This mainly exists for purpose of introducing a synchronous API if needed in the future.\r\n\t\t/// The usually refers to the base address of a server, since declared endpoints usually do not use different authentications.\r\n\t\t/// \r\n\t\tCertificateCredential CertificateRequest( [NotNull] Uri uri, bool preferHardwareCertificate = false );\r\n\r\n\t\t#endregion\r\n\t}\r\n}"},"license":{"kind":"string","value":"bsd-3-clause"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673670,"cells":{"commit":{"kind":"string","value":"41e45dbac4e5f6ba3a320b3eabd0ea2109ceb732"},"subject":{"kind":"string","value":"Fix build warnings"},"repos":{"kind":"string","value":"Ninputer/VBF"},"old_file":{"kind":"string","value":"src/Compilers/Compilers.Scanners/SymbolExpression.cs"},"new_file":{"kind":"string","value":"src/Compilers/Compilers.Scanners/SymbolExpression.cs"},"new_contents":{"kind":"string","value":"// Copyright 2012 Fan Shi\n// \n// This file is part of the VBF project.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace VBF.Compilers.Scanners\n{\n /// \n /// Represents a regular expression accepts a literal character\n /// \n public class SymbolExpression : RegularExpression\n {\n public SymbolExpression(char symbol)\n : base(RegularExpressionType.Symbol)\n {\n Symbol = symbol;\n }\n\n public new char Symbol { get; private set; }\n\n public override string ToString()\n {\n return Symbol.ToString(CultureInfo.InvariantCulture);\n }\n\n internal override Func>[] GetCompactableCharSets()\n {\n return new Func>[0];\n }\n\n internal override HashSet GetUncompactableCharSet()\n {\n var result = new HashSet {Symbol};\n\n return result;\n }\n\n internal override T Accept(RegularExpressionConverter converter)\n {\n return converter.ConvertSymbol(this);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"// Copyright 2012 Fan Shi\n// \n// This file is part of the VBF project.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\n\nnamespace VBF.Compilers.Scanners\n{\n /// \n /// Represents a regular expression accepts a literal character\n /// \n public class SymbolExpression : RegularExpression\n {\n public SymbolExpression(char symbol)\n : base(RegularExpressionType.Symbol)\n {\n Symbol = symbol;\n }\n\n public char Symbol { get; private set; }\n\n public override string ToString()\n {\n return Symbol.ToString(CultureInfo.InvariantCulture);\n }\n\n internal override Func>[] GetCompactableCharSets()\n {\n return new Func>[0];\n }\n\n internal override HashSet GetUncompactableCharSet()\n {\n var result = new HashSet {Symbol};\n\n return result;\n }\n\n internal override T Accept(RegularExpressionConverter converter)\n {\n return converter.ConvertSymbol(this);\n }\n }\n}\n"},"license":{"kind":"string","value":"apache-2.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673671,"cells":{"commit":{"kind":"string","value":"aa44980ae9b37df4807e5ea7cfbe01309ea8a50c"},"subject":{"kind":"string","value":"fix small bug"},"repos":{"kind":"string","value":"mdavid626/artemis"},"old_file":{"kind":"string","value":"src/Artemis.Data/DbContextRepository.cs"},"new_file":{"kind":"string","value":"src/Artemis.Data/DbContextRepository.cs"},"new_contents":{"kind":"string","value":"using Artemis.Common;\nusing System;\nusing System.Collections.Generic;\nusing System.Data.Entity;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Linq.Dynamic;\n\nnamespace Artemis.Data\n{\n public abstract class DbContextRepository : IRepository where T : class, IHasKey\n {\n private IUnitOfWork unitOfWork;\n\n public abstract DbSet EntityDbSet { get; }\n\n public DbContextRepository(IUnitOfWork unitOfWork)\n {\n this.unitOfWork = unitOfWork;\n }\n\n public T Get(int id)\n {\n return EntityDbSet.FirstOrDefault(c => c.Id == id);\n }\n\n public IEnumerable Get(string orderBy = null, string direction = null)\n {\n var ordering = GetOrdering(orderBy, direction);\n return EntityDbSet.OrderBy(ordering);\n }\n\n public void Update(T entity)\n {\n \n }\n\n public void Create(T entity)\n {\n EntityDbSet.Add(entity);\n }\n\n public void Delete(T entity)\n {\n EntityDbSet.Remove(entity);\n }\n\n private string GetOrdering(string orderBy, string direction)\n {\n var ascending = true;\n if (direction?.ToLower() == \"desc\")\n ascending = false;\n\n var directionText = ascending\n ? \" asc\"\n : \" desc\";\n\n var allowedProps = typeof(T)\n .GetProperties()\n .Where(p => p.GetCustomAttribute() != null)\n .Select(p => p.Name.ToLower());\n\n var prop = allowedProps.Intersect(new string[] { orderBy?.ToLower() });\n if (prop.Any())\n {\n return orderBy + directionText;\n }\n\n return nameof(IHasKey.Id) + directionText;\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using Artemis.Common;\nusing System;\nusing System.Collections.Generic;\nusing System.Data.Entity;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Linq.Dynamic;\n\nnamespace Artemis.Data\n{\n public abstract class DbContextRepository : IRepository where T : class, IHasKey\n {\n private IUnitOfWork unitOfWork;\n\n public abstract DbSet EntityDbSet { get; }\n\n public DbContextRepository(IUnitOfWork unitOfWork)\n {\n this.unitOfWork = unitOfWork;\n }\n\n public T Get(int id)\n {\n return EntityDbSet.FirstOrDefault(c => c.Id == id);\n }\n\n public IEnumerable Get(string orderBy = null, string direction = null)\n {\n var ordering = GetOrdering(orderBy, direction);\n return EntityDbSet.OrderBy(ordering);\n }\n\n public void Update(T entity)\n {\n \n }\n\n public void Create(T entity)\n {\n EntityDbSet.Add(entity);\n }\n\n public void Delete(T entity)\n {\n EntityDbSet.Remove(entity);\n }\n\n private string GetOrdering(string orderBy, string direction)\n {\n var ascending = true;\n if (direction?.ToLower() == \"desc\")\n ascending = false;\n\n var directionText = ascending\n ? \" asc\"\n : \" desc\";\n\n var allowedProps = typeof(CarAdvert)\n .GetProperties()\n .Where(p => p.GetCustomAttribute() != null)\n .Select(p => p.Name.ToLower());\n\n var prop = allowedProps.Intersect(new string[] { orderBy?.ToLower() });\n if (prop.Any())\n {\n return orderBy + directionText;\n }\n\n return nameof(IHasKey.Id) + directionText;\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673672,"cells":{"commit":{"kind":"string","value":"135cd2647a8aa8b4c342d132400f89f6632b9718"},"subject":{"kind":"string","value":"update access modifiers from public -> internal"},"repos":{"kind":"string","value":"colinmxs/CodenameGenerator"},"old_file":{"kind":"string","value":"src/CodenameGenerator/StringExtensions.cs"},"new_file":{"kind":"string","value":"src/CodenameGenerator/StringExtensions.cs"},"new_contents":{"kind":"string","value":"using System;\n\nnamespace CodenameGenerator\n{\n internal static class StringExtensions\n {\n //http://stackoverflow.com/questions/4135317/make-first-letter-of-a-string-upper-case-for-maximum-performance\n /// \n /// Capitalize the first character of a string\n /// \n /// \n /// \n internal static string FirstCharToUpper(this string @string)\n {\n if (String.IsNullOrEmpty(@string))\n throw new ArgumentException(\"There is no first letter\");\n char[] chars = @string.ToCharArray();\n chars[0] = char.ToUpper(chars[0]);\n return new string(chars);\n }\n }\n}"},"old_contents":{"kind":"string","value":"using System;\n\nnamespace CodenameGenerator\n{\n public static class StringExtensions\n {\n //http://stackoverflow.com/questions/4135317/make-first-letter-of-a-string-upper-case-for-maximum-performance\n /// \n /// Capitalize the first character of a string\n /// \n /// \n /// \n public static string FirstCharToUpper(this string @string)\n {\n if (String.IsNullOrEmpty(@string))\n throw new ArgumentException(\"There is no first letter\");\n char[] chars = @string.ToCharArray();\n chars[0] = char.ToUpper(chars[0]);\n return new string(chars);\n }\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673673,"cells":{"commit":{"kind":"string","value":"5b9b0c1a168203af0ef8d49ebe5a0bdc31f8da75"},"subject":{"kind":"string","value":"Put custom uploaders in same dir as other plugins"},"repos":{"kind":"string","value":"nikeee/HolzShots"},"old_file":{"kind":"string","value":"src/HolzShots.Core/IO/HolzShotsPaths.cs"},"new_file":{"kind":"string","value":"src/HolzShots.Core/IO/HolzShotsPaths.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Diagnostics;\nusing System.IO;\n\nnamespace HolzShots.IO\n{\n public static class HolzShotsPaths\n {\n private static readonly string SystemAppDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);\n private static readonly string UserPicturesDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);\n private static readonly string AppDataDirectory = Path.Combine(SystemAppDataDirectory, LibraryInformation.Name);\n\n public static string SystemPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.System);\n\n public static string PluginDirectory { get; } = Path.Combine(AppDataDirectory, \"Plugin\");\n public static string CustomUploadersDirectory { get; } = PluginDirectory;\n public static string UserSettingsFilePath { get; } = Path.Combine(AppDataDirectory, \"settings.json\");\n\n public static string DefaultScreenshotSavePath { get; } = Path.Combine(UserPicturesDirectory, LibraryInformation.Name);\n\n /// \n /// We are doing this synchronously, assuming the application is not located on a network drive.\n /// See: https://stackoverflow.com/a/20596865\n /// \n /// \n /// \n public static void EnsureDirectory(string directory)\n {\n Debug.Assert(directory != null);\n DirectoryEx.EnsureDirectory(directory);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Diagnostics;\nusing System.IO;\n\nnamespace HolzShots.IO\n{\n public static class HolzShotsPaths\n {\n private static readonly string SystemAppDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);\n private static readonly string UserPicturesDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);\n private static readonly string AppDataDirectory = Path.Combine(SystemAppDataDirectory, LibraryInformation.Name);\n\n public static string SystemPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.System);\n\n public static string PluginDirectory { get; } = Path.Combine(AppDataDirectory, \"Plugin\");\n public static string CustomUploadersDirectory { get; } = Path.Combine(AppDataDirectory, \"CustomUploaders\");\n public static string UserSettingsFilePath { get; } = Path.Combine(AppDataDirectory, \"settings.json\");\n\n public static string DefaultScreenshotSavePath { get; } = Path.Combine(UserPicturesDirectory, LibraryInformation.Name);\n\n /// \n /// We are doing this synchronously, assuming the application is not located on a network drive.\n /// See: https://stackoverflow.com/a/20596865\n /// \n /// \n /// \n public static void EnsureDirectory(string directory)\n {\n Debug.Assert(directory != null);\n DirectoryEx.EnsureDirectory(directory);\n }\n }\n}\n"},"license":{"kind":"string","value":"agpl-3.0"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673674,"cells":{"commit":{"kind":"string","value":"bd27a87f634dd4e45220195d6d63cbfe72750e60"},"subject":{"kind":"string","value":"Check isLocal using Uri.TryCreate. It is possible in case we have only absolute url."},"repos":{"kind":"string","value":"jmptrader/Nancy,fly19890211/Nancy,hitesh97/Nancy,JoeStead/Nancy,SaveTrees/Nancy,SaveTrees/Nancy,AIexandr/Nancy,malikdiarra/Nancy,ccellar/Nancy,SaveTrees/Nancy,MetSystem/Nancy,anton-gogolev/Nancy,sloncho/Nancy,duszekmestre/Nancy,AIexandr/Nancy,dbolkensteyn/Nancy,EIrwin/Nancy,blairconrad/Nancy,EliotJones/NancyTest,ayoung/Nancy,rudygt/Nancy,cgourlay/Nancy,Crisfole/Nancy,NancyFx/Nancy,grumpydev/Nancy,tparnell8/Nancy,sadiqhirani/Nancy,tsdl2013/Nancy,nicklv/Nancy,xt0rted/Nancy,NancyFx/Nancy,khellang/Nancy,damianh/Nancy,Novakov/Nancy,joebuschmann/Nancy,thecodejunkie/Nancy,sroylance/Nancy,khellang/Nancy,daniellor/Nancy,nicklv/Nancy,sloncho/Nancy,dbolkensteyn/Nancy,dbolkensteyn/Nancy,lijunle/Nancy,sloncho/Nancy,daniellor/Nancy,albertjan/Nancy,khellang/Nancy,dbabox/Nancy,vladlopes/Nancy,tparnell8/Nancy,anton-gogolev/Nancy,jeff-pang/Nancy,sadiqhirani/Nancy,jchannon/Nancy,MetSystem/Nancy,dbolkensteyn/Nancy,felipeleusin/Nancy,guodf/Nancy,jonathanfoster/Nancy,lijunle/Nancy,murador/Nancy,AlexPuiu/Nancy,jeff-pang/Nancy,ccellar/Nancy,sloncho/Nancy,jonathanfoster/Nancy,cgourlay/Nancy,lijunle/Nancy,anton-gogolev/Nancy,horsdal/Nancy,sroylance/Nancy,NancyFx/Nancy,JoeStead/Nancy,adamhathcock/Nancy,AIexandr/Nancy,cgourlay/Nancy,nicklv/Nancy,fly19890211/Nancy,jongleur1983/Nancy,rudygt/Nancy,charleypeng/Nancy,vladlopes/Nancy,duszekmestre/Nancy,adamhathcock/Nancy,jongleur1983/Nancy,danbarua/Nancy,AIexandr/Nancy,dbabox/Nancy,guodf/Nancy,ayoung/Nancy,tareq-s/Nancy,jonathanfoster/Nancy,Worthaboutapig/Nancy,guodf/Nancy,davidallyoung/Nancy,hitesh97/Nancy,jchannon/Nancy,tareq-s/Nancy,joebuschmann/Nancy,horsdal/Nancy,asbjornu/Nancy,Worthaboutapig/Nancy,tparnell8/Nancy,jonathanfoster/Nancy,NancyFx/Nancy,albertjan/Nancy,tareq-s/Nancy,felipeleusin/Nancy,nicklv/Nancy,VQComms/Nancy,albertjan/Nancy,duszekmestre/Nancy,jeff-pang/Nancy,grumpydev/Nancy,Novakov/Nancy,cgourlay/Nancy,sroylance/Nancy,AlexPuiu/Nancy,hitesh97/Nancy,xt0rted/Nancy,damianh/Nancy,VQComms/Nancy,duszekmestre/Nancy,tareq-s/Nancy,VQComms/Nancy,asbjornu/Nancy,Crisfole/Nancy,fly19890211/Nancy,EIrwin/Nancy,xt0rted/Nancy,ayoung/Nancy,thecodejunkie/Nancy,thecodejunkie/Nancy,VQComms/Nancy,phillip-haydon/Nancy,asbjornu/Nancy,thecodejunkie/Nancy,AcklenAvenue/Nancy,EliotJones/NancyTest,xt0rted/Nancy,blairconrad/Nancy,fly19890211/Nancy,ccellar/Nancy,blairconrad/Nancy,jchannon/Nancy,albertjan/Nancy,ayoung/Nancy,vladlopes/Nancy,daniellor/Nancy,charleypeng/Nancy,wtilton/Nancy,lijunle/Nancy,charleypeng/Nancy,blairconrad/Nancy,Novakov/Nancy,MetSystem/Nancy,murador/Nancy,jongleur1983/Nancy,jmptrader/Nancy,jmptrader/Nancy,malikdiarra/Nancy,horsdal/Nancy,phillip-haydon/Nancy,davidallyoung/Nancy,tsdl2013/Nancy,malikdiarra/Nancy,tparnell8/Nancy,sroylance/Nancy,hitesh97/Nancy,adamhathcock/Nancy,MetSystem/Nancy,davidallyoung/Nancy,AlexPuiu/Nancy,davidallyoung/Nancy,ccellar/Nancy,daniellor/Nancy,dbabox/Nancy,wtilton/Nancy,rudygt/Nancy,grumpydev/Nancy,guodf/Nancy,tsdl2013/Nancy,wtilton/Nancy,khellang/Nancy,wtilton/Nancy,danbarua/Nancy,rudygt/Nancy,AlexPuiu/Nancy,dbabox/Nancy,jongleur1983/Nancy,EIrwin/Nancy,JoeStead/Nancy,asbjornu/Nancy,EIrwin/Nancy,murador/Nancy,davidallyoung/Nancy,tsdl2013/Nancy,EliotJones/NancyTest,AcklenAvenue/Nancy,charleypeng/Nancy,anton-gogolev/Nancy,malikdiarra/Nancy,jchannon/Nancy,danbarua/Nancy,murador/Nancy,charleypeng/Nancy,danbarua/Nancy,asbjornu/Nancy,vladlopes/Nancy,joebuschmann/Nancy,felipeleusin/Nancy,horsdal/Nancy,JoeStead/Nancy,damianh/Nancy,phillip-haydon/Nancy,AcklenAvenue/Nancy,jmptrader/Nancy,AIexandr/Nancy,sadiqhirani/Nancy,felipeleusin/Nancy,EliotJones/NancyTest,sadiqhirani/Nancy,SaveTrees/Nancy,Worthaboutapig/Nancy,Novakov/Nancy,grumpydev/Nancy,AcklenAvenue/Nancy,VQComms/Nancy,jeff-pang/Nancy,adamhathcock/Nancy,joebuschmann/Nancy,phillip-haydon/Nancy,Crisfole/Nancy,Worthaboutapig/Nancy,jchannon/Nancy"},"old_file":{"kind":"string","value":"src/Nancy/Extensions/RequestExtensions.cs"},"new_file":{"kind":"string","value":"src/Nancy/Extensions/RequestExtensions.cs"},"new_contents":{"kind":"string","value":"namespace Nancy.Extensions\r\n{\r\n using System;\r\n using System.Linq;\r\n\r\n /// \r\n /// Containing extensions for the object\r\n /// \r\n public static class RequestExtensions\r\n {\r\n /// \r\n /// An extension method making it easy to check if the reqeuest was done using ajax\r\n /// \r\n /// The request made by client\r\n /// if the request was done using ajax, otherwise .\r\n public static bool IsAjaxRequest(this Request request)\r\n {\r\n const string ajaxRequestHeaderKey = \"X-Requested-With\";\r\n const string ajaxRequestHeaderValue = \"XMLHttpRequest\";\r\n\r\n return request.Headers[ajaxRequestHeaderKey].Contains(ajaxRequestHeaderValue);\r\n }\r\n /// \r\n /// Gets a value indicating whether the request is local.\r\n /// \r\n /// The request made by client\r\n /// if the request is local, otherwise .\r\n public static bool IsLocal(this Request request)\r\n {\r\n if (string.IsNullOrEmpty(request.UserHostAddress) || string.IsNullOrEmpty(request.Url))\r\n {\r\n return false;\r\n }\r\n \r\n Uri uri = null;\r\n if (Uri.TryCreate(request.Url, UriKind.Absolute, out uri))\r\n {\r\n return uri.IsLoopback;\r\n }\r\n else\r\n {\r\n // Invalid or relative Request.Url string\r\n return false;\r\n }\r\n }\r\n }\r\n}\r\n"},"old_contents":{"kind":"string","value":"namespace Nancy.Extensions\r\n{\r\n using System;\r\n using System.Linq;\r\n\r\n /// \r\n /// Containing extensions for the object\r\n /// \r\n public static class RequestExtensions\r\n {\r\n /// \r\n /// An extension method making it easy to check if the reqeuest was done using ajax\r\n /// \r\n /// The request made by client\r\n /// if the request was done using ajax, otherwise .\r\n public static bool IsAjaxRequest(this Request request)\r\n {\r\n const string ajaxRequestHeaderKey = \"X-Requested-With\";\r\n const string ajaxRequestHeaderValue = \"XMLHttpRequest\";\r\n\r\n return request.Headers[ajaxRequestHeaderKey].Contains(ajaxRequestHeaderValue);\r\n }\r\n /// \r\n /// Gets a value indicating whether the request is local.\r\n /// \r\n /// The request made by client\r\n /// if the request is local, otherwise .\r\n public static bool IsLocal(this Request request)\r\n {\r\n if (string.IsNullOrEmpty(request.UserHostAddress) || string.IsNullOrEmpty(request.Url))\r\n {\r\n return false;\r\n }\r\n try\r\n {\r\n var uri = new Uri(request.Url);\r\n return uri.IsLoopback;\r\n }\r\n catch (Exception)\r\n {\r\n // Invalid Request.Url string\r\n return false;\r\n }\r\n }\r\n }\r\n}\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673675,"cells":{"commit":{"kind":"string","value":"bf94d3ef0b52e9444df9e3e3cc6896cac5ec4f06"},"subject":{"kind":"string","value":"Update Validator"},"repos":{"kind":"string","value":"WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common"},"old_file":{"kind":"string","value":"src/WeihanLi.Common/Services/Validator.cs"},"new_file":{"kind":"string","value":"src/WeihanLi.Common/Services/Validator.cs"},"new_contents":{"kind":"string","value":"using System.ComponentModel.DataAnnotations;\nusing WeihanLi.Extensions;\nusing AnnotationValidationResult = System.ComponentModel.DataAnnotations.ValidationResult;\nusing ValidationResult = WeihanLi.Common.Models.ValidationResult;\n\nnamespace WeihanLi.Common.Services;\n\npublic interface IValidator\n{\n ValidationResult Validate(object? value);\n}\n\npublic interface IValidator\n{\n ValidationResult Validate(T value);\n}\n\npublic interface IAsyncValidator\n{\n Task ValidateAsync(T value);\n}\n\npublic sealed class DataAnnotationValidator : IValidator\n{\n public static IValidator Instance { get; } = new DataAnnotationValidator();\n\n public ValidationResult Validate(object? value)\n {\n var validationResult = new ValidationResult();\n if(value is null)\n {\n validationResult.Valid = false;\n validationResult.Errors ??= new Dictionary();\n validationResult.Errors[string.Empty] = new[]{ \"Value is null\" };\n }\n else\n {\n var annotationValidateResults = new List();\n validationResult.Valid =\n Validator.TryValidateObject(value, new ValidationContext(value), annotationValidateResults);\n validationResult.Errors = annotationValidateResults\n .GroupBy(x => x.MemberNames.StringJoin(\",\"))\n .ToDictionary(g => g.Key, g => g.Select(x => x.ErrorMessage).WhereNotNull().ToArray());\n } \n return validationResult;\n }\n}\n\npublic sealed class DelegateValidator : IValidator\n{\n private readonly Func _validateFunc;\n\n public DelegateValidator(Func validateFunc)\n {\n _validateFunc = Guard.NotNull(validateFunc);\n }\n\n public ValidationResult Validate(object? value)\n {\n return _validateFunc.Invoke(value);\n }\n}\n\npublic sealed class DelegateValidator : IValidator, IAsyncValidator\n{\n private readonly Func> _validateFunc;\n\n public DelegateValidator(Func validateFunc)\n {\n Guard.NotNull(validateFunc);\n _validateFunc = t => validateFunc(t).WrapTask();\n }\n \n public DelegateValidator(Func> validateFunc)\n {\n _validateFunc = Guard.NotNull(validateFunc);\n }\n\n public ValidationResult Validate(T value)\n {\n return _validateFunc.Invoke(value).GetAwaiter().GetResult();\n }\n \n public Task ValidateAsync(T value)\n {\n return _validateFunc.Invoke(value);\n }\n}\n"},"old_contents":{"kind":"string","value":"using System.ComponentModel.DataAnnotations;\nusing WeihanLi.Extensions;\nusing AnnotationValidationResult = System.ComponentModel.DataAnnotations.ValidationResult;\nusing ValidationResult = WeihanLi.Common.Models.ValidationResult;\n\nnamespace WeihanLi.Common.Services;\n\npublic interface IValidator\n{\n ValidationResult Validate(object? value);\n}\n\npublic interface IValidator\n{\n Task ValidateAsync(T value);\n}\n\npublic sealed class DataAnnotationValidator : IValidator\n{\n public static IValidator Instance { get; }\n\n static DataAnnotationValidator()\n {\n Instance = new DataAnnotationValidator();\n }\n\n public ValidationResult Validate(object? value)\n {\n var validationResult = new ValidationResult();\n if(value is null)\n {\n validationResult.Valid = false;\n validationResult.Errors ??= new Dictionary();\n validationResult.Errors[string.Empty] = new[]{ \"Value is null\" };\n }\n else\n {\n var annotationValidateResults = new List();\n validationResult.Valid =\n Validator.TryValidateObject(value, new ValidationContext(value), annotationValidateResults);\n validationResult.Errors = annotationValidateResults\n .GroupBy(x => x.MemberNames.StringJoin(\",\"))\n .ToDictionary(g => g.Key, g => g.Select(x => x.ErrorMessage).WhereNotNull().ToArray());\n } \n return validationResult;\n }\n}\n\npublic sealed class DelegateValidator : IValidator\n{\n private readonly Func _validateFunc;\n\n public DelegateValidator(Func validateFunc)\n {\n _validateFunc = Guard.NotNull(validateFunc);\n }\n\n public ValidationResult Validate(object? value)\n {\n return _validateFunc.Invoke(value);\n }\n}\n\npublic sealed class DelegateValidator : IValidator\n{\n private readonly Func> _validateFunc;\n\n public DelegateValidator(Func> validateFunc)\n {\n _validateFunc = Guard.NotNull(validateFunc);\n }\n\n public Task ValidateAsync(T value)\n {\n return _validateFunc.Invoke(value);\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673676,"cells":{"commit":{"kind":"string","value":"c3a7892d0f730e0446e18daceb46922759501638"},"subject":{"kind":"string","value":"fix disposing on enable behavior."},"repos":{"kind":"string","value":"nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet"},"old_file":{"kind":"string","value":"WalletWasabi.Fluent/Behaviors/FocusOnEnableBehavior.cs"},"new_file":{"kind":"string","value":"WalletWasabi.Fluent/Behaviors/FocusOnEnableBehavior.cs"},"new_contents":{"kind":"string","value":"using Avalonia;\nusing System;\nusing System.Reactive.Disposables;\nusing System.Reactive.Linq;\nusing Avalonia.Controls;\nusing Avalonia.Input;\n\nnamespace WalletWasabi.Fluent.Behaviors\n{\n\tpublic class FocusOnEnableBehavior : DisposingBehavior\n\t{\n\t\tprotected override void OnAttached(CompositeDisposable disposables)\n\t\t{\n\t\t\tAssociatedObject\n\t\t\t\t.GetObservable(InputElement.IsEffectivelyEnabledProperty)\n\t\t\t\t.Where(x => x)\n\t\t\t\t.Subscribe(_ => AssociatedObject!.Focus())\n\t\t\t\t.DisposeWith(disposables);\n\t\t}\n\t}\n}"},"old_contents":{"kind":"string","value":"using Avalonia;\nusing Avalonia.Controls;\nusing Avalonia.Xaml.Interactivity;\nusing System;\nusing System.Reactive.Linq;\n\nnamespace WalletWasabi.Fluent.Behaviors\n{\n\tpublic class FocusOnEnableBehavior : Behavior\n\t{\n\t\tprotected override void OnAttached()\n\t\t{\n\t\t\tbase.OnAttached();\n\n\t\t\tObservable.\n\t\t\t\tFromEventPattern(AssociatedObject, nameof(AssociatedObject.PropertyChanged))\n\t\t\t\t.Select(x => x.EventArgs)\n\t\t\t\t.Where(x => x.Property.Name == nameof(AssociatedObject.IsEffectivelyEnabled) && x.NewValue is { } && (bool)x.NewValue == true)\n\t\t\t\t.Subscribe(_ => AssociatedObject!.Focus());\n\t\t}\n\n\t\tprotected override void OnDetaching()\n\t\t{\n\t\t\tbase.OnDetaching();\n\t\t}\n\t}\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673677,"cells":{"commit":{"kind":"string","value":"565dcaa3bd5e65ad172962d463c4f92907327183"},"subject":{"kind":"string","value":"Update version"},"repos":{"kind":"string","value":"masaedw/LineSharp"},"old_file":{"kind":"string","value":"LineSharp/Properties/AssemblyInfo.cs"},"new_file":{"kind":"string","value":"LineSharp/Properties/AssemblyInfo.cs"},"new_contents":{"kind":"string","value":"using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。\n// アセンブリに関連付けられている情報を変更するには、\n// これらの属性値を変更してください。\n[assembly: AssemblyTitle(\"LineSharp\")]\n[assembly: AssemblyDescription(\"A LINE Messaging API binding library\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Masayuki Muto\")]\n[assembly: AssemblyProduct(\"LineSharp\")]\n[assembly: AssemblyCopyright(\"Copyright © 2016\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから\n// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、\n// その型の ComVisible 属性を true に設定してください。\n[assembly: ComVisible(false)]\n\n// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります\n[assembly: Guid(\"0a2c415b-a00f-4e04-83a2-2b1bbe72b73d\")]\n\n// アセンブリのバージョン情報は次の 4 つの値で構成されています:\n//\n// メジャー バージョン\n// マイナー バージョン\n// ビルド番号\n// Revision\n//\n// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を\n// 既定値にすることができます:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"0.1.3.0\")]\n[assembly: AssemblyFileVersion(\"0.1.3.0\")]\n"},"old_contents":{"kind":"string","value":"using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。\n// アセンブリに関連付けられている情報を変更するには、\n// これらの属性値を変更してください。\n[assembly: AssemblyTitle(\"LineSharp\")]\n[assembly: AssemblyDescription(\"A LINE Messaging API binding library\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Masayuki Muto\")]\n[assembly: AssemblyProduct(\"LineSharp\")]\n[assembly: AssemblyCopyright(\"Copyright © 2016\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから\n// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、\n// その型の ComVisible 属性を true に設定してください。\n[assembly: ComVisible(false)]\n\n// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります\n[assembly: Guid(\"0a2c415b-a00f-4e04-83a2-2b1bbe72b73d\")]\n\n// アセンブリのバージョン情報は次の 4 つの値で構成されています:\n//\n// メジャー バージョン\n// マイナー バージョン\n// ビルド番号\n// Revision\n//\n// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を\n// 既定値にすることができます:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"0.1.0.0\")]\n[assembly: AssemblyFileVersion(\"0.1.0.0\")]\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673678,"cells":{"commit":{"kind":"string","value":"eb493ec4dcc730adc178c12855e4d557ddc07074"},"subject":{"kind":"string","value":"Fix whitespace issue"},"repos":{"kind":"string","value":"petedavis/essential-templating"},"old_file":{"kind":"string","value":"test/Essential.Templating.Razor.Tests/Templates/Test.ru.cshtml"},"new_file":{"kind":"string","value":"test/Essential.Templating.Razor.Tests/Templates/Test.ru.cshtml"},"new_contents":{"kind":"string","value":"@using System\n@inherits Essential.Templating.Razor.Template\nШаблон на русском языке. Выполненен @DateTime.Now"},"old_contents":{"kind":"string","value":"@using System\r\n@inherits Essential.Templating.Razor.Template\r\nШаблон на русском языке. Выполненен @DateTime.Now"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673679,"cells":{"commit":{"kind":"string","value":"92376f447a9956c2c221242011dee7bcaa1ddd95"},"subject":{"kind":"string","value":"fix guard clause"},"repos":{"kind":"string","value":"xbehave/xbehave.net,hitesh97/xbehave.net,adamralph/xbehave.net,modulexcite/xbehave.net,mvalipour/xbehave.net,hitesh97/xbehave.net,modulexcite/xbehave.net,mvalipour/xbehave.net"},"old_file":{"kind":"string","value":"src/Xbehave.2.Execution.desktop/Step.cs"},"new_file":{"kind":"string","value":"src/Xbehave.2.Execution.desktop/Step.cs"},"new_contents":{"kind":"string","value":"// \r\n// Copyright (c) xBehave.net contributors. All rights reserved.\r\n// \r\n\r\nnamespace Xbehave.Execution\r\n{\r\n using Xunit.Abstractions;\r\n using Xunit.Sdk;\r\n\r\n public class Step : LongLivedMarshalByRefObject, ITest\r\n {\r\n private readonly ITest scenario;\r\n private readonly string displayName;\r\n\r\n public Step(ITest scenario, string displayName)\r\n {\r\n Guard.AgainstNullArgument(\"scenario\", scenario);\r\n\r\n this.scenario = scenario;\r\n this.displayName = displayName;\r\n }\r\n\r\n public ITest Scenario\r\n {\r\n get { return this.scenario; }\r\n }\r\n\r\n public string DisplayName\r\n {\r\n get { return this.displayName; }\r\n }\r\n\r\n public ITestCase TestCase\r\n {\r\n get { return this.scenario.TestCase; }\r\n }\r\n }\r\n}\r\n"},"old_contents":{"kind":"string","value":"// \r\n// Copyright (c) xBehave.net contributors. All rights reserved.\r\n// \r\n\r\nnamespace Xbehave.Execution\r\n{\r\n using Xunit.Abstractions;\r\n using Xunit.Sdk;\r\n\r\n public class Step : LongLivedMarshalByRefObject, ITest\r\n {\r\n private readonly ITest scenario;\r\n private readonly string displayName;\r\n\r\n public Step(ITest scenario, string displayName)\r\n {\r\n Guard.AgainstNullArgument(\"testGroup\", scenario);\r\n\r\n this.scenario = scenario;\r\n this.displayName = displayName;\r\n }\r\n\r\n public ITest Scenario\r\n {\r\n get { return this.scenario; }\r\n }\r\n\r\n public string DisplayName\r\n {\r\n get { return this.displayName; }\r\n }\r\n\r\n public ITestCase TestCase\r\n {\r\n get { return this.scenario.TestCase; }\r\n }\r\n }\r\n}\r\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673680,"cells":{"commit":{"kind":"string","value":"857af8ecd94a8172f2e7a332a0fda67a2dd41040"},"subject":{"kind":"string","value":"Add session options"},"repos":{"kind":"string","value":"andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples"},"old_file":{"kind":"string","value":"using-session-state/src/UsingSessionState/Startup.cs"},"new_file":{"kind":"string","value":"using-session-state/src/UsingSessionState/Startup.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Logging;\n\nnamespace UsingSessionState\n{\n public class Startup\n {\n public Startup(IHostingEnvironment env)\n {\n var builder = new ConfigurationBuilder()\n .SetBasePath(env.ContentRootPath)\n .AddJsonFile(\"appsettings.json\", optional: true, reloadOnChange: true)\n .AddJsonFile($\"appsettings.{env.EnvironmentName}.json\", optional: true)\n .AddEnvironmentVariables();\n Configuration = builder.Build();\n }\n\n public IConfigurationRoot Configuration { get; }\n\n // This method gets called by the runtime. Use this method to add services to the container.\n public void ConfigureServices(IServiceCollection services)\n {\n // Add framework services.\n services.AddMvc();\n\n services.AddDistributedMemoryCache();\n services.AddSession(opts =>\n {\n opts.CookieName = \".NetEscapades.Session\";\n opts.IdleTimeout = TimeSpan.FromSeconds(5);\n });\n }\n\n // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.\n public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)\n {\n loggerFactory.AddConsole(Configuration.GetSection(\"Logging\"));\n loggerFactory.AddDebug();\n\n if (env.IsDevelopment())\n {\n app.UseDeveloperExceptionPage();\n app.UseBrowserLink();\n }\n else\n {\n app.UseExceptionHandler(\"/Home/Error\");\n }\n\n app.UseStaticFiles();\n\n app.UseSession();\n\n app.UseMvc(routes =>\n {\n routes.MapRoute(\n name: \"default\",\n template: \"{controller=Home}/{action=Index}/{id?}\");\n });\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Logging;\n\nnamespace UsingSessionState\n{\n public class Startup\n {\n public Startup(IHostingEnvironment env)\n {\n var builder = new ConfigurationBuilder()\n .SetBasePath(env.ContentRootPath)\n .AddJsonFile(\"appsettings.json\", optional: true, reloadOnChange: true)\n .AddJsonFile($\"appsettings.{env.EnvironmentName}.json\", optional: true)\n .AddEnvironmentVariables();\n Configuration = builder.Build();\n }\n\n public IConfigurationRoot Configuration { get; }\n\n // This method gets called by the runtime. Use this method to add services to the container.\n public void ConfigureServices(IServiceCollection services)\n {\n // Add framework services.\n services.AddMvc();\n\n services.AddDistributedMemoryCache();\n services.AddSession();\n }\n\n // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.\n public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)\n {\n loggerFactory.AddConsole(Configuration.GetSection(\"Logging\"));\n loggerFactory.AddDebug();\n\n if (env.IsDevelopment())\n {\n app.UseDeveloperExceptionPage();\n app.UseBrowserLink();\n }\n else\n {\n app.UseExceptionHandler(\"/Home/Error\");\n }\n\n app.UseStaticFiles();\n\n app.UseSession();\n\n app.UseMvc(routes =>\n {\n routes.MapRoute(\n name: \"default\",\n template: \"{controller=Home}/{action=Index}/{id?}\");\n });\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673681,"cells":{"commit":{"kind":"string","value":"9b34e20521e6de1b3a68c8466516184861dcf804"},"subject":{"kind":"string","value":"update description"},"repos":{"kind":"string","value":"yb199478/catlib,CatLib/Framework"},"old_file":{"kind":"string","value":"CatLib.VS/CatLib/API/Debugger/Internal/ILoggerAware.cs"},"new_file":{"kind":"string","value":"CatLib.VS/CatLib/API/Debugger/Internal/ILoggerAware.cs"},"new_contents":{"kind":"string","value":"/*\n * This file is part of the CatLib package.\n *\n * (c) Yu Bin \n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n *\n * Document: http://catlib.io/\n */\n\nnamespace CatLib.API.Debugger\n{\n /// \n /// 设定记录器实例接口\n /// \n public interface ILoggerAware\n {\n /// \n /// 设定记录器实例接口\n /// \n /// 记录器\n void SetLogger(ILogger logger);\n }\n}\n"},"old_contents":{"kind":"string","value":"/*\n * This file is part of the CatLib package.\n *\n * (c) Yu Bin \n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n *\n * Document: http://catlib.io/\n */\n\nnamespace CatLib.API.Debugger\n{\n /// \n /// 设定实例接口\n /// \n public interface ILoggerAware\n {\n /// \n /// 设定记录器接口\n /// \n /// 记录器\n void SetLogger(ILogger logger);\n }\n}\n"},"license":{"kind":"string","value":"unknown"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673682,"cells":{"commit":{"kind":"string","value":"9405d44a5b0f8dbfe5c6bdd094ced11e6efb621c"},"subject":{"kind":"string","value":"Fix build"},"repos":{"kind":"string","value":"pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet"},"old_file":{"kind":"string","value":"Test/CoreSDK.Test/TestFramework/Shared/StubPlatform.cs"},"new_file":{"kind":"string","value":"Test/CoreSDK.Test/TestFramework/Shared/StubPlatform.cs"},"new_contents":{"kind":"string","value":"namespace Microsoft.ApplicationInsights.TestFramework\n{\n using System;\n using System.Collections.Generic;\n using Microsoft.ApplicationInsights.Channel;\n using Microsoft.ApplicationInsights.Extensibility;\n using Microsoft.ApplicationInsights.Extensibility.Implementation;\n using Microsoft.ApplicationInsights.Extensibility.Implementation.External;\n\n internal class StubPlatform : IPlatform\n {\n public Func> OnGetApplicationSettings = () => new Dictionary();\n public Func OnGetDebugOutput = () => new StubDebugOutput();\n public Func OnReadConfigurationXml = () => null;\n public Func OnGetExceptionDetails = (e, p) => new ExceptionDetails();\n\n public string ReadConfigurationXml()\n {\n return this.OnReadConfigurationXml();\n }\n\n public IDebugOutput GetDebugOutput()\n {\n return this.OnGetDebugOutput();\n }\n\n public string GetEnvironmentVariable(string name)\n {\n return Environment.GetEnvironmentVariable(name);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"namespace Microsoft.ApplicationInsights.TestFramework\n{\n using System;\n using System.Collections.Generic;\n using Microsoft.ApplicationInsights.Channel;\n using Microsoft.ApplicationInsights.Extensibility;\n using Microsoft.ApplicationInsights.Extensibility.Implementation;\n using Microsoft.ApplicationInsights.Extensibility.Implementation.External;\n\n internal class StubPlatform : IPlatform\n {\n public Func> OnGetApplicationSettings = () => new Dictionary();\n public Func OnGetDebugOutput = () => new StubDebugOutput();\n public Func OnReadConfigurationXml = () => null;\n public Func OnGetExceptionDetails = (e, p) => new ExceptionDetails();\n\n public string ReadConfigurationXml()\n {\n return this.OnReadConfigurationXml();\n }\n\n public IDebugOutput GetDebugOutput()\n {\n return this.OnGetDebugOutput();\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673683,"cells":{"commit":{"kind":"string","value":"368fb1ed53ea1f7cf60070437dc162e53742ebd1"},"subject":{"kind":"string","value":"Fix tests."},"repos":{"kind":"string","value":"JohanLarsson/Gu.Units"},"old_file":{"kind":"string","value":"Gu.Units.Tests/LengthUnitTests.cs"},"new_file":{"kind":"string","value":"Gu.Units.Tests/LengthUnitTests.cs"},"new_contents":{"kind":"string","value":"namespace Gu.Units.Tests\n{\n using System;\n using NUnit.Framework;\n\n public class LengthUnitTests\n {\n public static string[] HappyPathSource { get; } = { \"m\", \"mm\", \" cm\", \" m \", \"ft\", \"yd\" };\n public static string[] ErrorSource { get; } = { \"ssg\", \"mms\" };\n\n [TestCaseSource(nameof(HappyPathSource))]\n public void ParseSuccess(string text)\n {\n var lengthUnit = LengthUnit.Parse(text);\n Assert.AreEqual(text.Trim(), lengthUnit.ToString());\n }\n\n [TestCaseSource(nameof(ErrorSource))]\n public void ParseError(string text)\n {\n Assert.Throws(() => LengthUnit.Parse(text));\n LengthUnit temp;\n Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));\n }\n\n [TestCaseSource(nameof(HappyPathSource))]\n public void TryParseSuccess(string text)\n {\n LengthUnit result;\n Assert.AreEqual(true, LengthUnit.TryParse(text, out result));\n Assert.AreEqual(text.Trim(), result.ToString());\n }\n\n [TestCaseSource(nameof(ErrorSource))]\n public void TryParseError(string text)\n {\n LengthUnit temp;\n Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));\n }\n }\n}"},"old_contents":{"kind":"string","value":"namespace Gu.Units.Tests\n{\n using System;\n using System.Collections.Generic;\n using NUnit.Framework;\n\n public class LengthUnitTests\n {\n [TestCaseSource(nameof(HappyPathSource))]\n public void ParseSuccess(string text)\n {\n var lengthUnit = LengthUnit.Parse(text);\n Assert.AreEqual(text.Trim(), lengthUnit.ToString());\n }\n\n [TestCaseSource(nameof(ErrorSource))]\n public void ParseError(string text)\n {\n Assert.Throws(() => LengthUnit.Parse(text));\n LengthUnit temp;\n Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));\n }\n\n [TestCaseSource(nameof(HappyPathSource))]\n public void TryParseSuccess(string text)\n {\n LengthUnit result;\n Assert.AreEqual(true, LengthUnit.TryParse(text, out result));\n Assert.AreEqual(text.Trim(), result.ToString());\n }\n\n [TestCaseSource(nameof(ErrorSource))]\n public void TryParseError(string text)\n {\n LengthUnit temp;\n Assert.AreEqual(false, LengthUnit.TryParse(text, out temp));\n }\n\n private IReadOnlyList HappyPathSource = new[] { \"m\", \"mm\", \" cm\", \" m \", \"ft\", \"yd\" };\n private IReadOnlyList ErrorSource = new[] { \"ssg\", \"mms\" };\n }\n}"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}},{"rowIdx":2673684,"cells":{"commit":{"kind":"string","value":"51510955c8a3dedc95f79d487b6963a75e3f4b8b"},"subject":{"kind":"string","value":"Fix a dumb bug in the interface generator"},"repos":{"kind":"string","value":"PKRoma/refit,ammachado/refit,jlucansky/refit,PureWeen/refit,mteper/refit,onovotny/refit,martijn00/refit,mteper/refit,jlucansky/refit,paulcbetts/refit,martijn00/refit,paulcbetts/refit,ammachado/refit,onovotny/refit,PureWeen/refit"},"old_file":{"kind":"string","value":"InterfaceStubGenerator/Program.cs"},"new_file":{"kind":"string","value":"InterfaceStubGenerator/Program.cs"},"new_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Refit.Generator\n{\n class Program\n {\n static void Main(string[] args)\n {\n // NB: @Compile passes us a list of files relative to the project\n // directory - we're going to assume that the target is always in\n // the same directory as the project file\n var generator = new InterfaceStubGenerator();\n var target = new FileInfo(args[0]);\n var targetDir = target.DirectoryName;\n\n var files = args[1].Split(';')\n .Select(x => new FileInfo(Path.Combine(targetDir, x)))\n .ToArray();\n\n var template = generator.GenerateInterfaceStubs(files.Select(x => x.FullName).ToArray());\n File.WriteAllText(target.FullName, template);\n }\n }\n}\n"},"old_contents":{"kind":"string","value":"using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Refit.Generator\n{\n class Program\n {\n static void Main(string[] args)\n {\n var generator = new InterfaceStubGenerator();\n var target = new FileInfo(args[0]);\n var files = args[1].Split(';').Select(x => new FileInfo(x)).ToArray();\n\n var template = generator.GenerateInterfaceStubs(files.Select(x => x.FullName).ToArray());\n File.WriteAllText(target.FullName, template);\n }\n }\n}\n"},"license":{"kind":"string","value":"mit"},"lang":{"kind":"string","value":"C#"}}}],"truncated":false,"partial":false},"paginationData":{"pageIndex":26736,"numItemsPerPage":100,"numTotalItems":2673685,"offset":2673600,"length":100}},"jwt":"eyJhbGciOiJFZERTQSJ9.eyJyZWFkIjp0cnVlLCJwZXJtaXNzaW9ucyI6eyJyZXBvLmNvbnRlbnQucmVhZCI6dHJ1ZX0sImlhdCI6MTc1NTgwMzcxMywic3ViIjoiL2RhdGFzZXRzL2JpZ2NvZGUvY29tbWl0cy1jb2RlZ2VleCIsImV4cCI6MTc1NTgwNzMxMywiaXNzIjoiaHR0cHM6Ly9odWdnaW5nZmFjZS5jbyJ9.D0M1KEXdg-rJLNyVbQiQjDFj-ey-U7jF2DUIwpa8Rs0_K-usEuzMHpMBHnt__JkESFnBacQ8jA4SZNeDbK78Aw","displayUrls":true},"discussionsStats":{"closed":0,"open":0,"total":0},"fullWidth":true,"hasGatedAccess":true,"hasFullAccess":true,"isEmbedded":false,"savedQueries":{"community":[],"user":[]}}">
commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
7df1e911696261639e4ca19fb14770c0dd23c16f
Change forums schema
drasticactions/AwfulForumsLibrary
AwfulForumsLibrary/Entity/ForumEntity.cs
AwfulForumsLibrary/Entity/ForumEntity.cs
using PropertyChanged; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; namespace AwfulForumsLibrary.Entity { [ImplementPropertyChanged] public class ForumEntity { public string Name { get; set; } public string Location { get; set; } public string Description { get; set; } public int CurrentPage { get; set; } public bool IsSubforum { get; set; } public int TotalPages { get; set; } public int ForumId { get; set; } [PrimaryKey] public int Id { get; set; } [ForeignKey(typeof(ForumCategoryEntity))] public int ForumCategoryEntityId { get; set; } [ForeignKey(typeof(ForumEntity))] public int ParentForumId { get; set; } [ManyToOne] public ForumEntity ParentForum { get; set; } [ManyToOne] public ForumCategoryEntity ForumCategory { get; set; } public bool IsBookmarks { get; set; } } }
using PropertyChanged; using SQLite.Net.Attributes; using SQLiteNetExtensions.Attributes; namespace AwfulForumsLibrary.Entity { [ImplementPropertyChanged] public class ForumEntity { public string Name { get; set; } public string Location { get; set; } public string Description { get; set; } public int CurrentPage { get; set; } public bool IsSubforum { get; set; } public int TotalPages { get; set; } [PrimaryKey] public int ForumId { get; set; } [ForeignKey(typeof(ForumCategoryEntity))] public int ForumCategoryEntityId { get; set; } [ForeignKey(typeof(ForumEntity))] public int ParentForumId { get; set; } [ManyToOne] public ForumEntity ParentForum { get; set; } [ManyToOne] public ForumCategoryEntity ForumCategory { get; set; } public bool IsBookmarks { get; set; } } }
mit
C#
5d0e4f5bafa2f8a2746cc469b04a0ca57d5d1aab
Add the binary logger
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
Android/Kotlin/build.cake
Android/Kotlin/build.cake
var TARGET = Argument("t", Argument("target", "ci")); Task("binderate") .Does(() => { var configFile = MakeAbsolute(new FilePath("./config.json")).FullPath; var basePath = MakeAbsolute(new DirectoryPath("./")).FullPath; var exit = StartProcess("xamarin-android-binderator", $"--config=\"{configFile}\" --basepath=\"{basePath}\""); if (exit != 0) throw new Exception($"xamarin-android-binderator exited with code {exit}."); }); Task("native") .Does(() => { var fn = IsRunningOnWindows() ? "gradlew.bat" : "gradlew"; var gradlew = MakeAbsolute((FilePath)("./native/KotlinSample/" + fn)); var exit = StartProcess(gradlew, new ProcessSettings { Arguments = "assemble", WorkingDirectory = "./native/KotlinSample/" }); if (exit != 0) throw new Exception($"Gradle exited with exit code {exit}."); }); Task("externals") .IsDependentOn("binderate") .IsDependentOn("native"); Task("libs") .IsDependentOn("externals") .Does(() => { var settings = new MSBuildSettings() .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) .EnableBinaryLogger("./output/libs.binlog") .WithRestore() .WithProperty("DesignTimeBuild", "false") .WithProperty("PackageOutputPath", MakeAbsolute((DirectoryPath)"./output/").FullPath) .WithTarget("Pack"); MSBuild("./generated/Xamarin.Kotlin.sln", settings); }); Task("nuget") .IsDependentOn("libs"); Task("samples") .IsDependentOn("libs") .Does(() => { var settings = new MSBuildSettings() .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) .EnableBinaryLogger("./output/samples.binlog") .WithRestore() .WithProperty("DesignTimeBuild", "false"); MSBuild("./samples/KotlinSample.sln", settings); }); Task("clean") .Does(() => { CleanDirectories("./generated/*/bin"); CleanDirectories("./generated/*/obj"); CleanDirectories("./externals/"); CleanDirectories("./generated/"); CleanDirectories("./native/.gradle"); CleanDirectories("./native/**/build"); }); Task("ci") .IsDependentOn("externals") .IsDependentOn("libs") .IsDependentOn("nuget") .IsDependentOn("samples"); RunTarget(TARGET);
var TARGET = Argument("t", Argument("target", "ci")); Task("binderate") .Does(() => { var configFile = MakeAbsolute(new FilePath("./config.json")).FullPath; var basePath = MakeAbsolute(new DirectoryPath("./")).FullPath; var exit = StartProcess("xamarin-android-binderator", $"--config=\"{configFile}\" --basepath=\"{basePath}\""); if (exit != 0) throw new Exception($"xamarin-android-binderator exited with code {exit}."); }); Task("native") .Does(() => { var fn = IsRunningOnWindows() ? "gradlew.bat" : "gradlew"; var gradlew = MakeAbsolute((FilePath)("./native/KotlinSample/" + fn)); var exit = StartProcess(gradlew, new ProcessSettings { Arguments = "assemble", WorkingDirectory = "./native/KotlinSample/" }); if (exit != 0) throw new Exception($"Gradle exited with exit code {exit}."); }); Task("externals") .IsDependentOn("binderate") .IsDependentOn("native"); Task("libs") .IsDependentOn("externals") .Does(() => { var settings = new MSBuildSettings() .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) .WithRestore() .WithProperty("DesignTimeBuild", "false") .WithProperty("PackageOutputPath", MakeAbsolute((DirectoryPath)"./output/").FullPath) .WithTarget("Pack"); MSBuild("./generated/Xamarin.Kotlin.sln", settings); }); Task("nuget") .IsDependentOn("libs"); Task("samples") .IsDependentOn("libs") .Does(() => { var settings = new MSBuildSettings() .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) .WithRestore() .WithProperty("DesignTimeBuild", "false"); MSBuild("./samples/KotlinSample.sln", settings); }); Task("clean") .Does(() => { CleanDirectories("./generated/*/bin"); CleanDirectories("./generated/*/obj"); CleanDirectories("./externals/"); CleanDirectories("./generated/"); CleanDirectories("./native/.gradle"); CleanDirectories("./native/**/build"); }); Task("ci") .IsDependentOn("externals") .IsDependentOn("libs") .IsDependentOn("nuget") .IsDependentOn("samples"); RunTarget(TARGET);
mit
C#
a4cd04f69f53757e41d1e70d37dc83b8773bf4a5
Add EnumerableUtility.Enumerate
SaberSnail/GoldenAnvil.Utility
GoldenAnvil.Utility/EnumerableUtility.cs
GoldenAnvil.Utility/EnumerableUtility.cs
using System.Collections.Generic; using System.Linq; namespace GoldenAnvil.Utility { public static class EnumerableUtility { public static HashSet<T> ToHashSet<T>(this IEnumerable<T> items) { return new HashSet<T>(items); } public static IEnumerable<T> Append<T>(this IEnumerable<T> items, T value) { foreach (T item in items) yield return item; yield return value; } public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> items) { return items ?? Enumerable.Empty<T>(); } public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> items) { return items.Where(x => x != null); } public static IEnumerable<T> Enumerate<T>(params T[] items) { return items; } } }
using System.Collections.Generic; using System.Linq; namespace GoldenAnvil.Utility { public static class EnumerableUtility { public static HashSet<T> ToHashSet<T>(this IEnumerable<T> items) { return new HashSet<T>(items); } public static IEnumerable<T> Append<T>(this IEnumerable<T> items, T value) { foreach (T item in items) yield return item; yield return value; } public static IEnumerable<T> EmptyIfNull<T>(this IEnumerable<T> items) { return items ?? Enumerable.Empty<T>(); } public static IEnumerable<T> WhereNotNull<T>(this IEnumerable<T> items) { return items.Where(x => x != null); } } }
mit
C#
a9a525c56b173971a96815f8c60847fc5c07547b
make command a bit more concise.
bennidhamma/EmergeTk,bennidhamma/EmergeTk
tools/emergecli/AddColCommand.cs
tools/emergecli/AddColCommand.cs
using System; using Mono.Options; using System.IO; namespace emergecli { [Command(Name="addcol")] public class AddColCommand : ICommand { public const string template = @" DROP PROCEDURE IF EXISTS addcol; delimiter // CREATE PROCEDURE addcol() BEGIN IF NOT EXISTS ( SELECT * FROM information_schema.COLUMNS WHERE COLUMN_NAME='{0}' AND TABLE_NAME='{1}' AND TABLE_SCHEMA=DATABASE() ) THEN ALTER TABLE {1} ADD COLUMN {0} {2} {3}; END IF; END// delimiter ; CALL addcol(); DROP PROCEDURE IF EXISTS addcol; "; public string Table {get; set;} public string ColumnName {get; set;} public string Type {get; set;} public string Suffix {get; set;} private string fileName = null; public string FileName { get { return fileName ?? string.Format ("add_{0}_to_{1}.sql", ColumnName, Table); } set { fileName = value; } } public OptionSet GetOptions (string[] args) { var o = new OptionSet () { {"t|table=", v => this.Table = v}, {"c|column=", v => this.ColumnName = v}, {"T|type=", v => this.Type = v}, {"s|suffix:", v => this.Suffix = v}, {"f|file:", v => this.FileName = v} }; return o; } public bool Validate () { return Table != null && ColumnName != null && Type != null; } public void Run () { File.WriteAllText (FileName, string.Format (template, ColumnName, Table, Type, Suffix)); } } }
using System; using Mono.Options; using System.IO; namespace emergecli { [Command(Name="addcol")] public class AddColCommand : ICommand { public const string template = @" DROP PROCEDURE IF EXISTS addcol; delimiter // CREATE PROCEDURE addcol() BEGIN IF NOT EXISTS ( SELECT * FROM information_schema.COLUMNS WHERE COLUMN_NAME='{0}' AND TABLE_NAME='{1}' AND TABLE_SCHEMA=DATABASE() ) THEN ALTER TABLE {1} ADD COLUMN {0} {2} {3}; END IF; END// delimiter ; CALL addcol(); DROP PROCEDURE IF EXISTS addcol; "; public string Table {get; set;} public string ColumnName {get; set;} public string Type {get; set;} public string Suffix {get; set;} private string fileName = null; public string FileName { get { return fileName ?? string.Format ("add_{0}_to_{1}.sql", ColumnName, Table); } set { fileName = value; } } public AddColCommand () { } public OptionSet GetOptions (string[] args) { var o = new OptionSet () { {"t|table=", v => this.Table = v}, {"c|column=", v => this.ColumnName = v}, {"T|type=", v => this.Type = v}, {"s|suffix:", v => this.Suffix = v}, {"f|file:", v => this.FileName = v} }; return o; } public bool Validate () { return Table != null && ColumnName != null && Type != null; } public void Run () { File.WriteAllText (FileName, string.Format (template, ColumnName, Table, Type, Suffix)); } } }
mit
C#
57ed91d86fcc45a0ac1aadd646d8311de5195dc3
Update metadata resource to use callback instead of console.log
dudzon/Glimpse,flcdrg/Glimpse,gabrielweyer/Glimpse,sorenhl/Glimpse,dudzon/Glimpse,SusanaL/Glimpse,sorenhl/Glimpse,codevlabs/Glimpse,elkingtonmcb/Glimpse,gabrielweyer/Glimpse,rho24/Glimpse,rho24/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,SusanaL/Glimpse,Glimpse/Glimpse,elkingtonmcb/Glimpse,sorenhl/Glimpse,rho24/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse,Glimpse/Glimpse,rho24/Glimpse,paynecrl97/Glimpse,SusanaL/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,gabrielweyer/Glimpse
source/Glimpse.Core2/Resource/MetadataResource.cs
source/Glimpse.Core2/Resource/MetadataResource.cs
using System.Collections.Generic; using System.Linq; using Glimpse.Core2.Extensibility; using Glimpse.Core2.Framework; using Glimpse.Core2.ResourceResult; namespace Glimpse.Core2.Resource { public class Metadata : IResource { internal const string InternalName = "metadata.js"; private const int CacheDuration = 12960000; //150 days public string Name { get { return InternalName; } } public IEnumerable<string> ParameterKeys { get { return new[] { ResourceParameterKey.VersionNumber, ResourceParameterKey.Callback }; } } public IResourceResult Execute(IResourceContext context) { var metadata = context.PersistanceStore.GetMetadata(); if (metadata == null) return new StatusCodeResourceResult(404); return new JsonResourceResult(metadata, context.Parameters[ResourceParameterKey.Callback], CacheDuration, CacheSetting.Public); } } }
using System.Collections.Generic; using System.Linq; using Glimpse.Core2.Extensibility; using Glimpse.Core2.Framework; using Glimpse.Core2.ResourceResult; namespace Glimpse.Core2.Resource { public class Metadata : IResource { internal const string InternalName = "metadata.js"; private const int CacheDuration = 12960000; //150 days public string Name { get { return InternalName; } } public IEnumerable<string> ParameterKeys { get { return new[] { ResourceParameterKey.VersionNumber }; } } public IResourceResult Execute(IResourceContext context) { var metadata = context.PersistanceStore.GetMetadata(); if (metadata == null) return new StatusCodeResourceResult(404); return new JsonResourceResult(metadata, "console.log", CacheDuration, CacheSetting.Public); } } }
apache-2.0
C#
379dc2c0da1c4f2edf32087e3a6c23b43fe3af65
bump version to 2.0.2
piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker
Piwik.Tracker/Properties/AssemblyInfo.cs
Piwik.Tracker/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PiwikTracker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Piwik")] [assembly: AssemblyProduct("PiwikTracker")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.2")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("PiwikTracker")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Piwik")] [assembly: AssemblyProduct("PiwikTracker")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.1")]
bsd-3-clause
C#
03c988874d265f92994194a4e290c8c22cf4cf93
Allow sequence ID to wrap around.
mysql-net/MySqlConnector,gitsno/MySqlConnector,gitsno/MySqlConnector,mysql-net/MySqlConnector
src/MySql.Data/Serialization/PacketTransmitter.cs
src/MySql.Data/Serialization/PacketTransmitter.cs
using System; using System.IO; using System.Threading; using System.Threading.Tasks; namespace MySql.Data.Serialization { internal sealed class PacketTransmitter { public PacketTransmitter(Stream stream) { m_stream = stream; m_buffer = new byte[256]; } // Starts a new conversation with the server by sending the first packet. public Task SendAsync(PayloadData payload, CancellationToken cancellationToken) { m_sequenceId = 0; return DoSendAsync(payload, cancellationToken); } // Starts a new conversation with the server by receiving the first packet. public Task<PayloadData> ReceiveAsync(CancellationToken cancellationToken) { m_sequenceId = 0; return DoReceiveAsync(cancellationToken); } // Continues a conversation with the server by receiving a response to a packet sent with 'Send' or 'SendReply'. public Task<PayloadData> ReceiveReplyAsync(CancellationToken cancellationToken) => DoReceiveAsync(cancellationToken); // Continues a conversation with the server by sending a reply to a packet received with 'Receive' or 'ReceiveReply'. public Task SendReplyAsync(PayloadData payload, CancellationToken cancellationToken) => DoSendAsync(payload, cancellationToken); private async Task DoSendAsync(PayloadData payload, CancellationToken cancellationToken) { var bytesSent = 0; var data = payload.ArraySegment; const int maxBytesToSend = 16777215; int bytesToSend; do { // break payload into packets of at most (2^24)-1 bytes bytesToSend = Math.Min(data.Count - bytesSent, maxBytesToSend); // write four-byte packet header; https://dev.mysql.com/doc/internals/en/mysql-packet.html SerializationUtility.WriteUInt32((uint) bytesToSend, m_buffer, 0, 3); m_buffer[3] = (byte) m_sequenceId; m_sequenceId++; await m_stream.WriteAsync(m_buffer, 0, 4, cancellationToken); // write payload await m_stream.WriteAsync(data.Array, data.Offset + bytesSent, bytesToSend, cancellationToken); bytesSent += bytesToSend; } while (bytesToSend == maxBytesToSend); } private async Task<PayloadData> DoReceiveAsync(CancellationToken cancellationToken) { await m_stream.ReadExactlyAsync(m_buffer, 0, 4, cancellationToken); int payloadLength = (int) SerializationUtility.ReadUInt32(m_buffer, 0, 3); if (m_buffer[3] != (byte) (m_sequenceId & 0xFF)) throw new InvalidOperationException("Packet received out-of-order."); m_sequenceId++; if (payloadLength > m_buffer.Length) throw new NotSupportedException("TODO: Can't read long payloads."); await m_stream.ReadExactlyAsync(m_buffer, 0, payloadLength, cancellationToken); return new PayloadData(new ArraySegment<byte>(m_buffer, 0, payloadLength)); } readonly Stream m_stream; readonly byte[] m_buffer; int m_sequenceId; } }
using System; using System.IO; using System.Threading; using System.Threading.Tasks; namespace MySql.Data.Serialization { internal sealed class PacketTransmitter { public PacketTransmitter(Stream stream) { m_stream = stream; m_buffer = new byte[256]; } // Starts a new conversation with the server by sending the first packet. public Task SendAsync(PayloadData payload, CancellationToken cancellationToken) { m_sequenceId = 0; return DoSendAsync(payload, cancellationToken); } // Starts a new conversation with the server by receiving the first packet. public Task<PayloadData> ReceiveAsync(CancellationToken cancellationToken) { m_sequenceId = 0; return DoReceiveAsync(cancellationToken); } // Continues a conversation with the server by receiving a response to a packet sent with 'Send' or 'SendReply'. public Task<PayloadData> ReceiveReplyAsync(CancellationToken cancellationToken) => DoReceiveAsync(cancellationToken); // Continues a conversation with the server by sending a reply to a packet received with 'Receive' or 'ReceiveReply'. public Task SendReplyAsync(PayloadData payload, CancellationToken cancellationToken) => DoSendAsync(payload, cancellationToken); private async Task DoSendAsync(PayloadData payload, CancellationToken cancellationToken) { var bytesSent = 0; var data = payload.ArraySegment; const int maxBytesToSend = 16777215; int bytesToSend; do { // break payload into packets of at most (2^24)-1 bytes bytesToSend = Math.Min(data.Count - bytesSent, maxBytesToSend); // write four-byte packet header; https://dev.mysql.com/doc/internals/en/mysql-packet.html SerializationUtility.WriteUInt32((uint) bytesToSend, m_buffer, 0, 3); m_buffer[3] = (byte) m_sequenceId; m_sequenceId++; await m_stream.WriteAsync(m_buffer, 0, 4, cancellationToken); // write payload await m_stream.WriteAsync(data.Array, data.Offset + bytesSent, bytesToSend, cancellationToken); bytesSent += bytesToSend; } while (bytesToSend == maxBytesToSend); } private async Task<PayloadData> DoReceiveAsync(CancellationToken cancellationToken) { await m_stream.ReadExactlyAsync(m_buffer, 0, 4, cancellationToken); int payloadLength = (int) SerializationUtility.ReadUInt32(m_buffer, 0, 3); if (m_buffer[3] != m_sequenceId) throw new InvalidOperationException("Packet received out-of-order."); m_sequenceId++; if (payloadLength > m_buffer.Length) throw new NotSupportedException("TODO: Can't read long payloads."); await m_stream.ReadExactlyAsync(m_buffer, 0, payloadLength, cancellationToken); return new PayloadData(new ArraySegment<byte>(m_buffer, 0, payloadLength)); } readonly Stream m_stream; readonly byte[] m_buffer; int m_sequenceId; } }
mit
C#
78b663d0f2ab6f21704f64de0d641c1d6e1ba14e
Move none generic generator to top of file
inputfalken/Sharpy
GeneratorAPI/Generator.cs
GeneratorAPI/Generator.cs
using System; using System.Collections.Generic; namespace GeneratorAPI { public static class Generator { /// <summary> /// <para> /// Contains methods for creating Generators with various Providers. /// </para> /// </summary> public static GeneratorFactory Factory { get; } = new GeneratorFactory(); } /// <summary> /// </summary> /// <typeparam name="TProvider"></typeparam> public class Generator<TProvider> { private readonly TProvider _provider; public Generator(TProvider provider) => _provider = provider; private IEnumerable<TResult> InfiniteEnumerable<TResult>(Func<TProvider, TResult> fn) { while (true) yield return fn(_provider); } /// <summary> /// <para> /// Turn Generator into Generation&lt;TResult&gt; /// </para> /// </summary> /// <typeparam name="TResult"></typeparam> /// <param name="fn"></param> /// <returns></returns> public Generation<TResult> Generate<TResult>(Func<TProvider, TResult> fn) => new Generation<TResult>( InfiniteEnumerable(fn)); } /// <summary> /// <para> /// Contains methods for creating Generators with various Providers. /// </para> /// </summary> public class GeneratorFactory { /// <summary> /// <para> /// A Generator using System.Random as provider. /// </para> /// </summary> /// <param name="random"></param> /// <returns></returns> public Generator<Random> RandomGenerator(Random random) => Create(random); /// <summary> /// <para> /// Create a Generator with TProivder as provider. /// </para> /// </summary> /// <typeparam name="TProvider"></typeparam> /// <param name="provider"></param> /// <returns></returns> public Generator<TProvider> Create<TProvider>(TProvider provider) => new Generator<TProvider>(provider); } }
using System; using System.Collections.Generic; namespace GeneratorAPI { /// <summary> /// </summary> /// <typeparam name="TProvider"></typeparam> public class Generator<TProvider> { private readonly TProvider _provider; public Generator(TProvider provider) => _provider = provider; private IEnumerable<TResult> InfiniteEnumerable<TResult>(Func<TProvider, TResult> fn) { while (true) yield return fn(_provider); } /// <summary> /// <para> /// Turn Generator into Generation&lt;TResult&gt; /// </para> /// </summary> /// <typeparam name="TResult"></typeparam> /// <param name="fn"></param> /// <returns></returns> public Generation<TResult> Generate<TResult>(Func<TProvider, TResult> fn) => new Generation<TResult>( InfiniteEnumerable(fn)); } public static class Generator { /// <summary> /// <para> /// Contains methods for creating Generators with various Providers. /// </para> /// </summary> public static GeneratorFactory Factory { get; } = new GeneratorFactory(); } /// <summary> /// <para> /// Contains methods for creating Generators with various Providers. /// </para> /// </summary> public class GeneratorFactory { /// <summary> /// <para> /// A Generator using System.Random as provider. /// </para> /// </summary> /// <param name="random"></param> /// <returns></returns> public Generator<Random> RandomGenerator(Random random) => Create(random); /// <summary> /// <para> /// Create a Generator with TProivder as provider. /// </para> /// </summary> /// <typeparam name="TProvider"></typeparam> /// <param name="provider"></param> /// <returns></returns> public Generator<TProvider> Create<TProvider>(TProvider provider) => new Generator<TProvider>(provider); } }
mit
C#
159efe394f24a5935fce623a4f7be6c9a18d26bf
Fix "Countdown" widget "EndDateTime" read only
danielchalmers/DesktopWidgets
DesktopWidgets/Widgets/CountdownClock/Settings.cs
DesktopWidgets/Widgets/CountdownClock/Settings.cs
using System; using DesktopWidgets.Classes; namespace DesktopWidgets.Widgets.CountdownClock { public class Settings : WidgetClockSettingsBase { public DateTime EndDateTime { get; set; } = DateTime.Now; } }
using System; using DesktopWidgets.Classes; namespace DesktopWidgets.Widgets.CountdownClock { public class Settings : WidgetClockSettingsBase { public DateTime EndDateTime { get; } = DateTime.Now; } }
apache-2.0
C#
e96c52cc9bd4c7f4fe408c1bf5d145f337eab339
Add default database names to connectionfactory.cs
Ackara/Daterpillar
src/Tests.Daterpillar/Helper/ConnectionFactory.cs
src/Tests.Daterpillar/Helper/ConnectionFactory.cs
using System; using System.Data; using System.IO; namespace Tests.Daterpillar.Helper { public static class ConnectionFactory { public static IDbConnection CreateSQLiteConnection(string filePath = "") { if (!File.Exists(filePath)) { filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "daterpillar-test.db3"); System.Data.SQLite.SQLiteConnection.CreateFile(filePath); } var connStr = new System.Data.SQLite.SQLiteConnectionStringBuilder() { DataSource = filePath }; return new System.Data.SQLite.SQLiteConnection(connStr.ConnectionString); } public static IDbConnection CreateMySQLConnection(string database = "daterpillar") { var connStr = new MySql.Data.MySqlClient.MySqlConnectionStringBuilder(ConnectionString.GetMySQLServerConnectionString()); if (!string.IsNullOrEmpty(database)) connStr.Database = database; return new MySql.Data.MySqlClient.MySqlConnection(connStr.ConnectionString); } public static IDbConnection CreateMSSQLConnection(string database = "daterpillar") { var connStr = new System.Data.SqlClient.SqlConnectionStringBuilder(ConnectionString.GetSQLServerConnectionString()); if (!string.IsNullOrEmpty(database)) connStr.Add("database", database); return new System.Data.SqlClient.SqlConnection(connStr.ConnectionString); } } }
using System; using System.Data; using System.IO; namespace Tests.Daterpillar.Helper { public static class ConnectionFactory { public static IDbConnection CreateMySQLConnection(string database = null) { var connStr = new MySql.Data.MySqlClient.MySqlConnectionStringBuilder(""); if (!string.IsNullOrEmpty(database)) connStr.Database = database; return new MySql.Data.MySqlClient.MySqlConnection(connStr.ConnectionString); } public static IDbConnection CreateMSSQLConnection(string database = null) { var connStr = new System.Data.SqlClient.SqlConnectionStringBuilder(""); if (!string.IsNullOrEmpty(database)) connStr.Add("database", database); return new System.Data.SqlClient.SqlConnection(connStr.ConnectionString); } public static IDbConnection CreateSQLiteConnection(string filePath = "") { if (!File.Exists(filePath)) { filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "daterpillar-test.db3"); System.Data.SQLite.SQLiteConnection.CreateFile(filePath); } var connStr = new System.Data.SQLite.SQLiteConnectionStringBuilder() { DataSource = filePath }; return new System.Data.SQLite.SQLiteConnection(connStr.ConnectionString); } } }
mit
C#
1ec046af74d054ffd55240cfc249b8f561d7122c
Add missing flags attribute.
mono/mono-addins,mono/mono-addins
Mono.Addins/Mono.Addins.Description/AddinFlags.cs
Mono.Addins/Mono.Addins.Description/AddinFlags.cs
// AddinFlags.cs // // Author: // Lluis Sanchez Gual <[email protected]> // // Copyright (c) 2008 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; namespace Mono.Addins.Description { /// <summary> /// Add-in flags /// </summary> [Flags] public enum AddinFlags { /// <summary> /// No flags /// </summary> None = 0, /// <summary> /// The add-in can't be uninstalled /// </summary> CantUninstall = 1, /// <summary> /// The add-in can't be disabled /// </summary> CantDisable = 2, /// <summary> /// The add-in is not visible to end users /// </summary> Hidden = 4 } }
// AddinFlags.cs // // Author: // Lluis Sanchez Gual <[email protected]> // // Copyright (c) 2008 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // // using System; namespace Mono.Addins.Description { /// <summary> /// Add-in flags /// </summary> public enum AddinFlags { /// <summary> /// No flags /// </summary> None = 0, /// <summary> /// The add-in can't be uninstalled /// </summary> CantUninstall = 1, /// <summary> /// The add-in can't be disabled /// </summary> CantDisable = 2, /// <summary> /// The add-in is not visible to end users /// </summary> Hidden = 4 } }
mit
C#
85a4c4fb4319b96e8d730b1f15f3140f71599f5f
Remove GC debug setting (#5175)
NeoAdonis/osu,2yangk23/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,johnneijzen/osu,peppy/osu,ZLima12/osu,smoogipoo/osu,peppy/osu,johnneijzen/osu,UselessToucan/osu,ZLima12/osu,peppy/osu-new,smoogipoo/osu,ppy/osu,EVAST9919/osu,ppy/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,EVAST9919/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu
osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs
osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; namespace osu.Game.Overlays.Settings.Sections.Debug { public class GCSettings : SettingsSubsection { protected override string Header => "Garbage Collector"; [BackgroundDependencyLoader] private void load(FrameworkDebugConfigManager config) { Children = new Drawable[] { new SettingsButton { Text = "Force garbage collection", Action = GC.Collect }, }; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Runtime; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; namespace osu.Game.Overlays.Settings.Sections.Debug { public class GCSettings : SettingsSubsection { protected override string Header => "Garbage Collector"; private readonly Bindable<LatencyMode> latencyMode = new Bindable<LatencyMode>(); private Bindable<GCLatencyMode> configLatencyMode; [BackgroundDependencyLoader] private void load(FrameworkDebugConfigManager config) { Children = new Drawable[] { new SettingsEnumDropdown<LatencyMode> { LabelText = "Active mode", Bindable = latencyMode }, new SettingsButton { Text = "Force garbage collection", Action = GC.Collect }, }; configLatencyMode = config.GetBindable<GCLatencyMode>(DebugSetting.ActiveGCMode); configLatencyMode.BindValueChanged(mode => latencyMode.Value = (LatencyMode)mode.NewValue, true); latencyMode.BindValueChanged(mode => configLatencyMode.Value = (GCLatencyMode)mode.NewValue); } private enum LatencyMode { Batch = GCLatencyMode.Batch, Interactive = GCLatencyMode.Interactive, LowLatency = GCLatencyMode.LowLatency, SustainedLowLatency = GCLatencyMode.SustainedLowLatency } } }
mit
C#
dc904411c1f0b602265e0d92fdad7092bf860d26
comment out remaining explicit test
dupdob/NFluent,dupdob/NFluent,dupdob/NFluent,NFluent/NFluent,tpierrain/NFluent,tpierrain/NFluent,tpierrain/NFluent,NFluent/NFluent
tests/NFluent.Tests.Internals/NotRelatedTests.cs
tests/NFluent.Tests.Internals/NotRelatedTests.cs
// // -------------------------------------------------------------------------------------------------------------------- // // <copyright file="NotRelatedTests.cs" company=""> // // Copyright 2013 Thomas PIERRAIN // // Licensed under the Apache License, Version 2.0 (the "License"); // // you may not use this file except in compliance with the License. // // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // // distributed under the License is distributed on an "AS IS" BASIS, // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // // limitations under the License. // // </copyright> // // -------------------------------------------------------------------------------------------------------------------- // ReSharper disable once CheckNamespace namespace NFluent.Tests { using ForDocumentation; using Kernel; using NUnit.Framework; [TestFixture] public class NotRelatedTests { [Test] public void CheckContextWorks() { Assert.IsTrue(CheckContext.DefaulNegated); CheckContext.DefaulNegated = false; try { Assert.IsFalse(CheckContext.DefaulNegated); } finally { CheckContext.DefaulNegated = true; } } #if !NETCOREAPP1_0 [Test] [Explicit("Experimental: to check if negation works")] public void ForceNegationOnAllTest() { if (!CheckContext.DefaulNegated) { return; } CheckContext.DefaulNegated = false; try { RunnerHelper.RunAllTests(false); } finally { CheckContext.DefaulNegated = true; } } #endif } }
// // -------------------------------------------------------------------------------------------------------------------- // // <copyright file="NotRelatedTests.cs" company=""> // // Copyright 2013 Thomas PIERRAIN // // Licensed under the Apache License, Version 2.0 (the "License"); // // you may not use this file except in compliance with the License. // // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // // distributed under the License is distributed on an "AS IS" BASIS, // // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // // See the License for the specific language governing permissions and // // limitations under the License. // // </copyright> // // -------------------------------------------------------------------------------------------------------------------- // ReSharper disable once CheckNamespace namespace NFluent.Tests { using ForDocumentation; using Kernel; using NUnit.Framework; [TestFixture] public class NotRelatedTests { [Test] public void CheckContextWorks() { Assert.IsTrue(CheckContext.DefaulNegated); CheckContext.DefaulNegated = false; try { Assert.IsFalse(CheckContext.DefaulNegated); } finally { CheckContext.DefaulNegated = true; } } [Test] [Explicit("Experimental: to check if negation works")] public void ForceNegationOnAllTest() { if (!CheckContext.DefaulNegated) { return; } CheckContext.DefaulNegated = false; try { RunnerHelper.RunAllTests(false); } finally { CheckContext.DefaulNegated = true; } } } }
apache-2.0
C#
028040344a9c2bfcc1cd25d3efad2e8dcf651207
Fix test scene using local beatmap
smoogipoo/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,ppy/osu,peppy/osu-new,NeoAdonis/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,UselessToucan/osu
osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs
osu.Game.Tests/Skins/TestSceneBeatmapSkinResources.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.IO.Archives; using osu.Game.Tests.Resources; using osu.Game.Tests.Visual; namespace osu.Game.Tests.Skins { [HeadlessTest] public class TestSceneBeatmapSkinResources : OsuTestScene { [Resolved] private BeatmapManager beatmaps { get; set; } [BackgroundDependencyLoader] private void load() { var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result; Beatmap.Value = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]); } [Test] public void TestRetrieveOggSample() => AddAssert("sample is non-null", () => Beatmap.Value.Skin.GetSample(new SampleInfo("sample")) != null); [Test] public void TestRetrieveOggTrack() => AddAssert("track is non-null", () => MusicController.CurrentTrack.IsDummyDevice == false); } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Testing; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.IO.Archives; using osu.Game.Tests.Resources; using osu.Game.Tests.Visual; namespace osu.Game.Tests.Skins { [HeadlessTest] public class TestSceneBeatmapSkinResources : OsuTestScene { [Resolved] private BeatmapManager beatmaps { get; set; } private WorkingBeatmap beatmap; [BackgroundDependencyLoader] private void load() { var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result; beatmap = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]); } [Test] public void TestRetrieveOggSample() => AddAssert("sample is non-null", () => beatmap.Skin.GetSample(new SampleInfo("sample")) != null); [Test] public void TestRetrieveOggTrack() => AddAssert("track is non-null", () => MusicController.CurrentTrack.IsDummyDevice == false); } }
mit
C#
8115a4bb8fd9e2d53c40b8607c7ad99f0f62e9a0
Fix potential crash in tests when attempting to lookup key bindings in cases the lookup is not available
NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,peppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu
osu.Game/Configuration/DevelopmentOsuConfigManager.cs
osu.Game/Configuration/DevelopmentOsuConfigManager.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Platform; using osu.Framework.Testing; namespace osu.Game.Configuration { [ExcludeFromDynamicCompile] public class DevelopmentOsuConfigManager : OsuConfigManager { protected override string Filename => base.Filename.Replace(".ini", ".dev.ini"); public DevelopmentOsuConfigManager(Storage storage) : base(storage) { LookupKeyBindings = _ => "unknown"; LookupSkinName = _ => "unknown"; } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Platform; using osu.Framework.Testing; namespace osu.Game.Configuration { [ExcludeFromDynamicCompile] public class DevelopmentOsuConfigManager : OsuConfigManager { protected override string Filename => base.Filename.Replace(".ini", ".dev.ini"); public DevelopmentOsuConfigManager(Storage storage) : base(storage) { } } }
mit
C#
a01e9aea7be60f7eb916c396ee183f8c86546ba6
add missing dependency to bootstrapper
jorik041/ReactiveTrader,jorik041/ReactiveTrader,abbasmhd/ReactiveTrader,jorik041/ReactiveTrader,abbasmhd/ReactiveTrader,singhdev/ReactiveTrader,AdaptiveConsulting/ReactiveTrader,LeeCampbell/ReactiveTrader,rikoe/ReactiveTrader,HalidCisse/ReactiveTrader,LeeCampbell/ReactiveTrader,AdaptiveConsulting/ReactiveTrader,singhdev/ReactiveTrader,HalidCisse/ReactiveTrader,abbasmhd/ReactiveTrader,abbasmhd/ReactiveTrader,rikoe/ReactiveTrader,mrClapham/ReactiveTrader,HalidCisse/ReactiveTrader,akrisiun/ReactiveTrader,jorik041/ReactiveTrader,mrClapham/ReactiveTrader,LeeCampbell/ReactiveTrader,akrisiun/ReactiveTrader,mrClapham/ReactiveTrader,LeeCampbell/ReactiveTrader,HalidCisse/ReactiveTrader,rikoe/ReactiveTrader,akrisiun/ReactiveTrader,akrisiun/ReactiveTrader,rikoe/ReactiveTrader,singhdev/ReactiveTrader,singhdev/ReactiveTrader,mrClapham/ReactiveTrader
src/Adaptive.ReactiveTrader.Web/Bootstrapper.cs
src/Adaptive.ReactiveTrader.Web/Bootstrapper.cs
using Adaptive.ReactiveTrader.Server.Blotter; using Adaptive.ReactiveTrader.Server.Control; using Adaptive.ReactiveTrader.Server.Execution; using Adaptive.ReactiveTrader.Server.Pricing; using Adaptive.ReactiveTrader.Server.ReferenceData; using Adaptive.ReactiveTrader.Server.Transport; using Autofac; namespace Adaptive.ReactiveTrader.Web { public class Bootstrapper { public IContainer Build() { var builder = new ContainerBuilder(); // pricing builder.RegisterType<PricePublisher>().As<IPricePublisher>().SingleInstance(); builder.RegisterType<PriceFeedSimulator>().As<IPriceFeed>().SingleInstance(); builder.RegisterType<PriceLastValueCache>().As<IPriceLastValueCache>().SingleInstance(); builder.RegisterType<PricingHub>().SingleInstance(); // reference data builder.RegisterType<CurrencyPairRepository>().As<ICurrencyPairRepository>().SingleInstance(); builder.RegisterType<CurrencyPairUpdatePublisher>().As<ICurrencyPairUpdatePublisher>().SingleInstance(); builder.RegisterType<ReferenceDataHub>().SingleInstance(); // execution builder.RegisterType<ExecutionService>().As<IExecutionService>().SingleInstance(); builder.RegisterType<ExecutionHub>().SingleInstance(); // control builder.RegisterType<ControlHub>().SingleInstance(); // blotter builder.RegisterType<BlotterPublisher>().As<IBlotterPublisher>().SingleInstance(); builder.RegisterType<TradeRepository>().As<ITradeRepository>().SingleInstance(); builder.RegisterType<BlotterHub>().SingleInstance(); builder.RegisterType<ContextHolder>().As<IContextHolder>().SingleInstance(); return builder.Build(); } } }
using Adaptive.ReactiveTrader.Server.Blotter; using Adaptive.ReactiveTrader.Server.Execution; using Adaptive.ReactiveTrader.Server.Pricing; using Adaptive.ReactiveTrader.Server.ReferenceData; using Adaptive.ReactiveTrader.Server.Transport; using Autofac; namespace Adaptive.ReactiveTrader.Web { public class Bootstrapper { public IContainer Build() { var builder = new ContainerBuilder(); // pricing builder.RegisterType<PricePublisher>().As<IPricePublisher>().SingleInstance(); builder.RegisterType<PriceFeedSimulator>().As<IPriceFeed>().SingleInstance(); builder.RegisterType<PriceLastValueCache>().As<IPriceLastValueCache>().SingleInstance(); builder.RegisterType<PricingHub>().SingleInstance(); // reference data builder.RegisterType<CurrencyPairRepository>().As<ICurrencyPairRepository>().SingleInstance(); builder.RegisterType<CurrencyPairUpdatePublisher>().As<ICurrencyPairUpdatePublisher>().SingleInstance(); builder.RegisterType<ReferenceDataHub>().SingleInstance(); // execution builder.RegisterType<ExecutionService>().As<IExecutionService>().SingleInstance(); builder.RegisterType<ExecutionHub>().SingleInstance(); // blotter builder.RegisterType<BlotterPublisher>().As<IBlotterPublisher>().SingleInstance(); builder.RegisterType<TradeRepository>().As<ITradeRepository>().SingleInstance(); builder.RegisterType<BlotterHub>().SingleInstance(); builder.RegisterType<ContextHolder>().As<IContextHolder>().SingleInstance(); return builder.Build(); } } }
apache-2.0
C#
8f51fae0d93a2a345f68528462435d6b55b7d994
update comment for ResolveByName attribute.
jkoritzinsky/Avalonia,grokys/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,grokys/Perspex,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia
src/Avalonia.Controls/ResolveByNameAttribute.cs
src/Avalonia.Controls/ResolveByNameAttribute.cs
using System; namespace Avalonia.Controls { /// <summary> /// Indicates that the property resolves an element by Name or x:Name. /// When applying this to attached properties, ensure to put on both /// the Getter and Setter methods. /// </summary> public class ResolveByNameAttribute : Attribute { } }
using System; namespace Avalonia.Controls { public class ResolveByNameAttribute : Attribute { } }
mit
C#
8023161945bcf7d8dfb2604b6d0c72a9e8f14a73
add meta descr
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
src/FilterLists.Web/Views/Shared/_Layout.cshtml
src/FilterLists.Web/Views/Shared/_Layout.cshtml
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>@ViewData["Title"] - FilterLists</title> <base href="~/"/> <meta name="description" content="FilterLists is the independent and comprehensive directory of all public filter and hosts lists for advertisements, trackers, malware, and annoyances. Project by Collin M. Barrett."/> <link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true"/> <environment exclude="Development"> <link rel="stylesheet" href="~/dist/site.css" asp-append-version="true"/> </environment> </head> <body> @RenderBody() <script src="~/dist/vendor.js" asp-append-version="true"></script> @RenderSection("scripts", false) </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <title>@ViewData["Title"] - FilterLists</title> <base href="~/"/> <link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true"/> <environment exclude="Development"> <link rel="stylesheet" href="~/dist/site.css" asp-append-version="true"/> </environment> </head> <body> @RenderBody() <script src="~/dist/vendor.js" asp-append-version="true"></script> @RenderSection("scripts", false) </body> </html>
mit
C#
35d147f46bbec5ceeb0941711ff5e3457a2b6e45
Fix incorrect namespace name.
github/VisualStudio,github/VisualStudio,github/VisualStudio
src/GitHub.App/Infrastructure/ExportWrappers.cs
src/GitHub.App/Infrastructure/ExportWrappers.cs
using System.ComponentModel.Composition; using Octokit.Internal; using System; using System.Net.Http; namespace GitHub.Infrastructure { /// <summary> /// Since VS doesn't support dynamic component registration, we have to implement wrappers /// for types we don't control in order to export them. /// </summary> [Export(typeof(IHttpClient))] public class ExportedHttpClient : HttpClientAdapter { public ExportedHttpClient() : base(HttpMessageHandlerFactory.CreateDefault) {} } }
using System.ComponentModel.Composition; using Octokit.Internal; using System; using System.Net.Http; namespace GitHub.Logging { /// <summary> /// Since VS doesn't support dynamic component registration, we have to implement wrappers /// for types we don't control in order to export them. /// </summary> [Export(typeof(IHttpClient))] public class ExportedHttpClient : HttpClientAdapter { public ExportedHttpClient() : base(HttpMessageHandlerFactory.CreateDefault) {} } }
mit
C#
1e28cb9ac2707f554e3d7e961335ba9ef8ba15f0
Change StatusUpdater job to run every hour.
LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform
src/CompetitionPlatform/ScheduledJobs/JobScheduler.cs
src/CompetitionPlatform/ScheduledJobs/JobScheduler.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Common.Log; using CompetitionPlatform.Data.AzureRepositories.Log; using Quartz; using Quartz.Impl; namespace CompetitionPlatform.ScheduledJobs { public static class JobScheduler { public static async void Start(string connectionString, ILog log) { var schedFact = new StdSchedulerFactory(); var sched = await schedFact.GetScheduler(); await sched.Start(); var job = JobBuilder.Create<ProjectStatusIpdaterJob>() .WithIdentity("myJob", "group1") .Build(); var trigger = TriggerBuilder.Create() .WithIdentity("myTrigger", "group1") .WithSimpleSchedule(x => x .WithIntervalInHours(1) .RepeatForever()) .Build(); job.JobDataMap["connectionString"] = connectionString; job.JobDataMap["log"] = log; await sched.ScheduleJob(job, trigger); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Common.Log; using CompetitionPlatform.Data.AzureRepositories.Log; using Quartz; using Quartz.Impl; namespace CompetitionPlatform.ScheduledJobs { public static class JobScheduler { public static async void Start(string connectionString, ILog log) { var schedFact = new StdSchedulerFactory(); var sched = await schedFact.GetScheduler(); await sched.Start(); var job = JobBuilder.Create<ProjectStatusIpdaterJob>() .WithIdentity("myJob", "group1") .Build(); var trigger = TriggerBuilder.Create() .WithIdentity("myTrigger", "group1") .WithSimpleSchedule(x => x .WithIntervalInSeconds(50) .RepeatForever()) .Build(); job.JobDataMap["connectionString"] = connectionString; job.JobDataMap["log"] = log; await sched.ScheduleJob(job, trigger); } } }
mit
C#
b18633f85ee169203e980827d2d5fd972a8220b3
Add pickable flag to the SimplePlaneAnnotation.
stevefsp/Lizitt-Unity3D-Utilities
Source/Lizitt/Utils/Core/Editor/SimplePlaneAnnotationEditor.cs
Source/Lizitt/Utils/Core/Editor/SimplePlaneAnnotationEditor.cs
/* * Copyright (c) 2015 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using UnityEditor; using UnityEngine; namespace com.lizitt.u3d.editor { public static class SimplePlaneAnnotationEditor { private static readonly Vector3 MarkerSize = new Vector3(1, 0.01f, 1); #if UNITY_5_0_0 || UNITY_5_0_1 [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)] #else [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy | GizmoType.Pickable)] #endif static void DrawGizmo(SimplePlaneAnnotation item, GizmoType type) { #if UNITY_5_0_0 || UNITY_5_0_1 if (!(AnnotationUtil.drawAlways || (type & GizmoType.SelectedOrChild) != 0)) #else if (!(AnnotationUtil.drawAlways || (type & GizmoType.InSelectionHierarchy) != 0)) #endif return; Gizmos.color = item.Color; Gizmos.matrix = item.transform.localToWorldMatrix; Gizmos.DrawCube(item.PositionOffset, MarkerSize); } } }
/* * Copyright (c) 2015 Stephen A. Pratt * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ using UnityEditor; using UnityEngine; namespace com.lizitt.u3d.editor { public static class SimplePlaneAnnotationEditor { private static readonly Vector3 MarkerSize = new Vector3(1, 0.01f, 1); #if UNITY_5_0_0 || UNITY_5_0_1 [DrawGizmo(GizmoType.NotSelected | GizmoType.SelectedOrChild)] #else [DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.InSelectionHierarchy)] #endif static void DrawGizmo(SimplePlaneAnnotation item, GizmoType type) { #if UNITY_5_0_0 || UNITY_5_0_1 if (!(AnnotationUtil.drawAlways || (type & GizmoType.SelectedOrChild) != 0)) #else if (!(AnnotationUtil.drawAlways || (type & GizmoType.InSelectionHierarchy) != 0)) #endif return; Gizmos.color = item.Color; Gizmos.matrix = item.transform.localToWorldMatrix; Gizmos.DrawCube(item.PositionOffset, MarkerSize); } } }
mit
C#
6a50c7bde5843d5f0ee625259b9d87c1cd902e86
Fix new office name clearing after adding
aregaz/starcounterdemo,aregaz/starcounterdemo
src/RealEstateAgencyFranchise/CorporationJson.json.cs
src/RealEstateAgencyFranchise/CorporationJson.json.cs
using RealEstateAgencyFranchise.Database; using Starcounter; namespace RealEstateAgencyFranchise { partial class CorporationJson : Json { static CorporationJson() { DefaultTemplate.Offices.ElementType.InstanceType = typeof(AgencyOfficeJson); } void Handle(Input.SaveTrigger action) { Transaction.Commit(); } void Handle(Input.NewOfficeTrigger action) { new Office() { Corporation = this.Data as Corporation, Address = new Address(), Trend = 0, Name = this.NewOfficeName }; this.NewOfficeName = ""; } } }
using RealEstateAgencyFranchise.Database; using Starcounter; namespace RealEstateAgencyFranchise { partial class CorporationJson : Json { static CorporationJson() { DefaultTemplate.Offices.ElementType.InstanceType = typeof(AgencyOfficeJson); } void Handle(Input.SaveTrigger action) { Transaction.Commit(); } void Handle(Input.NewOfficeTrigger action) { new Office() { Corporation = this.Data as Corporation, Address = new Address(), Trend = 0, Name = this.NewOfficeName }; } } }
mit
C#
5e7c91cb36e843edb2880963334e6f2ab1ddb735
Apply SerializableAttribute to custom exception
ritterim/silverpop-dotnet-api,kendaleiv/silverpop-dotnet-api,billboga/silverpop-dotnet-api,kendaleiv/silverpop-dotnet-api
src/Silverpop.Client/TransactClientException.cs
src/Silverpop.Client/TransactClientException.cs
using System; namespace Silverpop.Client { [Serializable] public class TransactClientException : Exception { public TransactClientException() { } public TransactClientException(string message) : base(message) { } public TransactClientException(string message, Exception innerException) : base(message, innerException) { } } }
using System; namespace Silverpop.Client { public class TransactClientException : Exception { public TransactClientException() { } public TransactClientException(string message) : base(message) { } public TransactClientException(string message, Exception innerException) : base(message, innerException) { } } }
mit
C#
51ded03151085f1f3a609108697c1f3b44f11451
fix echant channel resources
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
TCC.Core/TemplateSelectors/ChannelLabelDataTemplateSelector.cs
TCC.Core/TemplateSelectors/ChannelLabelDataTemplateSelector.cs
using System.Windows; using System.Windows.Controls; using TCC.Data; namespace TCC.TemplateSelectors { public class ChannelLabelDataTemplateSelector : DataTemplateSelector { public DataTemplate NormalChannelDataTemplate { get; set; } public DataTemplate WhisperChannelDataTemplate { get; set; } public DataTemplate MegaphoneChannelDataTemplate { get; set; } public DataTemplate EnchantChannelDataTemplate { get; set; } public override DataTemplate SelectTemplate(object item, DependencyObject container) { var m = item as ChatMessage; if (m == null) return null; switch (m.Channel) { case ChatChannel.SentWhisper: case ChatChannel.ReceivedWhisper: return WhisperChannelDataTemplate; case ChatChannel.Megaphone: return MegaphoneChannelDataTemplate; //case ChatChannel.Enchant12: // return EnchantChannelDataTemplate; //case ChatChannel.Enchant15: // return EnchantChannelDataTemplate; default: return NormalChannelDataTemplate; } } } }
using System.Windows; using System.Windows.Controls; using TCC.Data; namespace TCC.TemplateSelectors { public class ChannelLabelDataTemplateSelector : DataTemplateSelector { public DataTemplate NormalChannelDataTemplate { get; set; } public DataTemplate WhisperChannelDataTemplate { get; set; } public DataTemplate MegaphoneChannelDataTemplate { get; set; } public DataTemplate EnchantChannelDataTemplate { get; set; } public override DataTemplate SelectTemplate(object item, DependencyObject container) { var m = item as ChatMessage; if (m == null) return null; switch (m.Channel) { case ChatChannel.SentWhisper: case ChatChannel.ReceivedWhisper: return WhisperChannelDataTemplate; case ChatChannel.Megaphone: return MegaphoneChannelDataTemplate; case ChatChannel.Enchant12: return EnchantChannelDataTemplate; case ChatChannel.Enchant15: return EnchantChannelDataTemplate; default: return NormalChannelDataTemplate; } } } }
mit
C#
13d05d3f665d6039f4ccbb2c0a9653123909d97b
add Scope.HasVariable()
maul-esel/CobaltAHK,maul-esel/CobaltAHK
CobaltAHK/ExpressionTree/Scope.cs
CobaltAHK/ExpressionTree/Scope.cs
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; namespace CobaltAHK.ExpressionTree { public class Scope { public Scope() : this(null) { LoadBuiltinFunctions(); } public Scope(Scope parentScope) { parent = parentScope; } private void LoadBuiltinFunctions() { var flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly; var methods = typeof(IronAHK.Rusty.Core).GetMethods(flags); foreach (var method in methods) { var paramList = method.GetParameters(); if (HasFunction(method.Name) || paramList.Any(p => p.ParameterType.IsByRef)) { continue; // skips byRef and overloads // todo: support overloads! } var prms = paramList.Select(p => Expression.Parameter(p.ParameterType, p.Name)).ToArray(); var types = paramList.Select(p => p.ParameterType).ToList(); types.Add(method.ReturnType); var lambda = Expression.Lambda(Expression.GetFuncType(types.ToArray()), Expression.Call(method, prms), prms); AddFunction(method.Name, lambda); } } protected readonly Scope parent; public bool IsRoot { get { return parent == null; } } protected readonly IDictionary<string, LambdaExpression> functions = new Dictionary<string, LambdaExpression>(); public virtual void AddFunction(string name, LambdaExpression func) { functions[name.ToLower()] = func; } protected virtual bool HasFunction(string name) { return functions.ContainsKey(name.ToLower()); } public virtual LambdaExpression ResolveFunction(string name) { if (HasFunction(name)) { return functions[name.ToLower()]; } else if (parent != null) { return parent.ResolveFunction(name); } throw new FunctionNotFoundException(name); } protected readonly IDictionary<string, ParameterExpression> variables = new Dictionary<string, ParameterExpression>(); public virtual void AddVariable(string name, ParameterExpression variable) { variables[name.ToLower()] = variable; } protected virtual bool HasVariable(string name) { return variables.ContainsKey(name.ToLower()); } public virtual ParameterExpression ResolveVariable(string name) { if (!variables.ContainsKey(name.ToLower())) { AddVariable(name, Expression.Parameter(typeof(object), name)); } return variables[name.ToLower()]; } } public class FunctionNotFoundException : System.Exception { public FunctionNotFoundException(string func) : base("Function '" + func + "' was not found!") { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; namespace CobaltAHK.ExpressionTree { public class Scope { public Scope() : this(null) { LoadBuiltinFunctions(); } public Scope(Scope parentScope) { parent = parentScope; } private void LoadBuiltinFunctions() { var flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly; var methods = typeof(IronAHK.Rusty.Core).GetMethods(flags); foreach (var method in methods) { var paramList = method.GetParameters(); if (HasFunction(method.Name) || paramList.Any(p => p.ParameterType.IsByRef)) { continue; // skips byRef and overloads // todo: support overloads! } var prms = paramList.Select(p => Expression.Parameter(p.ParameterType, p.Name)).ToArray(); var types = paramList.Select(p => p.ParameterType).ToList(); types.Add(method.ReturnType); var lambda = Expression.Lambda(Expression.GetFuncType(types.ToArray()), Expression.Call(method, prms), prms); AddFunction(method.Name, lambda); } } protected readonly Scope parent; public bool IsRoot { get { return parent == null; } } protected readonly IDictionary<string, LambdaExpression> functions = new Dictionary<string, LambdaExpression>(); public virtual void AddFunction(string name, LambdaExpression func) { functions[name.ToLower()] = func; } protected virtual bool HasFunction(string name) { return functions.ContainsKey(name.ToLower()); } public virtual LambdaExpression ResolveFunction(string name) { if (HasFunction(name)) { return functions[name.ToLower()]; } else if (parent != null) { return parent.ResolveFunction(name); } throw new FunctionNotFoundException(name); } protected readonly IDictionary<string, ParameterExpression> variables = new Dictionary<string, ParameterExpression>(); public virtual void AddVariable(string name, ParameterExpression variable) { variables[name.ToLower()] = variable; } public virtual ParameterExpression ResolveVariable(string name) { if (!variables.ContainsKey(name.ToLower())) { AddVariable(name, Expression.Parameter(typeof(object), name)); } return variables[name.ToLower()]; } } public class FunctionNotFoundException : System.Exception { public FunctionNotFoundException(string func) : base("Function '" + func + "' was not found!") { } } }
mit
C#
fca5ae088e2c3864cc1e728fba8cfbc7b434bf95
Use NDes.options for binarycache test executable
lucasg/Dependencies,lucasg/Dependencies,lucasg/Dependencies
test/binarycache-test/Program.cs
test/binarycache-test/Program.cs
using System; using System.Diagnostics; using System.Collections.Generic; using Dependencies.ClrPh; using NDesk.Options; namespace Dependencies { namespace Test { class Program { static void ShowHelp(OptionSet p) { Console.WriteLine("Usage: binarycache [options] <FILES_TO_LOAD>"); Console.WriteLine(); Console.WriteLine("Options:"); p.WriteOptionDescriptions(Console.Out); } static void Main(string[] args) { bool is_verbose = false; bool show_help = false; OptionSet opts = new OptionSet() { { "v|verbose", "redirect debug traces to console", v => is_verbose = v != null }, { "h|help", "show this message and exit", v => show_help = v != null }, }; List<string> eps = opts.Parse(args); if (show_help) { ShowHelp(opts); return; } if (is_verbose) { // Redirect debug log to the console Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; } // always the first call to make Phlib.InitializePhLib(); BinaryCache.Instance.Load(); foreach ( var peFilePath in eps) { PE Pe = BinaryCache.LoadPe(peFilePath); Console.WriteLine("Loaded PE file : {0:s}", Pe.Filepath); } BinaryCache.Instance.Unload(); } } } }
using System; using System.Diagnostics; using Dependencies.ClrPh; namespace Dependencies { namespace Test { class Program { static void Main(string[] args) { // always the first call to make Phlib.InitializePhLib(); // Redirect debug log to the console Debug.Listeners.Add(new TextWriterTraceListener(Console.Out)); Debug.AutoFlush = true; BinaryCache.Instance.Load(); foreach ( var peFilePath in args ) { PE Pe = BinaryCache.LoadPe(peFilePath); } BinaryCache.Instance.Unload(); } } } }
mit
C#
3bcef6c182601f3c6ea7f556b3d1091f62e5d0c3
Update Program.cs
Metapyziks/Ziks.WebServer
Examples/SimpleExample/Program.cs
Examples/SimpleExample/Program.cs
using System; using System.Reflection; using System.Threading.Tasks; using Ziks.WebServer; namespace SimpleExample { public class Program : IProgram { [STAThread] static void Main( string[] args ) { var server = new Server(); server.AddPrefix( "http://+:8080/" ); server.AddControllers( Assembly.GetExecutingAssembly() ); Task.Run( server.Run ); Console.ReadKey( true ); server.Stop(); } } }
using System; using System.Reflection; using System.Threading.Tasks; using Ziks.WebServer; namespace SimpleExample { public interface IProgram { void WriteLine( string message ); } public class Program : IProgram { [STAThread] static void Main( string[] args ) { var program = new Program(); program.Run(); } public void Run() { var server = new Server(); server.AddPrefix( "http://+:8080/" ); server.Components.Add<IProgram>( this ); server.AddControllers( Assembly.GetExecutingAssembly() ); Task.Run( () => server.Run() ); Console.ReadKey( true ); server.Stop(); } public void WriteLine( string message ) { Console.WriteLine( message ); } } }
mit
C#
fe1e451812fc298a0d591ed374dc03f1cd0f3341
Fix wrong dirtyness propagation
cbovar/ConvNetSharp
src/ConvNetSharp.Flow/Ops/Assign.cs
src/ConvNetSharp.Flow/Ops/Assign.cs
using System; using ConvNetSharp.Volume; namespace ConvNetSharp.Flow.Ops { /// <summary> /// Assignment: valueOp = op /// </summary> /// <typeparam name="T"></typeparam> public class Assign<T> : Op<T> where T : struct, IEquatable<T>, IFormattable { private long _lastComputeStep; public Assign(Op<T> valueOp, Op<T> op) { if (!(valueOp is Variable<T>)) { throw new ArgumentException("Assigned Op should be a Variable", nameof(valueOp)); } AddParent(valueOp); AddParent(op); } public override string Representation => "->"; public override void Differentiate() { throw new NotImplementedException(); } public override Volume<T> Evaluate(Session<T> session) { if(!this.IsDirty) { return base.Evaluate(session); } this.IsDirty = false; this.Result = this.Parents[1].Evaluate(session); ((Variable<T>)this.Parents[0]).SetValue(this.Result); return base.Evaluate(session); } public override string ToString() { return $"({this.Parents[0]} <- {this.Parents[1]})"; } } }
using System; using ConvNetSharp.Volume; namespace ConvNetSharp.Flow.Ops { /// <summary> /// Assignment: valueOp = op /// </summary> /// <typeparam name="T"></typeparam> public class Assign<T> : Op<T> where T : struct, IEquatable<T>, IFormattable { private long _lastComputeStep; public Assign(Op<T> valueOp, Op<T> op) { if (!(valueOp is Variable<T>)) { throw new ArgumentException("Assigned Op should be a Variable", nameof(valueOp)); } AddParent(valueOp); AddParent(op); } public override string Representation => "->"; public override void Differentiate() { throw new NotImplementedException(); } public override Volume<T> Evaluate(Session<T> session) { if (this._lastComputeStep == session.Step) { return this.Parents[0].Evaluate(session); } this._lastComputeStep = session.Step; this.Result = this.Parents[1].Evaluate(session); ((Variable<T>)this.Parents[0]).SetValue(this.Result); return base.Evaluate(session); } } }
mit
C#
a77306567b8ae26bafced6d2b32b9a73c2c42e6c
Swap Dictionary with ConcurrentDictionary in InMemoryBackgroundJobStore
zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,andmattia/aspnetboilerplate,verdentk/aspnetboilerplate,verdentk/aspnetboilerplate,AlexGeller/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,AlexGeller/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,ryancyq/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ilyhacker/aspnetboilerplate,virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,Nongzhsh/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,zclmoon/aspnetboilerplate,zclmoon/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,andmattia/aspnetboilerplate,beratcarsi/aspnetboilerplate,andmattia/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,Nongzhsh/aspnetboilerplate,luchaoshuai/aspnetboilerplate,virtualcca/aspnetboilerplate,ryancyq/aspnetboilerplate,AlexGeller/aspnetboilerplate
src/Abp/BackgroundJobs/InMemoryBackgroundJobStore.cs
src/Abp/BackgroundJobs/InMemoryBackgroundJobStore.cs
using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Abp.Timing; namespace Abp.BackgroundJobs { /// <summary> /// In memory implementation of <see cref="IBackgroundJobStore"/>. /// It's used if <see cref="IBackgroundJobStore"/> is not implemented by actual persistent store /// and job execution is enabled (<see cref="IBackgroundJobConfiguration.IsJobExecutionEnabled"/>) for the application. /// </summary> public class InMemoryBackgroundJobStore : IBackgroundJobStore { private readonly ConcurrentDictionary<long, BackgroundJobInfo> _jobs; private long _lastId; /// <summary> /// Initializes a new instance of the <see cref="InMemoryBackgroundJobStore"/> class. /// </summary> public InMemoryBackgroundJobStore() { _jobs = new ConcurrentDictionary<long, BackgroundJobInfo>(); } public Task<BackgroundJobInfo> GetAsync(long jobId) { return Task.FromResult(_jobs[jobId]); } public Task InsertAsync(BackgroundJobInfo jobInfo) { jobInfo.Id = Interlocked.Increment(ref _lastId); _jobs[jobInfo.Id] = jobInfo; return Task.FromResult(0); } public Task<List<BackgroundJobInfo>> GetWaitingJobsAsync(int maxResultCount) { var waitingJobs = _jobs.Values .Where(t => !t.IsAbandoned && t.NextTryTime <= Clock.Now) .OrderByDescending(t => t.Priority) .ThenBy(t => t.TryCount) .ThenBy(t => t.NextTryTime) .Take(maxResultCount) .ToList(); return Task.FromResult(waitingJobs); } public Task DeleteAsync(BackgroundJobInfo jobInfo) { _jobs.TryRemove(jobInfo.Id, out _); return Task.FromResult(0); } public Task UpdateAsync(BackgroundJobInfo jobInfo) { if (jobInfo.IsAbandoned) { return DeleteAsync(jobInfo); } return Task.FromResult(0); } } }
using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Abp.Timing; namespace Abp.BackgroundJobs { /// <summary> /// In memory implementation of <see cref="IBackgroundJobStore"/>. /// It's used if <see cref="IBackgroundJobStore"/> is not implemented by actual persistent store /// and job execution is enabled (<see cref="IBackgroundJobConfiguration.IsJobExecutionEnabled"/>) for the application. /// </summary> public class InMemoryBackgroundJobStore : IBackgroundJobStore { private readonly Dictionary<long, BackgroundJobInfo> _jobs; private long _lastId; /// <summary> /// Initializes a new instance of the <see cref="InMemoryBackgroundJobStore"/> class. /// </summary> public InMemoryBackgroundJobStore() { _jobs = new Dictionary<long, BackgroundJobInfo>(); } public Task<BackgroundJobInfo> GetAsync(long jobId) { return Task.FromResult(_jobs[jobId]); } public Task InsertAsync(BackgroundJobInfo jobInfo) { jobInfo.Id = Interlocked.Increment(ref _lastId); _jobs[jobInfo.Id] = jobInfo; return Task.FromResult(0); } public Task<List<BackgroundJobInfo>> GetWaitingJobsAsync(int maxResultCount) { var waitingJobs = _jobs.Values .Where(t => !t.IsAbandoned && t.NextTryTime <= Clock.Now) .OrderByDescending(t => t.Priority) .ThenBy(t => t.TryCount) .ThenBy(t => t.NextTryTime) .Take(maxResultCount) .ToList(); return Task.FromResult(waitingJobs); } public Task DeleteAsync(BackgroundJobInfo jobInfo) { if (!_jobs.ContainsKey(jobInfo.Id)) { return Task.FromResult(0); } _jobs.Remove(jobInfo.Id); return Task.FromResult(0); } public Task UpdateAsync(BackgroundJobInfo jobInfo) { if (jobInfo.IsAbandoned) { return DeleteAsync(jobInfo); } return Task.FromResult(0); } } }
mit
C#
4883acbef61dd86afff2b3e1ab486a2943a4fcf0
Update src/Abp/Configuration/Startup/IMultiTenancyConfig.cs
beratcarsi/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,verdentk/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,luchaoshuai/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,ilyhacker/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,ilyhacker/aspnetboilerplate,carldai0106/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ilyhacker/aspnetboilerplate,verdentk/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ryancyq/aspnetboilerplate,carldai0106/aspnetboilerplate,beratcarsi/aspnetboilerplate,ryancyq/aspnetboilerplate,verdentk/aspnetboilerplate
src/Abp/Configuration/Startup/IMultiTenancyConfig.cs
src/Abp/Configuration/Startup/IMultiTenancyConfig.cs
using System.Collections; using Abp.Collections; using Abp.MultiTenancy; namespace Abp.Configuration.Startup { /// <summary> /// Used to configure multi-tenancy. /// </summary> public interface IMultiTenancyConfig { /// <summary> /// Is multi-tenancy enabled? /// Default value: false. /// </summary> bool IsEnabled { get; set; } /// <summary> /// Ignore feature check for host users /// Default value: false. /// </summary> bool IgnoreFeatureCheckForHostUsers { get; set; } /// <summary> /// A list of contributors for tenant resolve process. /// </summary> ITypeList<ITenantResolveContributor> Resolvers { get; } /// <summary> /// TenantId resolve key /// Default value: "Abp.TenantId" /// </summary> string TenantIdResolveKey { get; set; } } }
using System.Collections; using Abp.Collections; using Abp.MultiTenancy; namespace Abp.Configuration.Startup { /// <summary> /// Used to configure multi-tenancy. /// </summary> public interface IMultiTenancyConfig { /// <summary> /// Is multi-tenancy enabled? /// Default value: false. /// </summary> bool IsEnabled { get; set; } /// <summary> /// Ignore feature check for host users /// Default value: false. /// </summary> bool IgnoreFeatureCheckForHostUsers { get; set; } /// <summary> /// A list of contributors for tenant resolve process. /// </summary> ITypeList<ITenantResolveContributor> Resolvers { get; } /// <summary> /// TenantId resolve key, default value is Abp.TenantId /// </summary> string TenantIdResolveKey { get; set; } } }
mit
C#
2cc9326f0b657fb0383633739f98c2dfd1fcd699
Add Clock.SecondsLeftAfterLatestMove
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/ChessVariantsTraining/Models/Variant960/Clock.cs
src/ChessVariantsTraining/Models/Variant960/Clock.cs
using MongoDB.Bson.Serialization.Attributes; using System.Diagnostics; namespace ChessVariantsTraining.Models.Variant960 { public class Clock { double secondsLimit; Stopwatch stopwatch; TimeControl timeControl; [BsonElement("secondsLeftAfterLatestMove")] public double SecondsLeftAfterLatestMove { get; set; } public Clock(TimeControl tc) { timeControl = tc; secondsLimit = tc.InitialSeconds; SecondsLeftAfterLatestMove = secondsLimit; } public void Start() { stopwatch.Start(); } public void Pause() { stopwatch.Stop(); } public void AddIncrement() { secondsLimit += timeControl.Increment; } public void MoveMade() { Pause(); AddIncrement(); SecondsLeftAfterLatestMove = GetSecondsLeft(); } public double GetSecondsLeft() { return secondsLimit - stopwatch.Elapsed.TotalSeconds; } } }
using System.Diagnostics; namespace ChessVariantsTraining.Models.Variant960 { public class Clock { double secondsLimit; Stopwatch stopwatch; TimeControl timeControl; public Clock(TimeControl tc) { timeControl = tc; secondsLimit = tc.InitialSeconds; } public void Start() { stopwatch.Start(); } public void Pause() { stopwatch.Stop(); } public void AddIncrement() { secondsLimit += timeControl.Increment; } public double GetSecondsLeft() { return secondsLimit - stopwatch.Elapsed.TotalSeconds; } } }
agpl-3.0
C#
4102b5857d71cabae340c069d09cb96e2cfe59e4
Make sure multi-line output works when invoked with <<...>> output templates.
JornWildt/ZimmerBot
ZimmerBot.Core/Request.cs
ZimmerBot.Core/Request.cs
using System.Collections.Generic; using CuttingEdge.Conditions; namespace ZimmerBot.Core { public class Request { public enum EventEnum { Welcome } public string Input { get; set; } public Dictionary<string, string> State { get; set; } public string SessionId { get; set; } public string UserId { get; set; } public string RuleId { get; set; } public string RuleLabel { get; set; } public EventEnum? EventType { get; set; } public string BotId { get; set; } public Request() : this("default", "default") { } public Request(string sessionId, string userId) { Condition.Requires(sessionId, nameof(sessionId)).IsNotNullOrEmpty(); Condition.Requires(userId, nameof(userId)).IsNotNullOrEmpty(); SessionId = sessionId; UserId = userId; } public Request(Request src, string input) { Input = input; State = src.State; SessionId = src.SessionId; UserId = src.UserId; RuleId = src.RuleId; RuleLabel = src.RuleLabel; EventType = src.EventType; BotId = src.BotId; } } }
using System.Collections.Generic; using CuttingEdge.Conditions; namespace ZimmerBot.Core { public class Request { public enum EventEnum { Welcome } public string Input { get; set; } public Dictionary<string, string> State { get; set; } public string SessionId { get; set; } public string UserId { get; set; } public string RuleId { get; set; } public string RuleLabel { get; set; } public EventEnum? EventType { get; set; } public string BotId { get; set; } public Request() : this("default", "default") { } public Request(string sessionId, string userId) { Condition.Requires(sessionId, nameof(sessionId)).IsNotNullOrEmpty(); Condition.Requires(userId, nameof(userId)).IsNotNullOrEmpty(); SessionId = sessionId; UserId = userId; } public Request(Request src, string input) { Input = input; State = src.State; SessionId = src.SessionId; UserId = src.UserId; State = src.State; RuleId = src.RuleId; RuleLabel = src.RuleLabel; } } }
mit
C#
fc9aa4cd88eacd1f3f40c7029be79d0a9232c2fa
Make ConsoleHost internals visible to powershell-tests
JamesWTruher/PowerShell-1,PaulHigin/PowerShell,PaulHigin/PowerShell,bingbing8/PowerShell,PaulHigin/PowerShell,KarolKaczmarek/PowerShell,jsoref/PowerShell,kmosher/PowerShell,PaulHigin/PowerShell,bingbing8/PowerShell,kmosher/PowerShell,kmosher/PowerShell,jsoref/PowerShell,kmosher/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,TravisEz13/PowerShell,TravisEz13/PowerShell,TravisEz13/PowerShell,kmosher/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,jsoref/PowerShell,JamesWTruher/PowerShell-1,bmanikm/PowerShell,KarolKaczmarek/PowerShell,JamesWTruher/PowerShell-1,jsoref/PowerShell,bingbing8/PowerShell,bmanikm/PowerShell,jsoref/PowerShell,bmanikm/PowerShell,KarolKaczmarek/PowerShell,bingbing8/PowerShell,KarolKaczmarek/PowerShell,daxian-dbw/PowerShell,daxian-dbw/PowerShell,bingbing8/PowerShell,bmanikm/PowerShell,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1
src/Microsoft.PowerShell.ConsoleHost/AssemblyInfo.cs
src/Microsoft.PowerShell.ConsoleHost/AssemblyInfo.cs
using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; #if !CORECLR using System.Runtime.ConstrainedExecution; using System.Security.Permissions; #endif [assembly:InternalsVisibleTo("powershell-tests")] [assembly:AssemblyCulture("")] [assembly:NeutralResourcesLanguage("en-US")] #if !CORECLR [assembly:AssemblyConfiguration("")] [assembly:AssemblyInformationalVersionAttribute (@"10.0.10011.16384")] [assembly:ReliabilityContractAttribute(Consistency.MayCorruptAppDomain, Cer.MayFail)] [assembly:AssemblyTitle("Microsoft.PowerShell.ConsoleHost")] [assembly:AssemblyDescription("Microsoft Windows PowerShell Console Host")] [assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5")] [assembly:System.Reflection.AssemblyFileVersion("10.0.10011.16384")] [assembly:AssemblyKeyFileAttribute(@"..\signing\visualstudiopublic.snk")] [assembly:System.Reflection.AssemblyDelaySign(true)] #endif [assembly:System.Runtime.InteropServices.ComVisible(false)] [assembly:System.Reflection.AssemblyVersion("3.0.0.0")] [assembly:System.Reflection.AssemblyProduct("Microsoft (R) Windows (R) Operating System")] [assembly:System.Reflection.AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] [assembly:System.Reflection.AssemblyCompany("Microsoft Corporation")] internal static class AssemblyStrings { internal const string AssemblyVersion = @"3.0.0.0"; internal const string AssemblyCopyright = "Copyright (C) 2006 Microsoft Corporation. All rights reserved."; }
using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; #if !CORECLR using System.Runtime.ConstrainedExecution; using System.Security.Permissions; #endif [assembly:AssemblyCulture("")] [assembly:NeutralResourcesLanguage("en-US")] #if !CORECLR [assembly:AssemblyConfiguration("")] [assembly:AssemblyInformationalVersionAttribute (@"10.0.10011.16384")] [assembly:ReliabilityContractAttribute(Consistency.MayCorruptAppDomain, Cer.MayFail)] [assembly:AssemblyTitle("Microsoft.PowerShell.ConsoleHost")] [assembly:AssemblyDescription("Microsoft Windows PowerShell Console Host")] [assembly:System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5")] [assembly:System.Reflection.AssemblyFileVersion("10.0.10011.16384")] [assembly:AssemblyKeyFileAttribute(@"..\signing\visualstudiopublic.snk")] [assembly:System.Reflection.AssemblyDelaySign(true)] #endif [assembly:System.Runtime.InteropServices.ComVisible(false)] [assembly:System.Reflection.AssemblyVersion("3.0.0.0")] [assembly:System.Reflection.AssemblyProduct("Microsoft (R) Windows (R) Operating System")] [assembly:System.Reflection.AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")] [assembly:System.Reflection.AssemblyCompany("Microsoft Corporation")] internal static class AssemblyStrings { internal const string AssemblyVersion = @"3.0.0.0"; internal const string AssemblyCopyright = "Copyright (C) 2006 Microsoft Corporation. All rights reserved."; }
mit
C#
f1192418c70c1bd8db6a8d05b23f6bf7645f5d5e
remove unused dependency on System.Threading.Tasks
biboudis/LambdaMicrobenchmarking
LambdaMicrobenchmarking/Script.cs
LambdaMicrobenchmarking/Script.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace LambdaMicrobenchmarking { public static class Script { public static Script<T> Of<T>(params Tuple<String, Func<T>>[] actions) { return Script<T>.Of(actions); } public static Script<T> Of<T>(String name, Func<T> action) { return Of(Tuple.Create(name, action)); } } public class Script<T> { static public int Iterations { get { return Run<T>.iterations; } set { Run<T>.iterations = value; } } static public int WarmupIterations { get { return Run<T>.warmups; } set { Run<T>.warmups = value; } } public static double MinRunningSecs { get { return Run<T>.minimumSecs; } set { Run<T>.minimumSecs = value; } } private List<Tuple<String, Func<T>>> actions { get; set; } private Script(params Tuple<String, Func<T>>[] actions) { this.actions = actions.ToList(); } public static Script<T> Of(params Tuple<String, Func<T>>[] actions) { return new Script<T>(actions); } public Script<T> Of(String name, Func<T> action) { actions.Add(Tuple.Create(name,action)); return this; } public Script<T> WithHead() { Console.WriteLine(Run<T>.FORMAT, "Benchmark", "Mean", "Mean-Error", "Sdev", "Unit", "Count"); return this; } public Script<T> RunAll() { actions.Select(action => new Run<T>(action)).ToList().ForEach(run => run.Measure()); return this; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace LambdaMicrobenchmarking { public static class Script { public static Script<T> Of<T>(params Tuple<String, Func<T>>[] actions) { return Script<T>.Of(actions); } public static Script<T> Of<T>(String name, Func<T> action) { return Of(Tuple.Create(name, action)); } } public class Script<T> { static public int Iterations { get { return Run<T>.iterations; } set { Run<T>.iterations = value; } } static public int WarmupIterations { get { return Run<T>.warmups; } set { Run<T>.warmups = value; } } public static double MinRunningSecs { get { return Run<T>.minimumSecs; } set { Run<T>.minimumSecs = value; } } private List<Tuple<String, Func<T>>> actions { get; set; } private Script(params Tuple<String, Func<T>>[] actions) { this.actions = actions.ToList(); } public static Script<T> Of(params Tuple<String, Func<T>>[] actions) { return new Script<T>(actions); } public Script<T> Of(String name, Func<T> action) { actions.Add(Tuple.Create(name,action)); return this; } public Script<T> WithHead() { Console.WriteLine(Run<T>.FORMAT, "Benchmark", "Mean", "Mean-Error", "Sdev", "Unit", "Count"); return this; } public Script<T> RunAll() { actions.Select(action => new Run<T>(action)).ToList().ForEach(run => run.Measure()); return this; } } }
apache-2.0
C#
168baae3d25bf647a61056aa762e6b3c581869b6
update storage size and limit peck
ASOS/woodpecker
src/Woodpecker.Core/Sql/AzureSqlStorageSizePecker.cs
src/Woodpecker.Core/Sql/AzureSqlStorageSizePecker.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Woodpecker.Core.Sql { public class AzureSqlStorageSizePecker : AzureSqlDmvPeckerBase { private const string _query = @" select @@servername [collection_server_name] , db_name() [collection_database_name]      , getutcdate() [collection_time_utc]        , df.file_id  , df.type_desc [file_type_desc] , convert(bigint, df.size) *8 [size_kb] , convert(bigint, df.max_size) *8 [max_size_kb] from sys.database_files df;"; protected override string GetQuery() { return _query; } protected override IEnumerable<string> GetRowKeyFieldNames() { return new[] { "collection_server_name", "collection_database_name", "file_id" }; } protected override string GetUtcTimestampFieldName() { return "collection_time_utc"; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Woodpecker.Core.Sql { public class AzureSqlStorageSizePecker : AzureSqlDmvPeckerBase { private const string DatabaseWaitInlineSqlNotSoBad = @"select @@servername [server_name] -- varchar(128) , db_name() [database_name] -- varchar(128) , db_id() [database_id] -- int , getutcdate() [collection_time_utc]                -- datetime , df.file_id -- int , df.type_desc [file_type_desc] -- varchar(60) , convert(bigint, df.size) *8 [size_kb] -- bigint , convert(bigint, df.max_size) *8 [max_size_kb] -- bigint from sys.database_files df; "; protected override string GetQuery() { return DatabaseWaitInlineSqlNotSoBad; } protected override IEnumerable<string> GetRowKeyFieldNames() { return new[] { "server_name", "database_name", "file_id"}; } protected override string GetUtcTimestampFieldName() { return "collection_time_utc"; } } }
mit
C#
d87c31ee01abb55c97a043c43d95a81f7d5f4368
Use PredefinedErrorTypeNames instead of literals
modulexcite/DartVS,DartVS/DartVS,DartVS/DartVS,modulexcite/DartVS,DartVS/DartVS,modulexcite/DartVS
DanTup.DartVS.Vsix/Taggers/ErrorSquiggleTagger.cs
DanTup.DartVS.Vsix/Taggers/ErrorSquiggleTagger.cs
using System; using System.ComponentModel.Composition; using System.Linq; using System.Reactive.Linq; using DanTup.DartAnalysis; using DanTup.DartAnalysis.Json; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Adornments; using Microsoft.VisualStudio.Text.Tagging; using Microsoft.VisualStudio.Utilities; namespace DanTup.DartVS { [Export(typeof(ITaggerProvider))] [ContentType(DartContentTypeDefinition.DartContentType)] [TagType(typeof(ErrorTag))] internal sealed class ErrorSquiggleTagProvider : ITaggerProvider { [Import] ITextDocumentFactoryService textDocumentFactory = null; [Import] DartAnalysisService analysisService = null; public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag { return new ErrorSquiggleTagger(buffer, textDocumentFactory, analysisService) as ITagger<T>; } } class ErrorSquiggleTagger : AnalysisNotificationTagger<ErrorTag, AnalysisError, AnalysisErrorsNotification> { public ErrorSquiggleTagger(ITextBuffer buffer, ITextDocumentFactoryService textDocumentFactory, DartAnalysisService analysisService) : base(buffer, textDocumentFactory, analysisService) { this.Subscribe(); } protected override ITagSpan<ErrorTag> CreateTag(AnalysisError error) { // syntax error: red // compiler error: blue // other error: purple // warning: red var squiggleType = error.Severity == AnalysisErrorSeverity.Error ? PredefinedErrorTypeNames.SyntaxError : error.Severity == AnalysisErrorSeverity.Warning ? PredefinedErrorTypeNames.CompilerError : PredefinedErrorTypeNames.OtherError; return new TagSpan<ErrorTag>(new SnapshotSpan(buffer.CurrentSnapshot, error.Location.Offset, error.Location.Length), new ErrorTag(squiggleType, error.Message)); } protected override IDisposable Subscribe(Action<AnalysisErrorsNotification> updateSourceData) { return this.analysisService.AnalysisErrorsNotification.Where(en => en.File == textDocument.FilePath).Subscribe(updateSourceData); } protected override AnalysisError[] GetDataToTag(AnalysisErrorsNotification notification) { return notification.Errors.Where(e => e.Location.File == textDocument.FilePath).ToArray(); } protected override Tuple<int, int> GetOffsetAndLength(AnalysisError data) { return Tuple.Create(data.Location.Offset, data.Location.Length); } } }
using System; using System.ComponentModel.Composition; using System.Linq; using System.Reactive.Linq; using DanTup.DartAnalysis; using DanTup.DartAnalysis.Json; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Text.Tagging; using Microsoft.VisualStudio.Utilities; namespace DanTup.DartVS { [Export(typeof(ITaggerProvider))] [ContentType(DartContentTypeDefinition.DartContentType)] [TagType(typeof(ErrorTag))] internal sealed class ErrorSquiggleTagProvider : ITaggerProvider { [Import] ITextDocumentFactoryService textDocumentFactory = null; [Import] DartAnalysisService analysisService = null; public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag { return new ErrorSquiggleTagger(buffer, textDocumentFactory, analysisService) as ITagger<T>; } } class ErrorSquiggleTagger : AnalysisNotificationTagger<ErrorTag, AnalysisError, AnalysisErrorsNotification> { public ErrorSquiggleTagger(ITextBuffer buffer, ITextDocumentFactoryService textDocumentFactory, DartAnalysisService analysisService) : base(buffer, textDocumentFactory, analysisService) { this.Subscribe(); } protected override ITagSpan<ErrorTag> CreateTag(AnalysisError error) { // syntax error: red // compiler error: blue // other error: purple // warning: red var squiggleType = error.Severity == AnalysisErrorSeverity.Error ? "syntax error" : error.Severity == AnalysisErrorSeverity.Warning ? "compiler error" : "other error"; return new TagSpan<ErrorTag>(new SnapshotSpan(buffer.CurrentSnapshot, error.Location.Offset, error.Location.Length), new ErrorTag(squiggleType, error.Message)); } protected override IDisposable Subscribe(Action<AnalysisErrorsNotification> updateSourceData) { return this.analysisService.AnalysisErrorsNotification.Where(en => en.File == textDocument.FilePath).Subscribe(updateSourceData); } protected override AnalysisError[] GetDataToTag(AnalysisErrorsNotification notification) { return notification.Errors.Where(e => e.Location.File == textDocument.FilePath).ToArray(); } protected override Tuple<int, int> GetOffsetAndLength(AnalysisError data) { return Tuple.Create(data.Location.Offset, data.Location.Length); } } }
mit
C#
aef22f3fd61183a5b7c270d631b204a737965dda
Make minor version a constant
paladique/nodejstools,lukedgr/nodejstools,kant2002/nodejstools,paladique/nodejstools,munyirik/nodejstools,paulvanbrenk/nodejstools,mjbvz/nodejstools,paladique/nodejstools,AustinHull/nodejstools,lukedgr/nodejstools,munyirik/nodejstools,Microsoft/nodejstools,munyirik/nodejstools,mjbvz/nodejstools,paulvanbrenk/nodejstools,kant2002/nodejstools,kant2002/nodejstools,kant2002/nodejstools,Microsoft/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,AustinHull/nodejstools,kant2002/nodejstools,paladique/nodejstools,paulvanbrenk/nodejstools,lukedgr/nodejstools,Microsoft/nodejstools,AustinHull/nodejstools,paulvanbrenk/nodejstools,munyirik/nodejstools,paladique/nodejstools,mjbvz/nodejstools,Microsoft/nodejstools,mjbvz/nodejstools,lukedgr/nodejstools,munyirik/nodejstools,AustinHull/nodejstools,AustinHull/nodejstools,paulvanbrenk/nodejstools,Microsoft/nodejstools
Nodejs/Product/AssemblyVersion.cs
Nodejs/Product/AssemblyVersion.cs
//*********************************************************// // Copyright (c) Microsoft. All rights reserved. // // Apache 2.0 License // // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or // implied. See the License for the specific language governing // permissions and limitations under the License. // //*********************************************************// using System.Reflection; // If you get compiler errors CS0579, "Duplicate '<attributename>' attribute", check your // Properties\AssemblyInfo.cs file and remove any lines duplicating the ones below. // (See also AssemblyInfoCommon.cs in this same directory.) #if !SUPPRESS_COMMON_ASSEMBLY_VERSION [assembly: AssemblyVersion(AssemblyVersionInfo.StableVersion)] #endif [assembly: AssemblyFileVersion(AssemblyVersionInfo.Version)] class AssemblyVersionInfo { // This version string (and the comment for StableVersion) should be // updated manually between major releases (e.g. from 1.0 to 2.0). // Servicing branches and minor releases should retain the value. public const string ReleaseVersion = "1.0"; // This version string (and the comment for Version) should be updated // manually between minor releases (e.g. from 1.0 to 1.1). // Servicing branches and prereleases should retain the value. public const string FileVersion = "1.2"; // This version should never change from "4100.00"; BuildRelease.ps1 // will replace it with a generated value. public const string BuildNumber = "4100.00"; #if DEV14 public const string VSMajorVersion = "14"; const string VSVersionSuffix = "2015"; #elif DEV15 public const string VSMajorVersion = "15"; const string VSVersionSuffix = "15"; #else #error Unrecognized VS Version. #endif public const string VSVersion = VSMajorVersion + ".0"; // Defaults to "1.0.0.(2012|2013|2015)" public const string StableVersion = ReleaseVersion + ".0." + VSVersionSuffix; // Defaults to "1.2.4100.00" public const string Version = FileVersion + "." + BuildNumber; }
//*********************************************************// // Copyright (c) Microsoft. All rights reserved. // // Apache 2.0 License // // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or // implied. See the License for the specific language governing // permissions and limitations under the License. // //*********************************************************// using System.Reflection; // If you get compiler errors CS0579, "Duplicate '<attributename>' attribute", check your // Properties\AssemblyInfo.cs file and remove any lines duplicating the ones below. // (See also AssemblyInfoCommon.cs in this same directory.) #if !SUPPRESS_COMMON_ASSEMBLY_VERSION [assembly: AssemblyVersion(AssemblyVersionInfo.StableVersion)] #endif [assembly: AssemblyFileVersion(AssemblyVersionInfo.Version)] class AssemblyVersionInfo { // This version string (and the comment for StableVersion) should be // updated manually between major releases (e.g. from 1.0 to 2.0). // Servicing branches and minor releases should retain the value. public const string ReleaseVersion = "1.0"; // This version string (and the comment for StableVersion) should be // updated manually between minor releases. // Servicing branches should retain the value public const string MinorVersion = "0"; // This version string (and the comment for Version) should be updated // manually between minor releases (e.g. from 1.0 to 1.1). // Servicing branches and prereleases should retain the value. public const string FileVersion = "1.2"; // This version should never change from "4100.00"; BuildRelease.ps1 // will replace it with a generated value. public const string BuildNumber = "4100.00"; #if DEV14 public const string VSMajorVersion = "14"; const string VSVersionSuffix = "2015"; #elif DEV15 public const string VSMajorVersion = "15"; const string VSVersionSuffix = "15"; #else #error Unrecognized VS Version. #endif public const string VSVersion = VSMajorVersion + ".0"; // Defaults to "1.0.0.(2012|2013|2015)" public const string StableVersion = ReleaseVersion + "." + MinorVersion + "." + VSVersionSuffix; // Defaults to "1.2.4100.00" public const string Version = FileVersion + "." + BuildNumber; }
apache-2.0
C#
9bf9c6b2871d7ff710063d4056d6da5563c4117b
Fix : Un-Stealth rogues for this quest otherwise the mobs arent aggroed.
TheNoobCompany/LevelingQuestsTNB
Profiles/Quester/Scripts/11661.cs
Profiles/Quester/Scripts/11661.cs
WoWUnit unit = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.Entry, questObjective.IsDead), questObjective.IgnoreNotSelectable, questObjective.IgnoreBlackList, questObjective.AllowPlayerControlled); ObjectManager.Me.UnitAura(115191).TryCancel(); //Remove Stealth from rogue if (unit.IsValid && unit.Position.DistanceTo(questObjective.Position) <=8) { MovementManager.Face(unit); Interact.InteractWith(unit.GetBaseAddress); nManager.Wow.Helpers.Fight.StartFight(unit.Guid); } else { List<Point> liste = new List<Point>(); liste.Add(ObjectManager.Me.Position); liste.Add(questObjective.Position); MovementManager.Go(liste); }
WoWUnit unit = ObjectManager.GetNearestWoWUnit(ObjectManager.GetWoWUnitByEntry(questObjective.Entry, questObjective.IsDead), questObjective.IgnoreNotSelectable, questObjective.IgnoreBlackList, questObjective.AllowPlayerControlled); if (unit.IsValid && unit.Position.DistanceTo(questObjective.Position) <=8) { MovementManager.Face(unit); Interact.InteractWith(unit.GetBaseAddress); nManager.Wow.Helpers.Fight.StartFight(unit.Guid); } else { List<Point> liste = new List<Point>(); liste.Add(ObjectManager.Me.Position); liste.Add(questObjective.Position); MovementManager.Go(liste); }
mit
C#
6b3c88e1488e28255890ef6eb488deb85586c5f2
change measuring method.
Codeer-Software/LambdicSql
Project/Performance/SelectTime.cs
Project/Performance/SelectTime.cs
using Dapper; using LambdicSql; using LambdicSql.SqlServer; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Diagnostics; using System.Linq; using System.Windows.Forms; namespace Performance { class TableValues { public int IntVal { get; set; } public float FloatVal { get; set; } public double DoubleVal { get; set; } public decimal DecimalVal { get; set; } public string StringVal { get; set; } } class DB { public TableValues TableValues { get; set; } } [TestClass] public class SelectTime { [TestMethod] public void CheckLambdicSql() { var adaptor = new SqlServerAdapter(TestEnvironment.ConnectionString); var times = new List<long>(); for (int i = 0; i < 10; i++) { Stopwatch watch = new Stopwatch(); watch.Start(); var datas = Sql.Query<DB>().SelectFrom(db => db.TableValues).ToExecutor(adaptor).Read().ToList(); watch.Stop(); times.Add(watch.ElapsedMilliseconds); } MessageBox.Show(string.Join(Environment.NewLine, times.Select(e=>e.ToString())) + Environment.NewLine + times.Average().ToString()); } [TestMethod] public void CheckDapper() { using (var connection = new SqlConnection(TestEnvironment.ConnectionString)) { var times = new List<long>(); for (int i = 0; i < 10; i++) { Stopwatch watch = new Stopwatch(); watch.Start(); var datas = connection.Query<TableValues>("select IntVal, FloatVal, DoubleVal, DecimalVal, StringVal from TableValues;").ToList(); watch.Stop(); times.Add(watch.ElapsedMilliseconds); } MessageBox.Show(string.Join(Environment.NewLine, times.Select(e => e.ToString())) + Environment.NewLine + times.Average().ToString()); } } } }
using Dapper; using LambdicSql; using LambdicSql.SqlServer; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Diagnostics; using System.Linq; using System.Windows.Forms; namespace Performance { class TableValues { public int IntVal { get; set; } public float FloatVal { get; set; } public double DoubleVal { get; set; } public decimal DecimalVal { get; set; } public string StringVal { get; set; } } class DB { public TableValues TableValues { get; set; } } [TestClass] public class SelectTime { [TestMethod] public void CheckLambdicSql() { var executor = Sql.Query<DB>().SelectFrom(db => db.TableValues).ToExecutor(new SqlServerAdapter(TestEnvironment.ConnectionString)); var times = new List<long>(); for (int i = 0; i < 10; i++) { Stopwatch watch = new Stopwatch(); watch.Start(); var datas = executor.Read().ToList(); watch.Stop(); times.Add(watch.ElapsedMilliseconds); } MessageBox.Show(string.Join(Environment.NewLine, times.Select(e=>e.ToString())) + Environment.NewLine + times.Average().ToString()); } [TestMethod] public void CheckDapper() { using (var connection = new SqlConnection(TestEnvironment.ConnectionString)) { var times = new List<long>(); for (int i = 0; i < 10; i++) { Stopwatch watch = new Stopwatch(); watch.Start(); var datas = connection.Query<TableValues>("select IntVal, FloatVal, DoubleVal, DecimalVal, StringVal from TableValues;").ToList(); watch.Stop(); times.Add(watch.ElapsedMilliseconds); } MessageBox.Show(string.Join(Environment.NewLine, times.Select(e => e.ToString())) + Environment.NewLine + times.Average().ToString()); } } } }
mit
C#
bfe837d00f70c2787e42318b712a16e546aba9c5
Build script now creates individual zip file packages to align with the NuGet packages and semantic versioning.
autofac/Autofac.Extras.AttributeMetadata
Properties/VersionAssemblyInfo.cs
Properties/VersionAssemblyInfo.cs
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18033 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyConfiguration("Release built on 2013-02-28 02:03")] [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
//------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:4.0.30319.18033 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ using System; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")] [assembly: AssemblyConfiguration("Release built on 2013-02-22 14:39")] [assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
mit
C#
71ef2ebd4f155cace5712b1f2e6d527142706145
Refactor KeyHelper
danielchalmers/SteamAccountSwitcher
SteamAccountSwitcher/KeyHelper.cs
SteamAccountSwitcher/KeyHelper.cs
using System.Windows.Input; namespace SteamAccountSwitcher { internal static class KeyHelper { public static int KeyToInt(Key key) { switch (key) { case Key.D1: return 1; case Key.D2: return 2; case Key.D3: return 3; case Key.D4: return 4; case Key.D5: return 5; case Key.D6: return 6; case Key.D7: return 7; case Key.D8: return 8; case Key.D9: return 9; case Key.D0: return 10; } return 0; } } }
using System.Windows.Input; namespace SteamAccountSwitcher { internal static class KeyHelper { public static int KeyToInt(Key key) { var num = 0; switch (key) { case Key.D1: num = 1; break; case Key.D2: num = 2; break; case Key.D3: num = 3; break; case Key.D4: num = 4; break; case Key.D5: num = 5; break; case Key.D6: num = 6; break; case Key.D7: num = 7; break; case Key.D8: num = 8; break; case Key.D9: num = 9; break; case Key.D0: num = 10; break; } return num; } } }
mit
C#
fdb7d6e5f40b5c86d6e3b597132663f27fdedbd7
bump version
RainwayApp/warden
Warden/Properties/AssemblyInfo.cs
Warden/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Warden.NET")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rainway, Inc.")] [assembly: AssemblyProduct("Warden.NET")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("69bd1ac4-362a-41d0-8e84-a76064d90b4b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("3.0.0.0")] [assembly: AssemblyFileVersion("3.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Warden.NET")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rainway, Inc.")] [assembly: AssemblyProduct("Warden.NET")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("69bd1ac4-362a-41d0-8e84-a76064d90b4b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.1.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")]
apache-2.0
C#
2517146d62b1e6cea55d5ac83b84cd14d2a9710e
Correct home member
alvachien/achihapi
src/hihapi/Controllers/Home/HomeMembersController.cs
src/hihapi/Controllers/Home/HomeMembersController.cs
using System; using System.Linq; using System.IO; using System.Collections.Generic; using Microsoft.AspNetCore.OData.Routing.Controllers; using Microsoft.AspNetCore.OData.Query; using Microsoft.AspNetCore.OData.Results; using Microsoft.AspNetCore.OData.Formatter; using Microsoft.EntityFrameworkCore; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using hihapi.Models; using Microsoft.AspNetCore.Authorization; namespace hihapi.Controllers { public class HomeMembersController : ODataController { private readonly hihDataContext _context; public HomeMembersController(hihDataContext context) { _context = context; } /// GET: /HomeMembers /// <summary> /// Adds support for getting home member, for example: /// /// GET /HomeMembers /// GET /HomeMembers?$filter=Host eq 'abc' /// GET /HomeMembers? /// /// <remarks> [EnableQuery] [Authorize] public IQueryable<HomeMember> Get() { return _context.HomeMembers; } } }
using System; using System.Linq; using System.IO; using System.Collections.Generic; using Microsoft.AspNetCore.OData.Routing.Controllers; using Microsoft.AspNetCore.OData.Query; using Microsoft.AspNetCore.OData.Results; using Microsoft.AspNetCore.OData.Formatter; using Microsoft.EntityFrameworkCore; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using hihapi.Models; using Microsoft.AspNetCore.Authorization; namespace hihapi.Controllers { public class HomeMembersController : ODataController { private readonly hihDataContext _context; public HomeMembersController(hihDataContext context) { _context = context; } /// GET: /HomeMembers /// <summary> /// Adds support for getting home member, for example: /// /// GET /HomeMembers /// GET /HomeMembers?$filter=Host eq 'abc' /// GET /HomeMembers? /// /// <remarks> [EnableQuery] [Authorize] public IQueryable<HomeDefine> Get() { return _context.HomeDefines; } } }
mit
C#
1b0b0e01cf2e5c1f3751fb6b19be7f2808bf1e69
Change indent to 2 spaces
12joan/hangman
hangman.cs
hangman.cs
using System; namespace Hangman { public class Hangman { public static void Main(string[] args) { // char key = Console.ReadKey(true).KeyChar; // var game = new Game("HANG THE MAN"); // bool wasCorrect = game.GuessLetter(key); // Console.WriteLine(wasCorrect.ToString()); // var output = game.ShownWord(); // Console.WriteLine(output); var table = new Table( Console.WindowWidth, // width 2 // spacing ); var output = table.Draw(); Console.WriteLine(output); } } }
using System; namespace Hangman { public class Hangman { public static void Main(string[] args) { // char key = Console.ReadKey(true).KeyChar; // var game = new Game("HANG THE MAN"); // bool wasCorrect = game.GuessLetter(key); // Console.WriteLine(wasCorrect.ToString()); // var output = game.ShownWord(); // Console.WriteLine(output); var table = new Table( Console.WindowWidth, // width 2 // spacing ); var output = table.Draw(); Console.WriteLine(output); } } }
unlicense
C#
c8beb9a949e44304afcb1c5a0332cd9bc0cc76a4
Fix Russian comment
IEVin/PropertyChangedNotificator
src/Core/Properties/AssemblyInfo.cs
src/Core/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Core")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6a968165-a5a8-46cd-b3ac-ccabdc718d28")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // Управление общими сведениями о сборке осуществляется с помощью // набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения, // связанные со сборкой. [assembly: AssemblyTitle("Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Core")] [assembly: AssemblyCopyright("Copyright © 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Параметр ComVisible со значением FALSE делает типы в сборке невидимыми // для COM-компонентов. Если требуется обратиться к типу в этой сборке через // COM, задайте атрибуту ComVisible значение TRUE для этого типа. [assembly: ComVisible(false)] // Следующий GUID служит для идентификации библиотеки типов, если этот проект будет видимым для COM [assembly: Guid("6a968165-a5a8-46cd-b3ac-ccabdc718d28")] // Сведения о версии сборки состоят из следующих четырех значений: // // Основной номер версии // Дополнительный номер версии // Номер построения // Редакция // // Можно задать все значения или принять номер построения и номер редакции по умолчанию, // используя "*", как показано ниже: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
ecaf050b609a7dbf10d6b6c33ab9059a15384fdb
Modify translation instructions page per request
BloomBooks/PhotoStoryToBloomConverter,BloomBooks/PhotoStoryToBloomConverter
PhotoStoryToBloomConverter/SpAppMetadata.cs
PhotoStoryToBloomConverter/SpAppMetadata.cs
using System.Collections.Generic; using System.ComponentModel; using System.Text; using PhotoStoryToBloomConverter.Utilities; namespace PhotoStoryToBloomConverter { public enum SpAppMetadataGraphic { [Description("gray-background")] GrayBackground, [Description("front-cover-graphic")] FrontCoverGraphic } public class SpAppMetadata { public SpAppMetadataGraphic Graphic { get; set; } public string ScriptureReference { get; set; } public string TitleIdeasHeading { get; set; } public List<string> TitleIdeas { get; } private const string kIntro = "CONTENT FOR THE TITLE SLIDE (slide #0) in SP APP"; private const string kInstructions = @"INSTRUCTIONS: After ""Graphic="" type either ""gray-background"" or ""front-cover-picture"" in English to indicate your choice for the title slide image. After ""ScriptureReference="" type a Scripture reference or a subtitle for your story in the LWC. After ""TitleIdeasHeading="" type something like ""Ideas for the story title:"" in the LWC. After ""TitleIdea1="" type a sample title in the LWC. (Always complete this line providing a title example.) After ""TitleIdea2="" type another sample title in the LWC. (Or leave this line blank.) After ""TitleIdea3="" type another sample title in the LWC. (Or leave this line blank.)"; public SpAppMetadata(string scriptureReference, string titleIdeasHeading, List<string> titleIdeas) { ScriptureReference = scriptureReference; TitleIdeasHeading = titleIdeasHeading; TitleIdeas = titleIdeas; } public string EnsureOneLine(string possibleMultiLine) { return string.Join("; ", possibleMultiLine.Split('\n')); } public override string ToString() { var sb = new StringBuilder($"{kIntro}\n\n" + $"Graphic={Graphic.ToDescriptionString()}\n" + $"ScriptureReference ={EnsureOneLine(ScriptureReference) }\n" + $"TitleIdeasHeading ={TitleIdeasHeading}" ); for (int i = 0; i < TitleIdeas.Count; i++) sb.Append($"\nTitleIdea{i + 1}={TitleIdeas[i]}"); sb.Append("\n\n"); sb.Append(kInstructions); return sb.ToString(); } } }
using System.Collections.Generic; using System.ComponentModel; using System.Text; using PhotoStoryToBloomConverter.Utilities; namespace PhotoStoryToBloomConverter { public enum SpAppMetadataGraphic { [Description("gray-background")] GrayBackground, [Description("front-cover-graphic")] FrontCoverGraphic } public class SpAppMetadata { public SpAppMetadataGraphic Graphic { get; set; } public string ScriptureReference { get; set; } public string TitleIdeasHeading { get; set; } public List<string> TitleIdeas { get; } private const string kIntro = "Video Title Slide Content"; public SpAppMetadata(string scriptureReference, string titleIdeasHeading, List<string> titleIdeas) { ScriptureReference = scriptureReference; TitleIdeasHeading = titleIdeasHeading; TitleIdeas = titleIdeas; } public string EnsureOneLine(string possibleMultiLine) { return string.Join("; ", possibleMultiLine.Split('\n')); } public override string ToString() { var sb = new StringBuilder($"{kIntro}\n" + $"Graphic={Graphic.ToDescriptionString()}\n" + $"ScriptureReference ={EnsureOneLine(ScriptureReference) }\n" + $"TitleIdeasHeading ={TitleIdeasHeading}" ); for (int i = 0; i < TitleIdeas.Count; i++) sb.Append($"\nTitleIdea{i + 1}={TitleIdeas[i]}"); return sb.ToString(); } } }
mit
C#
fb65aa332bced912b27438d6e2677a52c06ec996
use max camera positions instead of last character position
virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,virtuoushub/game-off-2016,virtuoushub/game-off-2016,whoa-algebraic/game-off-2016,whoa-algebraic/game-off-2016
Assets/Scripts/CameraFollowPlayer.cs
Assets/Scripts/CameraFollowPlayer.cs
using UnityEngine; using System.Collections; public class CameraFollowPlayer : MonoBehaviour { public Transform PlayerCharacter; public float horizontalEdgeBuffer; public float verticalEdgeBuffer; private int mapTileHorizontalUnits = 4; private int mapTileVerticalUnits = 2; private float unitSize = 5; private float maxLeft; private float maxRight; private float maxTop; private float maxBottom; void Start() { maxLeft = mapTileHorizontalUnits * (unitSize * -1f) + horizontalEdgeBuffer; maxRight = mapTileHorizontalUnits * unitSize - horizontalEdgeBuffer; maxTop = mapTileVerticalUnits * unitSize - verticalEdgeBuffer; maxBottom = mapTileVerticalUnits * (unitSize * -1f) + verticalEdgeBuffer; } void Update () { float playerX = PlayerCharacter.position.x; float playerY = PlayerCharacter.position.y; if(playerX < maxLeft) { playerX = maxLeft; } if(playerX > maxRight) { playerX = maxRight; } if(playerY < maxBottom) { playerY = maxBottom; } if(playerY > maxTop) { playerY = maxTop; } Vector3 newPosition = new Vector3(playerX, playerY, -10); transform.position = newPosition; } }
using UnityEngine; using System.Collections; public class CameraFollowPlayer : MonoBehaviour { public Transform PlayerCharacter; public float horizontalEdgeBuffer; public float verticalEdgeBuffer; private int mapTileHorizontalUnits = 4; private int mapTileVerticalUnits = 2; private float unitSize = 5; private float maxLeft; private float maxRight; private float maxTop; private float maxBottom; private Vector3 lastPosition; void Start() { maxLeft = mapTileHorizontalUnits * (unitSize * -1f) + horizontalEdgeBuffer; maxRight = mapTileHorizontalUnits * unitSize - horizontalEdgeBuffer; maxTop = mapTileVerticalUnits * unitSize - verticalEdgeBuffer; maxBottom = mapTileVerticalUnits * (unitSize * -1f) + verticalEdgeBuffer; } void Update () { float playerX = PlayerCharacter.position.x; float playerY = PlayerCharacter.position.y; Vector3 newPosition = new Vector3(lastPosition.x, lastPosition.y, -10); if(playerX >= maxLeft && playerX <= maxRight) { newPosition.x = playerX; } if(playerY >= maxBottom && playerY <= maxTop) { newPosition.y = playerY; } transform.position = newPosition; lastPosition = newPosition; } }
mit
C#
6d91c0f375369c182312bfde644cae26443339a9
Resolve inspection issue
ppy/osu,ppy/osu,peppy/osu,ppy/osu,peppy/osu,peppy/osu
osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs
osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Difficulty.Evaluators; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using System.Collections.Generic; using System.Linq; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { /// <summary> /// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit. /// </summary> public class Speed : OsuStrainSkill { private double skillMultiplier => 1375; private double strainDecayBase => 0.3; private double currentStrain; private double currentRhythm; protected override int ReducedSectionCount => 5; protected override double DifficultyMultiplier => 1.04; private readonly double greatWindow; private readonly List<double> objectStrains = new List<double>(); public Speed(Mod[] mods, double hitWindowGreat) : base(mods) { greatWindow = hitWindowGreat; } private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime); protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime); currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier; currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow); double totalStrain = currentStrain * currentRhythm; objectStrains.Add(totalStrain); return totalStrain; } public double RelevantNoteCount() { if (objectStrains.Count == 0) return 0; double maxStrain = objectStrains.Max(); if (maxStrain == 0) return 0; return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0))))); } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Difficulty.Evaluators; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; using System.Collections.Generic; using System.Linq; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { /// <summary> /// Represents the skill required to press keys with regards to keeping up with the speed at which objects need to be hit. /// </summary> public class Speed : OsuStrainSkill { private double skillMultiplier => 1375; private double strainDecayBase => 0.3; private double currentStrain; private double currentRhythm; protected override int ReducedSectionCount => 5; protected override double DifficultyMultiplier => 1.04; private readonly double greatWindow; private List<double> objectStrains = new List<double>(); public Speed(Mod[] mods, double hitWindowGreat) : base(mods) { greatWindow = hitWindowGreat; } private double strainDecay(double ms) => Math.Pow(strainDecayBase, ms / 1000); protected override double CalculateInitialStrain(double time, DifficultyHitObject current) => (currentStrain * currentRhythm) * strainDecay(time - current.Previous(0).StartTime); protected override double StrainValueAt(DifficultyHitObject current) { currentStrain *= strainDecay(((OsuDifficultyHitObject)current).StrainTime); currentStrain += SpeedEvaluator.EvaluateDifficultyOf(current, greatWindow) * skillMultiplier; currentRhythm = RhythmEvaluator.EvaluateDifficultyOf(current, greatWindow); double totalStrain = currentStrain * currentRhythm; objectStrains.Add(totalStrain); return totalStrain; } public double RelevantNoteCount() { if (objectStrains.Count == 0) return 0; double maxStrain = objectStrains.Max(); if (maxStrain == 0) return 0; return objectStrains.Aggregate((total, next) => total + (1.0 / (1.0 + Math.Exp(-(next / maxStrain * 12.0 - 6.0))))); } } }
mit
C#
7756e6a7591f2644ed91eca805d4dbb4efbcf31b
Update IEventTelemeter.cs
tiksn/TIKSN-Framework
TIKSN.Core/Analytics/Telemetry/IEventTelemeter.cs
TIKSN.Core/Analytics/Telemetry/IEventTelemeter.cs
using System.Collections.Generic; using System.Threading.Tasks; namespace TIKSN.Analytics.Telemetry { public interface IEventTelemeter { Task TrackEventAsync(string name); Task TrackEventAsync(string name, IDictionary<string, string> properties); } }
using System.Collections.Generic; using System.Threading.Tasks; namespace TIKSN.Analytics.Telemetry { public interface IEventTelemeter { Task TrackEvent(string name); Task TrackEvent(string name, IDictionary<string, string> properties); } }
mit
C#
0ea6e3a9c2477ae09173202fb0e66f70d15cd232
make the sequence add method null safe.
signumsoftware/framework,signumsoftware/framework,avifatal/framework,AlejandroCano/framework,AlejandroCano/framework,avifatal/framework
Signum.Utilities/DataStructures/Sequence.cs
Signum.Utilities/DataStructures/Sequence.cs
using System.Collections.Generic; namespace Signum.Utilities.DataStructures { public class Sequence<T> : List<T> { public void Add(IEnumerable<T> collection) { if (collection != null) { AddRange(collection); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Signum.Utilities.DataStructures { public class Sequence<T> : List<T> { public void Add(IEnumerable<T> collection) { AddRange(collection); } } }
mit
C#
268d1461e786b7e5d5c05916ad4c315f9d71a4b7
update version
prodot/ReCommended-Extension
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
using System.Reflection; using ReCommendedExtension; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("3.5.1.0")] [assembly: AssemblyFileVersion("3.5.1")]
using System.Reflection; using ReCommendedExtension; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2019 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("3.5.0.0")] [assembly: AssemblyFileVersion("3.5.0")]
apache-2.0
C#
a1d0a9c2b014d384543a9ec2db3de9568e25bfd4
Add containing type names (for nested classes)
ulrichb/Roflcopter,ulrichb/Roflcopter
Src/Roflcopter.Plugin/ShortNameTypeMemberFqnProvider.cs
Src/Roflcopter.Plugin/ShortNameTypeMemberFqnProvider.cs
using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using JetBrains.Application.DataContext; using JetBrains.ProjectModel; using JetBrains.ReSharper.Features.Environment.CopyFqn; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.DataContext; using JetBrains.UI.Avalon.TreeListView; namespace Roflcopter.Plugin { /// <summary> /// A provider for <see cref="CopyFqnAction"/> which returns <c>[type name].[member]</c>. /// </summary> [SolutionComponent] public class ShortNameTypeMemberFqnProvider : IFqnProvider { public bool IsApplicable([NotNull] IDataContext dataContext) { // Will be called in the CopyFqnAction to determine if _any_ provider has sth. to provide. var typeMembers = GetTypeMembers(dataContext); return typeMembers.Any(); } public IEnumerable<PresentableFqn> GetSortedFqns([NotNull] IDataContext dataContext) { var typeMembers = GetTypeMembers(dataContext); foreach (var typeMember in typeMembers) { var containingType = typeMember.GetContainingType(); if (containingType != null) { var containingTypePath = containingType.PathName(x => x.ShortName, x => x.GetContainingType()); yield return new PresentableFqn($"{containingTypePath}.{typeMember.ShortName}"); } } } public int Priority => -10; // The lower the value, the _higher_ it is ranked. Yes, really. private static IEnumerable<ITypeMember> GetTypeMembers(IDataContext dataContext) { var data = dataContext.GetData(PsiDataConstants.DECLARED_ELEMENTS); if (data == null) return new ITypeMember[0]; return data.OfType<ITypeMember>(); } } }
using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using JetBrains.Application.DataContext; using JetBrains.ProjectModel; using JetBrains.ReSharper.Features.Environment.CopyFqn; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.DataContext; namespace Roflcopter.Plugin { /// <summary> /// A provider for <see cref="CopyFqnAction"/> which returns [type(shortname)].[member(shortname)]. /// </summary> [SolutionComponent] public class ShortNameTypeMemberFqnProvider : IFqnProvider { public bool IsApplicable([NotNull] IDataContext dataContext) { // Will be called in the CopyFqnAction to determine if _any_ provider has sth. to provide. var typeMembers = GetTypeMembers(dataContext); return typeMembers.Any(); } public IEnumerable<PresentableFqn> GetSortedFqns([NotNull] IDataContext dataContext) { var typeMembers = GetTypeMembers(dataContext); foreach (var typeMember in typeMembers) { var containingType = typeMember.GetContainingType(); if (containingType != null) yield return new PresentableFqn($"{containingType.ShortName}.{typeMember.ShortName}"); } } public int Priority => -10; // The lower the value, the _higher_ it is ranked. Yes, really. private static IEnumerable<ITypeMember> GetTypeMembers(IDataContext dataContext) { var data = dataContext.GetData(PsiDataConstants.DECLARED_ELEMENTS); if (data == null) return new ITypeMember[0]; return data.OfType<ITypeMember>(); } } }
mit
C#
df29c9f2de8e6d94f4eef717a8e10e85e01b7dfa
Fix GostKeyValue name
AlexMAS/GostCryptography
Source/GostCryptography/Xml/GostKeyValue.cs
Source/GostCryptography/Xml/GostKeyValue.cs
using System; using System.Security.Cryptography.Xml; using System.Xml; using GostCryptography.Base; namespace GostCryptography.Xml { /// <summary> /// Параметры открытого ключа цифровой подписи ГОСТ Р 34.10. /// </summary> public sealed class GostKeyValue : KeyInfoClause { /// <summary> /// Наименование ключа. /// </summary> public const string NameValue = "urn:ietf:params:xml:ns:cpxmlsec:GOSTKeyValue"; /// <summary> /// Устаревшее наименование ключа. /// </summary> public const string ObsoleteNameValue = "http://www.w3.org/2000/09/xmldsig# KeyValue/GostKeyValue"; /// <summary> /// Известные наименования ключа. /// </summary> public static readonly string[] KnownNames = { NameValue, ObsoleteNameValue }; /// <inheritdoc /> public GostKeyValue() { } /// <inheritdoc /> public GostKeyValue(GostAsymmetricAlgorithm publicKey) { PublicKey = publicKey; } /// <summary> /// Открытый ключ. /// </summary> public GostAsymmetricAlgorithm PublicKey { get; set; } /// <inheritdoc /> public override void LoadXml(XmlElement element) { if (element == null) { throw new ArgumentNullException(nameof(element)); } PublicKey.FromXmlString(element.OuterXml); } /// <inheritdoc /> public override XmlElement GetXml() { var document = new XmlDocument { PreserveWhitespace = true }; var element = document.CreateElement("KeyValue", SignedXml.XmlDsigNamespaceUrl); element.InnerXml = PublicKey.ToXmlString(false); return element; } } }
using System; using System.Security.Cryptography.Xml; using System.Xml; using GostCryptography.Base; namespace GostCryptography.Xml { /// <summary> /// Параметры открытого ключа цифровой подписи ГОСТ Р 34.10. /// </summary> public sealed class GostKeyValue : KeyInfoClause { /// <summary> /// Наименование ключа. /// </summary> public const string NameValue = "urn:ietf:params:xml:ns:cpxmlsec:GOSTKeyValue"; /// <summary> /// Устаревшее наименование ключа. /// </summary> public const string ObsoleteNameValue = "http://www.w3.org/2000/09/xmldsig#KeyValue/GostKeyValue"; /// <summary> /// Известные наименования ключа. /// </summary> public static readonly string[] KnownNames = { NameValue, ObsoleteNameValue }; /// <inheritdoc /> public GostKeyValue() { } /// <inheritdoc /> public GostKeyValue(GostAsymmetricAlgorithm publicKey) { PublicKey = publicKey; } /// <summary> /// Открытый ключ. /// </summary> public GostAsymmetricAlgorithm PublicKey { get; set; } /// <inheritdoc /> public override void LoadXml(XmlElement element) { if (element == null) { throw new ArgumentNullException(nameof(element)); } PublicKey.FromXmlString(element.OuterXml); } /// <inheritdoc /> public override XmlElement GetXml() { var document = new XmlDocument { PreserveWhitespace = true }; var element = document.CreateElement("KeyValue", SignedXml.XmlDsigNamespaceUrl); element.InnerXml = PublicKey.ToXmlString(false); return element; } } }
mit
C#
2050ffbadfdeb7e5fb9a460789a4708979a98aa1
Tidy up with method sig overloads - reducing noise before the code gets too mad.
davidwhitney/XdtExtract,davidwhitney/XdtExtract
src/XdtExtract/AppConfigComparer.cs
src/XdtExtract/AppConfigComparer.cs
using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace XdtExtract { public class AppConfigComparer { public IEnumerable<Diff> Compare(string @base, string comparison) { return Compare(XDocument.Parse(@base), XDocument.Parse(comparison)); } public IEnumerable<Diff> Compare(XDocument @base, XDocument comparison) { var diffs = new List<Diff>(); var baseDocSettings = @base.AppSettings().Select(x => new { Source = "base", Node = x }); var comparisonDocSettings = comparison.AppSettings().Select(x => new { Source = "comparison", Node = x }); var groups = baseDocSettings.Union(comparisonDocSettings).GroupBy(x => x.Node.Attributes().Key()); foreach (var group in groups) { if (group.Count() == 1) { diffs.Add(new Diff { XPath = "/configuration/appSettings/add[@key='" + @group.Key + "']", Operation = @group.First().Source == "base" ? Operation.Remove : Operation.Add }); } } return diffs; } } public static class XDocumentExtensions { public static IEnumerable<XElement> AppSettings(this XDocument src) { return src.Descendants().Where(x => x.Name == "appSettings").Descendants(); } public static XElement SettingOrDefault(this IEnumerable<XElement> src, string key) { return src.SingleOrDefault(x => x.Attributes().Single(attr => attr.Name == "key").Value == key); } public static string Key(this IEnumerable<XAttribute> src) { return src.Single(x => x.Name == "key").Value; } } public class Diff { public string XPath { get; set; } public Operation Operation { get; set; } } public enum Operation { Add, Remove, Modify } }
using System.Collections.Generic; using System.Linq; using System.Xml.Linq; namespace XdtExtract { public class AppConfigComparer { public IEnumerable<Diff> Compare(string baseConfig, string comparisonConfig) { var baseDoc = XDocument.Parse(baseConfig); var comparisonDoc = XDocument.Parse(comparisonConfig); var diffs = new List<Diff>(); var baseDocSettings = baseDoc.AppSettings().Select(x => new { Source = "base", Node = x }); var comparisonDocSettings = comparisonDoc.AppSettings().Select(x => new { Source = "comparison", Node = x }); var groups = baseDocSettings.Union(comparisonDocSettings).GroupBy(x => x.Node.Attributes().Key()); foreach (var group in groups) { if (group.Count() == 1) { diffs.Add(new Diff { XPath = "/configuration/appSettings/add[@key='" + @group.Key + "']", Operation = @group.First().Source == "base" ? Operation.Remove : Operation.Add }); continue; } } return diffs; } } public static class XDocumentExtensions { public static IEnumerable<XElement> AppSettings(this XDocument src) { return src.Descendants().Where(x => x.Name == "appSettings").Descendants(); } public static XElement SettingOrDefault(this IEnumerable<XElement> src, string key) { return src.SingleOrDefault(x => x.Attributes().Single(attr => attr.Name == "key").Value == key); } public static string Key(this IEnumerable<XAttribute> src) { return src.Single(x => x.Name == "key").Value; } } public class Diff { public string XPath { get; set; } public Operation Operation { get; set; } } public enum Operation { Add, Remove, Modify } }
mit
C#
ef46b30ae2878c745246e71978f33232a9d6850a
Add conditional business rule execution based on successful validation rule execution
peasy/Samples,peasy/Samples,peasy/Samples
Orders.com.BLL/Services/OrdersDotComServiceBase.cs
Orders.com.BLL/Services/OrdersDotComServiceBase.cs
using Peasy; using Peasy.Core; using Orders.com.BLL.DataProxy; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; namespace Orders.com.BLL.Services { public abstract class OrdersDotComServiceBase<T> : BusinessServiceBase<T, long> where T : IDomainObject<long>, new() { public OrdersDotComServiceBase(IOrdersDotComDataProxy<T> dataProxy) : base(dataProxy) { } protected override IEnumerable<ValidationResult> GetAllErrorsForInsert(T entity, ExecutionContext<T> context) { var validationErrors = GetValidationResultsForInsert(entity, context); if (!validationErrors.Any()) { var businessRuleErrors = GetBusinessRulesForInsert(entity, context).GetValidationResults(); validationErrors.Concat(businessRuleErrors); } return validationErrors; } protected override async Task<IEnumerable<ValidationResult>> GetAllErrorsForInsertAsync(T entity, ExecutionContext<T> context) { var validationErrors = GetValidationResultsForInsert(entity, context); if (!validationErrors.Any()) { var businessRuleErrors = await GetBusinessRulesForInsertAsync(entity, context); validationErrors.Concat(await businessRuleErrors.GetValidationResultsAsync()); } return validationErrors; } protected override IEnumerable<ValidationResult> GetAllErrorsForUpdate(T entity, ExecutionContext<T> context) { var validationErrors = GetValidationResultsForUpdate(entity, context); if (!validationErrors.Any()) { var businessRuleErrors = GetBusinessRulesForUpdate(entity, context).GetValidationResults(); validationErrors.Concat(businessRuleErrors); } return validationErrors; } protected override async Task<IEnumerable<ValidationResult>> GetAllErrorsForUpdateAsync(T entity, ExecutionContext<T> context) { var validationErrors = GetValidationResultsForUpdate(entity, context); if (!validationErrors.Any()) { var businessRuleErrors = await GetBusinessRulesForUpdateAsync(entity, context); validationErrors.Concat(await businessRuleErrors.GetValidationResultsAsync()); } return validationErrors; } } }
using Peasy; using Peasy.Core; using Orders.com.BLL.DataProxy; namespace Orders.com.BLL.Services { public abstract class OrdersDotComServiceBase<T> : BusinessServiceBase<T, long> where T : IDomainObject<long>, new() { public OrdersDotComServiceBase(IOrdersDotComDataProxy<T> dataProxy) : base(dataProxy) { } } }
mit
C#
da527aa9548e9eb2ac1174b9b6e74e69fe6accca
Change ConfigurationGenerationAttributeBase to invoke generation only on local build
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/CI/ConfigurationGenerationAttributeBase.cs
source/Nuke.Common/CI/ConfigurationGenerationAttributeBase.cs
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Reflection; using Nuke.Common.Execution; using Nuke.Common.Tooling; namespace Nuke.Common.CI { [AttributeUsage(AttributeTargets.Class)] public abstract class ConfigurationGenerationAttributeBase : Attribute, IOnBeforeLogo { public const string ConfigurationParameterName = "configure-build-server"; public bool AutoGenerate { get; set; } = true; public void OnBeforeLogo(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets) { if (!EnvironmentInfo.GetParameter<bool>(ConfigurationParameterName)) { if (NukeBuild.IsLocalBuild && AutoGenerate) { Logger.LogLevel = LogLevel.Trace; var assembly = Assembly.GetEntryAssembly().NotNull("assembly != null"); ProcessTasks.StartProcess( assembly.Location, $"--{ConfigurationParameterName} --host {HostType}", logInvocation: false, logOutput: false) .AssertZeroExitCode(); } return; } if (NukeBuild.Host == HostType) { Generate(build, executableTargets); Environment.Exit(0); } } protected abstract HostType HostType { get; } protected abstract void Generate(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets); } }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Collections.Generic; using System.Reflection; using Nuke.Common.Execution; using Nuke.Common.Tooling; namespace Nuke.Common.CI { public abstract class ConfigurationGenerationAttributeBase : Attribute, IOnBeforeLogo { public const string ConfigurationParameterName = "configure-build-server"; public bool AutoGenerate { get; set; } = true; public void OnBeforeLogo(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets) { if (!EnvironmentInfo.GetParameter<bool>(ConfigurationParameterName)) { if (AutoGenerate) { var assembly = Assembly.GetEntryAssembly().NotNull("assembly != null"); ProcessTasks.StartProcess( assembly.Location, $"--{ConfigurationParameterName} --host {HostType}", logInvocation: false, logOutput: false); } return; } Generate(build, executableTargets); Environment.Exit(0); } protected abstract HostType HostType { get; } protected abstract void Generate(NukeBuild build, IReadOnlyCollection<ExecutableTarget> executableTargets); } }
mit
C#
86f2f65af34065e2c9a10f81a931c4a9a0f0b8b1
Use local datetime
drasticactions/WinMasto
WinMasto/Tools/Converters/CreatedTimeConverter.cs
WinMasto/Tools/Converters/CreatedTimeConverter.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; using PrettyPrintNet; namespace WinMasto.Tools.Converters { public class CreatedTimeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var accountDateTime = (DateTime) value; return accountDateTime.ToLocalTime().ToString("g"); //var timespan = DateTime.UtcNow.Subtract(accountDateTime); //return timespan.ToPrettyString(2, UnitStringRepresentation.Compact); } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.UI.Xaml.Data; using PrettyPrintNet; namespace WinMasto.Tools.Converters { public class CreatedTimeConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, string language) { var accountDateTime = (DateTime) value; var timespan = DateTime.UtcNow.Subtract(accountDateTime); return timespan.ToPrettyString(2, UnitStringRepresentation.Compact); } public object ConvertBack(object value, Type targetType, object parameter, string language) { throw new NotImplementedException(); } } }
mit
C#
ac8569202f27518afc57c5a7f14c0ee433b6b6f8
Update sys version to v2.0-a2 #259
FanrayMedia/Fanray,FanrayMedia/Fanray,FanrayMedia/Fanray
src/Fan/Helpers/SysVersion.cs
src/Fan/Helpers/SysVersion.cs
namespace Fan.Helpers { public class SysVersion { public static string CurrentVersion = "v2.0-a2"; } }
namespace Fan.Helpers { public class SysVersion { public static string CurrentVersion = "v2.0-a1"; } }
apache-2.0
C#
00b6f898914f32fdf8026aff77f65db0744cddb6
add missing using statement ref
manigandham/serilog-sinks-googlecloudlogging
src/TestWeb/HomeController.cs
src/TestWeb/HomeController.cs
using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Serilog; namespace TestWeb { public class HomeController : Controller { private readonly ILogger<HomeController> _logger; private readonly ILoggerFactory _loggerFactory; public HomeController(ILogger<HomeController> logger, ILoggerFactory loggerFactory) { _logger = logger; _loggerFactory = loggerFactory; } public string Index() { Log.Information("Testing info message with serilog"); Log.Debug("Testing debug message with serilog"); _logger.LogInformation("Testing info message with ILogger abstraction"); _logger.LogDebug("Testing debug message with ILogger abstraction"); _logger.LogDebug(eventId: new Random().Next(), message: "Testing message with random event ID"); _logger.LogInformation("Test message with a Dictionary {myDict}", new Dictionary<string, string> { { "myKey", "myValue" }, { "mySecondKey", "withAValue" } }); // ASP.NET Logger Factor accepts string log names, but these must follow the rules for Google Cloud logging: // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry // Names must only include upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period. No spaces! var logger = _loggerFactory.CreateLogger("AnotherLogger"); logger.LogInformation("Testing info message with ILoggerFactor abstraction and custom log name"); return $"Logged messages, visit GCP log viewer at https://console.cloud.google.com/logs/viewer?project={Program.GCP_PROJECT_ID}"; } } }
using System; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Serilog; namespace TestWeb { public class HomeController : Controller { private readonly ILogger<HomeController> _logger; private readonly ILoggerFactory _loggerFactory; public HomeController(ILogger<HomeController> logger, ILoggerFactory loggerFactory) { _logger = logger; _loggerFactory = loggerFactory; } public string Index() { Log.Information("Testing info message with serilog"); Log.Debug("Testing debug message with serilog"); _logger.LogInformation("Testing info message with ILogger abstraction"); _logger.LogDebug("Testing debug message with ILogger abstraction"); _logger.LogDebug(eventId: new Random().Next(), message: "Testing message with random event ID"); _logger.LogInformation("Test message with a Dictionary {myDict}", new Dictionary<string, string> { { "myKey", "myValue" }, { "mySecondKey", "withAValue" } }); // ASP.NET Logger Factor accepts string log names, but these must follow the rules for Google Cloud logging: // https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry // Names must only include upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period. No spaces! var logger = _loggerFactory.CreateLogger("AnotherLogger"); logger.LogInformation("Testing info message with ILoggerFactor abstraction and custom log name"); return $"Logged messages, visit GCP log viewer at https://console.cloud.google.com/logs/viewer?project={Program.GCP_PROJECT_ID}"; } } }
mit
C#
95d486c19b0064f653be1226e8bdc463efed4244
Add Json Constructor for WebInput
LibertyLocked/webscripthook,LibertyLocked/webscripthook,LibertyLocked/webscripthook,LibertyLocked/webscripthook
webscripthook-plugin/WebInput.cs
webscripthook-plugin/WebInput.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using GTA; using GTA.Math; using GTA.Native; using Newtonsoft.Json; namespace WebScriptHook { delegate object WebFunction(string arg, params object[] args); class WebInput { public string Cmd { get; set; } public string Arg { get; set; } public object[] Args { get; set; } public string UID { get; private set; } [JsonConstructor] public WebInput(string Cmd, string Arg, object[] Args, string UID) { this.Cmd = Cmd; this.Arg = Arg; this.Args = Args; this.UID = UID; } public object Execute() { if (string.IsNullOrEmpty(Cmd)) return null; WebFunction func = FunctionConvert.GetFunction(Cmd); if (func != null) { return func(Arg, Args); } else { return null; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using GTA; using GTA.Math; using GTA.Native; namespace WebScriptHook { delegate object WebFunction(string arg, params object[] args); class WebInput { public string Cmd { get; set; } public string Arg { get; set; } public object[] Args { get; set; } public string UID { get; set; } public object Execute() { if (string.IsNullOrEmpty(Cmd)) return null; WebFunction func = FunctionConvert.GetFunction(Cmd); if (func != null) { return func(Arg, Args); } else { return null; } } } }
mit
C#
3ee36bb8221323c5e29f9f56f22c55593960c262
Apply license terms uniformly
Lightstreamer/Lightstreamer-example-StockList-client-winphone,Weswit/Lightstreamer-example-StockList-client-winphone
WP7StockListDemo/Properties/AssemblyInfo.cs
WP7StockListDemo/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Lightstreamer Windows Phone Demo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Lightstreamer Windows Phone Demo")] [assembly: AssemblyCopyright("Copyright © Weswit 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("3e0afa5b-ebe3-408b-8c68-d1a45ae7eee8")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
#region License /* * Copyright 2013 Weswit Srl * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #endregion License using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Lightstreamer Windows Phone Demo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyProduct("Lightstreamer Windows Phone Demo")] [assembly: AssemblyCopyright("Copyright © Weswit 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("3e0afa5b-ebe3-408b-8c68-d1a45ae7eee8")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
apache-2.0
C#
4b79613aa31a5a0da573f5b54a0ce55a35f199fd
Add missing Id
hishamco/WebForms,hishamco/WebForms
samples/WebFormsSample/Pages/Index.htm.cs
samples/WebFormsSample/Pages/Index.htm.cs
using My.AspNetCore.WebForms; using My.AspNetCore.WebForms.Controls; using System; namespace WebFormsSample.Pages { public class Index : Page { private Literal litGreeting; public Index() { litGreeting = new Literal() { Id = "litGreeting" }; this.Load += Page_Load; this.Controls.Add(litGreeting); } private void Page_Load(object sender, EventArgs e) { litGreeting.Text = $"Hello, World! The time on the server is {DateTime.Now}"; } } }
using My.AspNetCore.WebForms; using My.AspNetCore.WebForms.Controls; using System; namespace WebFormsSample.Pages { public class Index : Page { private Literal litGreeting; public Index() { litGreeting = new Literal(); this.Load += Page_Load; this.Controls.Add(litGreeting); } private void Page_Load(object sender, EventArgs e) { litGreeting.Text = $"Hello, World! The time on the server is {DateTime.Now}"; } } }
mit
C#
5931c7fb9a8884adaf3087fb831caa103e0cfb86
Remove trailing slashes when creating LZMAs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
build/tasks/CreateLzma.cs
build/tasks/CreateLzma.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Microsoft.DotNet.Archive; namespace RepoTasks { public class CreateLzma : Task { [Required] public string OutputPath { get; set; } [Required] public string[] Sources { get; set; } public override bool Execute() { var progress = new ConsoleProgressReport(); using (var archive = new IndexedArchive()) { foreach (var source in Sources) { if (Directory.Exists(source)) { var trimmedSource = source.TrimEnd(new []{ '\\', '/' }); Log.LogMessage(MessageImportance.High, $"Adding directory: {trimmedSource}"); archive.AddDirectory(trimmedSource, progress); } else { Log.LogMessage(MessageImportance.High, $"Adding file: {source}"); archive.AddFile(source, Path.GetFileName(source)); } } archive.Save(OutputPath, progress); } return true; } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.IO; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using Microsoft.DotNet.Archive; namespace RepoTasks { public class CreateLzma : Task { [Required] public string OutputPath { get; set; } [Required] public string[] Sources { get; set; } public override bool Execute() { var progress = new ConsoleProgressReport(); using (var archive = new IndexedArchive()) { foreach (var source in Sources) { if (Directory.Exists(source)) { Log.LogMessage(MessageImportance.High, $"Adding directory: {source}"); archive.AddDirectory(source, progress); } else { Log.LogMessage(MessageImportance.High, $"Adding file: {source}"); archive.AddFile(source, Path.GetFileName(source)); } } archive.Save(OutputPath, progress); } return true; } } }
apache-2.0
C#
93cdc05ae158b3268f2812908e4b2fdfde08ff73
improve NotifyObjectChange: only check binding for ObservableModel context
minhdu/UIMan
Assets/UnuGames/UIMan/Scripts/MVVM/Core/DataContext.cs
Assets/UnuGames/UIMan/Scripts/MVVM/Core/DataContext.cs
using System; using System.Reflection; using UnityEngine; using System.Collections.Generic; namespace UnuGames.MVVM { /// <summary> /// Data context. /// </summary> public class DataContext : MonoBehaviour { #region DataContext Factory static List<DataContext> contextsList = new List<DataContext> (); static public void NotifyObjectChange (object modelInstance) { for (int i = 0; i < contextsList.Count; i++) { DataContext context = contextsList [i]; if (context.model != null && context.model is ObservableModel) { PropertyInfo propertyInfo = context.viewModel.IsBindingTo (modelInstance); if (propertyInfo != null) { context.viewModel.NotifyModelChange (modelInstance); } } } } #endregion #region Instance public ContextType type; public ViewModelBehaviour viewModel; public object model; public string propertyName; PropertyInfo propertyInfo; public PropertyInfo PropertyInfo { get { return propertyInfo; } } public void Clear () { viewModel = null; propertyName = null; propertyInfo = null; } void Awake () { if(!contextsList.Contains(this)) contextsList.Add (this); Init (); RegisterBindingMessage (false); } // Subscript for property change event public void Init () { GetPropertyInfo (); if (propertyInfo != null) { model = propertyInfo.GetValue (viewModel, null); if (model == null && type == ContextType.PROPERTY) model = ReflectUtils.GetCachedTypeInstance (propertyInfo.PropertyType); if (model != null) { viewModel.SubcriptObjectAction (model); viewModel.SubscribeAction (propertyName, viewModel.NotifyModelChange); } } } // Register binding message for child binders void RegisterBindingMessage (bool forceReinit = false) { BinderBase[] binders = GetComponentsInChildren<BinderBase> (true); for (int i = 0; i < binders.Length; i++) { BinderBase binder = binders [i]; if (binder.mDataContext == this) { binder.Init (forceReinit); } } } public PropertyInfo GetPropertyInfo () { #if !UNITY_EDITOR if(propertyInfo == null) propertyInfo = viewModel.GetCachedType ().GetProperty (propertyName); #else propertyInfo = viewModel.GetCachedType ().GetProperty (propertyName); #endif return propertyInfo; } } #endregion }
using System; using System.Reflection; using UnityEngine; using System.Collections.Generic; namespace UnuGames.MVVM { /// <summary> /// Data context. /// </summary> public class DataContext : MonoBehaviour { #region DataContext Factory static List<DataContext> contextsList = new List<DataContext> (); static public void NotifyObjectChange (object modelInstance) { for (int i = 0; i < contextsList.Count; i++) { DataContext context = contextsList [i]; PropertyInfo propertyInfo = context.viewModel.IsBindingTo (modelInstance); if (propertyInfo != null) { context.viewModel.NotifyModelChange (modelInstance); } } } #endregion #region Instance public ContextType type; public ViewModelBehaviour viewModel; public object model; public string propertyName; PropertyInfo propertyInfo; public PropertyInfo PropertyInfo { get { return propertyInfo; } } public void Clear () { viewModel = null; propertyName = null; propertyInfo = null; } void Awake () { if(!contextsList.Contains(this)) contextsList.Add (this); Init (); RegisterBindingMessage (false); } // Subscript for property change event public void Init () { GetPropertyInfo (); if (propertyInfo != null) { model = propertyInfo.GetValue (viewModel, null); if (model == null && type == ContextType.PROPERTY) model = ReflectUtils.GetCachedTypeInstance (propertyInfo.PropertyType); if (model != null) { viewModel.SubcriptObjectAction (model); viewModel.SubscribeAction (propertyName, viewModel.NotifyModelChange); } } } // Register binding message for child binders void RegisterBindingMessage (bool forceReinit = false) { BinderBase[] binders = GetComponentsInChildren<BinderBase> (true); for (int i = 0; i < binders.Length; i++) { BinderBase binder = binders [i]; if (binder.mDataContext == this) { binder.Init (forceReinit); } } } public PropertyInfo GetPropertyInfo () { #if !UNITY_EDITOR if(propertyInfo == null) propertyInfo = viewModel.GetCachedType ().GetProperty (propertyName); #else propertyInfo = viewModel.GetCachedType ().GetProperty (propertyName); #endif return propertyInfo; } } #endregion }
mit
C#
21c7ea664a6c071716a69b2f7659a0aebfb80802
Improve high-dpi.
yas-mnkornym/SylphyHorn,Grabacr07/SylphyHorn,mntone/SylphyHorn
source/SylphyHorn/Interop/IconHelper.cs
source/SylphyHorn/Interop/IconHelper.cs
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using MetroRadiance.Interop; namespace SylphyHorn.Interop { public static class IconHelper { public static Icon GetIconFromResource(Uri uri) { var streamResourceInfo = System.Windows.Application.GetResourceStream(uri); if (streamResourceInfo == null) throw new ArgumentException("Resource not found.", nameof(uri)); var dpi = PerMonitorDpi.GetDpi(IntPtr.Zero); // get desktop dpi using (var stream = streamResourceInfo.Stream) { return new Icon(stream, new Size((int)(16 * dpi.ScaleX), (int)(16 * dpi.ScaleY))); } } } }
using System; using System.Collections.Generic; using System.Drawing; using System.Linq; namespace SylphyHorn.Interop { public static class IconHelper { public static Icon GetIconFromResource(Uri uri) { var streamResourceInfo = System.Windows.Application.GetResourceStream(uri); if (streamResourceInfo == null) throw new ArgumentException("Resource not found.", nameof(uri)); using (var stream = streamResourceInfo.Stream) { return new Icon(stream, new Size(16, 16)); } } } }
mit
C#
77ec37d24ea3a6aca58761380c981952fa4ea784
Refactor normalization tests
ermshiperete/icu-dotnet,ermshiperete/icu-dotnet,conniey/icu-dotnet,sillsdev/icu-dotnet,sillsdev/icu-dotnet,conniey/icu-dotnet
source/icu.net.tests/NormalizerTests.cs
source/icu.net.tests/NormalizerTests.cs
// Copyright (c) 2013 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Text; using Icu.Collation; using NUnit.Framework; namespace Icu.Tests { [TestFixture] public class NormalizerTests { [TestCase("XA\u0308bc", Normalizer.UNormalizationMode.UNORM_NFC, Result = "X\u00C4bc")] [TestCase("X\u00C4bc", Normalizer.UNormalizationMode.UNORM_NFD, Result = "XA\u0308bc")] [TestCase("tést", Normalizer.UNormalizationMode.UNORM_NFD, Result = "te\u0301st")] [TestCase("te\u0301st", Normalizer.UNormalizationMode.UNORM_NFC, Result = "tést")] [TestCase("te\u0301st", Normalizer.UNormalizationMode.UNORM_NFD, Result = "te\u0301st")] public string Normalize(string src, Normalizer.UNormalizationMode mode) { return Normalizer.Normalize(src, mode); } [TestCase("X\u00C4bc", Normalizer.UNormalizationMode.UNORM_NFC, Result = true)] [TestCase("XA\u0308bc", Normalizer.UNormalizationMode.UNORM_NFC, Result = false)] [TestCase("X\u00C4bc", Normalizer.UNormalizationMode.UNORM_NFD, Result = false)] [TestCase("XA\u0308bc", Normalizer.UNormalizationMode.UNORM_NFD, Result = true)] public bool IsNormalized(string src, Normalizer.UNormalizationMode expectNormalizationMode) { return Normalizer.IsNormalized(src, expectNormalizationMode); } } }
// Copyright (c) 2013 SIL International // This software is licensed under the MIT license (http://opensource.org/licenses/MIT) using System; using System.Text; using NUnit.Framework; namespace Icu.Tests { [TestFixture] public class NormalizerTests { [Test] public void Normalize_NFC() { Assert.That(Normalizer.Normalize("XA\u0308bc", Normalizer.UNormalizationMode.UNORM_NFC), Is.EqualTo("X\u00C4bc")); } [Test] public void Normalize_NFD() { Assert.That(Normalizer.Normalize("X\u00C4bc", Normalizer.UNormalizationMode.UNORM_NFD), Is.EqualTo("XA\u0308bc")); } [Test] public void Normalize_NFC2NFC() { var normalizedString = Normalizer.Normalize("tést", Normalizer.UNormalizationMode.UNORM_NFC); Assert.That(normalizedString, Is.EqualTo("tést")); Assert.That(normalizedString.IsNormalized(NormalizationForm.FormC), Is.True); } [Test] public void Normalize_NFC2NFD() { var normalizedString = Normalizer.Normalize("tést", Normalizer.UNormalizationMode.UNORM_NFD); Assert.That(normalizedString[2], Is.EqualTo('\u0301')); Assert.That(normalizedString, Is.EqualTo("te\u0301st")); Assert.That(normalizedString.IsNormalized(NormalizationForm.FormD), Is.True); } [Test] public void Normalize_NFD2NFC() { var normalizedString = Normalizer.Normalize("te\u0301st", Normalizer.UNormalizationMode.UNORM_NFC); Assert.That(normalizedString, Is.EqualTo("tést")); Assert.That(normalizedString.IsNormalized(NormalizationForm.FormC), Is.True); } [Test] public void Normalize_NFD2NFD() { var normalizedString = Normalizer.Normalize("te\u0301st", Normalizer.UNormalizationMode.UNORM_NFD); Assert.That(normalizedString, Is.EqualTo("te\u0301st")); Assert.That(normalizedString.IsNormalized(NormalizationForm.FormD), Is.True); } [Test] public void IsNormalized_NFC() { Assert.That(Normalizer.IsNormalized("X\u00C4bc", Normalizer.UNormalizationMode.UNORM_NFC), Is.True); Assert.That(Normalizer.IsNormalized("XA\u0308bc", Normalizer.UNormalizationMode.UNORM_NFC), Is.False); } [Test] public void IsNormalized_NFD() { Assert.That(Normalizer.IsNormalized("XA\u0308bc", Normalizer.UNormalizationMode.UNORM_NFD), Is.True); Assert.That(Normalizer.IsNormalized("X\u00C4bc", Normalizer.UNormalizationMode.UNORM_NFD), Is.False); } } }
mit
C#
0a72d4024fc0cb0d1c063c077e86d3ab5edbce2e
Stop prior sounds
gadauto/OCDEscape
Assets/OCDRoomEscape/Scripts/Interaction/PuzzleMaster.cs
Assets/OCDRoomEscape/Scripts/Interaction/PuzzleMaster.cs
using UnityEngine; using System.Collections; using System.Collections.Generic; public class PuzzleMaster : MonoBehaviour { public float timeBetweenSounds = 15f; public WallManager wallMgr; public List<Puzzle> puzzles; float increment; float weightedIncrementTotal; bool isGameOver = false; // Use this for initialization void Awake () { foreach (var puzzle in puzzles) { Debug.Log("Puzzle added: "+puzzle); } } void Start() { // We'll consider the puzzle's weight when determining how much it affects the room movement foreach (var puzzle in puzzles) { weightedIncrementTotal += puzzle.puzzleWeight; } } public void PuzzleCompleted(Puzzle puzzle) { if (isGameOver) { Debug.Log("GAME OVER!!! Let the player know!!"); return; } var growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal; // Notify room of growth increment wallMgr.Resize(wallMgr.transformRoom + growthIncrement); KickOffSoundForPuzzle(puzzle); if (puzzle.IsResetable() && puzzles.Contains(puzzle)) { Debug.Log("Puzzle marked for reset"); puzzle.MarkForReset(); } // Remove the puzzle, but also allow it to remain in the list multiple times puzzles.Remove(puzzle); Debug.Log("Finished puzzle: "+puzzle+", "+puzzles.Count+" left, room growing to: "+(wallMgr.transformRoom + growthIncrement)); if (wallMgr.transformRoom >= 1f) { StopAllCoroutines(); // Turn off sounds isGameOver = true; Debug.Log("GAME OVER!!!"); } } private void KickOffSoundForPuzzle(Puzzle puzzle) { StopAllCoroutines(); AudioSource source = puzzle.SoundForPuzzle(); if (source) { StartCoroutine(PlaySound(source)); } else { Debug.Log(puzzle+" does not have an associated AudioSource"); } } private IEnumerator PlaySound(AudioSource source) { while (true) { source.Play(); yield return new WaitForSeconds(timeBetweenSounds); } } }
using UnityEngine; using System.Collections; using System.Collections.Generic; public class PuzzleMaster : MonoBehaviour { public float timeBetweenSounds = 15f; public WallManager wallMgr; public List<Puzzle> puzzles; float increment; float weightedIncrementTotal; bool isGameOver = false; // Use this for initialization void Awake () { foreach (var puzzle in puzzles) { Debug.Log("Puzzle added: "+puzzle); } } void Start() { // We'll consider the puzzle's weight when determining how much it affects the room movement foreach (var puzzle in puzzles) { weightedIncrementTotal += puzzle.puzzleWeight; } } public void PuzzleCompleted(Puzzle puzzle) { if (isGameOver) { Debug.Log("GAME OVER!!! Let the player know!!"); return; } var growthIncrement = puzzle.puzzleWeight / weightedIncrementTotal; // Notify room of growth increment wallMgr.Resize(wallMgr.transformRoom + growthIncrement); KickOffSoundForPuzzle(puzzle); if (puzzle.IsResetable() && puzzles.Contains(puzzle)) { Debug.Log("Puzzle marked for reset"); puzzle.MarkForReset(); } // Remove the puzzle, but also allow it to remain in the list multiple times puzzles.Remove(puzzle); Debug.Log("Finished puzzle: "+puzzle+", "+puzzles.Count+" left, room growing to: "+(wallMgr.transformRoom + growthIncrement)); if (wallMgr.transformRoom >= 1f) { isGameOver = true; Debug.Log("GAME OVER!!!"); } } private void KickOffSoundForPuzzle(Puzzle puzzle) { AudioSource source = puzzle.SoundForPuzzle(); if (source) { StartCoroutine(PlaySound(source)); } else { Debug.Log(puzzle+" does not have an associated AudioSource"); } } private IEnumerator PlaySound(AudioSource source) { while (true) { source.Play(); yield return new WaitForSeconds(timeBetweenSounds); } } }
apache-2.0
C#
01c15fe516e6fc599a12eef3936ed56aa4b8f1fc
Verify that region is set if specified
appharbor/appharbor-cli
src/AppHarbor.Tests/Commands/CreateAppCommandTest.cs
src/AppHarbor.Tests/Commands/CreateAppCommandTest.cs
using System.IO; using System.Linq; using AppHarbor.Commands; using AppHarbor.Model; using Moq; using Ploeh.AutoFixture.Xunit; using Xunit; using Xunit.Extensions; namespace AppHarbor.Tests.Commands { public class CreateAppCommandTest { [Theory, AutoCommandData] public void ShouldThrowWhenNoArguments(CreateAppCommand command) { var exception = Assert.Throws<CommandException>(() => command.Execute(new string[0])); Assert.Equal("An application name must be provided to create an application", exception.Message); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithOnlyName([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command) { var arguments = new string[] { "foo" }; VerifyArguments(client, command, arguments); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithRegion([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, string[] arguments) { VerifyArguments(client, command, arguments); } private static void VerifyArguments(Mock<IAppHarborClient> client, CreateAppCommand command, string[] arguments) { command.Execute(arguments); client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once()); } [Theory, AutoCommandData] public void ShouldSetupApplicationLocallyAfterCreationIfNotConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, CreateResult result, User user, string[] arguments) { client.Setup(x => x.CreateApplication(It.IsAny<string>(), It.IsAny<string>())).Returns(result); client.Setup(x => x.GetUser()).Returns(user); applicationConfiguration.Setup(x => x.GetApplicationId()).Throws<ApplicationConfigurationException>(); command.Execute(arguments); applicationConfiguration.Verify(x => x.SetupApplication(result.Id, user), Times.Once()); } [Theory, AutoCommandData] public void ShouldNotSetupApplicationIfAlreadyConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<TextWriter> writer, CreateAppCommand command, string[] arguments, string applicationName) { applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationName); command.Execute(arguments); writer.Verify(x => x.WriteLine("This directory is already configured to track application \"{0}\".", applicationName), Times.Once()); } [Theory, AutoCommandData] public void ShouldPrintSuccessMessageAfterCreatingApplication([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string applicationName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationName, null)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationName }); writer.Verify(x => x.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", applicationSlug), Times.Once()); } [Theory, AutoCommandData] public void ShouldSetRegionIsSpecified([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string regionName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationSlug, regionName)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationSlug, "-r", regionName }); client.VerifyAll(); } } }
using System.IO; using System.Linq; using AppHarbor.Commands; using AppHarbor.Model; using Moq; using Ploeh.AutoFixture.Xunit; using Xunit; using Xunit.Extensions; namespace AppHarbor.Tests.Commands { public class CreateAppCommandTest { [Theory, AutoCommandData] public void ShouldThrowWhenNoArguments(CreateAppCommand command) { var exception = Assert.Throws<CommandException>(() => command.Execute(new string[0])); Assert.Equal("An application name must be provided to create an application", exception.Message); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithOnlyName([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command) { var arguments = new string[] { "foo" }; VerifyArguments(client, command, arguments); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithRegion([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, string[] arguments) { VerifyArguments(client, command, arguments); } private static void VerifyArguments(Mock<IAppHarborClient> client, CreateAppCommand command, string[] arguments) { command.Execute(arguments); client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once()); } [Theory, AutoCommandData] public void ShouldSetupApplicationLocallyAfterCreationIfNotConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, CreateResult result, User user, string[] arguments) { client.Setup(x => x.CreateApplication(It.IsAny<string>(), It.IsAny<string>())).Returns(result); client.Setup(x => x.GetUser()).Returns(user); applicationConfiguration.Setup(x => x.GetApplicationId()).Throws<ApplicationConfigurationException>(); command.Execute(arguments); applicationConfiguration.Verify(x => x.SetupApplication(result.Id, user), Times.Once()); } [Theory, AutoCommandData] public void ShouldNotSetupApplicationIfAlreadyConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<TextWriter> writer, CreateAppCommand command, string[] arguments, string applicationName) { applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationName); command.Execute(arguments); writer.Verify(x => x.WriteLine("This directory is already configured to track application \"{0}\".", applicationName), Times.Once()); } [Theory, AutoCommandData] public void ShouldPrintSuccessMessageAfterCreatingApplication([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string applicationName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationName, null)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationName }); writer.Verify(x => x.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", applicationSlug), Times.Once()); } } }
mit
C#
be20878184318342858b03d85b61ca1643c71906
Update IndexModule.cs
LeedsSharp/AppVeyorDemo
src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs
src/AppVeyorDemo/AppVeyorDemo/Modules/IndexModule.cs
namespace AppVeyorDemo.Modules { using System.Configuration; using AppVeyorDemo.Models; using Nancy; public class IndexModule : NancyModule { public IndexModule() { Get["/"] = parameters => { var model = new IndexViewModel { HelloName = "Leeds#", ServerName = ConfigurationManager.AppSettings["Server_Name"] }; return View["index", model]; }; } } }
namespace AppVeyorDemo.Modules { using System.Configuration; using AppVeyorDemo.Models; using Nancy; public class IndexModule : NancyModule { public IndexModule() { Get["/"] = parameters => { var model = new IndexViewModel { HelloName = "AppVeyor", ServerName = ConfigurationManager.AppSettings["Server_Name"] }; return View["index", model]; }; } } }
apache-2.0
C#
b9df03da9d552c00887e209bba16e6cc33638a77
Add public comments to login request handler classes and interfaces
ZEISS-PiWeb/PiWeb-Api
src/Common/Client/ICertificateLoginRequestHandler.cs
src/Common/Client/ICertificateLoginRequestHandler.cs
#region Copyright /* * * * * * * * * * * * * * * * * * * * * * * * * */ /* Carl Zeiss IMT (IZfM Dresden) */ /* Softwaresystem PiWeb */ /* (c) Carl Zeiss 2016 */ /* * * * * * * * * * * * * * * * * * * * * * * * * */ #endregion namespace Zeiss.IMT.PiWeb.Api.Common.Client { #region usings using System; using System.Threading.Tasks; using PiWebApi.Annotations; using Zeiss.IMT.PiWeb.Api.Common.Utilities; #endregion /// <summary> /// Interface that is used as callback handler for requests that need a certificate for authentification. /// </summary> /// <remarks> /// This interface is mainly designed for showing a user interface to the user for choosing the right certificate. /// </remarks> public interface ICertificateLoginRequestHandler : ICacheClearable { #region methods /// <summary> /// Asynchronous callback if a certificate for a <see cref="Uri"/> is requested. /// </summary> /// <param name="uri">The address for which a certificate is requested.</param> /// <param name="preferHardwareCertificate">An option that is used to limit the list of possible certificates to hardware certificates only.</param> /// <returns>Returns a the certificate that should be used for authentication or null if no certificate should be used.</returns> /// <exception cref="LoginCanceledException">Throws a <see cref="LoginCanceledException"/> if the request should be canceled.</exception> /// <remarks> /// The <see cref="Uri"/> usually refers to the base address of a server, since declared endpoints usually do not use different authentications. /// </remarks> Task<CertificateCredential> CertificateRequestAsync( [NotNull] Uri uri, bool preferHardwareCertificate = false); /// <summary> /// Synchronous callback if a certificate for a <see cref="Uri"/> is requested. /// </summary> /// <param name="uri">The address for which a certificate is requested.</param> /// <param name="preferHardwareCertificate">An option that is used to limit the list of possible certificates to hardware certificates only.</param> /// <returns>Returns a the certificate that should be used for authentication or null if no certificate should be used.</returns> /// <exception cref="LoginCanceledException">Throws a <see cref="LoginCanceledException"/> if the request should be canceled.</exception> /// <remarks> /// This is the synchronous counter part to <see cref="CertificateRequestAsync"/> which stays usually unused by the <see cref="RestClient"/>, /// since its API is fully asynchronous. This mainly exists for purpose of introducing a synchronous API if needed in the future. /// The <see cref="Uri"/> usually refers to the base address of a server, since declared endpoints usually do not use different authentications. /// </remarks> CertificateCredential CertificateRequest( [NotNull] Uri uri, bool preferHardwareCertificate = false ); #endregion } }
#region Copyright /* * * * * * * * * * * * * * * * * * * * * * * * * */ /* Carl Zeiss IMT (IZfM Dresden) */ /* Softwaresystem PiWeb */ /* (c) Carl Zeiss 2016 */ /* * * * * * * * * * * * * * * * * * * * * * * * * */ #endregion namespace Zeiss.IMT.PiWeb.Api.Common.Client { #region usings using System; using System.Threading.Tasks; using PiWebApi.Annotations; using Zeiss.IMT.PiWeb.Api.Common.Utilities; #endregion /// <summary> /// Interface that is used as callback handler for requests that need a certificate for authentification. /// </summary> /// <remarks> /// This interface is mainly designed for showing a user interface to the user for choosing the right certificate. /// </remarks> public interface ICertificateLoginRequestHandler : ICacheClearable { #region methods /// <summary> /// Asynchronous callback if a certificate for a <see cref="Uri"/> is requested. /// </summary> /// <param name="uri">The address for which a certificate is requested.</param> /// <param name="preferHardwareCertificate">An option that is used to limit the list of possible certificates to hardware certificates only.</param> /// <returns>Returns a the certificate that should be used for authentication or null if no certificate should be used.</returns> /// <exception cref="LoginCanceledException">Throws a <see cref="LoginCanceledException"/> if the request should be canceled.</exception> /// <remarks> /// The <see cref="Uri"/> usually refers to the base address of a server, since declared endpoints usually do not use different authentications. /// </remarks> Task<CertificateCredential> CertificateRequestAsync( [NotNull] Uri uri, bool preferHardwareCertificate = false); /// <summary> /// Synchronous callback if a certificate for a <see cref="Uri"/> is requested. /// </summary> /// <param name="uri">The address for which a certificate is requested.</param> /// <param name="preferHardwareCertificate">An option that is used to limit the list of possible certificates to hardware certificates only.</param> /// <returns>Returns a the certificate that should be used for authentication or null if no certificate should be used.</returns> /// <exception cref="LoginCanceledException">Throws a <see cref="LoginCanceledException"/> if the request should be canceled.</exception> /// <remarks> /// This is the synchronous counter part to <see cref="CertificateRequestAsync"/> which stays usually unused by the <see cref="RestClient"/>, /// since its API is fully asynchronous. This mainly exists for purpose of introducing a synchronous API if needed in the future. /// The <see cref="Uri"/> usually refers to the base address of a server, since declared endpoints usually do not use different authentications. /// </remarks> CertificateCredential CertificateRequest( [NotNull] Uri uri, bool preferHardwareCertificate = false ); #endregion } }
bsd-3-clause
C#
41e45dbac4e5f6ba3a320b3eabd0ea2109ceb732
Fix build warnings
Ninputer/VBF
src/Compilers/Compilers.Scanners/SymbolExpression.cs
src/Compilers/Compilers.Scanners/SymbolExpression.cs
// Copyright 2012 Fan Shi // // This file is part of the VBF project. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Globalization; namespace VBF.Compilers.Scanners { /// <summary> /// Represents a regular expression accepts a literal character /// </summary> public class SymbolExpression : RegularExpression { public SymbolExpression(char symbol) : base(RegularExpressionType.Symbol) { Symbol = symbol; } public new char Symbol { get; private set; } public override string ToString() { return Symbol.ToString(CultureInfo.InvariantCulture); } internal override Func<HashSet<char>>[] GetCompactableCharSets() { return new Func<HashSet<char>>[0]; } internal override HashSet<char> GetUncompactableCharSet() { var result = new HashSet<char> {Symbol}; return result; } internal override T Accept<T>(RegularExpressionConverter<T> converter) { return converter.ConvertSymbol(this); } } }
// Copyright 2012 Fan Shi // // This file is part of the VBF project. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. using System; using System.Collections.Generic; using System.Globalization; namespace VBF.Compilers.Scanners { /// <summary> /// Represents a regular expression accepts a literal character /// </summary> public class SymbolExpression : RegularExpression { public SymbolExpression(char symbol) : base(RegularExpressionType.Symbol) { Symbol = symbol; } public char Symbol { get; private set; } public override string ToString() { return Symbol.ToString(CultureInfo.InvariantCulture); } internal override Func<HashSet<char>>[] GetCompactableCharSets() { return new Func<HashSet<char>>[0]; } internal override HashSet<char> GetUncompactableCharSet() { var result = new HashSet<char> {Symbol}; return result; } internal override T Accept<T>(RegularExpressionConverter<T> converter) { return converter.ConvertSymbol(this); } } }
apache-2.0
C#
aa44980ae9b37df4807e5ea7cfbe01309ea8a50c
fix small bug
mdavid626/artemis
src/Artemis.Data/DbContextRepository.cs
src/Artemis.Data/DbContextRepository.cs
using Artemis.Common; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Linq.Dynamic; namespace Artemis.Data { public abstract class DbContextRepository<T> : IRepository<T> where T : class, IHasKey { private IUnitOfWork unitOfWork; public abstract DbSet<T> EntityDbSet { get; } public DbContextRepository(IUnitOfWork unitOfWork) { this.unitOfWork = unitOfWork; } public T Get(int id) { return EntityDbSet.FirstOrDefault(c => c.Id == id); } public IEnumerable<T> Get(string orderBy = null, string direction = null) { var ordering = GetOrdering(orderBy, direction); return EntityDbSet.OrderBy(ordering); } public void Update(T entity) { } public void Create(T entity) { EntityDbSet.Add(entity); } public void Delete(T entity) { EntityDbSet.Remove(entity); } private string GetOrdering(string orderBy, string direction) { var ascending = true; if (direction?.ToLower() == "desc") ascending = false; var directionText = ascending ? " asc" : " desc"; var allowedProps = typeof(T) .GetProperties() .Where(p => p.GetCustomAttribute<SortableAttribute>() != null) .Select(p => p.Name.ToLower()); var prop = allowedProps.Intersect(new string[] { orderBy?.ToLower() }); if (prop.Any()) { return orderBy + directionText; } return nameof(IHasKey.Id) + directionText; } } }
using Artemis.Common; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Linq.Dynamic; namespace Artemis.Data { public abstract class DbContextRepository<T> : IRepository<T> where T : class, IHasKey { private IUnitOfWork unitOfWork; public abstract DbSet<T> EntityDbSet { get; } public DbContextRepository(IUnitOfWork unitOfWork) { this.unitOfWork = unitOfWork; } public T Get(int id) { return EntityDbSet.FirstOrDefault(c => c.Id == id); } public IEnumerable<T> Get(string orderBy = null, string direction = null) { var ordering = GetOrdering(orderBy, direction); return EntityDbSet.OrderBy(ordering); } public void Update(T entity) { } public void Create(T entity) { EntityDbSet.Add(entity); } public void Delete(T entity) { EntityDbSet.Remove(entity); } private string GetOrdering(string orderBy, string direction) { var ascending = true; if (direction?.ToLower() == "desc") ascending = false; var directionText = ascending ? " asc" : " desc"; var allowedProps = typeof(CarAdvert) .GetProperties() .Where(p => p.GetCustomAttribute<SortableAttribute>() != null) .Select(p => p.Name.ToLower()); var prop = allowedProps.Intersect(new string[] { orderBy?.ToLower() }); if (prop.Any()) { return orderBy + directionText; } return nameof(IHasKey.Id) + directionText; } } }
mit
C#
135cd2647a8aa8b4c342d132400f89f6632b9718
update access modifiers from public -> internal
colinmxs/CodenameGenerator
src/CodenameGenerator/StringExtensions.cs
src/CodenameGenerator/StringExtensions.cs
using System; namespace CodenameGenerator { internal static class StringExtensions { //http://stackoverflow.com/questions/4135317/make-first-letter-of-a-string-upper-case-for-maximum-performance /// <summary> /// Capitalize the first character of a string /// </summary> /// <param name="string"></param> /// <returns></returns> internal static string FirstCharToUpper(this string @string) { if (String.IsNullOrEmpty(@string)) throw new ArgumentException("There is no first letter"); char[] chars = @string.ToCharArray(); chars[0] = char.ToUpper(chars[0]); return new string(chars); } } }
using System; namespace CodenameGenerator { public static class StringExtensions { //http://stackoverflow.com/questions/4135317/make-first-letter-of-a-string-upper-case-for-maximum-performance /// <summary> /// Capitalize the first character of a string /// </summary> /// <param name="string"></param> /// <returns></returns> public static string FirstCharToUpper(this string @string) { if (String.IsNullOrEmpty(@string)) throw new ArgumentException("There is no first letter"); char[] chars = @string.ToCharArray(); chars[0] = char.ToUpper(chars[0]); return new string(chars); } } }
mit
C#
5b9b0c1a168203af0ef8d49ebe5a0bdc31f8da75
Put custom uploaders in same dir as other plugins
nikeee/HolzShots
src/HolzShots.Core/IO/HolzShotsPaths.cs
src/HolzShots.Core/IO/HolzShotsPaths.cs
using System; using System.Diagnostics; using System.IO; namespace HolzShots.IO { public static class HolzShotsPaths { private static readonly string SystemAppDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); private static readonly string UserPicturesDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); private static readonly string AppDataDirectory = Path.Combine(SystemAppDataDirectory, LibraryInformation.Name); public static string SystemPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.System); public static string PluginDirectory { get; } = Path.Combine(AppDataDirectory, "Plugin"); public static string CustomUploadersDirectory { get; } = PluginDirectory; public static string UserSettingsFilePath { get; } = Path.Combine(AppDataDirectory, "settings.json"); public static string DefaultScreenshotSavePath { get; } = Path.Combine(UserPicturesDirectory, LibraryInformation.Name); /// <summary> /// We are doing this synchronously, assuming the application is not located on a network drive. /// See: https://stackoverflow.com/a/20596865 /// </summary> /// <exception cref="System.UnauthorizedAccessException" /> /// <exception cref="System.IO.PathTooLongException" /> public static void EnsureDirectory(string directory) { Debug.Assert(directory != null); DirectoryEx.EnsureDirectory(directory); } } }
using System; using System.Diagnostics; using System.IO; namespace HolzShots.IO { public static class HolzShotsPaths { private static readonly string SystemAppDataDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); private static readonly string UserPicturesDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); private static readonly string AppDataDirectory = Path.Combine(SystemAppDataDirectory, LibraryInformation.Name); public static string SystemPath { get; } = Environment.GetFolderPath(Environment.SpecialFolder.System); public static string PluginDirectory { get; } = Path.Combine(AppDataDirectory, "Plugin"); public static string CustomUploadersDirectory { get; } = Path.Combine(AppDataDirectory, "CustomUploaders"); public static string UserSettingsFilePath { get; } = Path.Combine(AppDataDirectory, "settings.json"); public static string DefaultScreenshotSavePath { get; } = Path.Combine(UserPicturesDirectory, LibraryInformation.Name); /// <summary> /// We are doing this synchronously, assuming the application is not located on a network drive. /// See: https://stackoverflow.com/a/20596865 /// </summary> /// <exception cref="System.UnauthorizedAccessException" /> /// <exception cref="System.IO.PathTooLongException" /> public static void EnsureDirectory(string directory) { Debug.Assert(directory != null); DirectoryEx.EnsureDirectory(directory); } } }
agpl-3.0
C#
bd27a87f634dd4e45220195d6d63cbfe72750e60
Check isLocal using Uri.TryCreate. It is possible in case we have only absolute url.
jmptrader/Nancy,fly19890211/Nancy,hitesh97/Nancy,JoeStead/Nancy,SaveTrees/Nancy,SaveTrees/Nancy,AIexandr/Nancy,malikdiarra/Nancy,ccellar/Nancy,SaveTrees/Nancy,MetSystem/Nancy,anton-gogolev/Nancy,sloncho/Nancy,duszekmestre/Nancy,AIexandr/Nancy,dbolkensteyn/Nancy,EIrwin/Nancy,blairconrad/Nancy,EliotJones/NancyTest,ayoung/Nancy,rudygt/Nancy,cgourlay/Nancy,Crisfole/Nancy,NancyFx/Nancy,grumpydev/Nancy,tparnell8/Nancy,sadiqhirani/Nancy,tsdl2013/Nancy,nicklv/Nancy,xt0rted/Nancy,NancyFx/Nancy,khellang/Nancy,damianh/Nancy,Novakov/Nancy,joebuschmann/Nancy,thecodejunkie/Nancy,sroylance/Nancy,khellang/Nancy,daniellor/Nancy,nicklv/Nancy,sloncho/Nancy,dbolkensteyn/Nancy,dbolkensteyn/Nancy,lijunle/Nancy,sloncho/Nancy,daniellor/Nancy,albertjan/Nancy,khellang/Nancy,dbabox/Nancy,vladlopes/Nancy,tparnell8/Nancy,anton-gogolev/Nancy,jeff-pang/Nancy,sadiqhirani/Nancy,jchannon/Nancy,MetSystem/Nancy,dbolkensteyn/Nancy,felipeleusin/Nancy,guodf/Nancy,jonathanfoster/Nancy,lijunle/Nancy,murador/Nancy,AlexPuiu/Nancy,jeff-pang/Nancy,ccellar/Nancy,sloncho/Nancy,jonathanfoster/Nancy,cgourlay/Nancy,lijunle/Nancy,anton-gogolev/Nancy,horsdal/Nancy,sroylance/Nancy,NancyFx/Nancy,JoeStead/Nancy,adamhathcock/Nancy,AIexandr/Nancy,cgourlay/Nancy,nicklv/Nancy,fly19890211/Nancy,jongleur1983/Nancy,rudygt/Nancy,charleypeng/Nancy,vladlopes/Nancy,duszekmestre/Nancy,adamhathcock/Nancy,jongleur1983/Nancy,danbarua/Nancy,AIexandr/Nancy,dbabox/Nancy,guodf/Nancy,ayoung/Nancy,tareq-s/Nancy,jonathanfoster/Nancy,Worthaboutapig/Nancy,guodf/Nancy,davidallyoung/Nancy,hitesh97/Nancy,jchannon/Nancy,tareq-s/Nancy,joebuschmann/Nancy,horsdal/Nancy,asbjornu/Nancy,Worthaboutapig/Nancy,tparnell8/Nancy,jonathanfoster/Nancy,NancyFx/Nancy,albertjan/Nancy,tareq-s/Nancy,felipeleusin/Nancy,nicklv/Nancy,VQComms/Nancy,albertjan/Nancy,duszekmestre/Nancy,jeff-pang/Nancy,grumpydev/Nancy,Novakov/Nancy,cgourlay/Nancy,sroylance/Nancy,AlexPuiu/Nancy,hitesh97/Nancy,xt0rted/Nancy,damianh/Nancy,VQComms/Nancy,duszekmestre/Nancy,tareq-s/Nancy,VQComms/Nancy,asbjornu/Nancy,Crisfole/Nancy,fly19890211/Nancy,EIrwin/Nancy,xt0rted/Nancy,ayoung/Nancy,thecodejunkie/Nancy,thecodejunkie/Nancy,VQComms/Nancy,phillip-haydon/Nancy,asbjornu/Nancy,thecodejunkie/Nancy,AcklenAvenue/Nancy,EliotJones/NancyTest,xt0rted/Nancy,blairconrad/Nancy,fly19890211/Nancy,ccellar/Nancy,blairconrad/Nancy,jchannon/Nancy,albertjan/Nancy,ayoung/Nancy,vladlopes/Nancy,daniellor/Nancy,charleypeng/Nancy,wtilton/Nancy,lijunle/Nancy,charleypeng/Nancy,blairconrad/Nancy,Novakov/Nancy,MetSystem/Nancy,murador/Nancy,jongleur1983/Nancy,jmptrader/Nancy,jmptrader/Nancy,malikdiarra/Nancy,horsdal/Nancy,phillip-haydon/Nancy,davidallyoung/Nancy,tsdl2013/Nancy,malikdiarra/Nancy,tparnell8/Nancy,sroylance/Nancy,hitesh97/Nancy,adamhathcock/Nancy,MetSystem/Nancy,davidallyoung/Nancy,AlexPuiu/Nancy,davidallyoung/Nancy,ccellar/Nancy,daniellor/Nancy,dbabox/Nancy,wtilton/Nancy,rudygt/Nancy,grumpydev/Nancy,guodf/Nancy,tsdl2013/Nancy,wtilton/Nancy,khellang/Nancy,wtilton/Nancy,danbarua/Nancy,rudygt/Nancy,AlexPuiu/Nancy,dbabox/Nancy,jongleur1983/Nancy,EIrwin/Nancy,JoeStead/Nancy,asbjornu/Nancy,EIrwin/Nancy,murador/Nancy,davidallyoung/Nancy,tsdl2013/Nancy,EliotJones/NancyTest,AcklenAvenue/Nancy,charleypeng/Nancy,anton-gogolev/Nancy,malikdiarra/Nancy,jchannon/Nancy,danbarua/Nancy,murador/Nancy,charleypeng/Nancy,danbarua/Nancy,asbjornu/Nancy,vladlopes/Nancy,joebuschmann/Nancy,felipeleusin/Nancy,horsdal/Nancy,JoeStead/Nancy,damianh/Nancy,phillip-haydon/Nancy,AcklenAvenue/Nancy,jmptrader/Nancy,AIexandr/Nancy,sadiqhirani/Nancy,felipeleusin/Nancy,EliotJones/NancyTest,sadiqhirani/Nancy,SaveTrees/Nancy,Worthaboutapig/Nancy,Novakov/Nancy,grumpydev/Nancy,AcklenAvenue/Nancy,VQComms/Nancy,jeff-pang/Nancy,adamhathcock/Nancy,joebuschmann/Nancy,phillip-haydon/Nancy,Crisfole/Nancy,Worthaboutapig/Nancy,jchannon/Nancy
src/Nancy/Extensions/RequestExtensions.cs
src/Nancy/Extensions/RequestExtensions.cs
namespace Nancy.Extensions { using System; using System.Linq; /// <summary> /// Containing extensions for the <see cref="Request"/> object /// </summary> public static class RequestExtensions { /// <summary> /// An extension method making it easy to check if the reqeuest was done using ajax /// </summary> /// <param name="request">The request made by client</param> /// <returns><see langword="true" /> if the request was done using ajax, otherwise <see langword="false"/>.</returns> public static bool IsAjaxRequest(this Request request) { const string ajaxRequestHeaderKey = "X-Requested-With"; const string ajaxRequestHeaderValue = "XMLHttpRequest"; return request.Headers[ajaxRequestHeaderKey].Contains(ajaxRequestHeaderValue); } /// <summary> /// Gets a value indicating whether the request is local. /// </summary> /// <param name="request">The request made by client</param> /// <returns><see langword="true" /> if the request is local, otherwise <see langword="false"/>.</returns> public static bool IsLocal(this Request request) { if (string.IsNullOrEmpty(request.UserHostAddress) || string.IsNullOrEmpty(request.Url)) { return false; } Uri uri = null; if (Uri.TryCreate(request.Url, UriKind.Absolute, out uri)) { return uri.IsLoopback; } else { // Invalid or relative Request.Url string return false; } } } }
namespace Nancy.Extensions { using System; using System.Linq; /// <summary> /// Containing extensions for the <see cref="Request"/> object /// </summary> public static class RequestExtensions { /// <summary> /// An extension method making it easy to check if the reqeuest was done using ajax /// </summary> /// <param name="request">The request made by client</param> /// <returns><see langword="true" /> if the request was done using ajax, otherwise <see langword="false"/>.</returns> public static bool IsAjaxRequest(this Request request) { const string ajaxRequestHeaderKey = "X-Requested-With"; const string ajaxRequestHeaderValue = "XMLHttpRequest"; return request.Headers[ajaxRequestHeaderKey].Contains(ajaxRequestHeaderValue); } /// <summary> /// Gets a value indicating whether the request is local. /// </summary> /// <param name="request">The request made by client</param> /// <returns><see langword="true" /> if the request is local, otherwise <see langword="false"/>.</returns> public static bool IsLocal(this Request request) { if (string.IsNullOrEmpty(request.UserHostAddress) || string.IsNullOrEmpty(request.Url)) { return false; } try { var uri = new Uri(request.Url); return uri.IsLoopback; } catch (Exception) { // Invalid Request.Url string return false; } } } }
mit
C#
bf94d3ef0b52e9444df9e3e3cc6896cac5ec4f06
Update Validator
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
src/WeihanLi.Common/Services/Validator.cs
src/WeihanLi.Common/Services/Validator.cs
using System.ComponentModel.DataAnnotations; using WeihanLi.Extensions; using AnnotationValidationResult = System.ComponentModel.DataAnnotations.ValidationResult; using ValidationResult = WeihanLi.Common.Models.ValidationResult; namespace WeihanLi.Common.Services; public interface IValidator { ValidationResult Validate(object? value); } public interface IValidator<in T> { ValidationResult Validate(T value); } public interface IAsyncValidator<in T> { Task<ValidationResult> ValidateAsync(T value); } public sealed class DataAnnotationValidator : IValidator { public static IValidator Instance { get; } = new DataAnnotationValidator(); public ValidationResult Validate(object? value) { var validationResult = new ValidationResult(); if(value is null) { validationResult.Valid = false; validationResult.Errors ??= new Dictionary<string, string[]>(); validationResult.Errors[string.Empty] = new[]{ "Value is null" }; } else { var annotationValidateResults = new List<AnnotationValidationResult>(); validationResult.Valid = Validator.TryValidateObject(value, new ValidationContext(value), annotationValidateResults); validationResult.Errors = annotationValidateResults .GroupBy(x => x.MemberNames.StringJoin(",")) .ToDictionary(g => g.Key, g => g.Select(x => x.ErrorMessage).WhereNotNull().ToArray()); } return validationResult; } } public sealed class DelegateValidator : IValidator { private readonly Func<object?, ValidationResult> _validateFunc; public DelegateValidator(Func<object?, ValidationResult> validateFunc) { _validateFunc = Guard.NotNull(validateFunc); } public ValidationResult Validate(object? value) { return _validateFunc.Invoke(value); } } public sealed class DelegateValidator<T> : IValidator<T>, IAsyncValidator<T> { private readonly Func<T, Task<ValidationResult>> _validateFunc; public DelegateValidator(Func<T, ValidationResult> validateFunc) { Guard.NotNull(validateFunc); _validateFunc = t => validateFunc(t).WrapTask(); } public DelegateValidator(Func<T, Task<ValidationResult>> validateFunc) { _validateFunc = Guard.NotNull(validateFunc); } public ValidationResult Validate(T value) { return _validateFunc.Invoke(value).GetAwaiter().GetResult(); } public Task<ValidationResult> ValidateAsync(T value) { return _validateFunc.Invoke(value); } }
using System.ComponentModel.DataAnnotations; using WeihanLi.Extensions; using AnnotationValidationResult = System.ComponentModel.DataAnnotations.ValidationResult; using ValidationResult = WeihanLi.Common.Models.ValidationResult; namespace WeihanLi.Common.Services; public interface IValidator { ValidationResult Validate(object? value); } public interface IValidator<T> { Task<ValidationResult> ValidateAsync(T value); } public sealed class DataAnnotationValidator : IValidator { public static IValidator Instance { get; } static DataAnnotationValidator() { Instance = new DataAnnotationValidator(); } public ValidationResult Validate(object? value) { var validationResult = new ValidationResult(); if(value is null) { validationResult.Valid = false; validationResult.Errors ??= new Dictionary<string, string[]>(); validationResult.Errors[string.Empty] = new[]{ "Value is null" }; } else { var annotationValidateResults = new List<AnnotationValidationResult>(); validationResult.Valid = Validator.TryValidateObject(value, new ValidationContext(value), annotationValidateResults); validationResult.Errors = annotationValidateResults .GroupBy(x => x.MemberNames.StringJoin(",")) .ToDictionary(g => g.Key, g => g.Select(x => x.ErrorMessage).WhereNotNull().ToArray()); } return validationResult; } } public sealed class DelegateValidator : IValidator { private readonly Func<object?, ValidationResult> _validateFunc; public DelegateValidator(Func<object?, ValidationResult> validateFunc) { _validateFunc = Guard.NotNull(validateFunc); } public ValidationResult Validate(object? value) { return _validateFunc.Invoke(value); } } public sealed class DelegateValidator<T> : IValidator<T> { private readonly Func<T, Task<ValidationResult>> _validateFunc; public DelegateValidator(Func<T, Task<ValidationResult>> validateFunc) { _validateFunc = Guard.NotNull(validateFunc); } public Task<ValidationResult> ValidateAsync(T value) { return _validateFunc.Invoke(value); } }
mit
C#
c3a7892d0f730e0446e18daceb46922759501638
fix disposing on enable behavior.
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/Behaviors/FocusOnEnableBehavior.cs
WalletWasabi.Fluent/Behaviors/FocusOnEnableBehavior.cs
using Avalonia; using System; using System.Reactive.Disposables; using System.Reactive.Linq; using Avalonia.Controls; using Avalonia.Input; namespace WalletWasabi.Fluent.Behaviors { public class FocusOnEnableBehavior : DisposingBehavior<Control> { protected override void OnAttached(CompositeDisposable disposables) { AssociatedObject .GetObservable(InputElement.IsEffectivelyEnabledProperty) .Where(x => x) .Subscribe(_ => AssociatedObject!.Focus()) .DisposeWith(disposables); } } }
using Avalonia; using Avalonia.Controls; using Avalonia.Xaml.Interactivity; using System; using System.Reactive.Linq; namespace WalletWasabi.Fluent.Behaviors { public class FocusOnEnableBehavior : Behavior<Control> { protected override void OnAttached() { base.OnAttached(); Observable. FromEventPattern<AvaloniaPropertyChangedEventArgs>(AssociatedObject, nameof(AssociatedObject.PropertyChanged)) .Select(x => x.EventArgs) .Where(x => x.Property.Name == nameof(AssociatedObject.IsEffectivelyEnabled) && x.NewValue is { } && (bool)x.NewValue == true) .Subscribe(_ => AssociatedObject!.Focus()); } protected override void OnDetaching() { base.OnDetaching(); } } }
mit
C#
565dcaa3bd5e65ad172962d463c4f92907327183
Update version
masaedw/LineSharp
LineSharp/Properties/AssemblyInfo.cs
LineSharp/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("LineSharp")] [assembly: AssemblyDescription("A LINE Messaging API binding library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Masayuki Muto")] [assembly: AssemblyProduct("LineSharp")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("0a2c415b-a00f-4e04-83a2-2b1bbe72b73d")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.3.0")] [assembly: AssemblyFileVersion("0.1.3.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("LineSharp")] [assembly: AssemblyDescription("A LINE Messaging API binding library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Masayuki Muto")] [assembly: AssemblyProduct("LineSharp")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("0a2c415b-a00f-4e04-83a2-2b1bbe72b73d")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.0.0")] [assembly: AssemblyFileVersion("0.1.0.0")]
mit
C#
eb493ec4dcc730adc178c12855e4d557ddc07074
Fix whitespace issue
petedavis/essential-templating
test/Essential.Templating.Razor.Tests/Templates/Test.ru.cshtml
test/Essential.Templating.Razor.Tests/Templates/Test.ru.cshtml
@using System @inherits Essential.Templating.Razor.Template Шаблон на русском языке. Выполненен @DateTime.Now
@using System @inherits Essential.Templating.Razor.Template Шаблон на русском языке. Выполненен @DateTime.Now
mit
C#
92376f447a9956c2c221242011dee7bcaa1ddd95
fix guard clause
xbehave/xbehave.net,hitesh97/xbehave.net,adamralph/xbehave.net,modulexcite/xbehave.net,mvalipour/xbehave.net,hitesh97/xbehave.net,modulexcite/xbehave.net,mvalipour/xbehave.net
src/Xbehave.2.Execution.desktop/Step.cs
src/Xbehave.2.Execution.desktop/Step.cs
// <copyright file="Step.cs" company="xBehave.net contributors"> // Copyright (c) xBehave.net contributors. All rights reserved. // </copyright> namespace Xbehave.Execution { using Xunit.Abstractions; using Xunit.Sdk; public class Step : LongLivedMarshalByRefObject, ITest { private readonly ITest scenario; private readonly string displayName; public Step(ITest scenario, string displayName) { Guard.AgainstNullArgument("scenario", scenario); this.scenario = scenario; this.displayName = displayName; } public ITest Scenario { get { return this.scenario; } } public string DisplayName { get { return this.displayName; } } public ITestCase TestCase { get { return this.scenario.TestCase; } } } }
// <copyright file="Step.cs" company="xBehave.net contributors"> // Copyright (c) xBehave.net contributors. All rights reserved. // </copyright> namespace Xbehave.Execution { using Xunit.Abstractions; using Xunit.Sdk; public class Step : LongLivedMarshalByRefObject, ITest { private readonly ITest scenario; private readonly string displayName; public Step(ITest scenario, string displayName) { Guard.AgainstNullArgument("testGroup", scenario); this.scenario = scenario; this.displayName = displayName; } public ITest Scenario { get { return this.scenario; } } public string DisplayName { get { return this.displayName; } } public ITestCase TestCase { get { return this.scenario.TestCase; } } } }
mit
C#
857af8ecd94a8172f2e7a332a0fda67a2dd41040
Add session options
andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples,andrewlock/blog-examples
using-session-state/src/UsingSessionState/Startup.cs
using-session-state/src/UsingSessionState/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace UsingSessionState { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.AddDistributedMemoryCache(); services.AddSession(opts => { opts.CookieName = ".NetEscapades.Session"; opts.IdleTimeout = TimeSpan.FromSeconds(5); }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace UsingSessionState { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddMvc(); services.AddDistributedMemoryCache(); services.AddSession(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseSession(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); } } }
mit
C#
9b34e20521e6de1b3a68c8466516184861dcf804
update description
yb199478/catlib,CatLib/Framework
CatLib.VS/CatLib/API/Debugger/Internal/ILoggerAware.cs
CatLib.VS/CatLib/API/Debugger/Internal/ILoggerAware.cs
/* * This file is part of the CatLib package. * * (c) Yu Bin <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Document: http://catlib.io/ */ namespace CatLib.API.Debugger { /// <summary> /// 设定记录器实例接口 /// </summary> public interface ILoggerAware { /// <summary> /// 设定记录器实例接口 /// </summary> /// <param name="logger">记录器</param> void SetLogger(ILogger logger); } }
/* * This file is part of the CatLib package. * * (c) Yu Bin <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * * Document: http://catlib.io/ */ namespace CatLib.API.Debugger { /// <summary> /// 设定实例接口 /// </summary> public interface ILoggerAware { /// <summary> /// 设定记录器接口 /// </summary> /// <param name="logger">记录器</param> void SetLogger(ILogger logger); } }
unknown
C#
9405d44a5b0f8dbfe5c6bdd094ced11e6efb621c
Fix build
pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet
Test/CoreSDK.Test/TestFramework/Shared/StubPlatform.cs
Test/CoreSDK.Test/TestFramework/Shared/StubPlatform.cs
namespace Microsoft.ApplicationInsights.TestFramework { using System; using System.Collections.Generic; using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.ApplicationInsights.Extensibility.Implementation; using Microsoft.ApplicationInsights.Extensibility.Implementation.External; internal class StubPlatform : IPlatform { public Func<IDictionary<string, object>> OnGetApplicationSettings = () => new Dictionary<string, object>(); public Func<IDebugOutput> OnGetDebugOutput = () => new StubDebugOutput(); public Func<string> OnReadConfigurationXml = () => null; public Func<Exception, ExceptionDetails, ExceptionDetails> OnGetExceptionDetails = (e, p) => new ExceptionDetails(); public string ReadConfigurationXml() { return this.OnReadConfigurationXml(); } public IDebugOutput GetDebugOutput() { return this.OnGetDebugOutput(); } public string GetEnvironmentVariable(string name) { return Environment.GetEnvironmentVariable(name); } } }
namespace Microsoft.ApplicationInsights.TestFramework { using System; using System.Collections.Generic; using Microsoft.ApplicationInsights.Channel; using Microsoft.ApplicationInsights.Extensibility; using Microsoft.ApplicationInsights.Extensibility.Implementation; using Microsoft.ApplicationInsights.Extensibility.Implementation.External; internal class StubPlatform : IPlatform { public Func<IDictionary<string, object>> OnGetApplicationSettings = () => new Dictionary<string, object>(); public Func<IDebugOutput> OnGetDebugOutput = () => new StubDebugOutput(); public Func<string> OnReadConfigurationXml = () => null; public Func<Exception, ExceptionDetails, ExceptionDetails> OnGetExceptionDetails = (e, p) => new ExceptionDetails(); public string ReadConfigurationXml() { return this.OnReadConfigurationXml(); } public IDebugOutput GetDebugOutput() { return this.OnGetDebugOutput(); } } }
mit
C#
368fb1ed53ea1f7cf60070437dc162e53742ebd1
Fix tests.
JohanLarsson/Gu.Units
Gu.Units.Tests/LengthUnitTests.cs
Gu.Units.Tests/LengthUnitTests.cs
namespace Gu.Units.Tests { using System; using NUnit.Framework; public class LengthUnitTests { public static string[] HappyPathSource { get; } = { "m", "mm", " cm", " m ", "ft", "yd" }; public static string[] ErrorSource { get; } = { "ssg", "mms" }; [TestCaseSource(nameof(HappyPathSource))] public void ParseSuccess(string text) { var lengthUnit = LengthUnit.Parse(text); Assert.AreEqual(text.Trim(), lengthUnit.ToString()); } [TestCaseSource(nameof(ErrorSource))] public void ParseError(string text) { Assert.Throws<FormatException>(() => LengthUnit.Parse(text)); LengthUnit temp; Assert.AreEqual(false, LengthUnit.TryParse(text, out temp)); } [TestCaseSource(nameof(HappyPathSource))] public void TryParseSuccess(string text) { LengthUnit result; Assert.AreEqual(true, LengthUnit.TryParse(text, out result)); Assert.AreEqual(text.Trim(), result.ToString()); } [TestCaseSource(nameof(ErrorSource))] public void TryParseError(string text) { LengthUnit temp; Assert.AreEqual(false, LengthUnit.TryParse(text, out temp)); } } }
namespace Gu.Units.Tests { using System; using System.Collections.Generic; using NUnit.Framework; public class LengthUnitTests { [TestCaseSource(nameof(HappyPathSource))] public void ParseSuccess(string text) { var lengthUnit = LengthUnit.Parse(text); Assert.AreEqual(text.Trim(), lengthUnit.ToString()); } [TestCaseSource(nameof(ErrorSource))] public void ParseError(string text) { Assert.Throws<FormatException>(() => LengthUnit.Parse(text)); LengthUnit temp; Assert.AreEqual(false, LengthUnit.TryParse(text, out temp)); } [TestCaseSource(nameof(HappyPathSource))] public void TryParseSuccess(string text) { LengthUnit result; Assert.AreEqual(true, LengthUnit.TryParse(text, out result)); Assert.AreEqual(text.Trim(), result.ToString()); } [TestCaseSource(nameof(ErrorSource))] public void TryParseError(string text) { LengthUnit temp; Assert.AreEqual(false, LengthUnit.TryParse(text, out temp)); } private IReadOnlyList<string> HappyPathSource = new[] { "m", "mm", " cm", " m ", "ft", "yd" }; private IReadOnlyList<string> ErrorSource = new[] { "ssg", "mms" }; } }
mit
C#
51510955c8a3dedc95f79d487b6963a75e3f4b8b
Fix a dumb bug in the interface generator
PKRoma/refit,ammachado/refit,jlucansky/refit,PureWeen/refit,mteper/refit,onovotny/refit,martijn00/refit,mteper/refit,jlucansky/refit,paulcbetts/refit,martijn00/refit,paulcbetts/refit,ammachado/refit,onovotny/refit,PureWeen/refit
InterfaceStubGenerator/Program.cs
InterfaceStubGenerator/Program.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Refit.Generator { class Program { static void Main(string[] args) { // NB: @Compile passes us a list of files relative to the project // directory - we're going to assume that the target is always in // the same directory as the project file var generator = new InterfaceStubGenerator(); var target = new FileInfo(args[0]); var targetDir = target.DirectoryName; var files = args[1].Split(';') .Select(x => new FileInfo(Path.Combine(targetDir, x))) .ToArray(); var template = generator.GenerateInterfaceStubs(files.Select(x => x.FullName).ToArray()); File.WriteAllText(target.FullName, template); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Refit.Generator { class Program { static void Main(string[] args) { var generator = new InterfaceStubGenerator(); var target = new FileInfo(args[0]); var files = args[1].Split(';').Select(x => new FileInfo(x)).ToArray(); var template = generator.GenerateInterfaceStubs(files.Select(x => x.FullName).ToArray()); File.WriteAllText(target.FullName, template); } } }
mit
C#