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 |
|---|---|---|---|---|---|---|---|---|
f72bab4960ef73e37dfa3109bd88d8b65b7e1563 | make other invocations async | Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns | TCC.Core/Controls/TccPopup.cs | TCC.Core/Controls/TccPopup.cs | using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace TCC.Controls
{
public class TccPopup : Popup
{
public double MouseLeaveTolerance
{
get => (double)GetValue(MouseLeaveToleranceProperty);
set => SetValue(MouseLeaveToleranceProperty, value);
}
public static readonly DependencyProperty MouseLeaveToleranceProperty = DependencyProperty.Register("MouseLeaveTolerance",
typeof(double),
typeof(TccPopup),
new PropertyMetadata(0D));
public TccPopup()
{
WindowManager.VisibilityManager.VisibilityChanged += OnVisiblityChanged;
FocusManager.ForegroundChanged += OnForegroundChanged;
}
protected override void OnOpened(EventArgs e)
{
FocusManager.PauseTopmost = true;
base.OnOpened(e);
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
FocusManager.PauseTopmost = false;
}
private void OnForegroundChanged()
{
if (FocusManager.IsForeground) return;
Dispatcher?.InvokeAsync(() => IsOpen = false);
}
private void OnVisiblityChanged()
{
if (WindowManager.VisibilityManager.Visible) return;
Dispatcher?.InvokeAsync(() => IsOpen = false);
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (Child == null) return;
var content = (FrameworkElement) Child;
var pos = e.MouseDevice.GetPosition(content);
if ((pos.X > MouseLeaveTolerance && pos.X < content.ActualWidth - MouseLeaveTolerance)
&& (pos.Y > MouseLeaveTolerance && pos.Y < content.ActualHeight - MouseLeaveTolerance)) return;
IsOpen = false;
}
}
} | using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
namespace TCC.Controls
{
public class TccPopup : Popup
{
public double MouseLeaveTolerance
{
get => (double)GetValue(MouseLeaveToleranceProperty);
set => SetValue(MouseLeaveToleranceProperty, value);
}
public static readonly DependencyProperty MouseLeaveToleranceProperty = DependencyProperty.Register("MouseLeaveTolerance",
typeof(double),
typeof(TccPopup),
new PropertyMetadata(0D));
public TccPopup()
{
WindowManager.VisibilityManager.VisibilityChanged += OnVisiblityChanged;
FocusManager.ForegroundChanged += OnForegroundChanged;
}
protected override void OnOpened(EventArgs e)
{
FocusManager.PauseTopmost = true;
base.OnOpened(e);
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
FocusManager.PauseTopmost = false;
}
private void OnForegroundChanged()
{
if (FocusManager.IsForeground) return;
Dispatcher?.Invoke(() => IsOpen = false);
}
private void OnVisiblityChanged()
{
if (WindowManager.VisibilityManager.Visible) return;
Dispatcher?.Invoke(() => IsOpen = false);
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
if (Child == null) return;
var content = (FrameworkElement) Child;
var pos = e.MouseDevice.GetPosition(content);
if ((pos.X > MouseLeaveTolerance && pos.X < content.ActualWidth - MouseLeaveTolerance)
&& (pos.Y > MouseLeaveTolerance && pos.Y < content.ActualHeight - MouseLeaveTolerance)) return;
IsOpen = false;
}
}
} | mit | C# |
0ed1aa59d12427fb76ef6d6ed25922f979793380 | Update AssemblyInfo.cs | Guaranteed-Rate/Net.RequestStiching | Clients/Properties/AssemblyInfo.cs | Clients/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("Request stitching HTTP client")]
[assembly: AssemblyDescription("Simple HTTP client that stitches together requests by adding X-Request-Id and X-Session-Id into the header of requests")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Guaranteed Rate")]
[assembly: AssemblyProduct("GuaranteedRate.Net.RequestStitching.Clients")]
[assembly: AssemblyCopyright("Copyright © Guaranteed Rate 2015")]
[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("eb4c32f7-c5bd-4afb-8f6f-bf971f1f87a8")]
[assembly: AssemblyVersion("1.0.7")]
[assembly: AssemblyFileVersion("1.0.7")]
| 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("Request stitching HTTP client")]
[assembly: AssemblyDescription("Simple HTTP client that stitches together requests by adding X-Request-Id and X-Session-Id into the header of requests")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Guaranteed Rate")]
[assembly: AssemblyProduct("GuaranteedRate.Net.RequestStitching.Clients")]
[assembly: AssemblyCopyright("Copyright © Guaranteed Rate 2015")]
[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("eb4c32f7-c5bd-4afb-8f6f-bf971f1f87a8")]
[assembly: AssemblyVersion("1.0.6")]
[assembly: AssemblyFileVersion("1.0.6")]
| apache-2.0 | C# |
25518ac1a3d1c4ccbe5828ba9ce365661d3681d8 | Fix calculation in GDAXFeeModel | jameschch/Lean,redmeros/Lean,Jay-Jay-D/LeanSTP,StefanoRaggi/Lean,QuantConnect/Lean,Jay-Jay-D/LeanSTP,AlexCatarino/Lean,AlexCatarino/Lean,Jay-Jay-D/LeanSTP,QuantConnect/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,StefanoRaggi/Lean,redmeros/Lean,jameschch/Lean,kaffeebrauer/Lean,StefanoRaggi/Lean,jameschch/Lean,AlexCatarino/Lean,StefanoRaggi/Lean,Jay-Jay-D/LeanSTP,AnshulYADAV007/Lean,AnshulYADAV007/Lean,AnshulYADAV007/Lean,jameschch/Lean,Jay-Jay-D/LeanSTP,kaffeebrauer/Lean,QuantConnect/Lean,JKarathiya/Lean,AlexCatarino/Lean,AnshulYADAV007/Lean,kaffeebrauer/Lean,StefanoRaggi/Lean,jameschch/Lean,kaffeebrauer/Lean,JKarathiya/Lean,QuantConnect/Lean,redmeros/Lean,redmeros/Lean,JKarathiya/Lean,JKarathiya/Lean | Common/Orders/Fees/GDAXFeeModel.cs | Common/Orders/Fees/GDAXFeeModel.cs | /*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* 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;
namespace QuantConnect.Orders.Fees
{
/// <summary>
/// Provides an implementation of <see cref="IFeeModel"/> that models GDAX order fees
/// </summary>
public class GDAXFeeModel : IFeeModel
{
/// <summary>
/// Tier 1 maker fees
/// https://www.gdax.com/fees/BTC-USD
/// </summary>
private static readonly Dictionary<string, decimal> Fees = new Dictionary<string, decimal>
{
{ "BTCUSD", 0.0025m }, { "BTCEUR", 0.0025m }, { "BTCGBP", 0.0025m },
{ "BCHBTC", 0.003m }, { "BCHEUR", 0.003m }, { "BCHUSD", 0.003m },
{ "ETHBTC", 0.003m }, { "ETHEUR", 0.003m }, { "ETHUSD", 0.003m },
{ "LTCBTC", 0.003m }, { "LTCEUR", 0.003m }, { "LTCUSD", 0.003m }
};
/// <summary>
/// Get the fee for this order in units of the account currency
/// </summary>
/// <param name="security">The security matching the order</param>
/// <param name="order">The order to compute fees for</param>
/// <returns>The cost of the order in units of the account currency</returns>
public decimal GetOrderFee(Securities.Security security, Order order)
{
//0% maker fee after reimbursement.
if (order.Type == OrderType.Limit)
{
return 0m;
}
// currently we do not model daily rebates
decimal fee;
Fees.TryGetValue(security.Symbol.Value, out fee);
// get order value in account currency, then apply fee factor
return Math.Abs(order.GetValue(security)) * fee;
}
}
}
| /*
* QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
* Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
*
* 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.Collections.Generic;
namespace QuantConnect.Orders.Fees
{
/// <summary>
/// Provides an implementation of <see cref="IFeeModel"/> that models GDAX order fees
/// </summary>
public class GDAXFeeModel : IFeeModel
{
/// <summary>
/// Tier 1 maker fees
/// https://www.gdax.com/fees/BTC-USD
/// </summary>
private static readonly Dictionary<string, decimal> Fees = new Dictionary<string, decimal>
{
{ "BTCUSD", 0.0025m }, { "BTCEUR", 0.0025m }, { "BTCGBP", 0.0025m },
{ "BCHBTC", 0.003m }, { "BCHEUR", 0.003m }, { "BCHUSD", 0.003m },
{ "ETHBTC", 0.003m }, { "ETHEUR", 0.003m }, { "ETHUSD", 0.003m },
{ "LTCBTC", 0.003m }, { "LTCEUR", 0.003m }, { "LTCUSD", 0.003m }
};
/// <summary>
/// Get the fee for this order in units of the account currency
/// </summary>
/// <param name="security">The security matching the order</param>
/// <param name="order">The order to compute fees for</param>
/// <returns>The cost of the order in units of the account currency</returns>
public decimal GetOrderFee(Securities.Security security, Order order)
{
//0% maker fee after reimbursement.
if (order.Type == OrderType.Limit)
{
return 0m;
}
// currently we do not model daily rebates
decimal fee;
Fees.TryGetValue(security.Symbol.Value, out fee);
// get order value in account currency, then apply fee factor
return order.GetValue(security) * fee;
}
}
}
| apache-2.0 | C# |
bb15dd4fbac85a23350bed14a6831f8f6f8bc5e8 | Update Program.cs | MShechtman/Test2 | ConsoleApp1/ConsoleApp1/Program.cs | ConsoleApp1/ConsoleApp1/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
//new test on master 2
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
}
}
}
| mit | C# |
ef9e31dc740e513d68ff7f2feb750df52d582deb | fix test | mstyura/Anotar,Fody/Anotar,distantcam/Anotar,modulexcite/Anotar | Tests/MockAssemblyResolver.cs | Tests/MockAssemblyResolver.cs | using System;
using System.IO;
using System.Reflection;
using Mono.Cecil;
public class MockAssemblyResolver : IAssemblyResolver
{
public AssemblyDefinition Resolve(AssemblyNameReference name)
{
var fileName = Path.Combine(Directory, name.Name) + ".dll";
if (File.Exists(fileName))
{
return AssemblyDefinition.ReadAssembly(fileName);
}
try
{
var assembly = Assembly.Load(name.FullName);
var codeBase = assembly.CodeBase.Replace("file:///", "");
return AssemblyDefinition.ReadAssembly(codeBase);
}
catch (FileNotFoundException)
{
return null;
}
}
public AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
{
throw new NotImplementedException();
}
public AssemblyDefinition Resolve(string fullName)
{
var codeBase = Assembly.Load(fullName).CodeBase.Replace("file:///","");
return AssemblyDefinition.ReadAssembly(codeBase);
}
public AssemblyDefinition Resolve(string fullName, ReaderParameters parameters)
{
throw new NotImplementedException();
}
public string Directory;
} | using System;
using System.IO;
using System.Reflection;
using Mono.Cecil;
public class MockAssemblyResolver : IAssemblyResolver
{
public AssemblyDefinition Resolve(AssemblyNameReference name)
{
var fileName = Path.Combine(Directory, name.Name) + ".dll";
if (File.Exists(fileName))
{
return AssemblyDefinition.ReadAssembly(fileName);
}
var codeBase = Assembly.Load(name.FullName).CodeBase.Replace("file:///", "");
return AssemblyDefinition.ReadAssembly(codeBase);
}
public AssemblyDefinition Resolve(AssemblyNameReference name, ReaderParameters parameters)
{
throw new NotImplementedException();
}
public AssemblyDefinition Resolve(string fullName)
{
var codeBase = Assembly.Load(fullName).CodeBase.Replace("file:///","");
return AssemblyDefinition.ReadAssembly(codeBase);
}
public AssemblyDefinition Resolve(string fullName, ReaderParameters parameters)
{
throw new NotImplementedException();
}
public string Directory;
} | mit | C# |
725ca8fc86127d04c8dd5a1dc23a3b4d4ec4d5f5 | Throw specific exception in OldestNonAckedMessageUpdaterPeriodicAction | Abc-Arbitrage/Zebus | src/Abc.Zebus.Persistence.CQL/PeriodicAction/OldestNonAckedMessageUpdaterPeriodicAction.cs | src/Abc.Zebus.Persistence.CQL/PeriodicAction/OldestNonAckedMessageUpdaterPeriodicAction.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abc.Zebus.Hosting;
using Abc.Zebus.Persistence.CQL.Storage;
using Abc.Zebus.Persistence.Storage;
using Abc.Zebus.Util;
namespace Abc.Zebus.Persistence.CQL.PeriodicAction
{
public class OldestNonAckedMessageUpdaterPeriodicAction : PeriodicActionHostInitializer
{
private readonly ICqlPersistenceConfiguration _configuration;
private readonly ICqlStorage _cqlStorage;
private DateTime _lastGlobalCheck;
private readonly NonAckedCountCache _nonAckedCountCache = new NonAckedCountCache();
public OldestNonAckedMessageUpdaterPeriodicAction(IBus bus, ICqlPersistenceConfiguration configuration, ICqlStorage cqlStorage)
: base(bus, configuration.OldestMessagePerPeerCheckPeriod)
{
_configuration = configuration;
_cqlStorage = cqlStorage;
}
public override void DoPeriodicAction()
{
var isGlobalCheck = SystemDateTime.UtcNow >= _lastGlobalCheck.Add(_configuration.OldestMessagePerPeerGlobalCheckPeriod);
var allPeersDictionary = _cqlStorage.GetAllKnownPeers().ToDictionary(state => state.PeerId);
IEnumerable<PeerState> peersToCheck = allPeersDictionary.Values;
var updatedPeers = _nonAckedCountCache.GetUpdatedValues(peersToCheck.Select(x => new NonAckedCount(x.PeerId, x.NonAckedMessageCount)));
if (isGlobalCheck)
{
_lastGlobalCheck = SystemDateTime.UtcNow;
}
else
{
peersToCheck = updatedPeers.Select(x => allPeersDictionary[x.PeerId]);
}
Parallel.ForEach(peersToCheck, new ParallelOptions { MaxDegreeOfParallelism = 10 }, UpdateOldestNonAckedMessage);
}
private void UpdateOldestNonAckedMessage(PeerState peer)
{
if (peer.Removed)
return;
try
{
_cqlStorage.UpdateNewOldestMessageTimestamp(peer)
.Wait(_configuration.OldestMessagePerPeerCheckPeriod);
}
catch (Exception ex)
{
throw new Exception($"Unable to update oldest message timestamp for peer {peer.PeerId}", ex);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abc.Zebus.Hosting;
using Abc.Zebus.Persistence.CQL.Storage;
using Abc.Zebus.Persistence.Storage;
using Abc.Zebus.Util;
namespace Abc.Zebus.Persistence.CQL.PeriodicAction
{
public class OldestNonAckedMessageUpdaterPeriodicAction : PeriodicActionHostInitializer
{
private readonly ICqlPersistenceConfiguration _configuration;
private readonly ICqlStorage _cqlStorage;
private DateTime _lastGlobalCheck;
private readonly NonAckedCountCache _nonAckedCountCache = new NonAckedCountCache();
public OldestNonAckedMessageUpdaterPeriodicAction(IBus bus, ICqlPersistenceConfiguration configuration, ICqlStorage cqlStorage)
: base(bus, configuration.OldestMessagePerPeerCheckPeriod)
{
_configuration = configuration;
_cqlStorage = cqlStorage;
}
public override void DoPeriodicAction()
{
var isGlobalCheck = SystemDateTime.UtcNow >= _lastGlobalCheck.Add(_configuration.OldestMessagePerPeerGlobalCheckPeriod);
var allPeersDictionary = _cqlStorage.GetAllKnownPeers().ToDictionary(state => state.PeerId);
IEnumerable<PeerState> peersToCheck = allPeersDictionary.Values;
var updatedPeers = _nonAckedCountCache.GetUpdatedValues(peersToCheck.Select(x => new NonAckedCount(x.PeerId, x.NonAckedMessageCount)));
if (isGlobalCheck)
{
_lastGlobalCheck = SystemDateTime.UtcNow;
}
else
{
peersToCheck = updatedPeers.Select(x => allPeersDictionary[x.PeerId]);
}
Parallel.ForEach(peersToCheck, new ParallelOptions { MaxDegreeOfParallelism = 10 }, UpdateOldestNonAckedMessage);
}
private void UpdateOldestNonAckedMessage(PeerState peer)
{
if (peer.Removed)
return;
_cqlStorage.UpdateNewOldestMessageTimestamp(peer)
.Wait(_configuration.OldestMessagePerPeerCheckPeriod);
}
}
}
| mit | C# |
75ae37eacdddbbaa42174694dcf0641dac4e86da | add aria-label to form field without <label> tag | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerApprenticeshipsService.Web/Views/EmployerAccount/SelectEmployer.cshtml | src/SFA.DAS.EmployerApprenticeshipsService.Web/Views/EmployerAccount/SelectEmployer.cshtml | <div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-medium">Search for your company</h1>
<p>
We need to add a company name to the contract between you and the Skills Funding Agency.
To find your company enter the company number of your organisation that is registered with Companies House.
</p>
<h2 class="heading-medium">Companies House number</h2>
<form method="POST" action="@Url.Action("SelectEmployer")">
<div class="form-group">
<input class="form-control form-control-3-4" id="EmployerRef" name="EmployerRef" type="text"
aria-required="true" aria-label="Companies House number"/>
</div>
<button type="submit" class="button">Continue</button>
</form>
</div>
</div>
| <div class="grid-row">
<div class="column-two-thirds">
<h1 class="heading-medium">Search for your company</h1>
<p>
We need to add a company name to the contract between you and the Skills Funding Agency.
To find your company enter the company number of your organisation that is registered with Companies House.
</p>
<h2 class="heading-medium">Companies House number</h2>
<form method="POST" action="@Url.Action("SelectEmployer")">
<div class="form-group">
<input class="form-control form-control-3-4" id="EmployerRef" name="EmployerRef" type="text"
aria-required="true" />
</div>
<button type="submit" class="button">Continue</button>
</form>
</div>
</div>
| mit | C# |
226440debd9c9df579df302620b050a41474dd29 | fix tests | JetBrains/resharper-unity,JetBrains/resharper-unity,JetBrains/resharper-unity | resharper/src/resharper-unity/Rider/Settings/UiMinimizerSettings.cs | resharper/src/resharper-unity/Rider/Settings/UiMinimizerSettings.cs | using JetBrains.Application.Settings;
using JetBrains.DataFlow;
using JetBrains.Platform.RdFramework.Base;
using JetBrains.Platform.RdFramework.Util;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Host.Features;
using JetBrains.ReSharper.Plugins.Unity.Settings;
using JetBrains.Rider.Model;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.Settings
{
[SolutionComponent]
public class UiMinimizerSettings
{
public UiMinimizerSettings(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore)
{
if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null)
return;
var boundStore = settingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
var hideDatabaseSetting = boundStore.GetValueProperty(lifetime, (UnitySettings s) => s.HideDataBaseToolWindow);
var hideSolutionConfiguration = boundStore.GetValueProperty(lifetime,(UnitySettings s) => s.HideSolutionConfiguration);
var rdUnityModel = solution.GetProtocolSolution().GetRdUnityModel();
BindRdPropertyToProperty(lifetime, rdUnityModel.HideDataBaseToolWindow, hideDatabaseSetting);
BindRdPropertyToProperty(lifetime, rdUnityModel.HideSolutionConfiguration, hideSolutionConfiguration);
}
private static void BindRdPropertyToProperty(Lifetime lifetime, IRdProperty<bool> rdProperty, IProperty<bool> property)
{
rdProperty.Value = property.Value;
rdProperty.Advise(lifetime, value => property.SetValue(value));
property.Change.Advise(lifetime, args =>
{
if (args.HasNew)
rdProperty.SetValue(args.New);
});
}
}
} | using JetBrains.Application.Settings;
using JetBrains.DataFlow;
using JetBrains.Platform.RdFramework.Base;
using JetBrains.Platform.RdFramework.Util;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Host.Features;
using JetBrains.ReSharper.Plugins.Unity.Settings;
using JetBrains.Rider.Model;
namespace JetBrains.ReSharper.Plugins.Unity.Rider.Settings
{
[SolutionComponent]
public class UiMinimizerSettings
{
public UiMinimizerSettings(Lifetime lifetime, ISolution solution, ISettingsStore settingsStore)
{
var boundStore = settingsStore.BindToContextLive(lifetime, ContextRange.ApplicationWide);
var hideDatabaseSetting = boundStore.GetValueProperty(lifetime, (UnitySettings s) => s.HideDataBaseToolWindow);
var hideSolutionConfiguration = boundStore.GetValueProperty(lifetime,(UnitySettings s) => s.HideSolutionConfiguration);
var rdUnityModel = solution.GetProtocolSolution().GetRdUnityModel();
BindRdPropertyToProperty(lifetime, rdUnityModel.HideDataBaseToolWindow, hideDatabaseSetting);
BindRdPropertyToProperty(lifetime, rdUnityModel.HideSolutionConfiguration, hideSolutionConfiguration);
}
private static void BindRdPropertyToProperty(Lifetime lifetime, IRdProperty<bool> rdProperty, IProperty<bool> property)
{
rdProperty.Value = property.Value;
rdProperty.Advise(lifetime, value => property.SetValue(value));
property.Change.Advise(lifetime, args =>
{
if (args.HasNew)
rdProperty.SetValue(args.New);
});
}
}
} | apache-2.0 | C# |
983b81397bac3a393437ddb5aaeb59d5bb8260d6 | Add using for db context | nProdanov/Team-French-75 | TravelAgency/TravelAgency.Client/Startup.cs | TravelAgency/TravelAgency.Client/Startup.cs | using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelAgency.Data;
using TravelAgency.Data.Migrations;
using TravelAgency.MongoDbExtractor;
namespace TravelAgency.Client
{
public class Startup
{
public static void Main()
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<TravelAgencyDbContext, Configuration>());
using (var travelAgencyDbContext = new TravelAgencyDbContext())
{
var mongoExtractor = new MongoDbDataExtractor();
var dataImporter = new TravelAgenciesDataImporter(travelAgencyDbContext, mongoExtractor);
dataImporter.ImportData();
travelAgencyDbContext.SaveChanges();
}
//// Just for test - to see if something has been written to the Database
// Console.WriteLine(db.Destinations.Count());
}
}
}
| using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TravelAgency.Data;
using TravelAgency.Data.Migrations;
using TravelAgency.MongoDbExtractor;
namespace TravelAgency.Client
{
public class Startup
{
public static void Main()
{
Database.SetInitializer(new MigrateDatabaseToLatestVersion<TravelAgencyDbContext, Configuration>());
var travelAgencyDbContext = new TravelAgencyDbContext();
var mongoExtractor = new MongoDbDataExtractor();
var dataImporter = new TravelAgenciesDataImporter(travelAgencyDbContext, mongoExtractor);
dataImporter.ImportData();
try
{
travelAgencyDbContext.SaveChanges();
}
catch (System.Data.Entity.Validation.DbEntityValidationException ex)
{
throw;
}
//// Just for test - to see if something has been written to the Database
// Console.WriteLine(db.Destinations.Count());
}
}
}
| mit | C# |
50872a49309ce701e894fdd3b1348f9fb38a0229 | Update Version : 1.7.171.0 URL Changes + Fix User Manager Delete | Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal,Appleseed/portal | Master/Appleseed/Projects/Appleseed.Framework.Web.UI.WebControls/Properties/AssemblyInfo.cs | Master/Appleseed/Projects/Appleseed.Framework.Web.UI.WebControls/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("Appleseed.Framework.Web.UI.WebControls")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : Framework Controls")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("Appleseed.Framework.Web.UI.WebControls")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-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("9e4ca3a3-9394-41fd-ab23-8ec8c9568e35")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.7.171.0")]
[assembly: AssemblyFileVersion("1.7.171.0")]
| 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("Appleseed.Framework.Web.UI.WebControls")]
[assembly: AssemblyDescription("Appleseed Portal and Content Management System : Framework Controls")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ANANT Corporation")]
[assembly: AssemblyProduct("Appleseed.Framework.Web.UI.WebControls")]
[assembly: AssemblyCopyright("Copyright © ANANT Corporation 2010-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("9e4ca3a3-9394-41fd-ab23-8ec8c9568e35")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.6.160.540")]
[assembly: AssemblyFileVersion("1.6.160.540")]
| apache-2.0 | C# |
f5267fc14546c369c440db56569572568ae9a9d5 | Rename SetInt & GetInt -> SetInt32 & GetInt32 | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.Http.Extensions/SessionCollectionExtensions.cs | src/Microsoft.AspNet.Http.Extensions/SessionCollectionExtensions.cs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Text;
namespace Microsoft.AspNet.Http
{
public static class SessionCollectionExtensions
{
public static void SetInt32(this ISessionCollection session, string key, int value)
{
var bytes = new byte[]
{
(byte)(value >> 24),
(byte)(0xFF & (value >> 16)),
(byte)(0xFF & (value >> 8)),
(byte)(0xFF & value)
};
session.Set(key, bytes);
}
public static int? GetInt32(this ISessionCollection session, string key)
{
var data = session.Get(key);
if (data == null || data.Length < 4)
{
return null;
}
return data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
}
public static void SetString(this ISessionCollection session, string key, string value)
{
session.Set(key, Encoding.UTF8.GetBytes(value));
}
public static string GetString(this ISessionCollection session, string key)
{
var data = session.Get(key);
if (data == null)
{
return null;
}
return Encoding.UTF8.GetString(data);
}
public static byte[] Get(this ISessionCollection session, string key)
{
byte[] value = null;
session.TryGetValue(key, out value);
return value;
}
public static void Set(this ISessionCollection session, string key, byte[] value)
{
session.Set(key, new ArraySegment<byte>(value));
}
}
} | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Text;
namespace Microsoft.AspNet.Http
{
public static class SessionCollectionExtensions
{
public static void SetInt(this ISessionCollection session, string key, int value)
{
var bytes = new byte[]
{
(byte)(value >> 24),
(byte)(0xFF & (value >> 16)),
(byte)(0xFF & (value >> 8)),
(byte)(0xFF & value)
};
session.Set(key, bytes);
}
public static int? GetInt(this ISessionCollection session, string key)
{
var data = session.Get(key);
if (data == null || data.Length < 4)
{
return null;
}
return data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
}
public static void SetString(this ISessionCollection session, string key, string value)
{
session.Set(key, Encoding.UTF8.GetBytes(value));
}
public static string GetString(this ISessionCollection session, string key)
{
var data = session.Get(key);
if (data == null)
{
return null;
}
return Encoding.UTF8.GetString(data);
}
public static byte[] Get(this ISessionCollection session, string key)
{
byte[] value = null;
session.TryGetValue(key, out value);
return value;
}
public static void Set(this ISessionCollection session, string key, byte[] value)
{
session.Set(key, new ArraySegment<byte>(value));
}
}
} | apache-2.0 | C# |
adc5c7a407a4bee4fa4a68bc43428d358a590ace | Fix filter bug in MessagesTemplate.cs | Rickedb/OpenProtocolInterpreter,Rickedb/OpenProtocolIntepreter | src/OpenProtocolInterpreter/_internals/Messages/MessagesTemplate.cs | src/OpenProtocolInterpreter/_internals/Messages/MessagesTemplate.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace OpenProtocolInterpreter.Messages
{
internal abstract class MessagesTemplate : IMessagesTemplate
{
protected IDictionary<int, MidCompiledInstance> _templates;
public MessagesTemplate()
{
_templates = new Dictionary<int, MidCompiledInstance>();
}
public abstract bool IsAssignableTo(int mid);
public Mid ProcessPackage(int mid, string package)
{
var compiledInstance = GetMidType(mid);
return compiledInstance.CompiledConstructor().Parse(package);
}
public Mid ProcessPackage(int mid, byte[] package)
{
var compiledInstance = GetMidType(mid);
return compiledInstance.CompiledConstructor().Parse(package);
}
protected void FilterSelectedMids(InterpreterMode mode)
{
if (mode == InterpreterMode.Both)
return;
var type = mode == InterpreterMode.Controller ? typeof(IIntegrator) : typeof(IController);
var selectedMids = _templates.Values.Where(x => type.IsAssignableFrom(x.Type));
FilterSelectedMids(selectedMids);
}
protected void FilterSelectedMids(IEnumerable<Type> mids)
{
var ignoredMids = _templates.Values.Where(x => mids.Contains(x.Type));
FilterSelectedMids(ignoredMids);
}
private void FilterSelectedMids(IEnumerable<MidCompiledInstance> mids)
{
var ignoredMids = _templates.Where(x => !mids.Contains(x.Value)).ToList();
foreach (var ignore in ignoredMids)
_templates.Remove(ignore);
}
private MidCompiledInstance GetMidType(int mid)
{
if (!_templates.TryGetValue(mid, out MidCompiledInstance instanceCompiler))
{
throw new NotImplementedException($"MID {mid} was not implemented, please register it!");
}
return instanceCompiler;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace OpenProtocolInterpreter.Messages
{
internal abstract class MessagesTemplate : IMessagesTemplate
{
protected IDictionary<int, MidCompiledInstance> _templates;
public MessagesTemplate()
{
_templates = new Dictionary<int, MidCompiledInstance>();
}
public abstract bool IsAssignableTo(int mid);
public Mid ProcessPackage(int mid, string package)
{
var compiledInstance = GetMidType(mid);
return compiledInstance.CompiledConstructor().Parse(package);
}
public Mid ProcessPackage(int mid, byte[] package)
{
var compiledInstance = GetMidType(mid);
return compiledInstance.CompiledConstructor().Parse(package);
}
protected void FilterSelectedMids(InterpreterMode mode)
{
if (mode == InterpreterMode.Both)
return;
var type = mode == InterpreterMode.Controller ? typeof(IIntegrator) : typeof(IController);
var selectedMids = _templates.Values.Where(x => x.Type.IsAssignableFrom(type));
FilterSelectedMids(selectedMids);
}
protected void FilterSelectedMids(IEnumerable<Type> mids)
{
var ignoredMids = _templates.Values.Where(x => mids.Contains(x.Type));
FilterSelectedMids(ignoredMids);
}
private void FilterSelectedMids(IEnumerable<MidCompiledInstance> mids)
{
var ignoredMids = _templates.Where(x => !mids.Contains(x.Value)).ToList();
foreach (var ignore in ignoredMids)
_templates.Remove(ignore);
}
private MidCompiledInstance GetMidType(int mid)
{
if (!_templates.TryGetValue(mid, out MidCompiledInstance instanceCompiler))
{
throw new NotImplementedException($"MID {mid} was not implemented, please register it!");
}
return instanceCompiler;
}
}
}
| mit | C# |
fde783911b0b671dc4307ef5bcb2a9bc5e4a51bf | Remove extra cast for IPEndPoint (#17812) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Servers/Kestrel/Transport.MsQuic/src/MsQuicConnectionFactory.cs | src/Servers/Kestrel/Transport.MsQuic/src/MsQuicConnectionFactory.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;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Server.Kestrel.Transport.MsQuic.Internal;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.MsQuic
{
public class MsQuicConnectionFactory : IConnectionFactory
{
private MsQuicApi _api;
private QuicSession _session;
private bool _started;
private MsQuicTransportContext _transportContext;
public MsQuicConnectionFactory(IOptions<MsQuicTransportOptions> options, IHostApplicationLifetime lifetime, ILoggerFactory loggerFactory)
{
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
_api = new MsQuicApi();
var logger = loggerFactory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.MsQuic.Client");
var trace = new MsQuicTrace(logger);
_transportContext = new MsQuicTransportContext(lifetime, trace, options.Value);
}
public async ValueTask<ConnectionContext> ConnectAsync(EndPoint endPoint, CancellationToken cancellationToken = default)
{
if (!(endPoint is IPEndPoint ipEndPoint))
{
throw new NotSupportedException($"{endPoint} is not supported");
}
if (!_started)
{
_started = true;
await StartAsync();
}
var connection = await _session.ConnectionOpenAsync(ipEndPoint, _transportContext);
return connection;
}
private ValueTask StartAsync()
{
_api.RegistrationOpen(Encoding.ASCII.GetBytes(_transportContext.Options.RegistrationName));
_session = _api.SessionOpen(_transportContext.Options.Alpn);
_session.SetIdleTimeout(_transportContext.Options.IdleTimeout);
_session.SetPeerBiDirectionalStreamCount(_transportContext.Options.MaxBidirectionalStreamCount);
_session.SetPeerUnidirectionalStreamCount(_transportContext.Options.MaxBidirectionalStreamCount);
return new ValueTask();
}
}
}
| // 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;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Server.Kestrel.Transport.MsQuic.Internal;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
namespace Microsoft.AspNetCore.Server.Kestrel.Transport.MsQuic
{
public class MsQuicConnectionFactory : IConnectionFactory
{
private MsQuicApi _api;
private QuicSession _session;
private bool _started;
private MsQuicTransportContext _transportContext;
public MsQuicConnectionFactory(IOptions<MsQuicTransportOptions> options, IHostApplicationLifetime lifetime, ILoggerFactory loggerFactory)
{
if (options == null)
{
throw new ArgumentNullException(nameof(options));
}
_api = new MsQuicApi();
var logger = loggerFactory.CreateLogger("Microsoft.AspNetCore.Server.Kestrel.Transport.MsQuic.Client");
var trace = new MsQuicTrace(logger);
_transportContext = new MsQuicTransportContext(lifetime, trace, options.Value);
}
public async ValueTask<ConnectionContext> ConnectAsync(EndPoint endPoint, CancellationToken cancellationToken = default)
{
if (!(endPoint is IPEndPoint ipEndPoint))
{
throw new NotSupportedException($"{endPoint} is not supported");
}
if (!_started)
{
_started = true;
await StartAsync();
}
var connection = await _session.ConnectionOpenAsync(endPoint as IPEndPoint, _transportContext);
return connection;
}
private ValueTask StartAsync()
{
_api.RegistrationOpen(Encoding.ASCII.GetBytes(_transportContext.Options.RegistrationName));
_session = _api.SessionOpen(_transportContext.Options.Alpn);
_session.SetIdleTimeout(_transportContext.Options.IdleTimeout);
_session.SetPeerBiDirectionalStreamCount(_transportContext.Options.MaxBidirectionalStreamCount);
_session.SetPeerUnidirectionalStreamCount(_transportContext.Options.MaxBidirectionalStreamCount);
return new ValueTask();
}
}
}
| apache-2.0 | C# |
61ffd0e6fbb4685ebf638a89ac630e53caad107e | remove unused attribute | shyamnamboodiripad/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,dotnet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,bartdesmet/roslyn | src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/AbstractCSharpLSPSnippetTests.cs | src/EditorFeatures/CSharpTest/Completion/CompletionProviders/Snippets/AbstractCSharpLSPSnippetTests.cs | // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionProviders;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Test.Utilities.Snippets
{
public abstract class AbstractCSharpLSPSnippetTests : AbstractCSharpCompletionProviderTests
{
protected override async Task VerifyCustomCommitProviderWorkerAsync(string codeBeforeCommit, int position, string itemToCommit, string expectedLSPSnippet, SourceCodeKind sourceCodeKind, char? commitChar = null)
{
using var workspaceFixture = GetOrCreateWorkspaceFixture();
var workspace = workspaceFixture.Target.GetWorkspace();
// Set options that are not CompletionOptions
workspace.SetOptions(WithChangedNonCompletionOptions(workspace.Options));
var document1 = workspaceFixture.Target.UpdateDocument(codeBeforeCommit, sourceCodeKind);
await VerifyCustomCommitProviderLSPSnippetAsync(document1, position, itemToCommit, expectedLSPSnippet, commitChar);
if (await CanUseSpeculativeSemanticModelAsync(document1, position))
{
var document2 = workspaceFixture.Target.UpdateDocument(codeBeforeCommit, sourceCodeKind, cleanBeforeUpdate: false);
await VerifyCustomCommitProviderLSPSnippetAsync(document2, position, itemToCommit, expectedLSPSnippet, commitChar);
}
}
private async Task VerifyCustomCommitProviderLSPSnippetAsync(Document document, int position, string itemToCommit, string expectedLSPSnippet, char? commitChar = null)
{
var service = GetCompletionService(document.Project);
var completionList = await GetCompletionListAsync(service, document, position, CompletionTrigger.Invoke);
var items = completionList.Items;
Assert.Contains(itemToCommit, items.Select(x => x.DisplayText), GetStringComparer());
var completionItem = items.First(i => CompareItems(i.DisplayText, itemToCommit));
var commit = await service.GetChangeAsync(document, completionItem, commitChar, CancellationToken.None);
var generatedLSPSnippet = commit.LSPSnippet;
AssertEx.EqualOrDiff(expectedLSPSnippet, generatedLSPSnippet);
}
}
}
| // Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#nullable disable
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Completion;
using Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Completion.CompletionProviders;
using Roslyn.Test.Utilities;
using Xunit;
namespace Microsoft.CodeAnalysis.Test.Utilities.Snippets
{
[UseExportProvider]
public abstract class AbstractCSharpLSPSnippetTests : AbstractCSharpCompletionProviderTests
{
protected override async Task VerifyCustomCommitProviderWorkerAsync(string codeBeforeCommit, int position, string itemToCommit, string expectedLSPSnippet, SourceCodeKind sourceCodeKind, char? commitChar = null)
{
using var workspaceFixture = GetOrCreateWorkspaceFixture();
var workspace = workspaceFixture.Target.GetWorkspace();
// Set options that are not CompletionOptions
workspace.SetOptions(WithChangedNonCompletionOptions(workspace.Options));
var document1 = workspaceFixture.Target.UpdateDocument(codeBeforeCommit, sourceCodeKind);
await VerifyCustomCommitProviderLSPSnippetAsync(document1, position, itemToCommit, expectedLSPSnippet, commitChar);
if (await CanUseSpeculativeSemanticModelAsync(document1, position))
{
var document2 = workspaceFixture.Target.UpdateDocument(codeBeforeCommit, sourceCodeKind, cleanBeforeUpdate: false);
await VerifyCustomCommitProviderLSPSnippetAsync(document2, position, itemToCommit, expectedLSPSnippet, commitChar);
}
}
private async Task VerifyCustomCommitProviderLSPSnippetAsync(Document document, int position, string itemToCommit, string expectedLSPSnippet, char? commitChar = null)
{
var service = GetCompletionService(document.Project);
var completionList = await GetCompletionListAsync(service, document, position, CompletionTrigger.Invoke);
var items = completionList.Items;
Assert.Contains(itemToCommit, items.Select(x => x.DisplayText), GetStringComparer());
var completionItem = items.First(i => CompareItems(i.DisplayText, itemToCommit));
var commit = await service.GetChangeAsync(document, completionItem, commitChar, CancellationToken.None);
var generatedLSPSnippet = commit.LSPSnippet;
AssertEx.EqualOrDiff(expectedLSPSnippet, generatedLSPSnippet);
}
}
}
| mit | C# |
8397a70fe103adaeae3aa85a161cf8abd9af728d | Change of LevyAggregationRepository not to use the constructor parameter and instead to read this parameter from config in the interim, until the Table Storage part is removed. | SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice | src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/LevyAggregationRepository.cs | src/SFA.DAS.EmployerApprenticeshipsService.Infrastructure/Data/LevyAggregationRepository.cs | using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Newtonsoft.Json;
using SFA.DAS.EmployerApprenticeshipsService.Domain;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Data;
using SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Entities;
namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Data
{
public class LevyAggregationRepository : IAggregationRepository
{
private readonly CloudStorageAccount _storageAccount;
public LevyAggregationRepository()
{
_storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting("StorageConnectionString"));
}
public async Task Update(int accountId, int pageNumber, string json)
{
var tableClient = _storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("LevyAggregation");
var entity = new LevyAggregationEntity(accountId, pageNumber)
{
Data = json
};
var insertOperation = TableOperation.InsertOrReplace(entity);
await table.ExecuteAsync(insertOperation);
}
public async Task<AggregationData> GetByAccountId(int accountId)
{
var tableClient = _storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("LevyAggregation");
var fetchOperation = TableOperation.Retrieve<LevyAggregationEntity>(accountId.ToString(),1.ToString());
var result = await table.ExecuteAsync(fetchOperation);
var row = (LevyAggregationEntity) result.Result;
if (row == null)
return new AggregationData
{
AccountId = accountId,
Data = new List<AggregationLine>()
};
return JsonConvert.DeserializeObject<AggregationData>(row.Data);
}
}
} | using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.Azure;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Table;
using Newtonsoft.Json;
using SFA.DAS.EmployerApprenticeshipsService.Domain;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Data;
using SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Entities;
namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Data
{
public class LevyAggregationRepository : IAggregationRepository
{
private readonly CloudStorageAccount _storageAccount;
public LevyAggregationRepository(string storageConnectionString)
{
_storageAccount = CloudStorageAccount.Parse(storageConnectionString);
}
public async Task Update(int accountId, int pageNumber, string json)
{
var tableClient = _storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("LevyAggregation");
var entity = new LevyAggregationEntity(accountId, pageNumber)
{
Data = json
};
var insertOperation = TableOperation.InsertOrReplace(entity);
await table.ExecuteAsync(insertOperation);
}
public async Task<AggregationData> GetByAccountId(int accountId)
{
var tableClient = _storageAccount.CreateCloudTableClient();
var table = tableClient.GetTableReference("LevyAggregation");
var fetchOperation = TableOperation.Retrieve<LevyAggregationEntity>(accountId.ToString(),1.ToString());
var result = await table.ExecuteAsync(fetchOperation);
var row = (LevyAggregationEntity) result.Result;
if (row == null)
return new AggregationData
{
AccountId = accountId,
Data = new List<AggregationLine>()
};
return JsonConvert.DeserializeObject<AggregationData>(row.Data);
}
}
} | mit | C# |
c86df114c9a5149f28b9ea71353eb736b2bcf342 | Fix a bug in zabbix protocol with errors | RFQ-hub/ZabbixAgentLib | src/ZabbixAgent/Core/ZabbixProtocol.cs | src/ZabbixAgent/Core/ZabbixProtocol.cs | using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using JetBrains.Annotations;
namespace Itg.ZabbixAgent.Core
{
internal class ZabbixProtocol
{
private static readonly byte[] headerBytes = Encoding.ASCII.GetBytes(ZabbixConstants.HeaderString);
private static readonly byte[] zero = { 0 };
/// <summary>
/// Write a string to the stream prefixed with it's size and the Zabbix protocol header.
/// </summary>
public static void WriteWithHeader([NotNull] Stream stream, [NotNull] string valueString, [CanBeNull] string errorString)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
Debug.Assert(stream != null);
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
Debug.Assert(valueString != null);
// <HEADER>
stream.Write(headerBytes, 0, headerBytes.Length);
// <DATALEN>
var valueStringBytes = Encoding.UTF8.GetBytes(valueString);
var sizeBytes = BitConverter.GetBytes((long)valueStringBytes.Length);
stream.Write(sizeBytes, 0, sizeBytes.Length);
// <DATA>
stream.Write(valueStringBytes, 0, valueStringBytes.Length);
if (errorString != null)
{
// \0
stream.Write(zero, 0, 1);
// <ERROR>
var errorStringBytes = Encoding.UTF8.GetBytes(errorString);
stream.Write(errorStringBytes, 0, errorStringBytes.Length);
}
}
}
}
| using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using JetBrains.Annotations;
namespace Itg.ZabbixAgent.Core
{
internal class ZabbixProtocol
{
private static readonly byte[] headerBytes = Encoding.ASCII.GetBytes(ZabbixConstants.HeaderString);
private static readonly byte[] zero = new byte[ 0 ];
/// <summary>
/// Write a string to the stream prefixed with it's size and the Zabbix protocol header.
/// </summary>
public static void WriteWithHeader([NotNull] Stream stream, [NotNull] string valueString, [CanBeNull] string errorString)
{
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
Debug.Assert(stream != null);
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
Debug.Assert(valueString != null);
// <HEADER>
stream.Write(headerBytes, 0, headerBytes.Length);
// <DATALEN>
var valueStringBytes = Encoding.UTF8.GetBytes(valueString);
var sizeBytes = BitConverter.GetBytes((long)valueStringBytes.Length);
stream.Write(sizeBytes, 0, sizeBytes.Length);
// <DATA>
stream.Write(valueStringBytes, 0, valueStringBytes.Length);
if (errorString != null)
{
// \0
stream.Write(zero, 0, 1);
// <ERROR>
var errorStringBytes = Encoding.UTF8.GetBytes(errorString);
stream.Write(errorStringBytes, 0, errorStringBytes.Length);
}
}
}
}
| mit | C# |
28dcfe867c3afc866791d2d43934ae0a7626586d | Add Chroma keying to the background of the showcase video. | peppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,smoogipooo/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,peppy/osu,NeoAdonis/osu | osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs | osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Components;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Showcase
{
public class ShowcaseScreen : BeatmapInfoScreen, IProvideVideo
{
private Box chroma;
[BackgroundDependencyLoader]
private void load()
{
AddRangeInternal(new Drawable[] {
new TournamentLogo(),
new TourneyVideo("showcase")
{
Loop = true,
RelativeSizeAxes = Axes.Both,
},
chroma = new Box
{
// chroma key area for stable gameplay
Name = "chroma",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Height = 695,
Width = 1366,
Colour = new Color4(0, 255, 0, 255),
}
});
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Components;
namespace osu.Game.Tournament.Screens.Showcase
{
public class ShowcaseScreen : BeatmapInfoScreen
{
[BackgroundDependencyLoader]
private void load()
{
AddRangeInternal(new Drawable[] {
new TournamentLogo(),
new TourneyVideo("showcase")
{
Loop = true,
RelativeSizeAxes = Axes.Both,
}
});
}
}
}
| mit | C# |
c5e401d6788bf7219b5118186b1c4b866c956deb | Update usages to consume `IRulesetStore` | ppy/osu,peppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu | osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs | osu.Game/Scoring/Legacy/DatabasedLegacyScoreDecoder.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
namespace osu.Game.Scoring.Legacy
{
/// <summary>
/// A <see cref="LegacyScoreDecoder"/> which retrieves the applicable <see cref="Beatmap"/> and <see cref="Ruleset"/>
/// for the score from the database.
/// </summary>
public class DatabasedLegacyScoreDecoder : LegacyScoreDecoder
{
private readonly IRulesetStore rulesets;
private readonly BeatmapManager beatmaps;
public DatabasedLegacyScoreDecoder(IRulesetStore rulesets, BeatmapManager beatmaps)
{
this.rulesets = rulesets;
this.beatmaps = beatmaps;
}
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.MD5Hash == md5Hash));
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
namespace osu.Game.Scoring.Legacy
{
/// <summary>
/// A <see cref="LegacyScoreDecoder"/> which retrieves the applicable <see cref="Beatmap"/> and <see cref="Ruleset"/>
/// for the score from the database.
/// </summary>
public class DatabasedLegacyScoreDecoder : LegacyScoreDecoder
{
private readonly RulesetStore rulesets;
private readonly BeatmapManager beatmaps;
public DatabasedLegacyScoreDecoder(RulesetStore rulesets, BeatmapManager beatmaps)
{
this.rulesets = rulesets;
this.beatmaps = beatmaps;
}
protected override Ruleset GetRuleset(int rulesetId) => rulesets.GetRuleset(rulesetId).CreateInstance();
protected override WorkingBeatmap GetBeatmap(string md5Hash) => beatmaps.GetWorkingBeatmap(beatmaps.QueryBeatmap(b => !b.BeatmapSet.DeletePending && b.MD5Hash == md5Hash));
}
}
| mit | C# |
f59ba799d30390f030fcac0e12ac99a1893f78f4 | Adjust operation tracker implementation | UselessToucan/osu,UselessToucan/osu,ppy/osu,ppy/osu,ppy/osu,peppy/osu,smoogipoo/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,smoogipooo/osu,NeoAdonis/osu | osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs | osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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.Bindables;
namespace osu.Game.Screens.OnlinePlay
{
/// <summary>
/// Utility class to track ongoing online operations' progress.
/// Can be used to disable interactivity while waiting for a response from online sources.
/// </summary>
public class OngoingOperationTracker
{
/// <summary>
/// Whether there is an online operation in progress.
/// </summary>
public IBindable<bool> InProgress => inProgress;
private readonly Bindable<bool> inProgress = new BindableBool();
private LeasedBindable<bool> leasedInProgress;
/// <summary>
/// Begins tracking a new online operation.
/// </summary>
/// <returns>
/// An <see cref="IDisposable"/> that will automatically mark the operation as ended on disposal.
/// </returns>
/// <exception cref="InvalidOperationException">An operation has already been started.</exception>
public IDisposable BeginOperation()
{
if (leasedInProgress != null)
throw new InvalidOperationException("Cannot begin operation while another is in progress.");
leasedInProgress = inProgress.BeginLease(true);
leasedInProgress.Value = true;
return new InvokeOnDisposal(endOperation);
}
/// <summary>
/// Ends tracking an online operation.
/// Does nothing if an operation has not been begun yet.
/// </summary>
private void endOperation()
{
leasedInProgress?.Return();
leasedInProgress = null;
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Bindables;
namespace osu.Game.Screens.OnlinePlay
{
/// <summary>
/// Utility class to track ongoing online operations' progress.
/// Can be used to disable interactivity while waiting for a response from online sources.
/// </summary>
public class OngoingOperationTracker
{
/// <summary>
/// Whether there is an online operation in progress.
/// </summary>
public IBindable<bool> InProgress => inProgress;
private readonly Bindable<bool> inProgress = new BindableBool();
private LeasedBindable<bool> leasedInProgress;
/// <summary>
/// Begins tracking a new online operation.
/// </summary>
/// <exception cref="InvalidOperationException">An operation has already been started.</exception>
public void BeginOperation()
{
if (leasedInProgress != null)
throw new InvalidOperationException("Cannot begin operation while another is in progress.");
leasedInProgress = inProgress.BeginLease(true);
leasedInProgress.Value = true;
}
/// <summary>
/// Ends tracking an online operation.
/// Does nothing if an operation has not been begun yet.
/// </summary>
public void EndOperation()
{
leasedInProgress?.Return();
leasedInProgress = null;
}
}
}
| mit | C# |
7da21c1d2707ffd70fcafe75078884ec6687ae1b | Handle existing args format | cmgutmanis/Sitecore-Courier,csteeg/Sitecore-Courier,rauljmz/Sitecore-Courier,unic/Sitecore-Courier,adoprog/Sitecore-Courier | Sitecore.Courier.Runner/Program.cs | Sitecore.Courier.Runner/Program.cs | namespace Sitecore.Courier.Runner
{
using Sitecore.Update;
using Sitecore.Update.Engine;
using System;
/// <summary>
/// Defines the program class.
/// </summary>
internal class Program
{
/// <summary>
/// Mains the specified args.
/// </summary>
/// <param name="args">The arguments.</param>
public static void Main(string[] args)
{
var options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
if (options.Source.StartsWith(":"))
options.Source = options.Source.Substring(1);
if (options.Target.StartsWith(":"))
options.Target = options.Target.Substring(1);
if (options.Output.StartsWith(":"))
options.Output = options.Output.Substring(1);
Console.WriteLine("Source: {0}", options.Source);
Console.WriteLine("Target: {0}", options.Target);
Console.WriteLine("Output: {0}", options.Output);
var diff = new DiffInfo(
DiffGenerator.GetDiffCommands(options.Source, options.Target),
"Sitecore Courier Package",
string.Empty,
string.Format("Diff between serialization folders '{0}' and '{1}'.", options.Source, options.Target));
PackageGenerator.GeneratePackage(diff, string.Empty, options.Output);
}
else
{
Console.WriteLine(options.GetUsage());
}
}
}
}
| namespace Sitecore.Courier.Runner
{
using Sitecore.Update;
using Sitecore.Update.Engine;
using System;
/// <summary>
/// Defines the program class.
/// </summary>
internal class Program
{
/// <summary>
/// Mains the specified args.
/// </summary>
/// <param name="args">The arguments.</param>
public static void Main(string[] args)
{
var options = new Options();
if (CommandLine.Parser.Default.ParseArguments(args, options))
{
Console.WriteLine("Source: {0}", options.Source);
Console.WriteLine("Target: {0}", options.Target);
Console.WriteLine("Output: {0}", options.Output);
var diff = new DiffInfo(
DiffGenerator.GetDiffCommands(options.Source, options.Target),
"Sitecore Courier Package",
string.Empty,
string.Format("Diff between serialization folders '{0}' and '{1}'.", options.Source, options.Target));
PackageGenerator.GeneratePackage(diff, string.Empty, options.Output);
}
else
{
Console.WriteLine(options.GetUsage());
}
}
}
}
| mit | C# |
85bcb7ad2b439ec5f4f5332425bcf358a5ce0020 | Update migration | markoliver288/Umbraco-CMS,rajendra1809/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,christopherbauer/Umbraco-CMS,kasperhhk/Umbraco-CMS,markoliver288/Umbraco-CMS,VDBBjorn/Umbraco-CMS,Spijkerboer/Umbraco-CMS,mstodd/Umbraco-CMS,tompipe/Umbraco-CMS,tcmorris/Umbraco-CMS,lingxyd/Umbraco-CMS,neilgaietto/Umbraco-CMS,WebCentrum/Umbraco-CMS,kasperhhk/Umbraco-CMS,rustyswayne/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,nvisage-gf/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,mstodd/Umbraco-CMS,aadfPT/Umbraco-CMS,gregoriusxu/Umbraco-CMS,christopherbauer/Umbraco-CMS,ordepdev/Umbraco-CMS,Pyuuma/Umbraco-CMS,timothyleerussell/Umbraco-CMS,arknu/Umbraco-CMS,Khamull/Umbraco-CMS,timothyleerussell/Umbraco-CMS,umbraco/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,neilgaietto/Umbraco-CMS,romanlytvyn/Umbraco-CMS,KevinJump/Umbraco-CMS,Phosworks/Umbraco-CMS,base33/Umbraco-CMS,abryukhov/Umbraco-CMS,robertjf/Umbraco-CMS,qizhiyu/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,tcmorris/Umbraco-CMS,VDBBjorn/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,mittonp/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,gkonings/Umbraco-CMS,rasmusfjord/Umbraco-CMS,kgiszewski/Umbraco-CMS,KevinJump/Umbraco-CMS,engern/Umbraco-CMS,abryukhov/Umbraco-CMS,iahdevelop/Umbraco-CMS,Phosworks/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,lars-erik/Umbraco-CMS,bjarnef/Umbraco-CMS,VDBBjorn/Umbraco-CMS,kgiszewski/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,marcemarc/Umbraco-CMS,KevinJump/Umbraco-CMS,romanlytvyn/Umbraco-CMS,lars-erik/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,gregoriusxu/Umbraco-CMS,rajendra1809/Umbraco-CMS,gavinfaux/Umbraco-CMS,romanlytvyn/Umbraco-CMS,ehornbostel/Umbraco-CMS,bjarnef/Umbraco-CMS,TimoPerplex/Umbraco-CMS,abryukhov/Umbraco-CMS,ordepdev/Umbraco-CMS,corsjune/Umbraco-CMS,ordepdev/Umbraco-CMS,umbraco/Umbraco-CMS,base33/Umbraco-CMS,AzarinSergey/Umbraco-CMS,jchurchley/Umbraco-CMS,lingxyd/Umbraco-CMS,rajendra1809/Umbraco-CMS,romanlytvyn/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,abjerner/Umbraco-CMS,m0wo/Umbraco-CMS,VDBBjorn/Umbraco-CMS,markoliver288/Umbraco-CMS,markoliver288/Umbraco-CMS,ordepdev/Umbraco-CMS,gkonings/Umbraco-CMS,lingxyd/Umbraco-CMS,Phosworks/Umbraco-CMS,gavinfaux/Umbraco-CMS,robertjf/Umbraco-CMS,christopherbauer/Umbraco-CMS,gavinfaux/Umbraco-CMS,corsjune/Umbraco-CMS,aaronpowell/Umbraco-CMS,neilgaietto/Umbraco-CMS,AzarinSergey/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,WebCentrum/Umbraco-CMS,kasperhhk/Umbraco-CMS,ehornbostel/Umbraco-CMS,qizhiyu/Umbraco-CMS,m0wo/Umbraco-CMS,ordepdev/Umbraco-CMS,iahdevelop/Umbraco-CMS,DaveGreasley/Umbraco-CMS,madsoulswe/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,leekelleher/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,gregoriusxu/Umbraco-CMS,WebCentrum/Umbraco-CMS,nvisage-gf/Umbraco-CMS,corsjune/Umbraco-CMS,markoliver288/Umbraco-CMS,bjarnef/Umbraco-CMS,kasperhhk/Umbraco-CMS,tcmorris/Umbraco-CMS,engern/Umbraco-CMS,Spijkerboer/Umbraco-CMS,abryukhov/Umbraco-CMS,TimoPerplex/Umbraco-CMS,m0wo/Umbraco-CMS,kgiszewski/Umbraco-CMS,hfloyd/Umbraco-CMS,hfloyd/Umbraco-CMS,abjerner/Umbraco-CMS,sargin48/Umbraco-CMS,marcemarc/Umbraco-CMS,qizhiyu/Umbraco-CMS,robertjf/Umbraco-CMS,DaveGreasley/Umbraco-CMS,rustyswayne/Umbraco-CMS,qizhiyu/Umbraco-CMS,jchurchley/Umbraco-CMS,rasmuseeg/Umbraco-CMS,sargin48/Umbraco-CMS,rasmusfjord/Umbraco-CMS,iahdevelop/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,AzarinSergey/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,Tronhus/Umbraco-CMS,iahdevelop/Umbraco-CMS,tcmorris/Umbraco-CMS,engern/Umbraco-CMS,TimoPerplex/Umbraco-CMS,lingxyd/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,lars-erik/Umbraco-CMS,arknu/Umbraco-CMS,NikRimington/Umbraco-CMS,Pyuuma/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,tompipe/Umbraco-CMS,hfloyd/Umbraco-CMS,mattbrailsford/Umbraco-CMS,AzarinSergey/Umbraco-CMS,abjerner/Umbraco-CMS,mittonp/Umbraco-CMS,corsjune/Umbraco-CMS,leekelleher/Umbraco-CMS,bjarnef/Umbraco-CMS,iahdevelop/Umbraco-CMS,gkonings/Umbraco-CMS,mattbrailsford/Umbraco-CMS,tcmorris/Umbraco-CMS,mittonp/Umbraco-CMS,lars-erik/Umbraco-CMS,rasmusfjord/Umbraco-CMS,Phosworks/Umbraco-CMS,neilgaietto/Umbraco-CMS,abjerner/Umbraco-CMS,christopherbauer/Umbraco-CMS,Khamull/Umbraco-CMS,Spijkerboer/Umbraco-CMS,Pyuuma/Umbraco-CMS,tcmorris/Umbraco-CMS,m0wo/Umbraco-CMS,gkonings/Umbraco-CMS,leekelleher/Umbraco-CMS,aadfPT/Umbraco-CMS,nul800sebastiaan/Umbraco-CMS,timothyleerussell/Umbraco-CMS,nvisage-gf/Umbraco-CMS,ehornbostel/Umbraco-CMS,Khamull/Umbraco-CMS,gregoriusxu/Umbraco-CMS,rustyswayne/Umbraco-CMS,TimoPerplex/Umbraco-CMS,robertjf/Umbraco-CMS,DaveGreasley/Umbraco-CMS,jchurchley/Umbraco-CMS,qizhiyu/Umbraco-CMS,sargin48/Umbraco-CMS,gkonings/Umbraco-CMS,AzarinSergey/Umbraco-CMS,rasmuseeg/Umbraco-CMS,PeteDuncanson/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,umbraco/Umbraco-CMS,umbraco/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,rustyswayne/Umbraco-CMS,Khamull/Umbraco-CMS,mittonp/Umbraco-CMS,timothyleerussell/Umbraco-CMS,KevinJump/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Pyuuma/Umbraco-CMS,m0wo/Umbraco-CMS,sargin48/Umbraco-CMS,aaronpowell/Umbraco-CMS,hfloyd/Umbraco-CMS,NikRimington/Umbraco-CMS,markoliver288/Umbraco-CMS,corsjune/Umbraco-CMS,DaveGreasley/Umbraco-CMS,romanlytvyn/Umbraco-CMS,Khamull/Umbraco-CMS,hfloyd/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,sargin48/Umbraco-CMS,rasmusfjord/Umbraco-CMS,lars-erik/Umbraco-CMS,YsqEvilmax/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,mstodd/Umbraco-CMS,mstodd/Umbraco-CMS,aadfPT/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,madsoulswe/Umbraco-CMS,Tronhus/Umbraco-CMS,neilgaietto/Umbraco-CMS,VDBBjorn/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,christopherbauer/Umbraco-CMS,Spijkerboer/Umbraco-CMS,gavinfaux/Umbraco-CMS,ehornbostel/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,Nicholas-Westby/Umbraco-CMS,gregoriusxu/Umbraco-CMS,gavinfaux/Umbraco-CMS,Tronhus/Umbraco-CMS,lingxyd/Umbraco-CMS,tompipe/Umbraco-CMS,JeffreyPerplex/Umbraco-CMS,marcemarc/Umbraco-CMS,Spijkerboer/Umbraco-CMS,rajendra1809/Umbraco-CMS,mattbrailsford/Umbraco-CMS,Pyuuma/Umbraco-CMS,dawoe/Umbraco-CMS,mittonp/Umbraco-CMS,DaveGreasley/Umbraco-CMS,timothyleerussell/Umbraco-CMS,Scott-Herbert/Umbraco-CMS,TimoPerplex/Umbraco-CMS,arknu/Umbraco-CMS,rajendra1809/Umbraco-CMS,leekelleher/Umbraco-CMS,rustyswayne/Umbraco-CMS,aaronpowell/Umbraco-CMS,rasmusfjord/Umbraco-CMS,dawoe/Umbraco-CMS,kasperhhk/Umbraco-CMS,NikRimington/Umbraco-CMS,Phosworks/Umbraco-CMS,mstodd/Umbraco-CMS,rasmuseeg/Umbraco-CMS,KevinJump/Umbraco-CMS,marcemarc/Umbraco-CMS,nvisage-gf/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,ehornbostel/Umbraco-CMS,nvisage-gf/Umbraco-CMS,Tronhus/Umbraco-CMS,engern/Umbraco-CMS,Tronhus/Umbraco-CMS,madsoulswe/Umbraco-CMS,leekelleher/Umbraco-CMS,engern/Umbraco-CMS,base33/Umbraco-CMS | src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs | src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenTwoZero/AddIndexToUmbracoNodeTable.cs | using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero
{
[Migration("7.2.0", 3, GlobalSettings.UmbracoMigrationName)]
public class AddIndexToUmbracoNodeTable : MigrationBase
{
private readonly bool _skipIndexCheck;
internal AddIndexToUmbracoNodeTable(bool skipIndexCheck)
{
_skipIndexCheck = skipIndexCheck;
}
public AddIndexToUmbracoNodeTable()
{
}
public override void Up()
{
var dbIndexes = _skipIndexCheck ? new DbIndexDefinition[] { } : SqlSyntaxContext.SqlSyntaxProvider.GetDefinedIndexes(Context.Database)
.Select(x => new DbIndexDefinition
{
TableName = x.Item1,
IndexName = x.Item2,
ColumnName = x.Item3,
IsUnique = x.Item4
}).ToArray();
//make sure it doesn't already exist
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID")) == false)
{
Create.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode").OnColumn("uniqueID").Ascending().WithOptions().NonClustered();
}
}
public override void Down()
{
Delete.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode");
}
}
} | using System.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
using Umbraco.Core.Persistence.SqlSyntax;
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenTwoZero
{
[Migration("7.2.0", 3, GlobalSettings.UmbracoMigrationName)]
public class AddIndexToUmbracoNodeTable : MigrationBase
{
private readonly bool _skipIndexCheck;
internal AddIndexToUmbracoNodeTable(bool skipIndexCheck)
{
_skipIndexCheck = skipIndexCheck;
}
public AddIndexToUmbracoNodeTable()
{
}
public override void Up()
{
var dbIndexes = _skipIndexCheck ? new DbIndexDefinition[] { } : SqlSyntaxContext.SqlSyntaxProvider.GetDefinedIndexes(Context.Database)
.Select(x => new DbIndexDefinition
{
TableName = x.Item1,
IndexName = x.Item2,
ColumnName = x.Item3,
IsUnique = x.Item4
}).ToArray();
//make sure it doesn't already exist
if (dbIndexes.Any(x => x.IndexName.InvariantEquals("IX_umbracoNodeUniqueID")) == false)
{
Create.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode").OnColumn("uniqueID").Unique();
}
}
public override void Down()
{
Delete.Index("IX_umbracoNodeUniqueID").OnTable("umbracoNode");
}
}
} | mit | C# |
d12897e5de5087584198f2bb22341e2354fa90db | Update outdated comment | dcastro/AutoFixture,zvirja/AutoFixture,sbrockway/AutoFixture,AutoFixture/AutoFixture,hackle/AutoFixture,adamchester/AutoFixture,sbrockway/AutoFixture,adamchester/AutoFixture,Pvlerick/AutoFixture,hackle/AutoFixture,dcastro/AutoFixture,sergeyshushlyapin/AutoFixture,sean-gilliam/AutoFixture,sergeyshushlyapin/AutoFixture | Src/AutoFixture/ElementsBuilder.cs | Src/AutoFixture/ElementsBuilder.cs | using Ploeh.AutoFixture.Kernel;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Ploeh.AutoFixture
{
/// <summary>
/// Draws a random element from the given collection
/// </summary>
/// <typeparam name="T"></typeparam>
public sealed class ElementsBuilder<T> : ISpecimenBuilder
{
private readonly T[] elements;
private readonly RandomNumericSequenceGenerator sequence;
/// <summary>
/// Initializes a new instance of the <see cref="ElementsBuilder{T}"/> class.
/// </summary>
/// <param name="elements">The collection from which elements should be drawn from.
/// It must contain at least one element.</param>
public ElementsBuilder(IEnumerable<T> elements)
{
if (elements == null)
throw new ArgumentNullException("elements");
this.elements = elements.ToArray();
if (this.elements.Length < 1)
throw new ArgumentException("elements must contain at least one element.", "elements");
//The RandomNumericSequenceGenerator is only created for collections of minimum 2 elements
if (this.elements.Length > 1)
this.sequence = new RandomNumericSequenceGenerator(0, this.elements.Length - 1);
}
/// <summary>
/// Returns one of the element present in the collection given when the object was constructed.
/// </summary>
/// <param name="request">The request that describes what to create.</param>
/// <param name="context">Not used.</param>
/// <returns>
/// One of the element present in the collection given to the constructor if <paramref name="request"/>
/// is a request for <typeparamref name="T"/>; otherwise, a <see cref="NoSpecimen"/> instance.
/// </returns>
public object Create(object request, ISpecimenContext context)
{
if (!typeof(T).Equals(request))
#pragma warning disable 618
return new NoSpecimen(request);
#pragma warning restore 618
return this.elements[this.GetNextIndex()];
}
private int GetNextIndex()
{
if (this.elements.Length == 1)
return 0;
else
return (int)this.sequence.Create(typeof(int));
}
}
}
| using Ploeh.AutoFixture.Kernel;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Ploeh.AutoFixture
{
/// <summary>
/// Draws a random element from the given collection
/// </summary>
/// <typeparam name="T"></typeparam>
public sealed class ElementsBuilder<T> : ISpecimenBuilder
{
private readonly T[] elements;
private readonly RandomNumericSequenceGenerator sequence;
/// <summary>
/// Initializes a new instance of the <see cref="ElementsBuilder{T}"/> class.
/// </summary>
/// <param name="elements">The collection from which elements should be drawn from.
/// It must contain at least two element.</param>
public ElementsBuilder(IEnumerable<T> elements)
{
if (elements == null)
throw new ArgumentNullException("elements");
this.elements = elements.ToArray();
if (this.elements.Length < 1)
throw new ArgumentException("elements must contain at least one element.", "elements");
//The RandomNumericSequenceGenerator is only created for collections of minimum 2 elements
if (this.elements.Length > 1)
this.sequence = new RandomNumericSequenceGenerator(0, this.elements.Length - 1);
}
/// <summary>
/// Returns one of the element present in the collection given when the object was constructed.
/// </summary>
/// <param name="request">The request that describes what to create.</param>
/// <param name="context">Not used.</param>
/// <returns>
/// One of the element present in the collection given to the constructor if <paramref name="request"/>
/// is a request for <typeparamref name="T"/>; otherwise, a <see cref="NoSpecimen"/> instance.
/// </returns>
public object Create(object request, ISpecimenContext context)
{
if (!typeof(T).Equals(request))
#pragma warning disable 618
return new NoSpecimen(request);
#pragma warning restore 618
return this.elements[this.GetNextIndex()];
}
private int GetNextIndex()
{
if (this.elements.Length == 1)
return 0;
else
return (int)this.sequence.Create(typeof(int));
}
}
}
| mit | C# |
00f188d11638988c9040effa50b178a12f741aab | Revert "." | Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns | TCC.UI/Data/AbnormalityDuration.cs | TCC.UI/Data/AbnormalityDuration.cs | using System;
using System.Timers;
using TCC.Data;
namespace TCC
{
public class AbnormalityDuration : IDisposable
{
public ulong Target { get; set; }
public Abnormality Abnormality { get; set; }
public int Duration { get; set; }
public int Stacks { get; set; }
public Timer timer;
public int DurationLeft { get; set; }
public AbnormalityDuration(Abnormality b, int d, int s, ulong t)
{
Abnormality = b;
Duration = d;
Stacks = s;
Target = t;
DurationLeft = d;
timer = new Timer(1000);
timer.Elapsed += (se, ev) => DurationLeft = DurationLeft - 1000;
if (!Abnormality.Infinity)
{
timer.Start();
}
}
public AbnormalityDuration()
{
}
public void Dispose()
{
timer.Stop();
timer.Dispose();
}
}
}
| using System;
using System.Timers;
using TCC.Data;
namespace TCC
{
public class AbnormalityDuration : IDisposable
{
public ulong Target { get; set; }
public Abnormality Abnormality { get; set; }
public int Duration { get; set; }
public int Stacks { get; set; }
public Timer timer;
public int DurationLeft { get; set; }
public AbnormalityDuration(Abnormality b, int d, int s, ulong t)
{
Abnormality = b;
Duration = d;
Stacks = s;
Target = t;
DurationLeft = d;
timer = new Timer(1000);
timer.Elapsed += (se, ev) => DurationLeft = DurationLeft - 1000;
if (!Abnormality.Infinity)
{
timer.Start();
}
}
public AbnormalityDuration()
{
}
public void Dispose()
{
timer.Stop();
timer.Dispose();
}
}
}
| mit | C# |
7a593e75768152ffc2ffc593220d50d576a553b2 | Remove jQuery UI. | bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes,bigfont/orchard-cms-modules-and-themes | Orchard.Source.1.8/src/Orchard.Web/Modules/BigFont.TheThemeMachineDesigner/Views/TraceThemeWrapper.cshtml | Orchard.Source.1.8/src/Orchard.Web/Modules/BigFont.TheThemeMachineDesigner/Views/TraceThemeWrapper.cshtml | @{
// The purpose of this wrapper is simply to add JavaScript and CSS.
// We add CSS through JavaScript.
////Script.Require("jQueryUI").AtHead();
Script.Include("CssLoader.js").AtHead();
Script.Include("DragAndDrop.js").AtHead();
Style.Include("theme-designer.css");
}
@Display(Model.Metadata.ChildContent)
| @{
// The purpose of this wrapper is simply to add JavaScript and CSS.
// We add CSS through JavaScript.
Script.Require("jQueryUI").AtHead();
Script.Include("CssLoader.js").AtHead();
Script.Include("DragAndDrop.js").AtHead();
Style.Include("theme-designer.css");
}
@Display(Model.Metadata.ChildContent)
| bsd-3-clause | C# |
9829fe957fe2f63f17066615bdf6d7145f7a5a43 | Use `Drawable.ToString` in `LoadingComponentsLogger` | smoogipooo/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework | osu.Framework/Logging/LoadingComponentsLogger.cs | osu.Framework/Logging/LoadingComponentsLogger.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Development;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Lists;
namespace osu.Framework.Logging
{
internal static class LoadingComponentsLogger
{
private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>();
public static void Add(Drawable component)
{
if (!DebugUtils.IsDebugBuild) return;
lock (loading_components)
loading_components.Add(component);
}
public static void Remove(Drawable component)
{
if (!DebugUtils.IsDebugBuild) return;
lock (loading_components)
loading_components.Remove(component);
}
public static void LogAndFlush()
{
if (!DebugUtils.IsDebugBuild) return;
lock (loading_components)
{
Logger.Log($"⏳ Currently loading components ({loading_components.Count()})");
foreach (var c in loading_components.OrderBy(c => c.LoadThread?.Name).ThenBy(c => c.LoadState))
{
Logger.Log(c.ToString());
Logger.Log($"- thread: {c.LoadThread?.Name ?? "none"}");
Logger.Log($"- state: {c.LoadState}");
}
loading_components.Clear();
Logger.Log("🧵 Task schedulers");
Logger.Log(CompositeDrawable.SCHEDULER_STANDARD.GetStatusString());
Logger.Log(CompositeDrawable.SCHEDULER_LONG_LOAD.GetStatusString());
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Development;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Lists;
namespace osu.Framework.Logging
{
internal static class LoadingComponentsLogger
{
private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>();
public static void Add(Drawable component)
{
if (!DebugUtils.IsDebugBuild) return;
lock (loading_components)
loading_components.Add(component);
}
public static void Remove(Drawable component)
{
if (!DebugUtils.IsDebugBuild) return;
lock (loading_components)
loading_components.Remove(component);
}
public static void LogAndFlush()
{
if (!DebugUtils.IsDebugBuild) return;
lock (loading_components)
{
Logger.Log($"⏳ Currently loading components ({loading_components.Count()})");
foreach (var c in loading_components.OrderBy(c => c.LoadThread?.Name).ThenBy(c => c.LoadState))
{
Logger.Log($"{c.GetType().ReadableName()}");
Logger.Log($"- thread: {c.LoadThread?.Name ?? "none"}");
Logger.Log($"- state: {c.LoadState}");
}
loading_components.Clear();
Logger.Log("🧵 Task schedulers");
Logger.Log(CompositeDrawable.SCHEDULER_STANDARD.GetStatusString());
Logger.Log(CompositeDrawable.SCHEDULER_LONG_LOAD.GetStatusString());
}
}
}
}
| mit | C# |
d799090b1b8978a4e7eba0856ecd017c5be0c22f | Initialize HostnameCommand with dependencies | appharbor/appharbor-cli | src/AppHarbor/Commands/HostnameCommand.cs | src/AppHarbor/Commands/HostnameCommand.cs | using System;
using System.IO;
namespace AppHarbor.Commands
{
public class HostnameCommand : ICommand
{
private readonly IApplicationConfiguration _applicationConfiguration;
private readonly IAppHarborClient _appharborClient;
private readonly TextWriter _writer;
public HostnameCommand(IApplicationConfiguration applicationConfiguration, IAppHarborClient appharborClient, TextWriter writer)
{
_applicationConfiguration = applicationConfiguration;
_appharborClient = appharborClient;
_writer = writer;
}
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| using System;
namespace AppHarbor.Commands
{
public class HostnameCommand : ICommand
{
public void Execute(string[] arguments)
{
throw new NotImplementedException();
}
}
}
| mit | C# |
aabbd691ca1f0454ea60b826413ca71926eecfae | Remove unused property from GuiWindow. | FloodProject/flood,FloodProject/flood,FloodProject/flood | src/Editor/Editor.Client/GUI/GuiWindow.cs | src/Editor/Editor.Client/GUI/GuiWindow.cs | using System;
using Flood.GUI.Controls;
using Flood.GUI.Renderers;
using Flood.GUI.Skins;
namespace Flood.Editor.Client.Gui
{
public abstract class GuiWindow : IDisposable
{
/// <summary>
/// Renderer of the GUI.
/// </summary>
public Renderer Renderer { get; private set; }
/// <summary>
/// Skin of the GUI.
/// </summary>
public Skin Skin { get; private set; }
public Canvas Canvas { get; private set; }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposing) return;
Canvas.Dispose();
Skin.Dispose();
Renderer.Dispose();
}
public void Init(Renderer renderer, string textureName, Flood.GUI.Font defaultFont)
{
Renderer = renderer;
var resMan = FloodEngine.GetEngine().ResourceManager;
var options = new ResourceLoadOptions {Name = textureName, AsynchronousLoad = false};
var imageHandle = resMan.LoadResource<Image>(options);
if (imageHandle.Id == 0)
return;
Skin = new TexturedSkin(renderer, imageHandle, defaultFont);
Canvas = new Canvas(Skin);
Init();
}
protected abstract void Init();
public void Render()
{
Canvas.RenderCanvas();
}
}
}
| using System;
using Flood.GUI.Controls;
using Flood.GUI.Renderers;
using Flood.GUI.Skins;
namespace Flood.Editor.Client.Gui
{
public abstract class GuiWindow : IDisposable
{
/// <summary>
/// Native GUI window.
/// </summary>
public Window NativeWindow { get; set; }
/// <summary>
/// Renderer of the GUI.
/// </summary>
public Renderer Renderer { get; private set; }
/// <summary>
/// Skin of the GUI.
/// </summary>
public Skin Skin { get; private set; }
public Canvas Canvas { get; private set; }
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (!disposing) return;
Canvas.Dispose();
Skin.Dispose();
Renderer.Dispose();
}
public void Init(Renderer renderer, string textureName, Flood.GUI.Font defaultFont)
{
Renderer = renderer;
var resMan = FloodEngine.GetEngine().ResourceManager;
var options = new ResourceLoadOptions {Name = textureName, AsynchronousLoad = false};
var imageHandle = resMan.LoadResource<Image>(options);
if (imageHandle.Id == 0)
return;
Skin = new TexturedSkin(renderer, imageHandle, defaultFont);
Canvas = new Canvas(Skin);
Init();
}
protected abstract void Init();
public void Render()
{
Canvas.RenderCanvas();
}
}
}
| bsd-2-clause | C# |
19905a1b0b7a3cd8f9c5492ff9e781dddf19379f | Update AssemblyInfo | HoLLy-HaCKeR/osu-database-reader | osu-database-reader/Properties/AssemblyInfo.cs | osu-database-reader/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("osu-database-reader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("osu-database-reader")]
[assembly: AssemblyCopyright("Copyright © HoLLy 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("c3078606-8055-4122-845d-7f9a0154883d")]
// 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.0.0")]
[assembly: AssemblyFileVersion("2.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("osu-database-reader")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("osu-database-reader")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[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("c3078606-8055-4122-845d-7f9a0154883d")]
// 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")]
| mit | C# |
a88288cbd75afbeea55146e268866c70af631f82 | Fix using | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewLocator.cs | WalletWasabi.Fluent/ViewLocator.cs | using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using WalletWasabi.Fluent.ViewModels;
namespace WalletWasabi.Fluent
{
[StaticViewLocator]
public partial class ViewLocator : IDataTemplate
{
public IControl Build(object data)
{
var type = data.GetType();
if (s_views.TryGetValue(type, out var func))
{
return func.Invoke();
}
throw new Exception($"Unable to create view for type: {type}");
}
public bool Match(object data)
{
return data is ViewModelBase;
}
}
}
| using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using WalletWasabi.Gui.ViewModels;
namespace WalletWasabi.Fluent
{
[StaticViewLocator]
public partial class ViewLocator : IDataTemplate
{
public IControl Build(object data)
{
var type = data.GetType();
if (s_views.TryGetValue(type, out var func))
{
return func.Invoke();
}
throw new Exception($"Unable to create view for type: {type}");
}
public bool Match(object data)
{
return data is ViewModelBase;
}
}
} | mit | C# |
08ac8869e87727ff0220e86c3994e759599606e6 | Fix tick controller 2 | knexer/Chinese-Rooms-what-do-they-know-do-they-know-things-lets-find-out | Assets/Scripts/TickController.cs | Assets/Scripts/TickController.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TickController : MonoBehaviour {
public static TickController Obj;
public delegate void TickEventHandler(float lengthOfTickSeconds);
public static event TickEventHandler MoveTickEvent;
public static event TickEventHandler ManipulateTickEvent;
public delegate void ResetTabletsEventHandler();
public static event ResetTabletsEventHandler ResetTabletsEvent;
public float[] TicksPerSecond;
private int newSpeedIndex = -1;
private int speedIndex = -1;
private float lastTickTimeSeconds = 0;
void Awake() {
if (Obj != null)
{
Destroy(this);
}
Obj = this;
}
void Update() {
if (speedIndex >= 0) {
if (Time.time - lastTickTimeSeconds >= 1 / TicksPerSecond[speedIndex]) {
if (ManipulateTickEvent != null)
ManipulateTickEvent(1 / TicksPerSecond[speedIndex]);
if (MoveTickEvent != null)
MoveTickEvent(1 / TicksPerSecond[speedIndex]);
this.lastTickTimeSeconds = Time.time;
speedIndex = newSpeedIndex;
}
} else if (newSpeedIndex >= 0) {
speedIndex = newSpeedIndex;
}
}
public int GetMaxSpeed() {
return TicksPerSecond.Length;
}
public void SetSpeed(int speed) {
newSpeedIndex = Mathf.Clamp(speed - 1, -1, GetMaxSpeed());
}
public void ResetTablets() {
if (ResetTabletsEvent != null)
ResetTabletsEvent();
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TickController : MonoBehaviour {
public static TickController Obj;
public delegate void TickEventHandler(float lengthOfTickSeconds);
public static event TickEventHandler MoveTickEvent;
public static event TickEventHandler ManipulateTickEvent;
public delegate void ResetTabletsEventHandler();
public static event ResetTabletsEventHandler ResetTabletsEvent;
public float[] TicksPerSecond;
private int newSpeedIndex = -1;
private int speedIndex = -1;
private float lastTickTimeSeconds = 0;
void Awake() {
if (Obj != null)
{
Destroy(this);
}
Obj = this;
}
void Update() {
if (speedIndex >= 0) {
if (Time.time - lastTickTimeSeconds >= 1 / TicksPerSecond[newSpeedIndex]) {
if (ManipulateTickEvent != null)
ManipulateTickEvent(1 / TicksPerSecond[speedIndex]);
if (MoveTickEvent != null)
MoveTickEvent(1 / TicksPerSecond[speedIndex]);
this.lastTickTimeSeconds = Time.time;
speedIndex = newSpeedIndex;
}
} else if (newSpeedIndex >= 0) {
speedIndex = newSpeedIndex;
}
}
public int GetMaxSpeed() {
return TicksPerSecond.Length;
}
public void SetSpeed(int speed) {
newSpeedIndex = Mathf.Clamp(speed - 1, -1, GetMaxSpeed());
}
public void ResetTablets() {
if (ResetTabletsEvent != null)
ResetTabletsEvent();
}
}
| mit | C# |
befc10ce9620ba8d48b2eaedbe27babdd650573e | Update TetheredPlacement.cs (#10566) | killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity | Assets/MRTK/Examples/Demos/HandTracking/Scripts/TetheredPlacement.cs | Assets/MRTK/Examples/Demos/HandTracking/Scripts/TetheredPlacement.cs | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEngine;
using UnityEngine.Serialization;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
/// <summary>
/// Helper script to respawn objects if they go too far from their original position. Useful for objects that will fall forever etc.
/// </summary>
[AddComponentMenu("Scripts/MRTK/Examples/TetheredPlacement")]
public class TetheredPlacement : MonoBehaviour
{
[SerializeField, Tooltip("The distance from the GameObject's spawn position at which will trigger a respawn."), FormerlySerializedAs("DistanceThreshold")]
private float distanceThreshold = 20.0f;
/// <summary>
/// The distance from the GameObject's spawn position at which will trigger a respawn.
/// </summary>
/// <remarks>Also updates a local cache of this value squared for performant distance checking.</remarks>
public float DistanceThreshold
{
get => distanceThreshold;
set
{
distanceThreshold = value;
distanceThresholdSquared = distanceThreshold * distanceThreshold;
}
}
private Vector3 localRespawnPosition;
private Quaternion localRespawnRotation;
private Rigidbody rigidBody;
private float distanceThresholdSquared;
private void Start()
{
rigidBody = GetComponent<Rigidbody>();
LockSpawnPoint();
distanceThresholdSquared = distanceThreshold * distanceThreshold;
}
private void LateUpdate()
{
float distanceSqr = (localRespawnPosition - transform.localPosition).sqrMagnitude;
if (distanceSqr > distanceThresholdSquared)
{
// Reset any velocity from falling or moving when respawning to original location
if (rigidBody != null)
{
rigidBody.velocity = Vector3.zero;
rigidBody.angularVelocity = Vector3.zero;
}
transform.localPosition = localRespawnPosition;
transform.localRotation = localRespawnRotation;
}
}
/// <summary>
/// Updates the local respawn pose to the objects current pose.
/// </summary>
public void LockSpawnPoint()
{
localRespawnPosition = transform.localPosition;
localRespawnRotation = transform.localRotation;
}
}
}
| // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit.Examples.Demos
{
/// <summary>
/// Helper script to respawn objects if they go too far from their original position. Useful for objects that will fall forever etc.
/// </summary>
[AddComponentMenu("Scripts/MRTK/Examples/TetheredPlacement")]
public class TetheredPlacement : MonoBehaviour
{
[Tooltip("The distance from the GameObject's spawn position at which will trigger a respawn ")]
public float DistanceThreshold = 20.0f;
private Vector3 RespawnPoint;
private Quaternion RespawnOrientation;
private Rigidbody rigidBody;
private void Start()
{
rigidBody = GetComponent<Rigidbody>();
LockSpawnPoint();
}
private void LateUpdate()
{
float distanceSqr = (RespawnPoint - this.transform.position).sqrMagnitude;
if (distanceSqr > DistanceThreshold * DistanceThreshold)
{
// Reset any velocity from falling or moving when respawning to original location
if (rigidBody != null)
{
rigidBody.velocity = Vector3.zero;
rigidBody.angularVelocity = Vector3.zero;
}
this.transform.SetPositionAndRotation(RespawnPoint, RespawnOrientation);
}
}
public void LockSpawnPoint()
{
RespawnPoint = this.transform.position;
RespawnOrientation = this.transform.rotation;
}
}
} | mit | C# |
c03678ff043a754b85ecc45ada99fadd1616bb50 | adjust namespace import | tonytang-microsoft-com/autorest,jkonecki/autorest,vasanthangel4/autorest,sergey-shandar/autorest,anudeepsharma/autorest,jianghaolu/AutoRest,sergey-shandar/autorest,fhoring/autorest,John-Hart/autorest,xingwu1/autorest,BurtBiel/autorest,jhendrixMSFT/autorest,begoldsm/autorest,AzCiS/autorest,tonytang-microsoft-com/autorest,devigned/autorest,sergey-shandar/autorest,garimakhulbe/autorest,annatisch/autorest,devigned/autorest,hovsepm/AutoRest,Azure/autorest,xingwu1/autorest,hovsepm/AutoRest,John-Hart/autorest,stankovski/AutoRest,vishrutshah/autorest,sergey-shandar/autorest,brodyberg/autorest,lmazuel/autorest,balajikris/autorest,csmengwan/autorest,veronicagg/autorest,AzCiS/autorest,devigned/autorest,stankovski/AutoRest,amarzavery/AutoRest,BretJohnson/autorest,haocs/autorest,veronicagg/autorest,anudeepsharma/autorest,stankovski/AutoRest,csmengwan/autorest,balajikris/autorest,balajikris/autorest,vasanthangel4/autorest,vulcansteel/autorest,ljhljh235/AutoRest,colemickens/autorest,brodyberg/autorest,jianghaolu/AutoRest,jhendrixMSFT/autorest,hovsepm/AutoRest,annatisch/autorest,xingwu1/autorest,sharadagarwal/autorest,annatisch/autorest,dsgouda/autorest,csmengwan/autorest,hovsepm/AutoRest,jianghaolu/AutoRest,tbombach/autorest,yugangw-msft/autorest,stankovski/AutoRest,matthchr/autorest,annatisch/autorest,balajikris/autorest,hovsepm/AutoRest,dsgouda/autorest,begoldsm/autorest,matt-gibbs/AutoRest,fearthecowboy/autorest,lmazuel/autorest,veronicagg/autorest,jhancock93/autorest,dsgouda/autorest,yaqiyang/autorest,Azure/azure-sdk-for-java,yaqiyang/autorest,John-Hart/autorest,ljhljh235/AutoRest,tonytang-microsoft-com/autorest,begoldsm/autorest,fhoring/autorest,devigned/autorest,anudeepsharma/autorest,ljhljh235/AutoRest,vishrutshah/autorest,balajikris/autorest,haocs/autorest,yugangw-msft/autorest,anudeepsharma/autorest,tonytang-microsoft-com/autorest,vishrutshah/autorest,anudeepsharma/autorest,balajikris/autorest,tbombach/autorest,yugangw-msft/autorest,jianghaolu/AutoRest,veronicagg/autorest,John-Hart/autorest,veronicagg/autorest,John-Hart/autorest,begoldsm/autorest,vishrutshah/autorest,jianghaolu/AutoRest,yaqiyang/autorest,sergey-shandar/autorest,matthchr/autorest,sharadagarwal/autorest,vulcansteel/autorest,begoldsm/autorest,garimakhulbe/autorest,BretJohnson/autorest,tbombach/autorest,begoldsm/autorest,yugangw-msft/autorest,AzCiS/autorest,anudeepsharma/autorest,jhendrixMSFT/autorest,stankovski/AutoRest,selvasingh/azure-sdk-for-java,John-Hart/autorest,jkonecki/autorest,devigned/autorest,begoldsm/autorest,devigned/autorest,colemickens/autorest,sergey-shandar/autorest,hovsepm/AutoRest,tonytang-microsoft-com/autorest,balajikris/autorest,vulcansteel/autorest,matthchr/autorest,matt-gibbs/AutoRest,selvasingh/azure-sdk-for-java,matthchr/autorest,sergey-shandar/autorest,lmazuel/autorest,brodyberg/autorest,vishrutshah/autorest,BurtBiel/autorest,anudeepsharma/autorest,stankovski/AutoRest,haocs/autorest,dsgouda/autorest,lmazuel/autorest,amarzavery/AutoRest,yaqiyang/autorest,garimakhulbe/autorest,fhoring/autorest,vulcansteel/autorest,brodyberg/autorest,fhoring/autorest,annatisch/autorest,veronicagg/autorest,vulcansteel/autorest,John-Hart/autorest,Azure/azure-sdk-for-java,ljhljh235/AutoRest,Azure/autorest,lmazuel/autorest,yonglehou/autorest,navalev/azure-sdk-for-java,haocs/autorest,vishrutshah/autorest,brodyberg/autorest,vasanthangel4/autorest,sharadagarwal/autorest,jianghaolu/AutoRest,csmengwan/autorest,amarzavery/AutoRest,BurtBiel/autorest,anudeepsharma/autorest,vishrutshah/autorest,garimakhulbe/autorest,hovsepm/AutoRest,haocs/autorest,anudeepsharma/autorest,AzCiS/autorest,yugangw-msft/autorest,ljhljh235/AutoRest,BurtBiel/autorest,yugangw-msft/autorest,hovsepm/AutoRest,Azure/azure-sdk-for-java,BretJohnson/autorest,amarzavery/AutoRest,colemickens/autorest,navalev/azure-sdk-for-java,vasanthangel4/autorest,tbombach/autorest,tbombach/autorest,jhancock93/autorest,xingwu1/autorest,veronicagg/autorest,AzCiS/autorest,sharadagarwal/autorest,Azure/autorest,tbombach/autorest,devigned/autorest,ljhljh235/AutoRest,yugangw-msft/autorest,lmazuel/autorest,fhoring/autorest,dsgouda/autorest,matt-gibbs/AutoRest,jhancock93/autorest,jhancock93/autorest,BretJohnson/autorest,haocs/autorest,vulcansteel/autorest,AzCiS/autorest,csmengwan/autorest,matthchr/autorest,fhoring/autorest,BurtBiel/autorest,navalev/azure-sdk-for-java,sergey-shandar/autorest,stankovski/AutoRest,dsgouda/autorest,amarzavery/AutoRest,matthchr/autorest,garimakhulbe/autorest,matthchr/autorest,matt-gibbs/AutoRest,veronicagg/autorest,matthchr/autorest,colemickens/autorest,Azure/azure-sdk-for-java,stankovski/AutoRest,tbombach/autorest,navalev/azure-sdk-for-java,fhoring/autorest,BurtBiel/autorest,begoldsm/autorest,yugangw-msft/autorest,ljhljh235/AutoRest,sharadagarwal/autorest,matt-gibbs/AutoRest,Azure/azure-sdk-for-java,matthchr/autorest,annatisch/autorest,annatisch/autorest,BretJohnson/autorest,brodyberg/autorest,jhendrixMSFT/autorest,John-Hart/autorest,yonglehou/autorest,lmazuel/autorest,haocs/autorest,vishrutshah/autorest,xingwu1/autorest,devigned/autorest,vulcansteel/autorest,jhancock93/autorest,jkonecki/autorest,BurtBiel/autorest,yaqiyang/autorest,tbombach/autorest,selvasingh/azure-sdk-for-java,garimakhulbe/autorest,brjohnstmsft/autorest,haocs/autorest,AzCiS/autorest,fhoring/autorest,lmazuel/autorest,Azure/autorest,dsgouda/autorest,brodyberg/autorest,jhancock93/autorest,jkonecki/autorest,vishrutshah/autorest,balajikris/autorest,navalev/azure-sdk-for-java,annatisch/autorest,yaqiyang/autorest,xingwu1/autorest,jianghaolu/AutoRest,matt-gibbs/AutoRest,csmengwan/autorest,devigned/autorest,yonglehou/autorest,hovsepm/AutoRest,olydis/autorest,yugangw-msft/autorest,yonglehou/autorest,sharadagarwal/autorest,sergey-shandar/autorest,annatisch/autorest,veronicagg/autorest,amarzavery/AutoRest,amarzavery/AutoRest,begoldsm/autorest,dsgouda/autorest,yonglehou/autorest,fhoring/autorest,jianghaolu/AutoRest,ljhljh235/AutoRest,garimakhulbe/autorest,amarzavery/AutoRest,vasanthangel4/autorest,jianghaolu/AutoRest,yaqiyang/autorest,jhancock93/autorest,haocs/autorest,sharadagarwal/autorest,xingwu1/autorest,jhancock93/autorest,fearthecowboy/autorest,garimakhulbe/autorest,olydis/autorest,garimakhulbe/autorest,yaqiyang/autorest,amarzavery/AutoRest,brjohnstmsft/autorest,lmazuel/autorest,csmengwan/autorest,colemickens/autorest,dsgouda/autorest,brodyberg/autorest,jhancock93/autorest,xingwu1/autorest,csmengwan/autorest,BurtBiel/autorest,balajikris/autorest,sharadagarwal/autorest,AzCiS/autorest,jkonecki/autorest,tbombach/autorest | AutoRest/Generators/AcceptanceTests/NugetPackageTest/PackageTests.cs | AutoRest/Generators/AcceptanceTests/NugetPackageTest/PackageTests.cs | // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Newtonsoft.Json;
using Xunit;
using Xunit.Abstractions;
using Fixtures.Bodynumber;
using Microsoft.Rest.Generator.CSharp.Tests;
namespace NugetPackageTest
{
//we random port over a C# acceptance test so to verify in sanity
//that the freshly built out nuget packages (runtime and generator) works.
public class PackageTests : IClassFixture<ServiceController>
{
private readonly ITestOutputHelper _output;
public PackageTests(ServiceController data, ITestOutputHelper output)
{
this.Fixture = data;
_output = output;
}
public ServiceController Fixture { get; set; }
[Fact]
public void TestClientRuntimeWorks()
{
var client = new AutoRestNumberTestService(Fixture.Uri);
client.Number.PutBigFloat(3.402823e+20);
client.Number.PutSmallFloat(3.402823e-20);
client.Number.PutBigDouble(2.5976931e+101);
client.Number.PutSmallDouble(2.5976931e-101);
client.Number.PutBigDoubleNegativeDecimal(-99999999.99);
client.Number.PutBigDoublePositiveDecimal(99999999.99);
client.Number.GetNull();
Assert.Equal(3.402823e+20, client.Number.GetBigFloat());
Assert.Equal(3.402823e-20, client.Number.GetSmallFloat());
Assert.Equal(2.5976931e+101, client.Number.GetBigDouble());
Assert.Equal(2.5976931e-101, client.Number.GetSmallDouble());
Assert.Equal(-99999999.99, client.Number.GetBigDoubleNegativeDecimal());
Assert.Equal(99999999.99, client.Number.GetBigDoublePositiveDecimal());
Assert.Throws<JsonReaderException>(() => client.Number.GetInvalidDouble());
Assert.Throws<JsonReaderException>(() => client.Number.GetInvalidFloat());
}
}
}
| // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Fixtures.Bodynumber;
using Microsoft.Rest.Generator.CSharp.Tests;
using Newtonsoft.Json;
using System;
using Xunit;
using Xunit.Abstractions;
namespace NugetPackageTest
{
public class PackageTests : IClassFixture<ServiceController>
{
private readonly ITestOutputHelper _output;
public PackageTests(ServiceController data, ITestOutputHelper output)
{
this.Fixture = data;
_output = output;
}
public ServiceController Fixture { get; set; }
[Fact]
public void TestClientRuntimeWorks()
{
//we random port over a C# acceptance test so to verify in sanity
//that the freshly built out nuget packages (runtime and generator) works.
var client = new AutoRestNumberTestService(Fixture.Uri);
client.Number.PutBigFloat(3.402823e+20);
client.Number.PutSmallFloat(3.402823e-20);
client.Number.PutBigDouble(2.5976931e+101);
client.Number.PutSmallDouble(2.5976931e-101);
client.Number.PutBigDoubleNegativeDecimal(-99999999.99);
client.Number.PutBigDoublePositiveDecimal(99999999.99);
client.Number.GetNull();
Assert.Equal(3.402823e+20, client.Number.GetBigFloat());
Assert.Equal(3.402823e-20, client.Number.GetSmallFloat());
Assert.Equal(2.5976931e+101, client.Number.GetBigDouble());
Assert.Equal(2.5976931e-101, client.Number.GetSmallDouble());
Assert.Equal(-99999999.99, client.Number.GetBigDoubleNegativeDecimal());
Assert.Equal(99999999.99, client.Number.GetBigDoublePositiveDecimal());
Assert.Throws<JsonReaderException>(() => client.Number.GetInvalidDouble());
Assert.Throws<JsonReaderException>(() => client.Number.GetInvalidFloat());
}
}
}
| mit | C# |
c513ea8d7672d8cea425e2c19ccf511f9b481798 | fix camera fov when switching screens | CyberCRI/Hero.Coli,CyberCRI/Hero.Coli | Assets/Scripts/Camera/cameraFollow.cs | Assets/Scripts/Camera/cameraFollow.cs | using UnityEngine;
using System.Collections;
public class cameraFollow : MonoBehaviour {
public Transform target;
public bool useScenePosition = true;
public Vector3 offset;
public bool _transition = true;
public bool _zoomed = false;
public float zoomedCameraDistanceMin = 5;
public float cameraDistanceMin = 20;
public float cameraDistanceMax = 75;
public float scrollSpeed = 5;
public float zoomSmooth = 3;
public float fovZoomed = 10.0f;
private float fovUnzoomed;
private float fov;
private float _timeAtLastFrame = 0f;
private float _timeAtCurrentFrame = 0f;
private float deltaTime = 0f;
public void SetZoom(bool zoomIn) {
_zoomed = zoomIn;
if(zoomIn) {
fov = fovZoomed;
} else {
fov = fovUnzoomed;
}
}
// Use this for initialization
void Start () {
if(useScenePosition)
offset = transform.position - target.position;
fovUnzoomed = GetComponent<Camera>().fieldOfView;
fov = fovUnzoomed;
}
// Update is called once per frame
void LateUpdate () {
_timeAtCurrentFrame = Time.realtimeSinceStartup;
deltaTime = _timeAtCurrentFrame - _timeAtLastFrame;
_timeAtLastFrame = _timeAtCurrentFrame;
transform.position = target.position + offset;
if(_transition){
if(!_zoomed) {
fov = Mathf.Clamp(fov + Input.GetAxis("Mouse ScrollWheel") * scrollSpeed, cameraDistanceMin, cameraDistanceMax);
}
camera.fieldOfView = Mathf.Lerp(camera.fieldOfView, fov, deltaTime * zoomSmooth);
}
}
}
| using UnityEngine;
using System.Collections;
public class cameraFollow : MonoBehaviour {
public Transform target;
public bool useScenePosition = true;
public Vector3 offset;
public bool _transition = true;
public bool _zoomed = false;
public float zoomedCameraDistanceMin = 5;
public float cameraDistanceMin = 20;
public float cameraDistanceMax = 75;
public float scrollSpeed = 5;
public float zoomSmooth = 3;
private float fov;
private float _timeAtLastFrame = 0f;
private float _timeAtCurrentFrame = 0f;
private float deltaTime = 0f;
public void SetZoom(bool zoomIn) {
_zoomed = zoomIn;
if(zoomIn) {
fov = 10.0f;
} else {
fov = 65.0f;
}
}
// Use this for initialization
void Start () {
if(useScenePosition)
offset = transform.position - target.position;
fov = GetComponent<Camera>().fieldOfView;
}
// Update is called once per frame
void LateUpdate () {
_timeAtCurrentFrame = Time.realtimeSinceStartup;
deltaTime = _timeAtCurrentFrame - _timeAtLastFrame;
_timeAtLastFrame = _timeAtCurrentFrame;
transform.position = target.position + offset;
if(_transition){
if(!_zoomed) {
fov = Mathf.Clamp(fov + Input.GetAxis("Mouse ScrollWheel") * scrollSpeed, cameraDistanceMin, cameraDistanceMax);
}
camera.fieldOfView = Mathf.Lerp(camera.fieldOfView, fov, deltaTime * zoomSmooth);
}
}
}
| mit | C# |
10add2348296f78f5efa327188793d303cd7895b | 升级版本到2.0.5 | geffzhang/equeue,Aaron-Liu/equeue,Aaron-Liu/equeue,tangxuehua/equeue,tangxuehua/equeue,tangxuehua/equeue,geffzhang/equeue | src/EQueue/Properties/AssemblyInfo.cs | src/EQueue/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.5")]
[assembly: AssemblyFileVersion("2.0.5")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("EQueue")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EQueue")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("75468a30-77e7-4b09-813c-51513179c550")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.4")]
[assembly: AssemblyFileVersion("2.0.4")]
| mit | C# |
3c14ae7263bfb518c3701ce27127d399862b493c | Update ThomasLee.cs | planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell | src/Firehose.Web/Authors/ThomasLee.cs | src/Firehose.Web/Authors/ThomasLee.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ThomasLee : IAmAMicrosoftMVP
{
public string FirstName => "Thomas";
public string LastName => "Lee";
public string ShortBioOrTagLine => "Just this guy, living in the UK. A Grateful Dead and long time PowerShell Fan. MVP 17 times";
public string StateOrRegion => "Berkshire, UK";
public string EmailAddress => "DoctorDNS@Gmail.Com";
public string TwitterHandle => "DoctorDNS";
public string GravatarHash => "9fac677a9811ddc033b9ec883606031d";
public string GitHubHandle => "DoctorDNS";
public GeoPosition Position => new GeoPosition(51.5566737,-0.6941204);
public Uri WebSite => new Uri("https://tfl09.blogspot.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://tfl09.blogspot.com/feeds/posts/default/"); }
}
public string FeedLanguageCode => "en";
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;
namespace Firehose.Web.Authors
{
public class ThomasLee : IAmAMicrosoftMVP
{
public string FirstName => "Thomas";
public string LastName => "Lee";
public string ShortBioOrTagLine => "Just this guy, living in the UK. Grateful Dead fan, and long time PowerShell Fan. MVP 17 times";
public string StateOrRegion => "Berkshire, UI";
public string EmailAddress => "DoctorDNS@Gmail.Com";
public string TwitterHandle => "DoctorDNS";
public string GravatarHash => "9fac677a9811ddc033b9ec883606031d";
public string GitHubHandle => "DoctorDNS";
public GeoPosition Position => new GeoPosition(51.5566737,-0.6941204);
public Uri WebSite => new Uri("https://tfl09.blogspot.com");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("https://tfl09.blogspot.com/feeds/posts/default/"); }
}
public string FeedLanguageCode => "en";
}
}
| mit | C# |
89393562486d5a1dcabf5e97d9470ab9fe245b92 | add options to handle code blocks in formatting. | jokamjohn/Markdown-Edit,Tdue21/Markdown-Edit,mike-ward/Markdown-Edit,punker76/Markdown-Edit,dsuess/Markdown-Edit,Pulgafree/Markdown-Edit,chris84948/Markdown-Edit | src/MarkdownEdit/Models/FormatText.cs | src/MarkdownEdit/Models/FormatText.cs | using System.Diagnostics;
using System.IO;
using System.Text;
namespace MarkdownEdit.Models
{
internal static class FormatText
{
public static string Wrap(string text)
{
var tuple = Utility.SeperateFrontMatter(text);
var result = Pandoc(tuple.Item2, "--columns 80");
return tuple.Item1 + result;
}
public static string Unwrap(string text)
{
var tuple = Utility.SeperateFrontMatter(text);
var result = Pandoc(tuple.Item2, "--no-wrap --atx-headers");
return tuple.Item1 + result;
}
private static string Pandoc(string text, string args)
{
var info = PandocInfo();
info.Arguments += $" {args}";
using (var process = Process.Start(info))
{
var utf8 = new StreamWriter(process.StandardInput.BaseStream, Encoding.UTF8);
utf8.Write(text);
utf8.Close();
var result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
if (process.ExitCode != 0) result = process.StandardError.ReadToEnd();
return result;
}
}
private static ProcessStartInfo PandocInfo()
{
const string extensions = "+fenced_code_blocks+backtick_code_blocks+intraword_underscores";
return new ProcessStartInfo
{
FileName = "pandoc.exe",
Arguments = $"-f markdown_strict{extensions} -t markdown_strict{extensions}",
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardOutputEncoding = Encoding.UTF8,
StandardErrorEncoding = Encoding.UTF8,
UseShellExecute = false,
CreateNoWindow = true,
WorkingDirectory = Utility.AssemblyFolder()
};
}
}
} | using System.Diagnostics;
using System.IO;
using System.Text;
namespace MarkdownEdit.Models
{
internal static class FormatText
{
public static string Wrap(string text)
{
var tuple = Utility.SeperateFrontMatter(text);
var result = Pandoc(tuple.Item2, "--columns 80");
return tuple.Item1 + result;
}
public static string Unwrap(string text)
{
var tuple = Utility.SeperateFrontMatter(text);
var result = Pandoc(tuple.Item2, "--no-wrap --atx-headers");
return tuple.Item1 + result;
}
private static string Pandoc(string text, string args)
{
var info = PandocInfo();
info.Arguments += $" {args}";
using (var process = Process.Start(info))
{
var utf8 = new StreamWriter(process.StandardInput.BaseStream, Encoding.UTF8);
utf8.Write(text);
utf8.Close();
var result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
if (process.ExitCode != 0) result = process.StandardError.ReadToEnd();
return result;
}
}
private static ProcessStartInfo PandocInfo()
{
return new ProcessStartInfo
{
FileName = "pandoc.exe",
Arguments = "-f markdown_strict -t markdown_strict",
RedirectStandardInput = true,
RedirectStandardOutput = true,
RedirectStandardError = true,
StandardOutputEncoding = Encoding.UTF8,
StandardErrorEncoding = Encoding.UTF8,
UseShellExecute = false,
CreateNoWindow = true,
WorkingDirectory = Utility.AssemblyFolder()
};
}
}
} | mit | C# |
5c004533abe32e0493ea99a422daeb4608f69084 | Update spacing for project consistency | mroach/RollbarSharp,TheNeatCompany/RollbarSharp,TheNeatCompany/RollbarSharp,mteinum/RollbarSharp2,jmblab/RollbarSharp,mteinum/RollbarSharp2 | src/RollbarSharp/RollbarHttpModule.cs | src/RollbarSharp/RollbarHttpModule.cs | using System;
using System.Web;
namespace RollbarSharp
{
public class RollbarHttpModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.Error += SendError;
}
public void Dispose()
{
}
private static void SendError(object sender, EventArgs e)
{
var application = (HttpApplication) sender;
new RollbarClient().SendException(application.Server.GetLastError().GetBaseException());
}
}
} | using System;
using System.Web;
namespace RollbarSharp
{
public class RollbarHttpModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.Error += SendError;
}
public void Dispose()
{
}
private void SendError(object sender, EventArgs e)
{
var application = (HttpApplication)sender;
new RollbarClient().SendException(application.Server.GetLastError().GetBaseException());
}
}
} | apache-2.0 | C# |
556fd10adb440ec83e180a9fde9a6da4885349de | Change the Node to a class so we can use references rather than making copies of everything. | alekratz/apphack2-project | transf/Net/Node.cs | transf/Net/Node.cs | using System;
using System.Net;
using System.Collections.Generic;
using transf.Utils;
namespace transf.Net
{
public class Node
{
public string Nickname { get; set; }
public IPAddress RemoteAddress { get; set; }
public ulong LastCheckin { get; set; }
public const ulong MAX_TIMEOUT = 10000; // 10000 ms is the timeout
/// <summary>
/// Determines whether this instance has timed out, based on the maximum timeout.
/// </summary>
/// <returns><c>true</c> if this instance has timed out based on the current Unix time; otherwise, <c>false</c>.</returns>
public bool HasTimedOut()
{
ulong currTimeMs = TimeUtils.GetUnixTimestampMs ();
return currTimeMs - LastCheckin > MAX_TIMEOUT;
}
public override int GetHashCode ()
{
return Nickname.GetHashCode () ^ RemoteAddress.GetHashCode ();
}
public override bool Equals(object obj)
{
return obj.GetHashCode() == GetHashCode();
}
}
} | using System;
using System.Net;
using transf.Utils;
namespace transf.Net
{
public struct Node
{
public string Nickname { get; set; }
public IPAddress RemoteAddress { get; set; }
public ulong LastCheckin { get; set; }
public const ulong MAX_TIMEOUT = 10000; // 10000 ms is the timeout
/// <summary>
/// Determines whether this instance has timed out, based on the maximum timeout.
/// </summary>
/// <returns><c>true</c> if this instance has timed out based on the current Unix time; otherwise, <c>false</c>.</returns>
public bool HasTimedOut()
{
ulong currTimeMs = TimeUtils.GetUnixTimestampMs ();
return currTimeMs - LastCheckin > MAX_TIMEOUT;
}
public override int GetHashCode ()
{
return Nickname.GetHashCode () ^ RemoteAddress.GetHashCode ();
}
public override bool Equals(object obj)
{
return obj.GetHashCode() == GetHashCode();
}
}
}
| agpl-3.0 | C# |
0f1252974315d6b465be399493eb51d32d9b9947 | Support more SIZE strings | robinrodricks/FluentFTP,robinrodricks/FluentFTP,robinrodricks/FluentFTP | FluentFTP/Servers/FtpServerStrings.cs | FluentFTP/Servers/FtpServerStrings.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace FluentFTP.Servers {
internal static class FtpServerStrings {
#region File Exists
/// <summary>
/// Error messages returned by various servers when a file does not exist.
/// Instead of throwing an error, we use these to detect and handle the file detection properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileNotFound = new[] {
"can't find file",
"can't check for file existence",
"does not exist",
"failed to open file",
"not found",
"no such file",
"cannot find the file",
"cannot find",
"can't get file",
"could not get file",
"cannot get file",
"not a regular file",
"file unavailable",
"file is unavailable",
"file not unavailable",
"file is not available",
"no files found",
"no file found",
"datei oder verzeichnis nicht gefunden",
"can't find the path",
"cannot find the path",
"could not find the path",
};
#endregion
#region File Size
/// <summary>
/// Error messages returned by various servers when a file size is not supported in ASCII mode.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileSizeNotInASCII = new[] {
"not allowed in ascii",
"size not allowed in ascii",
"n'est pas autorisé en mode ascii"
};
#endregion
#region File Transfer
/// <summary>
/// Error messages returned by various servers when a file transfer temporarily failed.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] unexpectedEOF = new[] {
"unexpected eof for remote file",
"received an unexpected eof",
"unexpected eof"
};
#endregion
#region Create Directory
/// <summary>
/// Error messages returned by various servers when a folder already exists.
/// Instead of throwing an error, we use these to detect and handle the folder creation properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] folderExists = new[] {
"exist on server",
"exists on server",
"file exist",
"directory exist",
"folder exist",
"file already exist",
"directory already exist",
"folder already exist",
};
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace FluentFTP.Servers {
internal static class FtpServerStrings {
#region File Exists
/// <summary>
/// Error messages returned by various servers when a file does not exist.
/// Instead of throwing an error, we use these to detect and handle the file detection properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileNotFound = new[] {
"can't find file",
"can't check for file existence",
"does not exist",
"failed to open file",
"not found",
"no such file",
"cannot find the file",
"cannot find",
"could not get file",
"not a regular file",
"file unavailable",
"file is unavailable",
"file not unavailable",
"file is not available",
"no files found",
"no file found",
"datei oder verzeichnis nicht gefunden"
};
#endregion
#region File Size
/// <summary>
/// Error messages returned by various servers when a file size is not supported in ASCII mode.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileSizeNotInASCII = new[] {
"not allowed in ascii",
"size not allowed in ascii",
"n'est pas autorisé en mode ascii"
};
#endregion
#region File Transfer
/// <summary>
/// Error messages returned by various servers when a file transfer temporarily failed.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] unexpectedEOF = new[] {
"unexpected eof for remote file",
"received an unexpected eof",
"unexpected eof"
};
#endregion
#region Create Directory
/// <summary>
/// Error messages returned by various servers when a folder already exists.
/// Instead of throwing an error, we use these to detect and handle the folder creation properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] folderExists = new[] {
"exist on server",
"exists on server",
"file exist",
"directory exist",
"folder exist",
"file already exist",
"directory already exist",
"folder already exist",
};
#endregion
}
}
| mit | C# |
987db297d8b7e83d3af570239c91ac838f0dccaa | Fix for bug 13581 [OpenGLES20Example crashes on ipodTouch 5.1.1] - The GetExtension () method always returns an extension with a dot and NSBundle.MainBundle.PathForResource () doesn’t support dot on iOS prior to version 6. | kingyond/monotouch-samples,davidrynn/monotouch-samples,davidrynn/monotouch-samples,xamarin/monotouch-samples,peteryule/monotouch-samples,peteryule/monotouch-samples,sakthivelnagarajan/monotouch-samples,robinlaide/monotouch-samples,sakthivelnagarajan/monotouch-samples,kingyond/monotouch-samples,kingyond/monotouch-samples,nelzomal/monotouch-samples,andypaul/monotouch-samples,hongnguyenpro/monotouch-samples,labdogg1003/monotouch-samples,iFreedive/monotouch-samples,labdogg1003/monotouch-samples,nelzomal/monotouch-samples,albertoms/monotouch-samples,andypaul/monotouch-samples,davidrynn/monotouch-samples,peteryule/monotouch-samples,labdogg1003/monotouch-samples,nelzomal/monotouch-samples,YOTOV-LIMITED/monotouch-samples,W3SS/monotouch-samples,haithemaraissia/monotouch-samples,YOTOV-LIMITED/monotouch-samples,robinlaide/monotouch-samples,a9upam/monotouch-samples,peteryule/monotouch-samples,markradacz/monotouch-samples,hongnguyenpro/monotouch-samples,xamarin/monotouch-samples,labdogg1003/monotouch-samples,andypaul/monotouch-samples,xamarin/monotouch-samples,haithemaraissia/monotouch-samples,andypaul/monotouch-samples,a9upam/monotouch-samples,iFreedive/monotouch-samples,a9upam/monotouch-samples,W3SS/monotouch-samples,YOTOV-LIMITED/monotouch-samples,sakthivelnagarajan/monotouch-samples,davidrynn/monotouch-samples,nervevau2/monotouch-samples,a9upam/monotouch-samples,nervevau2/monotouch-samples,haithemaraissia/monotouch-samples,haithemaraissia/monotouch-samples,albertoms/monotouch-samples,markradacz/monotouch-samples,W3SS/monotouch-samples,nervevau2/monotouch-samples,robinlaide/monotouch-samples,hongnguyenpro/monotouch-samples,nervevau2/monotouch-samples,markradacz/monotouch-samples,YOTOV-LIMITED/monotouch-samples,nelzomal/monotouch-samples,hongnguyenpro/monotouch-samples,sakthivelnagarajan/monotouch-samples,albertoms/monotouch-samples,robinlaide/monotouch-samples,iFreedive/monotouch-samples | OpenGL/OpenGLES20Example/GLTexture.cs | OpenGL/OpenGLES20Example/GLTexture.cs | using System;
using OpenTK.Graphics.ES20;
using MonoTouch.OpenGLES;
using System.IO;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreImage;
using MonoTouch.CoreGraphics;
using System.Drawing;
namespace OpenGLES20Example
{
public class GLTexture
{
string filename;
uint texture;
public GLTexture (string inFilename)
{
GL.Enable (EnableCap.Texture2D);
GL.Enable (EnableCap.Blend);
filename = inFilename;
GL.Hint (HintTarget.GenerateMipmapHint, HintMode.Nicest);
GL.GenTextures (1, out texture);
GL.BindTexture (TextureTarget.Texture2D, texture);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int) All.Repeat);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int) All.Repeat);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int) All.Linear);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int) All.Linear);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int) All.Nearest);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int) All.Nearest);
//TODO Remove the Substring method if you don't support iOS versions prior to iOS 6.
string extension = Path.GetExtension (filename).Substring(1);
string baseFilename = Path.GetFileNameWithoutExtension (filename);
string path = NSBundle.MainBundle.PathForResource (baseFilename, extension);
NSData texData = NSData.FromFile (path);
UIImage image = UIImage.LoadFromData (texData);
if (image == null)
return;
int width = image.CGImage.Width;
int height = image.CGImage.Height;
CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB ();
byte [] imageData = new byte[height * width * 4];
CGContext context = new CGBitmapContext (imageData, width, height, 8, 4 * width, colorSpace,
CGBitmapFlags.PremultipliedLast | CGBitmapFlags.ByteOrder32Big);
context.TranslateCTM (0, height);
context.ScaleCTM (1, -1);
colorSpace.Dispose ();
context.ClearRect (new RectangleF (0, 0, width, height));
context.DrawImage (new RectangleF (0, 0, width, height), image.CGImage);
GL.TexImage2D (TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, width, height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, imageData);
context.Dispose ();
}
public static void UseDefaultTexture ()
{
GL.BindTexture (TextureTarget.Texture2D, 0);
}
public void Use ()
{
GL.BindTexture (TextureTarget.Texture2D, texture);
}
}
}
| using System;
using OpenTK.Graphics.ES20;
using MonoTouch.OpenGLES;
using System.IO;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreImage;
using MonoTouch.CoreGraphics;
using System.Drawing;
namespace OpenGLES20Example
{
public class GLTexture
{
string filename;
uint texture;
public GLTexture (string inFilename)
{
GL.Enable (EnableCap.Texture2D);
GL.Enable (EnableCap.Blend);
filename = inFilename;
GL.Hint (HintTarget.GenerateMipmapHint, HintMode.Nicest);
GL.GenTextures (1, out texture);
GL.BindTexture (TextureTarget.Texture2D, texture);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int) All.Repeat);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int) All.Repeat);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int) All.Linear);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int) All.Linear);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int) All.Nearest);
GL.TexParameter (TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int) All.Nearest);
string extension = Path.GetExtension (filename);
string baseFilename = Path.GetFileNameWithoutExtension (filename);
string path = NSBundle.MainBundle.PathForResource (baseFilename, extension);
NSData texData = NSData.FromFile (path);
UIImage image = UIImage.LoadFromData (texData);
if (image == null)
return;
int width = image.CGImage.Width;
int height = image.CGImage.Height;
CGColorSpace colorSpace = CGColorSpace.CreateDeviceRGB ();
byte [] imageData = new byte[height * width * 4];
CGContext context = new CGBitmapContext (imageData, width, height, 8, 4 * width, colorSpace,
CGBitmapFlags.PremultipliedLast | CGBitmapFlags.ByteOrder32Big);
context.TranslateCTM (0, height);
context.ScaleCTM (1, -1);
colorSpace.Dispose ();
context.ClearRect (new RectangleF (0, 0, width, height));
context.DrawImage (new RectangleF (0, 0, width, height), image.CGImage);
GL.TexImage2D (TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba, width, height, 0, PixelFormat.Rgba, PixelType.UnsignedByte, imageData);
context.Dispose ();
}
public static void UseDefaultTexture ()
{
GL.BindTexture (TextureTarget.Texture2D, 0);
}
public void Use ()
{
GL.BindTexture (TextureTarget.Texture2D, texture);
}
}
}
| mit | C# |
b59907b5cffc685eac713393e901846a69a802fa | Define and evaluate function, using defn defined in core.clj | ajlopez/ClojSharp | Src/ClojSharp.Core.Tests/CoreTests.cs | Src/ClojSharp.Core.Tests/CoreTests.cs | namespace ClojSharp.Core.Tests
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClojSharp.Core.Compiler;
using ClojSharp.Core.Forms;
using ClojSharp.Core.Language;
using ClojSharp.Core.SpecialForms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
[DeploymentItem("Src", "Src")]
public class CoreTests
{
private Machine machine;
[TestInitialize]
public void Setup()
{
this.machine = new Machine();
this.machine.EvaluateFile("Src\\core.clj");
}
[TestMethod]
public void MachineHasMacros()
{
this.IsMacro("defmacro");
this.IsMacro("defn");
}
[TestMethod]
public void DefineAndEvaluateFunction()
{
this.Evaluate("(defn incr [x] (+ x 1))");
Assert.AreEqual(2, this.Evaluate("(incr 1)"));
}
private void IsMacro(string name)
{
var result = this.machine.RootContext.GetValue(name);
Assert.IsNotNull(result, name);
Assert.IsInstanceOfType(result, typeof(IForm), name);
Assert.IsInstanceOfType(result, typeof(Macro), name);
}
private object Evaluate(string text)
{
return this.Evaluate(text, this.machine.RootContext);
}
private object Evaluate(string text, IContext context)
{
Parser parser = new Parser(text);
var expr = parser.ParseExpression();
Assert.IsNull(parser.ParseExpression());
return Machine.Evaluate(expr, context);
}
}
}
| namespace ClojSharp.Core.Tests
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClojSharp.Core.Forms;
using ClojSharp.Core.Language;
using ClojSharp.Core.SpecialForms;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
[DeploymentItem("Src", "Src")]
public class CoreTests
{
private Machine machine;
[TestInitialize]
public void Setup()
{
this.machine = new Machine();
this.machine.EvaluateFile("Src\\core.clj");
}
[TestMethod]
public void MachineHasMacros()
{
this.IsMacro("defmacro");
this.IsMacro("defn");
}
private void IsMacro(string name)
{
var result = this.machine.RootContext.GetValue(name);
Assert.IsNotNull(result, name);
Assert.IsInstanceOfType(result, typeof(IForm), name);
Assert.IsInstanceOfType(result, typeof(Macro), name);
}
}
}
| mit | C# |
bebc7a75967daecdb8c03951701abcbdf46de6bc | Fix issue where RegisterScript did not load file in a IIS Virtual App environment | janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent,janjonas/OpenContent | Components/OpenContentWebpage.cs | Components/OpenContentWebpage.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Web;
using System.Web.UI;
using System.Web.WebPages;
using DotNetNuke.Web.Client;
using DotNetNuke.Web.Client.ClientResourceManagement;
namespace Satrabel.OpenContent.Components
{
public abstract class OpenContentWebPage<TModel> : DotNetNuke.Web.Razor.DotNetNukeWebPage<TModel>
{
int JSOrder = (int)FileOrder.Js.DefaultPriority;
int CSSOrder = (int)FileOrder.Css.ModuleCss;
public void RegisterStyleSheet(string filePath)
{
if (!filePath.StartsWith("http") && !filePath.Contains("/"))
{
filePath = VirtualPath + filePath;
}
if (!filePath.StartsWith("http"))
{
var file = new FileUri(filePath);
filePath = file.UrlFilePath;
}
ClientResourceManager.RegisterStyleSheet((Page)HttpContext.Current.CurrentHandler, filePath, CSSOrder);
CSSOrder++;
}
public void RegisterScript(string filePath)
{
if (!filePath.StartsWith("http") && !filePath.Contains("/"))
{
filePath = VirtualPath + filePath;
}
if (!filePath.StartsWith("http"))
{
var file = new FileUri(filePath);
filePath = file.UrlFilePath;
}
ClientResourceManager.RegisterScript((Page)HttpContext.Current.CurrentHandler, filePath, JSOrder);
JSOrder++;
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Web;
using System.Web.UI;
using System.Web.WebPages;
using DotNetNuke.Web.Client;
using DotNetNuke.Web.Client.ClientResourceManagement;
namespace Satrabel.OpenContent.Components
{
public abstract class OpenContentWebPage<TModel> : DotNetNuke.Web.Razor.DotNetNukeWebPage<TModel>
{
int JSOrder = (int)FileOrder.Js.DefaultPriority;
int CSSOrder = (int)FileOrder.Css.ModuleCss;
public void RegisterStyleSheet(string filePath)
{
if (!filePath.StartsWith("http") && !filePath.StartsWith("/"))
filePath = this.VirtualPath + filePath;
ClientResourceManager.RegisterStyleSheet((Page)HttpContext.Current.CurrentHandler, filePath, CSSOrder);
CSSOrder++;
}
public void RegisterScript(string filePath)
{
if (!filePath.StartsWith("http") && !filePath.StartsWith("/"))
filePath = this.VirtualPath + filePath;
ClientResourceManager.RegisterScript((Page)HttpContext.Current.CurrentHandler, filePath, JSOrder);
JSOrder++;
}
}
} | mit | C# |
b65d1c4b793ef7e93b5c52234b7034e8b9be189c | Set TransitionTime with Scene | Q42/Q42.HueApi | src/Q42.HueApi/Models/Scene.cs | src/Q42.HueApi/Models/Scene.cs | using Newtonsoft.Json;
using Q42.HueApi.Converters;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Q42.HueApi.Models
{
[DataContract]
public class Scene
{
[DataMember]
public string Id { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "lights")]
public IEnumerable<string> Lights { get; set; }
/// <summary>
/// Whitelist user that created or modified the content of the scene. Note that changing name does not change the owner.
/// </summary>
[DataMember(Name = "owner")]
public string Owner { get; set; }
/// <summary>
/// App specific data linked to the scene. Each individual application should take responsibility for the data written in this field.
/// </summary>
[DataMember(Name = "appdata")]
public SceneAppData AppData { get; set; }
/// <summary>
/// Only available on a GET of an individual scene resource (/api/<username>/scenes/<id>). Not available for scenes created via a PUT in version 1. . Reserved for future use.
/// </summary>
[DataMember(Name = "picture")]
public string Picture { get; set; }
/// <summary>
/// Indicates whether the scene can be automatically deleted by the bridge. Only available by POSTSet to 'false' when omitted. Legacy scenes created by PUT are defaulted to true. When set to 'false' the bridge keeps the scene until deleted by an application.
/// </summary>
[DataMember(Name = "recycle")]
public bool? Recycle { get; set; }
/// <summary>
/// Indicates that the scene is locked by a rule or a schedule and cannot be deleted until all resources requiring or that reference the scene are deleted.
/// </summary>
[DataMember(Name = "locked")]
public bool? Locked { get; set; }
[DataMember(Name = "version")]
public int? Version { get; set; }
[DataMember(Name = "lastupdated")]
public DateTime? LastUpdated { get; set; }
[DataMember(Name = "storelightstate")]
public bool? StoreLightState { get; set; }
[DataMember(Name = "transitiontime")]
[JsonConverter(typeof(TransitionTimeConverter))]
public TimeSpan? TransitionTime { get; set; }
}
[DataContract]
public class SceneAppData
{
[DataMember(Name = "version")]
public int? Version { get; set; }
[DataMember(Name = "data")]
public string Data { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Q42.HueApi.Models
{
[DataContract]
public class Scene
{
[DataMember]
public string Id { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "lights")]
public IEnumerable<string> Lights { get; set; }
/// <summary>
/// Whitelist user that created or modified the content of the scene. Note that changing name does not change the owner.
/// </summary>
[DataMember(Name = "owner")]
public string Owner { get; set; }
/// <summary>
/// App specific data linked to the scene. Each individual application should take responsibility for the data written in this field.
/// </summary>
[DataMember(Name = "appdata")]
public SceneAppData AppData { get; set; }
/// <summary>
/// Only available on a GET of an individual scene resource (/api/<username>/scenes/<id>). Not available for scenes created via a PUT in version 1. . Reserved for future use.
/// </summary>
[DataMember(Name = "picture")]
public string Picture { get; set; }
/// <summary>
/// Indicates whether the scene can be automatically deleted by the bridge. Only available by POSTSet to 'false' when omitted. Legacy scenes created by PUT are defaulted to true. When set to 'false' the bridge keeps the scene until deleted by an application.
/// </summary>
[DataMember(Name = "recycle")]
public bool? Recycle { get; set; }
/// <summary>
/// Indicates that the scene is locked by a rule or a schedule and cannot be deleted until all resources requiring or that reference the scene are deleted.
/// </summary>
[DataMember(Name = "locked")]
public bool? Locked { get; set; }
[DataMember(Name = "version")]
public int? Version { get; set; }
[DataMember(Name = "lastupdated")]
public DateTime? LastUpdated { get; set; }
}
[DataContract]
public class SceneAppData
{
[DataMember(Name = "version")]
public int? Version { get; set; }
[DataMember(Name = "data")]
public string Data { get; set; }
}
}
| mit | C# |
41cd7bf45ecbe5c310b8f627d987c0bb913f692b | Remove display name for Negotiate and Ntlm | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNet.IISPlatformHandler/IISPlatformHandlerOptions.cs | src/Microsoft.AspNet.IISPlatformHandler/IISPlatformHandlerOptions.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.Collections.Generic;
using Microsoft.AspNet.Http.Authentication;
namespace Microsoft.AspNet.IISPlatformHandler
{
public class IISPlatformHandlerOptions
{
/// <summary>
/// If true the authentication middleware alter the request user coming in and respond to generic challenges.
/// If false the authentication middleware will only provide identity and respond to challenges when explicitly indicated
/// by the AuthenticationScheme.
/// </summary>
public bool AutomaticAuthentication { get; set; } = true;
/// <summary>
/// If true authentication middleware will try to authenticate using platform handler windows authentication
/// If false authentication middleware won't be added
/// </summary>
public bool FlowWindowsAuthentication { get; set; } = true;
/// <summary>
/// Additional information about the authentication type which is made available to the application.
/// </summary>
public IList<AuthenticationDescription> AuthenticationDescriptions { get; } = new List<AuthenticationDescription>()
{
new AuthenticationDescription()
{
AuthenticationScheme = IISPlatformHandlerDefaults.Negotiate
},
new AuthenticationDescription()
{
AuthenticationScheme = IISPlatformHandlerDefaults.Ntlm
}
};
}
} | // 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.Collections.Generic;
using Microsoft.AspNet.Http.Authentication;
namespace Microsoft.AspNet.IISPlatformHandler
{
public class IISPlatformHandlerOptions
{
/// <summary>
/// If true the authentication middleware alter the request user coming in and respond to generic challenges.
/// If false the authentication middleware will only provide identity and respond to challenges when explicitly indicated
/// by the AuthenticationScheme.
/// </summary>
public bool AutomaticAuthentication { get; set; } = true;
/// <summary>
/// If true authentication middleware will try to authenticate using platform handler windows authentication
/// If false authentication middleware won't be added
/// </summary>
public bool FlowWindowsAuthentication { get; set; } = true;
/// <summary>
/// Additional information about the authentication type which is made available to the application.
/// </summary>
public IList<AuthenticationDescription> AuthenticationDescriptions { get; } = new List<AuthenticationDescription>()
{
new AuthenticationDescription()
{
AuthenticationScheme = IISPlatformHandlerDefaults.Negotiate,
DisplayName = IISPlatformHandlerDefaults.Negotiate
},
new AuthenticationDescription()
{
AuthenticationScheme = IISPlatformHandlerDefaults.Ntlm,
DisplayName = IISPlatformHandlerDefaults.Ntlm
}
};
}
} | apache-2.0 | C# |
a23bcbcc56a6be2b6fa7bca3cedd4f25dc8e9ecd | Add JSON Converter to date fields | Baggykiin/Curse.NET | Curse.NET/Model/CreateInviteResponse.cs | Curse.NET/Model/CreateInviteResponse.cs | using System;
using Newtonsoft.Json;
namespace Curse.NET.Model
{
public class CreateInviteResponse
{
public string InviteCode { get; set; }
public int CreatorID { get; set; }
public string CreatorName { get; set; }
public string GroupID { get; set; }
public Group Group { get; set; }
public string ChannelID { get; set; }
public Channel Channel { get; set; }
[JsonConverter(typeof(MillisecondEpochConverter))]
public DateTime DateCreated { get; set; }
[JsonConverter(typeof(MillisecondEpochConverter))]
public DateTime DateExpires { get; set; }
public int MaxUses { get; set; }
public int TimesUsed { get; set; }
public bool IsRedeemable { get; set; }
public string InviteUrl { get; set; }
public string AdminDescription { get; set; }
}
} | namespace Curse.NET.Model
{
public class CreateInviteResponse
{
public string InviteCode { get; set; }
public int CreatorID { get; set; }
public string CreatorName { get; set; }
public string GroupID { get; set; }
public Group Group { get; set; }
public string ChannelID { get; set; }
public Channel Channel { get; set; }
public long DateCreated { get; set; }
public long DateExpires { get; set; }
public int MaxUses { get; set; }
public int TimesUsed { get; set; }
public bool IsRedeemable { get; set; }
public string InviteUrl { get; set; }
public string AdminDescription { get; set; }
}
} | mit | C# |
f9145ce5b47555072d215c712809be66695952b1 | Fix playlist items added with the wrong IDs | NeoAdonis/osu,peppy/osu-new,UselessToucan/osu,2yangk23/osu,smoogipoo/osu,peppy/osu,EVAST9919/osu,peppy/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,johnneijzen/osu,johnneijzen/osu,ppy/osu,2yangk23/osu,peppy/osu,ppy/osu,smoogipooo/osu,UselessToucan/osu,NeoAdonis/osu,EVAST9919/osu,UselessToucan/osu | osu.Game/Screens/Select/MatchSongSelect.cs | osu.Game/Screens/Select/MatchSongSelect.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.Components;
namespace osu.Game.Screens.Select
{
public class MatchSongSelect : SongSelect, IMultiplayerSubScreen
{
public Action<PlaylistItem> Selected;
public string ShortTitle => "song selection";
public override string Title => ShortTitle.Humanize();
public override bool AllowEditing => false;
[Resolved(typeof(Room), nameof(Room.Playlist))]
protected BindableList<PlaylistItem> Playlist { get; private set; }
[Resolved]
private BeatmapManager beatmaps { get; set; }
public MatchSongSelect()
{
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
}
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea
{
CreateNewItem = createNewItem
};
protected override bool OnStart()
{
switch (Playlist.Count)
{
case 0:
createNewItem();
break;
case 1:
populateItemFromCurrent(Playlist.Single());
break;
}
this.Exit();
return true;
}
private void createNewItem()
{
PlaylistItem item = new PlaylistItem
{
ID = Playlist.Count == 0 ? 0 : Playlist.Max(p => p.ID) + 1
};
populateItemFromCurrent(item);
Playlist.Add(item);
}
private void populateItemFromCurrent(PlaylistItem item)
{
item.Beatmap.Value = Beatmap.Value.BeatmapInfo;
item.Ruleset.Value = Ruleset.Value;
item.RequiredMods.Clear();
item.RequiredMods.AddRange(Mods.Value);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using Humanizer;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi;
using osu.Game.Screens.Multi.Components;
namespace osu.Game.Screens.Select
{
public class MatchSongSelect : SongSelect, IMultiplayerSubScreen
{
public Action<PlaylistItem> Selected;
public string ShortTitle => "song selection";
public override string Title => ShortTitle.Humanize();
public override bool AllowEditing => false;
[Resolved(typeof(Room), nameof(Room.Playlist))]
protected BindableList<PlaylistItem> Playlist { get; private set; }
[Resolved]
private BeatmapManager beatmaps { get; set; }
public MatchSongSelect()
{
Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING };
}
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new MatchBeatmapDetailArea
{
CreateNewItem = createNewItem
};
protected override bool OnStart()
{
switch (Playlist.Count)
{
case 0:
createNewItem();
break;
case 1:
populateItemFromCurrent(Playlist.Single());
break;
}
this.Exit();
return true;
}
private void createNewItem()
{
PlaylistItem item = new PlaylistItem
{
ID = (Playlist.LastOrDefault()?.ID + 1) ?? 0,
};
populateItemFromCurrent(item);
Playlist.Add(item);
}
private void populateItemFromCurrent(PlaylistItem item)
{
item.Beatmap.Value = Beatmap.Value.BeatmapInfo;
item.Ruleset.Value = Ruleset.Value;
item.RequiredMods.Clear();
item.RequiredMods.AddRange(Mods.Value);
}
}
}
| mit | C# |
1dcc4056122589079c1dd6258a408b37f3b545ad | Build and publish nuget package | RockFramework/Rock.Logging | Rock.Logging/Properties/AssemblyInfo.cs | Rock.Logging/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("Rock.Logging")]
[assembly: AssemblyDescription("Rock logger.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Logging")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014")]
[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("71736a4b-21bc-46f3-9bb7-f9c9a260f723")]
// 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("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.7")]
[assembly: AssemblyInformationalVersion("0.9.7")]
| 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("Rock.Logging")]
[assembly: AssemblyDescription("Rock logger.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quicken Loans")]
[assembly: AssemblyProduct("Rock.Logging")]
[assembly: AssemblyCopyright("Copyright © Quicken Loans 2014")]
[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("71736a4b-21bc-46f3-9bb7-f9c9a260f723")]
// 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("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.6")]
[assembly: AssemblyInformationalVersion("0.9.6")]
| mit | C# |
8bf2addc0ba135e6358e90d6c9d5fed8a4951885 | fix if condition in dashboard.cshtml | bradwestness/SecretSanta,bradwestness/SecretSanta | SecretSanta/Views/Home/Dashboard.cshtml | SecretSanta/Views/Home/Dashboard.cshtml | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<div class="row">
<div class="col-lg-6">
<h1>Welcome to Secret Santa, @ViewBag.CurrentUserAccount?.DisplayName!</h1>
@if (ViewBag.HasPicked != true)
{
<p>Looks like you haven't picked your recipient yet.</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Pick", "Home")">Pick Your Recipient »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
else
{
<p>You picked @ViewBag.PickedAccountDisplayName!</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Details", "Wishlist", new {id = ViewBag.PickedAccountId })">View @ViewBag.PickedAccountDisplayName's Wish List »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
</div>
<div class="col-lg-6">
<img class="img-responsive" src="@Url.Content("~/images/santa.png")" alt="Santa" />
</div>
</div>
</div> | @{
ViewBag.Title = "Home Page";
}
<div class="jumbotron">
<div class="row">
<div class="col-lg-6">
<h1>Welcome to Secret Santa, @ViewBag.CurrentUserAccount?.DisplayName!</h1>
@if (!ViewBag.HasPicked)
{
<p>Looks like you haven't picked your recipient yet.</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Pick", "Home")">Pick Your Recipient »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
else
{
<p>You picked @ViewBag.PickedAccountDisplayName!</p>
<p>
<a class="btn btn-primary btn-lg" href="@Url.Action("Details", "Wishlist", new {id = ViewBag.PickedAccountId })">View @ViewBag.PickedAccountDisplayName's Wish List »</a>
<a class="btn btn-default btn-lg" href="@Url.Action("Index", "Wishlist")">Manage Your Wish List »</a>
</p>
}
</div>
<div class="col-lg-6">
<img class="img-responsive" src="@Url.Content("~/images/santa.png")" alt="Santa" />
</div>
</div>
</div> | apache-2.0 | C# |
be20452511ff96dcf87d4cf19f058bb300fd8215 | Allow #, take of string length from group | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Core/Domain/TestItem.cs | Anlab.Core/Domain/TestItem.cs | using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using System.Text.Encodings.Web;
namespace Anlab.Core.Domain
{
public class TestItem
{
[Key]
[StringLength(128)]
[Display(Name = "Code")]
[RegularExpression(@"([A-Z0-9a-z\-#])+", ErrorMessage = "Codes can only contain alphanumerics, #, and dashes.")]
public string Id { get; set; }
[Required]
[StringLength(512)]
public string Analysis { get; set; }
[Required]
[StringLength(64)]
public string Category { get; set; }
[NotMapped]
public string[] Categories {
get => Category != null ? Category.Split('|') : new string[0];
set => Category = string.Join("|", value);
}
[Required]
public string Group { get; set; }
public bool Public { get; set; }
public string Notes { get; set; }
public string NotesEncoded
{
get
{
if (Notes == null)
{
return null;
}
var encoder = HtmlEncoder.Default;
return encoder.Encode(Notes);
}
}
}
public static class TestCategories
{
public static string Soil = "Soil";
public static string Plant = "Plant";
public static string Water = "Water";
public static string Other = "Other";
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;
using System.Text.Encodings.Web;
namespace Anlab.Core.Domain
{
public class TestItem
{
[Key]
[StringLength(128)]
[Display(Name = "Code")]
[RegularExpression(@"([A-Z0-9a-z\-])+", ErrorMessage = "Codes can only contain alphanumerics and dashes.")]
public string Id { get; set; }
[Required]
[StringLength(512)]
public string Analysis { get; set; }
[Required]
[StringLength(64)]
public string Category { get; set; }
[NotMapped]
public string[] Categories {
get => Category != null ? Category.Split('|') : new string[0];
set => Category = string.Join("|", value);
}
[Required]
[StringLength(8)]
public string Group { get; set; }
public bool Public { get; set; }
public string Notes { get; set; }
public string NotesEncoded
{
get
{
if (Notes == null)
{
return null;
}
var encoder = HtmlEncoder.Default;
return encoder.Encode(Notes);
}
}
}
public static class TestCategories
{
public static string Soil = "Soil";
public static string Plant = "Plant";
public static string Water = "Water";
public static string Other = "Other";
}
}
| mit | C# |
5f6685ab8990850ca29f52c931ff82a023964423 | Remove some unneeded usings | dstockhammer/Brighter,BrighterCommand/Brighter,BrighterCommand/Brighter,BrighterCommand/Brighter,BrighterCommand/Paramore.Brighter,BrighterCommand/Paramore.Brighter,dstockhammer/Brighter | Examples/TasksCoreApi/Program.cs | Examples/TasksCoreApi/Program.cs | using System.IO;
using Microsoft.AspNetCore.Hosting;
namespace TasksApi
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
namespace TasksApi
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}
| mit | C# |
32d10dd7f9c2ba181acad49397bf57a50f9635be | Fix 0x60 0x46 attackhitresult command size | HelloKitty/Booma.Proxy | src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60PlayerFinishedAttackStepEvent.cs | src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60PlayerFinishedAttackStepEvent.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
//https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x46
/// <summary>
/// Packet sent when an attack step is completed by a client.
/// </summary>
[WireDataContract]
[SubCommand60(SubCommand60OperationCode.AttackStepFinished)]
public sealed class Sub60PlayerFinishedAttackStepEvent : BaseSubCommand60, IMessageContextIdentifiable, ISerializationEventListener
{
//TODO: I haven't verified that this is the identifier for the client BUT it probably has to be.
/// <inheritdoc />
[WireMember(1)]
public byte Identifier { get; }
[WireMember(2)]
private byte unk1 { get; }
[SendSize(SendSizeAttribute.SizeType.UShort)]
[WireMember(3)]
private AttackHitResult[] _HitResults { get; }
/// <summary>
/// The results of an attack hit.
/// </summary>
public IEnumerable<AttackHitResult> HitResults => _HitResults;
/// <summary>
/// Indicates if the attack missed.
/// </summary>
public bool isAttackMissed => _HitResults == null || _HitResults.Length == 0;
//TODO: What is the last two bytes of this packet? Seems always 0, not from crypto padding.
[WireMember(4)]
private short unk2 { get; } = 0;
/// <inheritdoc />
public Sub60PlayerFinishedAttackStepEvent(byte identifier, params AttackHitResult[] hitResults)
{
Identifier = identifier;
_HitResults = hitResults;
//We only set the command header before serialization because
//it's dynamic and can't be statically set and is only needed when we're about to serialize
}
/// <summary>
/// Serializer ctor.
/// </summary>
private Sub60PlayerFinishedAttackStepEvent()
{
//We only set the command header before serialization because
//it's dynamic and can't be statically set and is only needed when we're about to serialize
}
/// <inheritdoc />
public void OnBeforeSerialization()
{
//Command size is header size + payload size /4
//header + lengthprefix size + hits size + final 2 bytes + 2 to avoid truncation
CommandSize = (byte)((2 + 2 + (_HitResults?.Length * 4 ?? 0) + 2 + 2) / 4);
}
/// <inheritdoc />
public void OnAfterDeserialization()
{
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FreecraftCore.Serializer;
namespace Booma.Proxy
{
//https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x46
/// <summary>
/// Packet sent when an attack step is completed by a client.
/// </summary>
[WireDataContract]
[SubCommand60(SubCommand60OperationCode.AttackStepFinished)]
public sealed class Sub60PlayerFinishedAttackStepEvent : BaseSubCommand60, IMessageContextIdentifiable
{
//TODO: I haven't verified that this is the identifier for the client BUT it probably has to be.
/// <inheritdoc />
[WireMember(1)]
public byte Identifier { get; }
[WireMember(2)]
private byte unk1 { get; }
[SendSize(SendSizeAttribute.SizeType.UShort)]
[WireMember(3)]
private AttackHitResult[] _HitResults { get; }
/// <summary>
/// The results of an attack hit.
/// </summary>
public IEnumerable<AttackHitResult> HitResults => _HitResults;
/// <summary>
/// Indicates if the attack missed.
/// </summary>
public bool isAttackMissed => _HitResults == null || _HitResults.Length == 0;
//TODO: What is the last two bytes of this packet? Seems always 0, not from crypto padding.
[WireMember(4)]
private short unk2 { get; }
/// <summary>
/// Serializer ctor.
/// </summary>
private Sub60PlayerFinishedAttackStepEvent()
{
}
}
}
| agpl-3.0 | C# |
0638ef3668665e327c17b9218e73b9cada799a6d | return error codes | jefking/King.Mapper.Generator | King.Mapper.Generator/Program.cs | King.Mapper.Generator/Program.cs | namespace King.Mapper.Generator
{
using King.Mapper.Generator.Sql;
using System;
using System.Diagnostics;
using System.Linq;
/// <summary>
/// King.Mapper.Generator Program
/// </summary>
public class Program
{
#region Methods
public static int Main(string[] args)
{
Trace.TraceInformation("King.Mapper.Generator Starting.");
Trace.TraceInformation("Source Code @: https://github.com/jefking/King.Mapper.Generator");
if (args == null)
{
Trace.TraceError("No parameters specified, usage: \"Connection String\" Directory.");
return -1;
}
if (2 > args.Length || args.Any(a => string.IsNullOrWhiteSpace(a)))
{
Trace.TraceError("Invalid parameters specified: '{0}'", args.Select(a => string.Format("'{0}'", a)));
return -1;
}
var connectionString = args[0];
var folder = args[1].Replace(@"\\", @"\").Replace("\"", string.Empty);
try
{
var loader = new DataLoader(connectionString);
var task = loader.Load();
task.Wait();
var schemas = task.Result;
var code = new Code(schemas);
}
catch (Exception ex)
{
Trace.TraceError("Failure: '{0}'", ex.Message);
return -1;
}
Trace.TraceInformation("King.Mapper.Generator Completed.");
return 0;
}
#endregion
}
} | namespace King.Mapper.Generator
{
using King.Mapper.Generator.Sql;
using System;
using System.Diagnostics;
using System.Linq;
/// <summary>
/// King.Mapper.Generator Program
/// </summary>
public class Program
{
#region Methods
public static void Main(string[] args)
{
Trace.TraceInformation("King.Mapper.Generator Starting.");
Trace.TraceInformation("Source Code @: https://github.com/jefking/King.Mapper.Generator");
if (args == null)
{
Trace.TraceError("No parameters specified, usage: \"Connection String\" Directory.");
return;
}
if (2 > args.Length || args.Any(a => string.IsNullOrWhiteSpace(a)))
{
Trace.TraceError("Invalid parameters specified: '{0}'", args.Select(a => string.Format("'{0}'", a)));
return;
}
var connectionString = args[0];
var folder = args[1].Replace(@"\\", @"\").Replace("\"", string.Empty);
try
{
var loader = new DataLoader(connectionString);
var task = loader.Load();
task.Wait();
var schemas = task.Result;
var code = new Code(schemas);
}
catch (Exception ex)
{
Trace.TraceError("Failure: '{0}'", ex.Message);
}
Trace.TraceInformation("King.Mapper.Generator Completed.");
}
#endregion
}
} | mit | C# |
4ccdcfd059b279585ba550bcaa83c7fa574e2702 | Add json properties | robsiera/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,bdukes/Dnn.Platform,EPTamminga/Dnn.Platform,bdukes/Dnn.Platform,nvisionative/Dnn.Platform,valadas/Dnn.Platform,robsiera/Dnn.Platform,RichardHowells/Dnn.Platform,valadas/Dnn.Platform,EPTamminga/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,EPTamminga/Dnn.Platform,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,RichardHowells/Dnn.Platform,nvisionative/Dnn.Platform,bdukes/Dnn.Platform,RichardHowells/Dnn.Platform,mitchelsellers/Dnn.Platform,mitchelsellers/Dnn.Platform,bdukes/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.AdminExperience.Library,valadas/Dnn.Platform,dnnsoftware/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,nvisionative/Dnn.Platform,RichardHowells/Dnn.Platform | src/Dnn.PersonaBar.Library/Prompt/Models/PagingInfo.cs | src/Dnn.PersonaBar.Library/Prompt/Models/PagingInfo.cs | using Newtonsoft.Json;
namespace Dnn.PersonaBar.Library.Prompt.Models
{
public class PagingInfo
{
[JsonProperty(PropertyName = "pageNo")]
public int PageNo { get; set; }
[JsonProperty(PropertyName = "pageSize")]
public int PageSize { get; set; }
[JsonProperty(PropertyName = "totalPages")]
public int TotalPages { get; set; }
}
}
| namespace Dnn.PersonaBar.Library.Prompt.Models
{
public class PagingInfo
{
public int PageNo { get; set; }
public int PageSize { get; set; }
public int TotalPages { get; set; }
}
}
| mit | C# |
959049bc5a2cbd69b3227f0ad58ce10bf1fc4987 | Implement MessagePackServiceSerializer.Clone(). | FacilityApi/FacilityCSharp | src/Facility.Core/MessagePackServiceSerializer.cs | src/Facility.Core/MessagePackServiceSerializer.cs | using MessagePack;
namespace Facility.Core;
/// <summary>
/// Serializes and deserializes values using MessagePack.
/// </summary>
public sealed class MessagePackServiceSerializer : ServiceSerializer
{
/// <summary>
/// The serializer instance.
/// </summary>
public static readonly MessagePackServiceSerializer Instance = new();
/// <summary>
/// The default media type.
/// </summary>
public override string DefaultMediaType => "application/x-msgpack";
/// <summary>
/// Serializes a value to the serialization format.
/// </summary>
public override void ToStream(object? value, Stream stream)
{
try
{
MessagePackSerializer.Serialize(stream, value, s_serializerOptions);
}
catch (MessagePackSerializationException exception)
{
throw new ServiceSerializationException(exception);
}
}
/// <summary>
/// Deserializes a value from the serialization format.
/// </summary>
public override object? FromStream(Stream stream, Type type)
{
try
{
return MessagePackSerializer.Deserialize(type, stream, s_serializerOptions);
}
catch (MessagePackSerializationException exception)
{
throw new ServiceSerializationException(exception);
}
}
public override T Clone<T>(T value)
{
if (value is null)
return default!;
try
{
return MessagePackSerializer.Deserialize<T>(MessagePackSerializer.Serialize(value, s_serializerOptions));
}
catch (MessagePackSerializationException exception)
{
throw new ServiceSerializationException(exception);
}
}
private MessagePackServiceSerializer()
{
}
private static readonly MessagePackSerializerOptions s_serializerOptions = MessagePackSerializerOptions.Standard;
}
| using MessagePack;
namespace Facility.Core;
/// <summary>
/// Serializes and deserializes values using MessagePack.
/// </summary>
public sealed class MessagePackServiceSerializer : ServiceSerializer
{
/// <summary>
/// The serializer instance.
/// </summary>
public static readonly MessagePackServiceSerializer Instance = new();
/// <summary>
/// The default media type.
/// </summary>
public override string DefaultMediaType => "application/x-msgpack";
/// <summary>
/// Serializes a value to the serialization format.
/// </summary>
public override void ToStream(object? value, Stream stream)
{
try
{
MessagePackSerializer.Serialize(stream, value, s_serializerOptions);
}
catch (MessagePackSerializationException exception)
{
throw new ServiceSerializationException(exception);
}
}
/// <summary>
/// Deserializes a value from the serialization format.
/// </summary>
public override object? FromStream(Stream stream, Type type)
{
try
{
return MessagePackSerializer.Deserialize(type, stream, s_serializerOptions);
}
catch (MessagePackSerializationException exception)
{
throw new ServiceSerializationException(exception);
}
}
private MessagePackServiceSerializer()
{
}
private static readonly MessagePackSerializerOptions s_serializerOptions = MessagePackSerializerOptions.Standard;
}
| mit | C# |
34dcfac0efe190bb65e32118fcb452ffb15b7c61 | Allow easy OrderBy custom Property | DejanMilicic/n2cms,SntsDev/n2cms,nimore/n2cms,nicklv/n2cms,nimore/n2cms,EzyWebwerkstaden/n2cms,SntsDev/n2cms,VoidPointerAB/n2cms,bussemac/n2cms,nicklv/n2cms,DejanMilicic/n2cms,nicklv/n2cms,bussemac/n2cms,SntsDev/n2cms,EzyWebwerkstaden/n2cms,VoidPointerAB/n2cms,n2cms/n2cms,nimore/n2cms,n2cms/n2cms,bussemac/n2cms,nicklv/n2cms,EzyWebwerkstaden/n2cms,bussemac/n2cms,bussemac/n2cms,EzyWebwerkstaden/n2cms,n2cms/n2cms,EzyWebwerkstaden/n2cms,nimore/n2cms,n2cms/n2cms,DejanMilicic/n2cms,SntsDev/n2cms,VoidPointerAB/n2cms,nicklv/n2cms,DejanMilicic/n2cms,VoidPointerAB/n2cms | src/Framework/N2/Persistence/NH/Finder/OrderBy.cs | src/Framework/N2/Persistence/NH/Finder/OrderBy.cs | namespace N2.Persistence.NH.Finder
{
/// <summary>
/// Transition to the property to order by.
/// </summary>
public class OrderBy : N2.Persistence.Finder.IOrderBy
{
private QueryBuilder query;
public OrderBy(QueryBuilder query)
{
this.query = query;
}
#region IOrderBy Members
public N2.Persistence.Finder.ISortDirection ID
{
get { return new PropertySortDirection("ID", query); }
}
public N2.Persistence.Finder.ISortDirection Parent
{
get { return new PropertySortDirection("Parent", query); }
}
public N2.Persistence.Finder.ISortDirection Title
{
get { return new PropertySortDirection("Title", query); }
}
public N2.Persistence.Finder.ISortDirection Name
{
get { return new PropertySortDirection("Name", query); }
}
public N2.Persistence.Finder.ISortDirection ZoneName
{
get { return new PropertySortDirection("ZoneName", query); }
}
public N2.Persistence.Finder.ISortDirection Created
{
get { return new PropertySortDirection("Created", query); }
}
public N2.Persistence.Finder.ISortDirection Updated
{
get { return new PropertySortDirection("Updated", query); }
}
public N2.Persistence.Finder.ISortDirection Published
{
get { return new PropertySortDirection("Published", query); }
}
public N2.Persistence.Finder.ISortDirection Expires
{
get { return new PropertySortDirection("Expires", query); }
}
public N2.Persistence.Finder.ISortDirection SortOrder
{
get { return new PropertySortDirection("SortOrder", query); }
}
public N2.Persistence.Finder.ISortDirection VersionIndex
{
get { return new PropertySortDirection("VersionIndex", query); }
}
public N2.Persistence.Finder.ISortDirection State
{
get { return new PropertySortDirection("State", query); }
}
public N2.Persistence.Finder.ISortDirection Visible
{
get { return new PropertySortDirection("Visible", query); }
}
public N2.Persistence.Finder.ISortDirection SavedBy
{
get { return new PropertySortDirection("SavedBy", query); }
}
public N2.Persistence.Finder.ISortDirection Property(string name)
{
return new PropertySortDirection(name, query);
}
public N2.Persistence.Finder.ISortDirection Detail(string name)
{
return new DetailSortDirection(name, query);
}
#endregion
}
}
| namespace N2.Persistence.NH.Finder
{
/// <summary>
/// Transition to the property to order by.
/// </summary>
public class OrderBy : N2.Persistence.Finder.IOrderBy
{
private QueryBuilder query;
public OrderBy(QueryBuilder query)
{
this.query = query;
}
#region IOrderBy Members
public N2.Persistence.Finder.ISortDirection ID
{
get { return new PropertySortDirection("ID", query); }
}
public N2.Persistence.Finder.ISortDirection Parent
{
get { return new PropertySortDirection("Parent", query); }
}
public N2.Persistence.Finder.ISortDirection Title
{
get { return new PropertySortDirection("Title", query); }
}
public N2.Persistence.Finder.ISortDirection Name
{
get { return new PropertySortDirection("Name", query); }
}
public N2.Persistence.Finder.ISortDirection ZoneName
{
get { return new PropertySortDirection("ZoneName", query); }
}
public N2.Persistence.Finder.ISortDirection Created
{
get { return new PropertySortDirection("Created", query); }
}
public N2.Persistence.Finder.ISortDirection Updated
{
get { return new PropertySortDirection("Updated", query); }
}
public N2.Persistence.Finder.ISortDirection Published
{
get { return new PropertySortDirection("Published", query); }
}
public N2.Persistence.Finder.ISortDirection Expires
{
get { return new PropertySortDirection("Expires", query); }
}
public N2.Persistence.Finder.ISortDirection SortOrder
{
get { return new PropertySortDirection("SortOrder", query); }
}
public N2.Persistence.Finder.ISortDirection VersionIndex
{
get { return new PropertySortDirection("VersionIndex", query); }
}
public N2.Persistence.Finder.ISortDirection State
{
get { return new PropertySortDirection("State", query); }
}
public N2.Persistence.Finder.ISortDirection Visible
{
get { return new PropertySortDirection("Visible", query); }
}
public N2.Persistence.Finder.ISortDirection SavedBy
{
get { return new PropertySortDirection("SavedBy", query); }
}
public N2.Persistence.Finder.ISortDirection Detail(string name)
{
return new DetailSortDirection(name, query);
}
#endregion
}
}
| lgpl-2.1 | C# |
9058bec0ac0046c56d2ae01d03894efe58b6236f | Make commit id short | SaladbowlCreative/Snake | src/GameClient/Assets/Scripts/Utility/AppPanel.cs | src/GameClient/Assets/Scripts/Utility/AppPanel.cs | using UnityEngine;
using UnityEngine.UI;
public class AppPanel : MonoBehaviour
{
public Text VersionText;
private void Start()
{
var commitId = string.IsNullOrEmpty(Version.CommitId)
? ""
: "(" + Version.CommitId.Substring(0, 6) + ")";
VersionText.text = "Ver: " + Version.VersionString + " " + commitId;
}
}
| using UnityEngine;
using UnityEngine.UI;
public class AppPanel : MonoBehaviour
{
public Text VersionText;
private void Start()
{
var commitId = string.IsNullOrEmpty(Version.CommitId)
? ""
: "(" + Version.CommitId + ")";
VersionText.text = "Ver: " + Version.VersionString + " " + commitId;
}
}
| mit | C# |
11d9d5c66bed98abe18236c9b47ab759a4061e67 | Add server|client mode to server demo | Tragetaschen/dbus-sharp,arfbtwn/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp,openmedicus/dbus-sharp,Tragetaschen/dbus-sharp,arfbtwn/dbus-sharp,mono/dbus-sharp | src/TestServer.cs | src/TestServer.cs | // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
using org.freedesktop.DBus;
using System.IO;
using System.Net;
using System.Net.Sockets;
using Mono.Unix;
public class TestServer
{
//TODO: complete this test daemon/server example, and a client
//TODO: maybe generalise it and integrate it into the core
public static void Main (string[] args)
{
bool isServer;
if (args.Length == 1 && args[0] == "server")
isServer = true;
else if (args.Length == 1 && args[0] == "client")
isServer = false;
else {
Console.Error.WriteLine ("Usage: test-server [server|client]");
return;
}
string addr = "unix:abstract=/tmp/dbus-ABCDEFGHIJ";
Connection conn;
DemoObject demo;
ObjectPath myOpath = new ObjectPath ("/test");
string myNameReq = "org.ndesk.test";
if (!isServer) {
conn = new Connection (false);
conn.Open (addr);
demo = conn.GetObject<DemoObject> (myNameReq, myOpath);
demo.Hello ("hi from test client", 21);
} else {
string path;
bool abstr;
Address.Parse (addr, out path, out abstr);
AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path);
Socket server = new Socket (AddressFamily.Unix, SocketType.Stream, 0);
server.Bind (ep);
server.Listen (1);
Console.WriteLine ("Waiting for client on " + addr);
Socket client = server.Accept ();
Console.WriteLine ("Client accepted");
//this might well be wrong, untested and doesn't yet work here onwards
conn = new Connection (false);
//conn.Open (path, @abstract);
conn.sock = client;
conn.sock.Blocking = true;
conn.ns = new NetworkStream (conn.sock);
Connection.tmpConn = conn;
demo = new DemoObject ();
conn.Marshal (demo, "org.ndesk.test");
//TODO: handle lost connections etc.
while (true)
conn.Iterate ();
}
}
}
[Interface ("org.ndesk.test")]
public class DemoObject : MarshalByRefObject
{
public void Hello (string arg0, int arg1)
{
Console.WriteLine ("Got a Hello(" + arg0 + ", " + arg1 +")");
}
}
| // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
using org.freedesktop.DBus;
using System.IO;
using System.Net;
using System.Net.Sockets;
using Mono.Unix;
public class TestServer
{
//TODO: complete this test daemon/server example, and a client
//TODO: maybe generalise it and integrate it into the core
public static void Main (string[] args)
{
string addr = "unix:abstract=/tmp/dbus-ABCDEFGHIJ";
string path = "/tmp/dbus-ABCDEFGHIJ";
bool @abstract = true;
AbstractUnixEndPoint ep = new AbstractUnixEndPoint (path);
Socket server = new Socket (AddressFamily.Unix, SocketType.Stream, 0);
server.Bind (ep);
server.Listen (1);
Console.WriteLine ("Waiting for client on " + addr);
Socket client = server.Accept ();
Console.WriteLine ("Client accepted");
//this might well be wrong, untested and doesn't yet work here onwards
Connection conn = new Connection (false);
//conn.Open (path, @abstract);
conn.sock = client;
conn.sock.Blocking = true;
conn.ns = new NetworkStream (conn.sock);
while (true)
conn.Iterate ();
}
}
| mit | C# |
86153b26347e053984ed6e52a01ffda9a5b184d9 | change isStarted method to property | app-enhance/ae-core,app-enhance/ae-core | src/AE.Transactions.Abstractions/ITransaction.cs | src/AE.Transactions.Abstractions/ITransaction.cs | namespace AE.Transactions.Abstractions
{
using Core.DI;
public interface ITransaction : IDependency
{
bool IsStarted { get; set; }
void Configure(ITransactionOptions options);
void Begin();
void End();
void Cancel();
}
} | namespace AE.Transactions.Abstractions
{
using Core.DI;
public interface ITransaction : IDependency
{
void Configure(ITransactionOptions options);
void Begin();
void End();
void Cancel();
bool IsStarted();
}
} | mit | C# |
6f78ea32b717e4b4ed272058a41cb1beccd8246f | Remove unnecessary RegexOptions.IgnoreCase option | AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp,AngleSharp/AngleSharp | src/AngleSharp/Html/InputTypes/ColorInputType.cs | src/AngleSharp/Html/InputTypes/ColorInputType.cs | namespace AngleSharp.Html.InputTypes
{
using AngleSharp.Html.Dom;
using System;
using System.Text.RegularExpressions;
class ColorInputType : BaseInputType
{
#region Fields
static readonly Regex hexColorPattern = new Regex("^\\#[0-9A-Fa-f]{6}$", RegexOptions.Compiled);
#endregion
#region ctor
public ColorInputType(IHtmlInputElement input, String name)
: base(input, name, validate: true)
{
}
#endregion
#region Methods
public override ValidationErrors Check(IValidityState current)
{
var result = GetErrorsFrom(current);
if (!hexColorPattern.IsMatch(Input.Value ?? String.Empty))
{
result ^= ValidationErrors.BadInput;
if (Input.IsRequired)
{
result ^= ValidationErrors.ValueMissing;
}
return result;
}
return ValidationErrors.None;
}
#endregion
}
}
| namespace AngleSharp.Html.InputTypes
{
using AngleSharp.Html.Dom;
using System;
using System.Text.RegularExpressions;
class ColorInputType : BaseInputType
{
#region Fields
static readonly Regex hexColorPattern = new Regex("^\\#[0-9A-Fa-f]{6}$", RegexOptions.IgnoreCase | RegexOptions.Compiled);
#endregion
#region ctor
public ColorInputType(IHtmlInputElement input, String name)
: base(input, name, validate: true)
{
}
#endregion
#region Methods
public override ValidationErrors Check(IValidityState current)
{
var result = GetErrorsFrom(current);
if (!hexColorPattern.IsMatch(Input.Value ?? String.Empty))
{
result ^= ValidationErrors.BadInput;
if (Input.IsRequired)
{
result ^= ValidationErrors.ValueMissing;
}
return result;
}
return ValidationErrors.None;
}
#endregion
}
}
| mit | C# |
aad118839867c46af4e421223fda3af05070bfff | Remove IRemotePlayerLobbyJoinEventSubscribable from BlockOtherPlayerLobbyJoinEventPayloadHandler | HelloKitty/Booma.Proxy | src/Booma.Proxy.Client.Unity.Ship/Handlers/Payload/BlockOtherPlayerLobbyJoinEventPayloadHandler.cs | src/Booma.Proxy.Client.Unity.Ship/Handlers/Payload/BlockOtherPlayerLobbyJoinEventPayloadHandler.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
using Guardians;
using SceneJect.Common;
using UnityEngine;
namespace Booma.Proxy
{
//TODO: Rewrite
[SceneTypeCreate(GameSceneType.RagolDefault)]
[SceneTypeCreate(GameSceneType.Pioneer2)]
[SceneTypeCreate(GameSceneType.LobbyDefault)]
public sealed class BlockOtherPlayerLobbyJoinEventPayloadHandler : GameMessageHandler<BlockOtherPlayerJoinedLobbyEventPayload>
{
/// <inheritdoc />
public BlockOtherPlayerLobbyJoinEventPayloadHandler(ILog logger)
: base(logger)
{
}
/// <inheritdoc />
public override Task HandleMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, BlockOtherPlayerJoinedLobbyEventPayload payload)
{
if(Logger.IsInfoEnabled)
Logger.Info($"Player Lobby Join: {payload.ClientId} LeaderId: {payload.LeaderId} EventId: {payload.EventId} Lobby: {payload.LobbyNumber}");
//We actually DON'T need to do anything here.
//Reason being this packet contains pretty much no relevant data.
//It just says "A player with this id is going to join the lobby"
//Future packet 15EA will contain character data (I think)
//Then next comes a teleport position command to set the position of the
//player.
//Then it actually warps to the area with Sub60WarpToNewAreaCommand
//Then it alerts everyone to its existence now in the zone with EnterFreshlyWrappedZoneCommand
return Task.CompletedTask;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.Logging;
using GladNet;
using Guardians;
using SceneJect.Common;
using UnityEngine;
namespace Booma.Proxy
{
//TODO: Rewrite
[AdditionalRegisterationAs(typeof(IRemotePlayerLobbyJoinEventSubscribable))]
[SceneTypeCreate(GameSceneType.RagolDefault)]
[SceneTypeCreate(GameSceneType.Pioneer2)]
[SceneTypeCreate(GameSceneType.LobbyDefault)]
public sealed class BlockOtherPlayerLobbyJoinEventPayloadHandler : GameMessageHandler<BlockOtherPlayerJoinedLobbyEventPayload>, IRemotePlayerLobbyJoinEventSubscribable
{
/// <inheritdoc />
public event EventHandler<LobbyJoinedEventArgs> OnRemotePlayerLobbyJoined;
/// <inheritdoc />
public BlockOtherPlayerLobbyJoinEventPayloadHandler(ILog logger)
: base(logger)
{
}
/// <inheritdoc />
public override Task HandleMessage(IPeerMessageContext<PSOBBGamePacketPayloadClient> context, BlockOtherPlayerJoinedLobbyEventPayload payload)
{
if(Logger.IsInfoEnabled)
Logger.Info($"Player Lobby Join: {payload.ClientId} LeaderId: {payload.LeaderId} EventId: {payload.EventId} Lobby: {payload.LobbyNumber}");
//Create the joined player
//We don't really have a position for them though, it didn't come in this packet
OnRemotePlayerLobbyJoined?.Invoke(this, new LobbyJoinedEventArgs(payload.LobbyNumber, EntityGuid.ComputeEntityGuid(EntityType.Player, payload.ClientId)));
return Task.CompletedTask;
}
}
}
| agpl-3.0 | C# |
52ed7710472a8182479a4731f1a8b9c1813c9f91 | Add region preprocessors on class Token | lury-lang/lury-lexer | lury-lexer/Token.cs | lury-lexer/Token.cs | //
// Token.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tomona Nanase
//
// 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 Lury.Compiling.Utils;
namespace Lury.Compiling.Lexer
{
public class Token
{
#region -- Public Properties --
public TokenEntry Entry { get; private set; }
public string Text { get; private set; }
public CharPosition Position { get; private set; }
public int Index { get; private set; }
#endregion
#region -- Constructors --
public Token(TokenEntry entry, string text, int index, CharPosition position)
{
this.Entry = entry;
this.Text = text;
this.Index = index;
this.Position = position;
}
#endregion
#region -- Public Methods --
public override string ToString()
{
return string.Format("{0} {1}{2}", this.Position, this.Entry.Name, this.Entry.Name.Length > 1 ? " - " + this.Text : "");
}
#endregion
}
}
| //
// Token.cs
//
// Author:
// Tomona Nanase <nanase@users.noreply.github.com>
//
// The MIT License (MIT)
//
// Copyright (c) 2015 Tomona Nanase
//
// 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 Lury.Compiling.Utils;
namespace Lury.Compiling.Lexer
{
public class Token
{
public TokenEntry Entry { get; private set; }
public string Text { get; private set; }
public CharPosition Position { get; private set; }
public int Index { get; private set; }
public Token(TokenEntry entry, string text, int index, CharPosition position)
{
this.Entry = entry;
this.Text = text;
this.Index = index;
this.Position = position;
}
public override string ToString()
{
return string.Format("{0} {1}{2}", this.Position, this.Entry.Name, this.Entry.Name.Length > 1 ? " - " + this.Text : "");
}
}
}
| mit | C# |
b22edbd7fae63183333a18e25e2906c691dda585 | Fix System.Console.Tests to not leave cursor hidden | mokchhya/corefx,tijoytom/corefx,richlander/corefx,pallavit/corefx,mafiya69/corefx,mafiya69/corefx,MaggieTsang/corefx,n1ghtmare/corefx,shmao/corefx,nchikanov/corefx,jcme/corefx,krytarowski/corefx,MaggieTsang/corefx,twsouthwick/corefx,Priya91/corefx-1,rjxby/corefx,mafiya69/corefx,mazong1123/corefx,ptoonen/corefx,ptoonen/corefx,janhenke/corefx,Jiayili1/corefx,dotnet-bot/corefx,wtgodbe/corefx,PatrickMcDonald/corefx,twsouthwick/corefx,ViktorHofer/corefx,iamjasonp/corefx,Jiayili1/corefx,kkurni/corefx,Petermarcu/corefx,alexandrnikitin/corefx,parjong/corefx,tstringer/corefx,Chrisboh/corefx,stone-li/corefx,richlander/corefx,n1ghtmare/corefx,pallavit/corefx,ericstj/corefx,shmao/corefx,MaggieTsang/corefx,690486439/corefx,krytarowski/corefx,rjxby/corefx,khdang/corefx,jeremymeng/corefx,dotnet-bot/corefx,ravimeda/corefx,stone-li/corefx,fgreinacher/corefx,Ermiar/corefx,weltkante/corefx,Ermiar/corefx,rahku/corefx,richlander/corefx,billwert/corefx,Ermiar/corefx,mellinoe/corefx,shahid-pk/corefx,PatrickMcDonald/corefx,alexandrnikitin/corefx,janhenke/corefx,pallavit/corefx,mokchhya/corefx,jcme/corefx,jeremymeng/corefx,SGuyGe/corefx,janhenke/corefx,Jiayili1/corefx,krk/corefx,nchikanov/corefx,jlin177/corefx,shmao/corefx,marksmeltzer/corefx,Ermiar/corefx,Priya91/corefx-1,rahku/corefx,fgreinacher/corefx,dhoehna/corefx,benpye/corefx,krk/corefx,Jiayili1/corefx,stone-li/corefx,ptoonen/corefx,billwert/corefx,PatrickMcDonald/corefx,bitcrazed/corefx,stephenmichaelf/corefx,Ermiar/corefx,ericstj/corefx,DnlHarvey/corefx,josguil/corefx,alexandrnikitin/corefx,cartermp/corefx,khdang/corefx,JosephTremoulet/corefx,rubo/corefx,jeremymeng/corefx,nchikanov/corefx,nbarbettini/corefx,tijoytom/corefx,jhendrixMSFT/corefx,ptoonen/corefx,elijah6/corefx,stephenmichaelf/corefx,jlin177/corefx,ViktorHofer/corefx,ravimeda/corefx,mokchhya/corefx,alexperovich/corefx,wtgodbe/corefx,twsouthwick/corefx,rahku/corefx,billwert/corefx,mmitche/corefx,YoupHulsebos/corefx,n1ghtmare/corefx,Jiayili1/corefx,the-dwyer/corefx,shimingsg/corefx,Ermiar/corefx,pallavit/corefx,adamralph/corefx,cartermp/corefx,mafiya69/corefx,mmitche/corefx,gkhanna79/corefx,shahid-pk/corefx,shmao/corefx,alphonsekurian/corefx,marksmeltzer/corefx,bitcrazed/corefx,khdang/corefx,benpye/corefx,parjong/corefx,dsplaisted/corefx,stone-li/corefx,shahid-pk/corefx,yizhang82/corefx,krytarowski/corefx,DnlHarvey/corefx,marksmeltzer/corefx,iamjasonp/corefx,marksmeltzer/corefx,ericstj/corefx,ravimeda/corefx,shahid-pk/corefx,alexandrnikitin/corefx,Chrisboh/corefx,manu-silicon/corefx,DnlHarvey/corefx,dotnet-bot/corefx,zhenlan/corefx,benjamin-bader/corefx,YoupHulsebos/corefx,ellismg/corefx,yizhang82/corefx,jlin177/corefx,josguil/corefx,shimingsg/corefx,iamjasonp/corefx,rjxby/corefx,Chrisboh/corefx,axelheer/corefx,richlander/corefx,690486439/corefx,lggomez/corefx,marksmeltzer/corefx,mokchhya/corefx,benpye/corefx,jcme/corefx,Chrisboh/corefx,weltkante/corefx,ellismg/corefx,cydhaselton/corefx,ViktorHofer/corefx,khdang/corefx,jhendrixMSFT/corefx,YoupHulsebos/corefx,axelheer/corefx,iamjasonp/corefx,Priya91/corefx-1,DnlHarvey/corefx,dhoehna/corefx,weltkante/corefx,krk/corefx,iamjasonp/corefx,iamjasonp/corefx,richlander/corefx,fgreinacher/corefx,cartermp/corefx,n1ghtmare/corefx,JosephTremoulet/corefx,rahku/corefx,benjamin-bader/corefx,marksmeltzer/corefx,lggomez/corefx,zhenlan/corefx,jhendrixMSFT/corefx,vidhya-bv/corefx-sorting,ellismg/corefx,yizhang82/corefx,dsplaisted/corefx,JosephTremoulet/corefx,YoupHulsebos/corefx,gkhanna79/corefx,lggomez/corefx,SGuyGe/corefx,tijoytom/corefx,jlin177/corefx,billwert/corefx,iamjasonp/corefx,cartermp/corefx,ravimeda/corefx,BrennanConroy/corefx,vidhya-bv/corefx-sorting,nbarbettini/corefx,cydhaselton/corefx,rjxby/corefx,vidhya-bv/corefx-sorting,stephenmichaelf/corefx,billwert/corefx,ravimeda/corefx,twsouthwick/corefx,elijah6/corefx,tstringer/corefx,rjxby/corefx,ericstj/corefx,manu-silicon/corefx,mellinoe/corefx,dotnet-bot/corefx,lggomez/corefx,Chrisboh/corefx,manu-silicon/corefx,the-dwyer/corefx,akivafr123/corefx,alexperovich/corefx,akivafr123/corefx,rahku/corefx,elijah6/corefx,jlin177/corefx,mazong1123/corefx,DnlHarvey/corefx,MaggieTsang/corefx,cydhaselton/corefx,Yanjing123/corefx,mellinoe/corefx,JosephTremoulet/corefx,shmao/corefx,lggomez/corefx,YoupHulsebos/corefx,mellinoe/corefx,YoupHulsebos/corefx,parjong/corefx,690486439/corefx,Yanjing123/corefx,seanshpark/corefx,alexperovich/corefx,stone-li/corefx,the-dwyer/corefx,jhendrixMSFT/corefx,weltkante/corefx,stone-li/corefx,adamralph/corefx,parjong/corefx,wtgodbe/corefx,Petermarcu/corefx,mazong1123/corefx,rahku/corefx,krk/corefx,alexandrnikitin/corefx,dotnet-bot/corefx,gkhanna79/corefx,benjamin-bader/corefx,shahid-pk/corefx,ellismg/corefx,Priya91/corefx-1,jlin177/corefx,gkhanna79/corefx,twsouthwick/corefx,mafiya69/corefx,mokchhya/corefx,alphonsekurian/corefx,rahku/corefx,Priya91/corefx-1,MaggieTsang/corefx,cartermp/corefx,alphonsekurian/corefx,adamralph/corefx,ViktorHofer/corefx,kkurni/corefx,ellismg/corefx,jeremymeng/corefx,the-dwyer/corefx,yizhang82/corefx,nbarbettini/corefx,kkurni/corefx,twsouthwick/corefx,weltkante/corefx,benjamin-bader/corefx,nbarbettini/corefx,alexperovich/corefx,ViktorHofer/corefx,stephenmichaelf/corefx,wtgodbe/corefx,alphonsekurian/corefx,yizhang82/corefx,rubo/corefx,mmitche/corefx,MaggieTsang/corefx,alexperovich/corefx,richlander/corefx,dhoehna/corefx,wtgodbe/corefx,Petermarcu/corefx,mokchhya/corefx,BrennanConroy/corefx,690486439/corefx,Yanjing123/corefx,Petermarcu/corefx,josguil/corefx,zhenlan/corefx,josguil/corefx,Chrisboh/corefx,seanshpark/corefx,kkurni/corefx,billwert/corefx,mmitche/corefx,khdang/corefx,shimingsg/corefx,mafiya69/corefx,shmao/corefx,Yanjing123/corefx,bitcrazed/corefx,tstringer/corefx,axelheer/corefx,weltkante/corefx,akivafr123/corefx,ViktorHofer/corefx,cartermp/corefx,rjxby/corefx,shahid-pk/corefx,elijah6/corefx,stephenmichaelf/corefx,Ermiar/corefx,tijoytom/corefx,shimingsg/corefx,kkurni/corefx,dsplaisted/corefx,twsouthwick/corefx,ericstj/corefx,wtgodbe/corefx,SGuyGe/corefx,ptoonen/corefx,the-dwyer/corefx,ericstj/corefx,mazong1123/corefx,mellinoe/corefx,the-dwyer/corefx,gkhanna79/corefx,fgreinacher/corefx,jcme/corefx,marksmeltzer/corefx,rubo/corefx,elijah6/corefx,ravimeda/corefx,mmitche/corefx,alexperovich/corefx,elijah6/corefx,dotnet-bot/corefx,cydhaselton/corefx,nbarbettini/corefx,BrennanConroy/corefx,seanshpark/corefx,janhenke/corefx,akivafr123/corefx,manu-silicon/corefx,parjong/corefx,pallavit/corefx,stephenmichaelf/corefx,jlin177/corefx,gkhanna79/corefx,gkhanna79/corefx,Petermarcu/corefx,ericstj/corefx,dhoehna/corefx,Petermarcu/corefx,tstringer/corefx,manu-silicon/corefx,krytarowski/corefx,jcme/corefx,ptoonen/corefx,benpye/corefx,tstringer/corefx,josguil/corefx,tijoytom/corefx,wtgodbe/corefx,josguil/corefx,dotnet-bot/corefx,JosephTremoulet/corefx,DnlHarvey/corefx,richlander/corefx,alexperovich/corefx,SGuyGe/corefx,JosephTremoulet/corefx,billwert/corefx,benjamin-bader/corefx,ViktorHofer/corefx,kkurni/corefx,MaggieTsang/corefx,cydhaselton/corefx,shimingsg/corefx,Jiayili1/corefx,krytarowski/corefx,alphonsekurian/corefx,shimingsg/corefx,jhendrixMSFT/corefx,rubo/corefx,DnlHarvey/corefx,YoupHulsebos/corefx,zhenlan/corefx,krk/corefx,janhenke/corefx,krk/corefx,ravimeda/corefx,seanshpark/corefx,tstringer/corefx,JosephTremoulet/corefx,shimingsg/corefx,pallavit/corefx,Petermarcu/corefx,nchikanov/corefx,vidhya-bv/corefx-sorting,parjong/corefx,zhenlan/corefx,SGuyGe/corefx,elijah6/corefx,PatrickMcDonald/corefx,bitcrazed/corefx,mmitche/corefx,mazong1123/corefx,parjong/corefx,janhenke/corefx,tijoytom/corefx,nbarbettini/corefx,nchikanov/corefx,alphonsekurian/corefx,tijoytom/corefx,mellinoe/corefx,jeremymeng/corefx,cydhaselton/corefx,benpye/corefx,ptoonen/corefx,yizhang82/corefx,zhenlan/corefx,zhenlan/corefx,manu-silicon/corefx,690486439/corefx,Yanjing123/corefx,PatrickMcDonald/corefx,rjxby/corefx,dhoehna/corefx,shmao/corefx,bitcrazed/corefx,manu-silicon/corefx,the-dwyer/corefx,seanshpark/corefx,mmitche/corefx,alphonsekurian/corefx,rubo/corefx,ellismg/corefx,vidhya-bv/corefx-sorting,axelheer/corefx,khdang/corefx,n1ghtmare/corefx,jcme/corefx,nchikanov/corefx,benjamin-bader/corefx,seanshpark/corefx,krytarowski/corefx,lggomez/corefx,benpye/corefx,axelheer/corefx,cydhaselton/corefx,krk/corefx,seanshpark/corefx,mazong1123/corefx,stephenmichaelf/corefx,jhendrixMSFT/corefx,nbarbettini/corefx,mazong1123/corefx,akivafr123/corefx,dhoehna/corefx,yizhang82/corefx,lggomez/corefx,weltkante/corefx,dhoehna/corefx,Priya91/corefx-1,jhendrixMSFT/corefx,stone-li/corefx,krytarowski/corefx,axelheer/corefx,Jiayili1/corefx,nchikanov/corefx,SGuyGe/corefx | src/System.Console/tests/WindowAndCursorProps.cs | src/System.Console/tests/WindowAndCursorProps.cs | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
public class WindowAndCursorProps
{
[Fact]
[PlatformSpecific(PlatformID.AnyUnix)]
public static void WindowWidth()
{
Assert.Throws<PlatformNotSupportedException>(() => Console.WindowWidth = 100);
// Validate that Console.WindowWidth returns some value in a non-redirected o/p.
Helpers.RunInNonRedirectedOutput((data) => Console.WriteLine(Console.WindowWidth));
Helpers.RunInRedirectedOutput((data) => Console.WriteLine(Console.WindowWidth));
}
//[Fact] //CI system makes it difficult to run things in a non-redirected environments.
[PlatformSpecific(PlatformID.AnyUnix)]
public static void NonRedirectedCursorVisible()
{
// Validate that Console.CursorVisible adds something to the stream when in a non-redirected environment.
Helpers.RunInNonRedirectedOutput((data) => { Console.CursorVisible = false; Assert.True(data.ToArray().Length > 0); });
Helpers.RunInNonRedirectedOutput((data) => { Console.CursorVisible = true; Assert.True(data.ToArray().Length > 0); });
}
[Fact]
[PlatformSpecific(PlatformID.AnyUnix)]
public static void CursorVisible()
{
Assert.Throws<PlatformNotSupportedException>(() => { bool unused = Console.CursorVisible; });
// Validate that the Console.CursorVisible does nothing in a redirected stream.
Helpers.RunInRedirectedOutput((data) => { Console.CursorVisible = false; Assert.Equal(0, data.ToArray().Length); });
Helpers.RunInRedirectedOutput((data) => { Console.CursorVisible = true; Assert.Equal(0, data.ToArray().Length); });
}
}
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;
public class WindowAndCursorProps
{
[Fact]
[PlatformSpecific(PlatformID.AnyUnix)]
public static void WindowWidth()
{
Assert.Throws<PlatformNotSupportedException>(() => Console.WindowWidth = 100);
// Validate that Console.WindowWidth returns some value in a non-redirected o/p.
Helpers.RunInNonRedirectedOutput((data) => Console.WriteLine(Console.WindowWidth));
Helpers.RunInRedirectedOutput((data) => Console.WriteLine(Console.WindowWidth));
}
//[Fact] //CI system makes it difficult to run things in a non-redirected environments.
[PlatformSpecific(PlatformID.AnyUnix)]
public static void NonRedirectedCursorVisible()
{
// Validate that Console.CursorVisible adds something to the stream when in a non-redirected environment.
Helpers.RunInNonRedirectedOutput((data) => { Console.CursorVisible = true; Assert.True(data.ToArray().Length > 0); });
Helpers.RunInNonRedirectedOutput((data) => { Console.CursorVisible = false; Assert.True(data.ToArray().Length > 0); });
}
[Fact]
[PlatformSpecific(PlatformID.AnyUnix)]
public static void CursorVisible()
{
Assert.Throws<PlatformNotSupportedException>(() => { bool unused = Console.CursorVisible; });
// Validate that the Console.CursorVisible does nothing in a redirected stream.
Helpers.RunInRedirectedOutput((data) => { Console.CursorVisible = true; Assert.Equal(0, data.ToArray().Length); });
Helpers.RunInRedirectedOutput((data) => { Console.CursorVisible = false; Assert.Equal(0, data.ToArray().Length); });
}
}
| mit | C# |
face0e859b575c5e01fc532f115a0d46b84886cb | fix index boos usage integration test | elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,adam-mccoy/elasticsearch-net,adam-mccoy/elasticsearch-net,CSGOpenSource/elasticsearch-net,elastic/elasticsearch-net,adam-mccoy/elasticsearch-net,CSGOpenSource/elasticsearch-net | src/Tests/Search/Request/IndexBoostUsageTests.cs | src/Tests/Search/Request/IndexBoostUsageTests.cs | using System;
using System.Collections.Generic;
using Nest;
using Tests.Framework.Integration;
using Tests.Framework.MockData;
namespace Tests.Search.Request
{
public class IndexBoostUsageTests : SearchUsageTestBase
{
public IndexBoostUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
protected override object ExpectJson => new
{
indices_boost = new
{
project = 1.4,
devs = 1.3
}
};
protected override Func<SearchDescriptor<Project>, ISearchRequest> Fluent => s => s
.IndicesBoost(b => b
.Add("project", 1.4)
.Add("devs", 1.3)
);
protected override SearchRequest<Project> Initializer =>
new SearchRequest<Project>
{
IndicesBoost = new Dictionary<IndexName, double>
{
{ "project", 1.4 },
{ "devs", 1.3 }
}
};
}
}
| using System;
using System.Collections.Generic;
using Nest;
using Tests.Framework.Integration;
using Tests.Framework.MockData;
namespace Tests.Search.Request
{
public class IndexBoostUsageTests : SearchUsageTestBase
{
public IndexBoostUsageTests(ReadOnlyCluster cluster, EndpointUsage usage) : base(cluster, usage) { }
protected override object ExpectJson => new
{
indices_boost = new
{
index1 = 1.4,
index2 = 1.3
}
};
protected override Func<SearchDescriptor<Project>, ISearchRequest> Fluent => s => s
.IndicesBoost(b => b
.Add("index1", 1.4)
.Add("index2", 1.3)
);
protected override SearchRequest<Project> Initializer =>
new SearchRequest<Project>
{
IndicesBoost = new Dictionary<IndexName, double>
{
{ "index1", 1.4 },
{ "index2", 1.3 }
}
};
}
}
| apache-2.0 | C# |
9e332a602759a9785bfffcd120867c44e2351e57 | Add some code comments. | DavidLievrouw/WordList | src/WordList.Processing/WordListReaderFactory.cs | src/WordList.Processing/WordListReaderFactory.cs | using System;
using WordList.Data;
namespace WordList.Processing {
public class WordListReaderFactory : IWordListReaderFactory {
readonly IFileReader _fileReader;
public WordListReaderFactory(IFileReader fileReader) {
if (fileReader == null) throw new ArgumentNullException(nameof(fileReader));
_fileReader = fileReader;
}
public IWordListReader Create(ProgramSettings settings) {
if (settings == null) throw new ArgumentNullException(nameof(settings));
// Only the WordList from file is currently supported. Maybe insert Strategy pattern here?
return new WordListReader(
new WordListFromFileDataSource(
_fileReader,
settings.WordListFile));
}
}
} | using System;
using WordList.Data;
namespace WordList.Processing {
public class WordListReaderFactory : IWordListReaderFactory {
readonly IFileReader _fileReader;
public WordListReaderFactory(IFileReader fileReader) {
if (fileReader == null) throw new ArgumentNullException(nameof(fileReader));
_fileReader = fileReader;
}
public IWordListReader Create(ProgramSettings settings) {
if (settings == null) throw new ArgumentNullException(nameof(settings));
return new WordListReader(new WordListFromFileDataSource(_fileReader, settings.WordListFile));
}
}
} | mit | C# |
470edc1aacdc2b4e7ab38582d72f3aeaf6448539 | Remove commented line | joelverhagen/TorSharp | test/TorSharp.Tests/TestSupport/HttpFixture.cs | test/TorSharp.Tests/TestSupport/HttpFixture.cs | using System;
using System.IO;
using System.Net.Http;
using Knapcode.TorSharp.Tools;
namespace Knapcode.TorSharp.Tests.TestSupport
{
public class HttpFixture : IDisposable
{
private readonly string _cacheDirectory;
public HttpFixture()
{
_cacheDirectory = Path.Combine(
Path.GetTempPath(),
"Knapcode.TorSharp.Tests",
"cache",
Guid.NewGuid().ToString());
Directory.CreateDirectory(_cacheDirectory);
}
internal ISimpleHttpClient GetSimpleHttpClient(HttpClient httpClient)
{
return new CachingSimpleHttpClient(httpClient, _cacheDirectory);
}
public TorSharpToolFetcher GetTorSharpToolFetcher(TorSharpSettings settings, HttpClient httpClient)
{
return new TorSharpToolFetcher(
settings,
httpClient,
GetSimpleHttpClient(httpClient),
new ConsoleProgress());
}
public void Dispose()
{
try
{
Directory.Delete(_cacheDirectory, recursive: true);
}
catch
{
// Not much we can do here.
}
}
private class ConsoleProgress : IProgress<DownloadProgress>
{
public void Report(DownloadProgress p)
{
Console.WriteLine($"{p.RequestUri.AbsoluteUri}: {p.Complete} / {(p.Total.HasValue ? p.Total.Value.ToString() : "???")}");
}
}
}
}
| using System;
using System.IO;
using System.Net.Http;
using Knapcode.TorSharp.Tools;
namespace Knapcode.TorSharp.Tests.TestSupport
{
public class HttpFixture : IDisposable
{
private readonly string _cacheDirectory;
public HttpFixture()
{
_cacheDirectory = Path.Combine(
Path.GetTempPath(),
"Knapcode.TorSharp.Tests",
"cache",
// DateTimeOffset.UtcNow.ToString("yyyy-MM-dd"));
Guid.NewGuid().ToString());
Directory.CreateDirectory(_cacheDirectory);
}
internal ISimpleHttpClient GetSimpleHttpClient(HttpClient httpClient)
{
return new CachingSimpleHttpClient(httpClient, _cacheDirectory);
}
public TorSharpToolFetcher GetTorSharpToolFetcher(TorSharpSettings settings, HttpClient httpClient)
{
return new TorSharpToolFetcher(
settings,
httpClient,
GetSimpleHttpClient(httpClient),
new ConsoleProgress());
}
public void Dispose()
{
try
{
Directory.Delete(_cacheDirectory, recursive: true);
}
catch
{
// Not much we can do here.
}
}
private class ConsoleProgress : IProgress<DownloadProgress>
{
public void Report(DownloadProgress p)
{
Console.WriteLine($"{p.RequestUri.AbsoluteUri}: {p.Complete} / {(p.Total.HasValue ? p.Total.Value.ToString() : "???")}");
}
}
}
}
| mit | C# |
d06cf6b1ab0ec157fab63821d9a3bce2329d310c | Correct docs | danielwertheim/mynatsclient,danielwertheim/mynatsclient | src/projects/MyNatsClient/IClientSubscription.cs | src/projects/MyNatsClient/IClientSubscription.cs | using System;
namespace MyNatsClient
{
/// <summary>
/// Represents a subscription against a NATS broker as well
/// as an associated message handler against the in-process
/// observable message stream.
/// </summary>
/// <remarks>
/// If you forget to explicitly dispose, the <see cref="INatsClient"/>
/// that created this subscribtion, will clean it when disposed.
/// </remarks>
public interface IClientSubscription : IDisposable
{
SubscriptionInfo SubscriptionInfo { get; }
}
} | using System;
namespace MyNatsClient
{
/// <summary>
/// Represents a subscription against a NATS broker as well
/// as an associated message handler against the in-process
/// observable message stream.
/// </summary>
/// <remarks>
/// If you forget to explicitly dispose, the <see cref="INatsConsumer"/>
/// that created this subscribtion, will clean it.
/// </remarks>
public interface IClientSubscription : IDisposable
{
SubscriptionInfo SubscriptionInfo { get; }
}
} | mit | C# |
a3aad3d4fff9a50102241aa9a46473950befd3f7 | Create server side API for single multiple answer question | Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist,Promact/trappist | Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs | Trappist/src/Promact.Trappist.Core/Controllers/QuestionsController.cs | using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.Models.Question;
using Promact.Trappist.Repository.Questions;
using System;
namespace Promact.Trappist.Core.Controllers
{
[Route("api/question")]
public class QuestionsController : Controller
{
private readonly IQuestionRepository _questionsRepository;
public QuestionsController(IQuestionRepository questionsRepository)
{
_questionsRepository = questionsRepository;
}
[HttpGet]
/// <summary>
/// Gets all questions
/// </summary>
/// <returns>Questions list</returns>
public IActionResult GetQuestions()
{
var questions = _questionsRepository.GetAllQuestions();
return Json(questions);
}
[HttpPost]
/// <summary>
///
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <returns></returns>
public IActionResult AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
{
_questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleAnswerQuestion);
return Ok();
}
/// <summary>
///
/// </summary>
/// <param name="singleMultipleAnswerQuestion"></param>
/// <returns></returns>
public IActionResult AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
{
_questionsRepository.AddSingleMultipleAnswerQuestionOption(singleMultipleAnswerQuestionOption);
return Ok();
}
}
}
| using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.Models.Question;
using Promact.Trappist.Repository.Questions;
using System;
namespace Promact.Trappist.Core.Controllers
{
[Route("api/question")]
public class QuestionsController : Controller
{
private readonly IQuestionRepository _questionsRepository;
public QuestionsController(IQuestionRepository questionsRepository)
{
_questionsRepository = questionsRepository;
}
[HttpGet]
/// <summary>
/// Gets all questions
/// </summary>
/// <returns>Questions list</returns>
public IActionResult GetQuestions()
{
var questions = _questionsRepository.GetAllQuestions();
return Json(questions);
}
}
}
| mit | C# |
1b844ab99cd498db5cb679dea7300a6e6d1061fb | Fix database abstraction test to use correct table name, etc. | brendanjbaker/StraightSQL | test/StraightSql.Test/DatabaseAbstractionTest.cs | test/StraightSql.Test/DatabaseAbstractionTest.cs | namespace StraightSql.Test
{
using System;
using System.Threading.Tasks;
using Xunit;
public class DatabaseAbstractionTest
{
[Fact]
public async Task DatabaseAbstractionTestAsync()
{
var queryDispatcher = new QueryDispatcher(new ConnectionFactory(ConnectionString.Default));
var database = new Database(queryDispatcher, TestReaderCollection.Default);
var setupQueries = new String[]
{
"DROP TABLE IF EXISTS database_abstraction_test;",
"CREATE TABLE database_abstraction_test (id INT NOT NULL, value TEXT NOT NULL);",
"INSERT INTO database_abstraction_test VALUES (1, 'James');",
"INSERT INTO database_abstraction_test VALUES (2, 'Madison');",
"INSERT INTO database_abstraction_test VALUES (3, 'University');"
};
foreach (var setupQuery in setupQueries)
await queryDispatcher.ExecuteAsync(new Query(setupQuery));
var item =
await database
.CreateQuery(@"
SELECT id, value
FROM database_abstraction_test
WHERE id = :id;")
.SetParameter("id", 1)
.FirstAsync<TestItem>();
Assert.NotNull(item);
Assert.Equal(item.Id, 1);
Assert.Equal(item.Value, "James");
}
}
}
| namespace StraightSql.Test
{
using System;
using System.Threading.Tasks;
using Xunit;
public class DatabaseAbstractionTest
{
[Fact]
public async Task DatabaseAbstractionTestAsync()
{
var queryDispatcher = new QueryDispatcher(new ConnectionFactory(ConnectionString.Default));
var database = new Database(queryDispatcher, TestReaderCollection.Default);
var setupQueries = new String[]
{
"DROP TABLE IF EXISTS database_abstraction_test;",
"CREATE TABLE database_abstraction_test (id INT NOT NULL, value TEXT NOT NULL);",
"INSERT INTO database_abstraction_test VALUES (1, 'James');",
"INSERT INTO database_abstraction_test VALUES (2, 'Madison');",
"INSERT INTO database_abstraction_test VALUES (3, 'University');"
};
foreach (var setupQuery in setupQueries)
await queryDispatcher.ExecuteAsync(new Query(setupQuery));
var item =
await database
.CreateQuery(@"
SELECT id, value
FROM contextualized_query_builder_query_test
WHERE value = :value;")
.SetParameter("value", "Hopkins")
.FirstAsync<TestItem>();
Assert.NotNull(item);
Assert.Equal(item.Id, 3);
Assert.Equal(item.Value, "Hopkins");
}
}
}
| mit | C# |
e98bd66d282807fede3424fc04d8e6cb4d18df24 | Update MvcDisplayModelConverter.cs | dudzon/Glimpse,SusanaL/Glimpse,rho24/Glimpse,elkingtonmcb/Glimpse,paynecrl97/Glimpse,dudzon/Glimpse,paynecrl97/Glimpse,sorenhl/Glimpse,sorenhl/Glimpse,SusanaL/Glimpse,Glimpse/Glimpse,sorenhl/Glimpse,elkingtonmcb/Glimpse,gabrielweyer/Glimpse,paynecrl97/Glimpse,rho24/Glimpse,gabrielweyer/Glimpse,codevlabs/Glimpse,Glimpse/Glimpse,rho24/Glimpse,rho24/Glimpse,elkingtonmcb/Glimpse,flcdrg/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,flcdrg/Glimpse,Glimpse/Glimpse,flcdrg/Glimpse,SusanaL/Glimpse,codevlabs/Glimpse,gabrielweyer/Glimpse,paynecrl97/Glimpse | source/Glimpse.Mvc/SerializationConverter/MvcDisplayModelConverter.cs | source/Glimpse.Mvc/SerializationConverter/MvcDisplayModelConverter.cs | using System;
using Glimpse.Core.Extensibility;
using Glimpse.Mvc.Display;
using Glimpse.Mvc.Model;
namespace Glimpse.Mvc.SerializationConverter
{
public class MvcDisplayModelConverter : SerializationConverter<MvcDisplayModel>
{
public override object Convert(MvcDisplayModel obj)
{
return new
{
controllerName = obj.ControllerName,
actionName = obj.ActionName,
actionExecutionTime = Math.Round(obj.ActionExecutionTime.Value, 2),
childActionCount = obj.ChildActionCount,
childViewCount = obj.ChildViewCount,
viewName = obj.ViewName,
viewRenderTime = Math.Round(obj.ViewRenderTime.GetValueOrDefault(), 2),
matchedRouteName = obj.MatchedRouteName,
};
}
}
}
| using System;
using Glimpse.Core.Extensibility;
using Glimpse.Mvc.Display;
using Glimpse.Mvc.Model;
namespace Glimpse.Mvc.SerializationConverter
{
public class MvcDisplayModelConverter : SerializationConverter<MvcDisplayModel>
{
public override object Convert(MvcDisplayModel obj)
{
return new
{
controllerName = obj.ControllerName,
actionName = obj.ActionName,
actionExecutionTime = Math.Round(obj.ActionExecutionTime.Value, 2),
childActionCount = obj.ChildActionCount,
childViewCount = obj.ChildViewCount,
viewName = obj.ViewName,
viewRenderTime = Math.Round(obj.ViewRenderTime.Value, 2),
matchedRouteName = obj.MatchedRouteName,
};
}
}
} | apache-2.0 | C# |
5c041e96ed165987a6549a11aecc06a82659a8a2 | add SectionExists method | martinusso/Ini.Net | Ini.Net/IniFile.cs | Ini.Net/IniFile.cs | using System;
using System.Text;
using System.Runtime.InteropServices;
namespace Ini.Net
{
public class IniFile
{
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
public string FileName { get; private set; }
public IniFile(string fileName)
{
this.FileName = fileName;
}
public void WriteString(string section, string key, string value)
{
WritePrivateProfileString(section, key, value, this.FileName);
}
public string ReadString(string section, string key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(section, key, null, temp, 255, this.FileName);
return temp.ToString();
}
public bool SectionExists(string sectionName)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(sectionName, null, null, temp, 255, this.FileName);
return temp.Length > 0;
}
}
}
| using System;
using System.Text;
using System.Runtime.InteropServices;
namespace Ini.Net
{
public class IniFile
{
[DllImport("kernel32")]
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
[DllImport("kernel32")]
private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);
public string FileName { get; private set; }
public IniFile(string fileName)
{
this.FileName = fileName;
}
public void WriteString(string section, string key, string value)
{
WritePrivateProfileString(section, key, value, this.FileName);
}
public string ReadString(string section, string key)
{
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(section, key, "", temp, 255, this.FileName);
return temp.ToString();
}
// function SectionExists(const Section: string): Boolean;
public bool SectionExists(string sectionName)
{
//string[] raw = GetPrivateProfileString(sectionName, null, null, this.FileName);
StringBuilder temp = new StringBuilder(255);
int i = GetPrivateProfileString(sectionName, null, null, temp, 255, this.FileName);
return temp.Length > 0;
}
}
}
| mit | C# |
fa615fd43fa239599d0507e1ce0d3b87d92db185 | Update post | bmsullivan/RavenDBBlogConsole | RavenDBBlogConsole/Program.cs | RavenDBBlogConsole/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Raven.Client.Document;
namespace RavenDBBlogConsole
{
class Program
{
static void Main(string[] args)
{
var docStore = new DocumentStore()
{
Url = "http://localhost:8080"
};
docStore.Initialize();
using (var session = docStore.OpenSession())
{
var post = session.Load<Post>("posts/1").Title = "New Title";
session.SaveChanges();
}
}
}
public class Blog
{
public string Id { get; set; }
public string Name { get; set; }
public string Author { get; set; }
}
public class Post
{
public string Id { get; set; }
public string BlogId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public List<Comment> Comments { get; set; }
public List<string> Tags { get; set; }
}
public class Comment
{
public string CommenterName { get; set; }
public string Text { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Raven.Client.Document;
namespace RavenDBBlogConsole
{
class Program
{
static void Main(string[] args)
{
var docStore = new DocumentStore()
{
Url = "http://localhost:8080"
};
docStore.Initialize();
using (var session = docStore.OpenSession())
{
var post = new Post()
{
BlogId = "blogs/33",
Comments = new List<Comment>() { new Comment() { CommenterName = "Bob", Text = "Hello!" } },
Content = "Some text",
Tags = new List<string>() { "tech" },
Title = "First post",
};
session.Store(post);
session.SaveChanges();
}
}
}
public class Blog
{
public string Id { get; set; }
public string Name { get; set; }
public string Author { get; set; }
}
public class Post
{
public string Id { get; set; }
public string BlogId { get; set; }
public string Title { get; set; }
public string Content { get; set; }
public List<Comment> Comments { get; set; }
public List<string> Tags { get; set; }
}
public class Comment
{
public string CommenterName { get; set; }
public string Text { get; set; }
}
}
| mit | C# |
20d973440c51d8fbca1f0d1a8253967f832ddb32 | Change automation formatting to include the type keyword, so it reads like 'class C' instead of 'NamedType C' | stephentoub/roslyn,dotnet/roslyn,AmadeusW/roslyn,gafter/roslyn,tannergooding/roslyn,heejaechang/roslyn,stephentoub/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,KevinRansom/roslyn,KevinRansom/roslyn,AlekseyTs/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,AlekseyTs/roslyn,eriawan/roslyn,reaction1989/roslyn,dotnet/roslyn,KevinRansom/roslyn,brettfo/roslyn,mavasani/roslyn,nguerrera/roslyn,gafter/roslyn,sharwell/roslyn,aelij/roslyn,bartdesmet/roslyn,abock/roslyn,weltkante/roslyn,tmat/roslyn,physhi/roslyn,eriawan/roslyn,diryboy/roslyn,genlu/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,weltkante/roslyn,sharwell/roslyn,aelij/roslyn,sharwell/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,agocke/roslyn,abock/roslyn,ErikSchierboom/roslyn,diryboy/roslyn,davkean/roslyn,jasonmalinowski/roslyn,agocke/roslyn,AmadeusW/roslyn,tmat/roslyn,tannergooding/roslyn,gafter/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,reaction1989/roslyn,panopticoncentral/roslyn,swaroop-sridhar/roslyn,panopticoncentral/roslyn,brettfo/roslyn,CyrusNajmabadi/roslyn,agocke/roslyn,AmadeusW/roslyn,nguerrera/roslyn,diryboy/roslyn,davkean/roslyn,brettfo/roslyn,genlu/roslyn,swaroop-sridhar/roslyn,swaroop-sridhar/roslyn,eriawan/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,ErikSchierboom/roslyn,abock/roslyn,davkean/roslyn,jasonmalinowski/roslyn,physhi/roslyn,wvdd007/roslyn,aelij/roslyn,bartdesmet/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,tmat/roslyn,jmarolf/roslyn,wvdd007/roslyn,wvdd007/roslyn,genlu/roslyn,tannergooding/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,heejaechang/roslyn,mavasani/roslyn | src/VisualStudio/Core/Def/Implementation/Utilities/SymbolViewModel.cs | src/VisualStudio/Core/Def/Implementation/Utilities/SymbolViewModel.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Windows.Media;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.Language.Intellisense;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities
{
internal class SymbolViewModel<T> : AbstractNotifyPropertyChanged where T : ISymbol
{
private readonly IGlyphService _glyphService;
public T Symbol { get; }
private static readonly SymbolDisplayFormat s_symbolDisplayFormat = new SymbolDisplayFormat(
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
memberOptions: SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions: SymbolDisplayParameterOptions.IncludeType | SymbolDisplayParameterOptions.IncludeParamsRefOut | SymbolDisplayParameterOptions.IncludeOptionalBrackets,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers | SymbolDisplayMiscellaneousOptions.UseSpecialTypes);
private static readonly SymbolDisplayFormat s_symbolAutomationFormat = new SymbolDisplayFormat(
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
memberOptions: SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions: SymbolDisplayParameterOptions.IncludeType | SymbolDisplayParameterOptions.IncludeParamsRefOut | SymbolDisplayParameterOptions.IncludeOptionalBrackets,
kindOptions: SymbolDisplayKindOptions.IncludeTypeKeyword,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers | SymbolDisplayMiscellaneousOptions.UseSpecialTypes);
public SymbolViewModel(T symbol, IGlyphService glyphService)
{
Symbol = symbol;
_glyphService = glyphService;
_isChecked = true;
}
private bool _isChecked;
public bool IsChecked
{
get => _isChecked;
set => SetProperty(ref _isChecked, value);
}
public string SymbolName => Symbol.ToDisplayString(s_symbolDisplayFormat);
public ImageSource Glyph => Symbol.GetGlyph().GetImageSource(_glyphService);
public string SymbolAutomationText => Symbol.ToDisplayString(s_symbolAutomationFormat);
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Windows.Media;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.VisualStudio.Language.Intellisense;
namespace Microsoft.VisualStudio.LanguageServices.Implementation.Utilities
{
internal class SymbolViewModel<T> : AbstractNotifyPropertyChanged where T : ISymbol
{
private readonly IGlyphService _glyphService;
public T Symbol { get; }
private static readonly SymbolDisplayFormat s_symbolDisplayFormat = new SymbolDisplayFormat(
genericsOptions: SymbolDisplayGenericsOptions.IncludeTypeParameters,
memberOptions: SymbolDisplayMemberOptions.IncludeParameters,
parameterOptions: SymbolDisplayParameterOptions.IncludeType | SymbolDisplayParameterOptions.IncludeParamsRefOut | SymbolDisplayParameterOptions.IncludeOptionalBrackets,
miscellaneousOptions: SymbolDisplayMiscellaneousOptions.EscapeKeywordIdentifiers | SymbolDisplayMiscellaneousOptions.UseSpecialTypes);
public SymbolViewModel(T symbol, IGlyphService glyphService)
{
Symbol = symbol;
_glyphService = glyphService;
_isChecked = true;
}
private bool _isChecked;
public bool IsChecked
{
get => _isChecked;
set => SetProperty(ref _isChecked, value);
}
public string SymbolName => Symbol.ToDisplayString(s_symbolDisplayFormat);
public ImageSource Glyph => Symbol.GetGlyph().GetImageSource(_glyphService);
public string SymbolAutomationText => $"{Symbol.Kind} {SymbolName}";
}
}
| mit | C# |
97913e47b164304a702ca56c417d2ee5fbb51bd6 | Fix sample | mvno/Okanshi,mvno/Okanshi,mvno/Okanshi | samples/Okanshi.Endpoint.Sample/Program.cs | samples/Okanshi.Endpoint.Sample/Program.cs | using System;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Okanshi.Endpoint.Sample
{
class Program
{
// The point of this sample to is to showcase the use of the HTTP endpoint
static void Main(string[] args)
{
// Get the default registry instance. This is the registry used when adding metrics
// through OkanshiMonitor.
var registry = DefaultMonitorRegistry.Instance;
var poller = new MetricMonitorRegistryPoller(registry, TimeSpan.FromMinutes(1));
// Create a HTTP endpoint, this listens on the default registry instance, gets the values
// every 10 seconds and keeps the last 100 samples in memory
var httpEndpoint = new MonitorEndpoint(new EndpointOptions {
NumberOfSamplesToStore = 100,
}, poller, o => JsonConvert.SerializeObject(o, Formatting.Indented));
httpEndpoint.Start();
while (true) {
Console.WriteLine("Monitor key presses. Start typing to measure");
while (true) {
var info = Console.ReadKey();
string measurementName;
if ((int)info.Modifiers == 0) {
measurementName = info.Key.ToString();
} else {
measurementName = $"{info.Modifiers} + {info.Key}";
}
System.Console.WriteLine();
OkanshiMonitor.Counter("Key press", new[] { new Tag("combination", measurementName) }).Increment();
}
}
}
}
}
| using System;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace Okanshi.Endpoint.Sample
{
class Program
{
// The point of this sample to is to showcase the use of the HTTP endpoint
static void Main(string[] args)
{
// Get the default registry instance. This is the registry used when adding metrics
// through OkanshiMonitor.
var registry = DefaultMonitorRegistry.Instance;
// Create a HTTP endpoint, this listens on the default registry instance, gets the values
// every 10 seconds and keeps the last 100 samples in memory
var httpEndpoint = new MonitorEndpoint(new EndpointOptions {
PollingInterval = TimeSpan.FromSeconds(10),
NumberOfSamplesToStore = 100,
}, DefaultMonitorRegistry.Instance, o => JsonConvert.SerializeObject(o, Formatting.Indented));
httpEndpoint.Start();
while (true) {
Console.WriteLine("Monitor key presses. Start typing to measure");
while (true) {
var info = Console.ReadKey();
string measurementName;
if ((int)info.Modifiers == 0) {
measurementName = info.Key.ToString();
} else {
measurementName = $"{info.Modifiers} + {info.Key}";
}
System.Console.WriteLine();
OkanshiMonitor.Counter("Key press", new[] { new Tag("combination", measurementName) }).Increment();
}
}
}
}
}
| mit | C# |
1829efabdd284dfd4b8fede81f3e91288e3e2a71 | add PlatformMask to PrefsKVSPathCustom | fuqunaga/PrefsGUI | Runtime/PrefsKVSPathCustom.cs | Runtime/PrefsKVSPathCustom.cs | using System;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
namespace PrefsGUI.KVS
{
/// <summary>
/// Custom File Path for PrefsKVS
/// Rerative to Application.dataPath
/// you can use magic path
/// - %dataPath% -> Application.dataPath
/// - %companyName% -> Application.companyName
/// - %productName% -> Application.productName
/// - other %[word]% -> System.Environment.GetEnvironmentVariable([word])
/// </summary>
public class PrefsKVSPathCustom : MonoBehaviour, IPrefsKVSPath
{
[SerializeField]
protected ulong platformMask = MakePlatformMask(RuntimePlatform.WindowsEditor, RuntimePlatform.WindowsPlayer);
[SerializeField]
protected string _path = "%dataPath%/../../%productName%Prefs";
static ulong MakePlatformMask(params RuntimePlatform[] platforms)
{
return platforms.Aggregate((ulong)0, (mask, platform) => mask | ((ulong)1 << (int)platform));
}
public string path
{
get
{
var enable = (platformMask & MakePlatformMask(Application.platform)) != 0;
string ret = null;
if (enable)
{
ret = _path
.Replace("%dataPath%", Application.dataPath)
.Replace("%companyName%", Application.companyName)
.Replace("%productName%", Application.productName);
var matches = Regex.Matches(ret, @"%\w+?%").Cast<Match>();
if (matches.Any())
{
matches.ToList().ForEach(m => ret = ret.Replace(m.Value, Environment.GetEnvironmentVariable(m.Value.Trim('%'))));
}
}
return ret;
}
}
}
} | using System;
using System.Linq;
using System.Text.RegularExpressions;
using UnityEngine;
namespace PrefsGUI.KVS
{
/// <summary>
/// Custom File Path for PrefsKVS
/// Rerative to Application.dataPath
/// you can use magic path
/// - %dataPath% -> Application.dataPath
/// - %companyName% -> Application.companyName
/// - %productName% -> Application.productName
/// - other %[word]% -> System.Environment.GetEnvironmentVariable([word])
/// </summary>
public class PrefsKVSPathCustom : MonoBehaviour, IPrefsKVSPath
{
[SerializeField]
protected string _path = "%dataPath%/../../%productName%Prefs";
public string path
{
get
{
var p = _path
.Replace("%dataPath%", Application.dataPath)
.Replace("%companyName%", Application.companyName)
.Replace("%productName%", Application.productName);
var matches = Regex.Matches(p, @"%\w+?%").Cast<Match>();
if ( matches.Any())
{
matches.ToList().ForEach(m => p = p.Replace(m.Value, Environment.GetEnvironmentVariable(m.Value.Trim('%'))));
}
return p;
}
}
}
} | mit | C# |
42c10708393d8be230d595232639e62ce6c6e5de | Add more precision to aspnet_start reported times. | brianrob/coretests,brianrob/coretests | managed/aspnet_start/src/Startup.cs | managed/aspnet_start/src/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.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace aspnet_start
{
public class Startup
{
public static IWebHost WebHost = null;
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
lifetime.ApplicationStarted.Register(OnAppStarted);
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
private void OnAppStarted()
{
Program._startupTimer.Stop();
Log($"Startup elapsed ms: {Program._startupTimer.Elapsed.TotalMilliseconds} ms");
WebHost.StopAsync(TimeSpan.FromSeconds(1));
}
private void Log(string s)
{
string time = DateTime.UtcNow.ToString();
Console.WriteLine($"[{time}] {s}");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
namespace aspnet_start
{
public class Startup
{
public static IWebHost WebHost = null;
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationLifetime lifetime)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
lifetime.ApplicationStarted.Register(OnAppStarted);
app.Run(async (context) =>
{
await context.Response.WriteAsync("Hello World!");
});
}
private void OnAppStarted()
{
Program._startupTimer.Stop();
Log($"Startup elapsed ms: {Program._startupTimer.ElapsedMilliseconds} ms");
WebHost.StopAsync(TimeSpan.FromSeconds(1));
}
private void Log(string s)
{
string time = DateTime.UtcNow.ToString();
Console.WriteLine($"[{time}] {s}");
}
}
}
| mit | C# |
d802f6c8448216deac00de420002cbc8c40d233c | Convert source to Hello World. | brianrob/coretests,brianrob/coretests | managed/time_to_main/src/Program.cs | managed/time_to_main/src/Program.cs | using System;
using System.Runtime.InteropServices;
namespace TimeToMain
{
public static class Program
{
[DllImport("libnative.so")]
private static extern void write_marker(string name);
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
write_marker("/function/main");
}
}
}
| using System;
using System.Runtime.InteropServices;
namespace TimeToMain
{
public static class Program
{
[DllImport("libnative.so")]
private static extern void write_marker(string name);
public static void Main(string[] args)
{
write_marker("/function/main");
}
}
}
| mit | C# |
db2d8b6d8bf875deddccecd0d583982060c30718 | Fix ruleset instance creation null checks | smoogipoo/osu,ppy/osu,peppy/osu,peppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,peppy/osu | osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs | osu.Game.Tournament.Tests/Components/TestSceneTournamentModDisplay.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Tournament.Components;
using osuTK;
namespace osu.Game.Tournament.Tests.Components
{
public class TestSceneTournamentModDisplay : TournamentTestScene
{
[Resolved]
private IAPIProvider api { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
private FillFlowContainer<TournamentBeatmapPanel> fillFlow;
[BackgroundDependencyLoader]
private void load()
{
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = 490154 });
req.Success += success;
api.Queue(req);
Add(fillFlow = new FillFlowContainer<TournamentBeatmapPanel>
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Full,
Spacing = new Vector2(10)
});
}
private void success(APIBeatmap beatmap)
{
var ruleset = rulesets.GetRuleset(Ladder.Ruleset.Value.OnlineID);
if (ruleset == null)
return;
var mods = ruleset.CreateInstance().AllMods;
foreach (var mod in mods)
{
fillFlow.Add(new TournamentBeatmapPanel(beatmap, mod.Acronym)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Tournament.Components;
using osuTK;
namespace osu.Game.Tournament.Tests.Components
{
public class TestSceneTournamentModDisplay : TournamentTestScene
{
[Resolved]
private IAPIProvider api { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
private FillFlowContainer<TournamentBeatmapPanel> fillFlow;
[BackgroundDependencyLoader]
private void load()
{
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = 490154 });
req.Success += success;
api.Queue(req);
Add(fillFlow = new FillFlowContainer<TournamentBeatmapPanel>
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Full,
Spacing = new Vector2(10)
});
}
private void success(APIBeatmap beatmap)
{
var mods = rulesets.GetRuleset(Ladder.Ruleset.Value.ID ?? 0).CreateInstance().AllMods;
foreach (var mod in mods)
{
fillFlow.Add(new TournamentBeatmapPanel(beatmap, mod.Acronym)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
});
}
}
}
}
| mit | C# |
4edc3aed870b00cdaba4584469b5f188f2a30f48 | Change error message. | LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform,LykkeCity/CompetitionPlatform | src/CompetitionPlatform/Views/Shared/AuthenticationFailed.cshtml | src/CompetitionPlatform/Views/Shared/AuthenticationFailed.cshtml | @{
ViewData["Title"] = "Access Denied";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">Authentication Failed.</h2>
<p>
You have denied Competition Platform access to your resources.
</p>
| @{
ViewData["Title"] = "Access Denied";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">Access denied</h2>
<p>
You have denied Competition Platform access to your resources.
</p>
| mit | C# |
31b79007b39b7594fd6342e05b45de30eec4f784 | Remove stale comment. | jasonmalinowski/roslyn,jasonmalinowski/roslyn,MichalStrehovsky/roslyn,mavasani/roslyn,paulvanbrenk/roslyn,AArnott/roslyn,mmitche/roslyn,weltkante/roslyn,davkean/roslyn,OmarTawfik/roslyn,KevinRansom/roslyn,zooba/roslyn,xoofx/roslyn,paulvanbrenk/roslyn,dpoeschl/roslyn,swaroop-sridhar/roslyn,diryboy/roslyn,paulvanbrenk/roslyn,tmeschter/roslyn,KirillOsenkov/roslyn,dotnet/roslyn,xasx/roslyn,VSadov/roslyn,brettfo/roslyn,dpoeschl/roslyn,stephentoub/roslyn,yeaicc/roslyn,MichalStrehovsky/roslyn,OmarTawfik/roslyn,aelij/roslyn,nguerrera/roslyn,orthoxerox/roslyn,MichalStrehovsky/roslyn,jasonmalinowski/roslyn,wvdd007/roslyn,genlu/roslyn,tmeschter/roslyn,brettfo/roslyn,mattwar/roslyn,TyOverby/roslyn,MattWindsor91/roslyn,jkotas/roslyn,genlu/roslyn,weltkante/roslyn,mmitche/roslyn,khyperia/roslyn,gafter/roslyn,robinsedlaczek/roslyn,lorcanmooney/roslyn,jeffanders/roslyn,CaptainHayashi/roslyn,lorcanmooney/roslyn,sharwell/roslyn,sharwell/roslyn,MattWindsor91/roslyn,shyamnamboodiripad/roslyn,orthoxerox/roslyn,reaction1989/roslyn,pdelvo/roslyn,diryboy/roslyn,eriawan/roslyn,bbarry/roslyn,bbarry/roslyn,davkean/roslyn,srivatsn/roslyn,natidea/roslyn,kelltrick/roslyn,jeffanders/roslyn,DustinCampbell/roslyn,abock/roslyn,panopticoncentral/roslyn,xoofx/roslyn,nguerrera/roslyn,AnthonyDGreen/roslyn,mattscheffer/roslyn,genlu/roslyn,VSadov/roslyn,pdelvo/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn,pdelvo/roslyn,weltkante/roslyn,yeaicc/roslyn,panopticoncentral/roslyn,yeaicc/roslyn,stephentoub/roslyn,eriawan/roslyn,lorcanmooney/roslyn,nguerrera/roslyn,Giftednewt/roslyn,tmat/roslyn,physhi/roslyn,robinsedlaczek/roslyn,diryboy/roslyn,AArnott/roslyn,xasx/roslyn,CyrusNajmabadi/roslyn,jmarolf/roslyn,bartdesmet/roslyn,reaction1989/roslyn,khyperia/roslyn,zooba/roslyn,Hosch250/roslyn,kelltrick/roslyn,jamesqo/roslyn,xasx/roslyn,gafter/roslyn,amcasey/roslyn,ErikSchierboom/roslyn,dotnet/roslyn,akrisiun/roslyn,tvand7093/roslyn,eriawan/roslyn,jmarolf/roslyn,srivatsn/roslyn,KevinH-MS/roslyn,sharwell/roslyn,KevinRansom/roslyn,heejaechang/roslyn,bartdesmet/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,a-ctor/roslyn,drognanar/roslyn,cston/roslyn,aelij/roslyn,abock/roslyn,Pvlerick/roslyn,shyamnamboodiripad/roslyn,jamesqo/roslyn,mgoertz-msft/roslyn,AArnott/roslyn,zooba/roslyn,Giftednewt/roslyn,Hosch250/roslyn,tmat/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tmeschter/roslyn,akrisiun/roslyn,stephentoub/roslyn,brettfo/roslyn,VSadov/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,a-ctor/roslyn,heejaechang/roslyn,vslsnap/roslyn,MattWindsor91/roslyn,AnthonyDGreen/roslyn,wvdd007/roslyn,akrisiun/roslyn,jcouv/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,tannergooding/roslyn,jcouv/roslyn,bbarry/roslyn,CaptainHayashi/roslyn,mattscheffer/roslyn,jmarolf/roslyn,AnthonyDGreen/roslyn,TyOverby/roslyn,tmat/roslyn,abock/roslyn,AmadeusW/roslyn,mgoertz-msft/roslyn,Hosch250/roslyn,ErikSchierboom/roslyn,bartdesmet/roslyn,swaroop-sridhar/roslyn,dpoeschl/roslyn,bkoelman/roslyn,mattwar/roslyn,DustinCampbell/roslyn,ljw1004/roslyn,jeffanders/roslyn,KevinH-MS/roslyn,ljw1004/roslyn,MattWindsor91/roslyn,kelltrick/roslyn,tvand7093/roslyn,agocke/roslyn,vslsnap/roslyn,physhi/roslyn,drognanar/roslyn,natidea/roslyn,mattwar/roslyn,wvdd007/roslyn,ljw1004/roslyn,CyrusNajmabadi/roslyn,agocke/roslyn,davkean/roslyn,orthoxerox/roslyn,jcouv/roslyn,mattscheffer/roslyn,ErikSchierboom/roslyn,panopticoncentral/roslyn,a-ctor/roslyn,vslsnap/roslyn,amcasey/roslyn,DustinCampbell/roslyn,bkoelman/roslyn,AlekseyTs/roslyn,gafter/roslyn,natidea/roslyn,CaptainHayashi/roslyn,physhi/roslyn,CyrusNajmabadi/roslyn,KevinH-MS/roslyn,TyOverby/roslyn,tannergooding/roslyn,robinsedlaczek/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,Pvlerick/roslyn,mavasani/roslyn,aelij/roslyn,drognanar/roslyn,tvand7093/roslyn,OmarTawfik/roslyn,AmadeusW/roslyn,bkoelman/roslyn,jamesqo/roslyn,amcasey/roslyn,xoofx/roslyn,tannergooding/roslyn,mavasani/roslyn,Giftednewt/roslyn,agocke/roslyn,jkotas/roslyn,KirillOsenkov/roslyn,reaction1989/roslyn,jkotas/roslyn,mgoertz-msft/roslyn,cston/roslyn,cston/roslyn,khyperia/roslyn,KirillOsenkov/roslyn,swaroop-sridhar/roslyn,dotnet/roslyn,mmitche/roslyn,srivatsn/roslyn,Pvlerick/roslyn | src/EditorFeatures/Core/Implementation/Adornments/GraphicsTag.cs | src/EditorFeatures/Core/Implementation/Adornments/GraphicsTag.cs | // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Adornments
{
/// <summary>
/// This needs to be public for testing the AdornmentManager
/// </summary>
internal abstract class GraphicsTag : ITag
{
private readonly IEditorFormatMap _editorFormatMap;
protected Brush _graphicsTagBrush;
protected Color _graphicsTagColor;
protected GraphicsTag(IEditorFormatMap editorFormatMap)
{
_editorFormatMap = editorFormatMap;
}
protected virtual void Initialize(IWpfTextView view)
{
if (_graphicsTagBrush != null)
{
return;
}
// If we can't get the color for some reason, fall back to a hardcoded value
// the editor has for outlining.
var lightGray = Color.FromRgb(0xA5, 0xA5, 0xA5);
var color = this.GetColor(view, _editorFormatMap) ?? lightGray;
_graphicsTagColor = color;
_graphicsTagBrush = new SolidColorBrush(_graphicsTagColor);
}
protected abstract Color? GetColor(IWpfTextView view, IEditorFormatMap editorFormatMap);
/// <summary>
/// This method allows corresponding adornment manager to ask for a graphical glyph.
/// </summary>
public abstract GraphicsResult GetGraphics(IWpfTextView view, Geometry bounds);
}
}
| // Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Adornments
{
/// <summary>
/// This needs to be public for testing the AdornmentManager
/// </summary>
internal abstract class GraphicsTag : ITag
{
private readonly IEditorFormatMap _editorFormatMap;
protected Brush _graphicsTagBrush;
protected Color _graphicsTagColor;
protected GraphicsTag(IEditorFormatMap editorFormatMap)
{
_editorFormatMap = editorFormatMap;
}
protected virtual void Initialize(IWpfTextView view)
{
if (_graphicsTagBrush != null)
{
return;
}
// TODO: Refresh this when the user changes fonts and colors
// If we can't get the color for some reason, fall back to a hardcoded value
// the editor has for outlining.
var lightGray = Color.FromRgb(0xA5, 0xA5, 0xA5);
var color = this.GetColor(view, _editorFormatMap) ?? lightGray;
_graphicsTagColor = color;
_graphicsTagBrush = new SolidColorBrush(_graphicsTagColor);
}
protected abstract Color? GetColor(IWpfTextView view, IEditorFormatMap editorFormatMap);
/// <summary>
/// This method allows corresponding adornment manager to ask for a graphical glyph.
/// </summary>
public abstract GraphicsResult GetGraphics(IWpfTextView view, Geometry bounds);
}
} | mit | C# |
a82aa2f849fcfe1b3c27b545a851a50079142584 | Update the test code to set the sources to an empty enumerable<string> | SeanFarrow/NBench.VisualStudio | tests/NBench.VisualStudio.TestAdapter.Tests.Unit/NBenchTestDiscoverer/DiscoverTests/WhenTheSourcesCollectionIsEmpty.cs | tests/NBench.VisualStudio.TestAdapter.Tests.Unit/NBenchTestDiscoverer/DiscoverTests/WhenTheSourcesCollectionIsEmpty.cs | namespace NBench.VisualStudio.TestAdapter.Tests.Unit.NBenchTestDiscoverer.DiscoverTests
{
using System;
using System.Collections.Generic;
using JustBehave;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NBench.VisualStudio.TestAdapter;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.AutoNSubstitute;
using Xunit;
using System.Linq;
public class WhenTheSourcesCollectionIsEmpty : XBehaviourTest<NBenchTestDiscoverer>
{
private IEnumerable<string> sources;
private IDiscoveryContext discoverycontext;
private IMessageLogger messagelogger;
private ITestCaseDiscoverySink testcasediscoverysink;
protected override void CustomizeAutoFixture(IFixture fixture)
{
fixture.Customize(new AutoNSubstituteCustomization());
}
protected override NBenchTestDiscoverer CreateSystemUnderTest()
{
return new NBenchTestDiscoverer();
}
protected override void Given()
{
this.RecordAnyExceptionsThrown();
this.sources = Enumerable.Empty<string>();
this.discoverycontext = this.Fixture.Create<IDiscoveryContext>();
this.messagelogger = this.Fixture.Create<IMessageLogger>();
this.testcasediscoverysink = this.Fixture.Create<ITestCaseDiscoverySink>();
}
protected override void When()
{
this.SystemUnderTest.DiscoverTests(this.sources, this.discoverycontext, this.messagelogger, this.testcasediscoverysink);
}
[Fact]
public void AnArgumentNullExceptionShouldBeThrown()
{
Assert.IsType<ArgumentException>(this.ThrownException);
}
[Fact]
public void TheMessageInTheExceptionDetailsTheFactThatTheSourcesCannotBeEmpty()
{
Assert.Equal("The sources collection you have passed in is empty. The source collection must be populated.\r\nParameter name: sources", this.ThrownException.Message);
}
}
} | namespace NBench.VisualStudio.TestAdapter.Tests.Unit.NBenchTestDiscoverer.DiscoverTests
{
using System;
using System.Collections.Generic;
using JustBehave;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using NBench.VisualStudio.TestAdapter;
using Ploeh.AutoFixture;
using Ploeh.AutoFixture.AutoNSubstitute;
using Xunit;
public class WhenTheSourcesCollectionIsEmpty : XBehaviourTest<NBenchTestDiscoverer>
{
private IEnumerable<string> sources;
private IDiscoveryContext discoverycontext;
private IMessageLogger messagelogger;
private ITestCaseDiscoverySink testcasediscoverysink;
protected override void CustomizeAutoFixture(IFixture fixture)
{
fixture.Customize(new AutoNSubstituteCustomization());
}
protected override NBenchTestDiscoverer CreateSystemUnderTest()
{
return new NBenchTestDiscoverer();
}
protected override void Given()
{
this.RecordAnyExceptionsThrown();
this.sources = null;
this.discoverycontext = this.Fixture.Create<IDiscoveryContext>();
this.messagelogger = this.Fixture.Create<IMessageLogger>();
this.testcasediscoverysink = this.Fixture.Create<ITestCaseDiscoverySink>();
}
protected override void When()
{
this.SystemUnderTest.DiscoverTests(this.sources, this.discoverycontext, this.messagelogger, this.testcasediscoverysink);
}
[Fact]
public void AnArgumentNullExceptionShouldBeThrown()
{
Assert.IsType<ArgumentException>(this.ThrownException);
}
[Fact]
public void TheMessageInTheExceptionDetailsTheFactThatTheSourcesCannotBeEmpty()
{
Assert.Equal("The sources collection you have passed in is empty. The source collection must be populated.\r\nParameter name: sources", this.ThrownException.Message);
}
}
} | apache-2.0 | C# |
9f7301dccd4fb676d762ac139cb688c264e8e166 | Add readonly to CcsProxy.proxy | lou1306/CIV,lou1306/CIV | CIV.Ccs/CcsProxy.cs | CIV.Ccs/CcsProxy.cs | using System.Collections.Generic;
using static CIV.Ccs.CcsParser;
using CIV.Interfaces;
using System;
namespace CIV.Ccs
{
/// <summary>
/// Proxy class that delays the creation of a new Process instance until it
/// is needed.
/// </summary>
class CcsProxy : CcsProcess
{
readonly Proxy<CcsProcess, ProcessContext> proxy;
public CcsProxy(ProcessFactory factory, ProcessContext context)
{
proxy = new Proxy<CcsProcess, ProcessContext>(factory, context);
}
public override bool Equals(CcsProcess other) => proxy.Real.Equals(other);
public override IEnumerable<Transition> Transitions() => proxy.Real.Transitions();
}
}
| using System.Collections.Generic;
using static CIV.Ccs.CcsParser;
using CIV.Interfaces;
using System;
namespace CIV.Ccs
{
/// <summary>
/// Proxy class that delays the creation of a new Process instance until it
/// is needed.
/// </summary>
class CcsProxy : CcsProcess
{
Proxy<CcsProcess, ProcessContext> proxy;
public CcsProxy(ProcessFactory factory, ProcessContext context)
{
proxy = new Proxy<CcsProcess, ProcessContext>(factory, context);
}
public override bool Equals(CcsProcess other) => proxy.Real.Equals(other);
public override IEnumerable<Transition> Transitions() => proxy.Real.Transitions();
}
}
| mit | C# |
673b11a44a64a650a7084ba0f22bffdfb3fcba19 | change format | taka-oyama/UniHttp | Assets/UniHttp/Support/Connection/HttpStream.cs | Assets/UniHttp/Support/Connection/HttpStream.cs | using UnityEngine;
using System.IO;
using System.Net.Sockets;
using System;
using System.Net.Security;
namespace UniHttp
{
internal sealed class HttpStream : Stream
{
internal string url;
TcpClient tcpClient;
SslStream sslStream;
Stream stream;
internal HttpStream(Uri uri)
{
this.url = string.Concat(uri.Scheme, Uri.SchemeDelimiter, uri.Authority);
this.tcpClient = new TcpClient();
this.tcpClient.Connect(uri.Host, uri.Port);
this.stream = tcpClient.GetStream();
if(uri.Scheme == Uri.UriSchemeHttp) {
return;
}
if(uri.Scheme == Uri.UriSchemeHttps) {
this.sslStream = new SslStream(stream, false, HttpManager.SslVerifier.Verify);
this.stream = sslStream;
sslStream.AuthenticateAsClient(uri.Host);
return;
}
throw new Exception("Unsupported Scheme:" + uri.Scheme);
}
public bool Connected
{
get { return tcpClient.Connected; }
}
public override bool CanRead
{
get { return stream.CanRead; }
}
public override bool CanSeek
{
get { return stream.CanSeek; }
}
public override bool CanWrite
{
get { return stream.CanTimeout; }
}
public override long Length
{
get { return stream.Length; }
}
public override long Position
{
get { return stream.Position; }
set { stream.Position = value; }
}
public override void SetLength(long value)
{
stream.SetLength(value);
}
public override int Read(byte[] buffer, int offset, int count)
{
return stream.Read(buffer, 0, count);
}
public override long Seek(long offset, SeekOrigin origin)
{
return stream.Seek(offset, origin);
}
public override void Write(byte[] buffer, int offset, int count)
{
stream.Write(buffer, offset, count);
}
public override void Flush()
{
stream.Flush();
}
protected override void Dispose(bool disposing)
{
if(disposing) {
stream.Dispose();
}
base.Dispose(disposing);
}
public override void Close()
{
Dispose(true);
base.Close();
}
}
}
| using UnityEngine;
using System.IO;
using System.Net.Sockets;
using System;
using System.Net.Security;
namespace UniHttp
{
internal sealed class HttpStream : Stream
{
internal string url;
TcpClient tcpClient;
SslStream sslStream;
Stream stream;
internal HttpStream(Uri uri)
{
this.url = string.Concat(uri.Scheme, Uri.SchemeDelimiter, uri.Authority);
this.tcpClient = new TcpClient();
this.tcpClient.Connect(uri.Host, uri.Port);
this.stream = tcpClient.GetStream();
if(uri.Scheme == Uri.UriSchemeHttp) {
return;
}
if(uri.Scheme == Uri.UriSchemeHttps) {
this.sslStream = new SslStream(stream, false, HttpManager.SslVerifier.Verify);
this.stream = sslStream;
sslStream.AuthenticateAsClient(uri.Host);
return;
}
throw new Exception("Unsupported Scheme:" + uri.Scheme);
}
public bool Connected { get { return tcpClient.Connected; } }
public override bool CanRead { get { return stream.CanRead; } }
public override bool CanSeek { get { return stream.CanSeek; } }
public override bool CanWrite { get { return stream.CanTimeout; } }
public override long Length { get { return stream.Length; } }
public override long Position
{
get { return stream.Position; }
set { stream.Position = value; }
}
public override void SetLength(long value)
{
stream.SetLength(value);
}
public override int Read(byte[] buffer, int offset, int count)
{
return stream.Read(buffer, 0, count);
}
public override long Seek(long offset, SeekOrigin origin)
{
return stream.Seek(offset, origin);
}
public override void Write(byte[] buffer, int offset, int count)
{
stream.Write(buffer, offset, count);
}
public override void Flush()
{
stream.Flush();
}
protected override void Dispose(bool disposing)
{
if(disposing) {
stream.Dispose();
}
base.Dispose(disposing);
}
public override void Close()
{
Dispose(true);
base.Close();
}
}
}
| mit | C# |
78949784f98d8046cad8ef3f085e569eadbb88cb | Update MovieDataSource.cs | OdeToCode/ngclass,OdeToCode/ngclass,OdeToCode/ngclass,OdeToCode/ngclass | AtTheMovies/AtTheMovies/Data/MovieDataSource.cs | AtTheMovies/AtTheMovies/Data/MovieDataSource.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace AtTheMovies.Data
{
public class MovieDataSource
{
static MovieDataSource()
{
_movies.Add(new Movie { Id = 1, Title = "Star Wars - A New Hope", Length = 125, ReleaseDate = new DateTime(1977, 5, 25) });
_movies.Add(new Movie { Id = 2, Title = "Star Wars - The Empire Strikes Back", Length = 127, ReleaseDate = new DateTime(1980, 5, 21) });
_movies.Add(new Movie { Id = 3, Title = "Star Wars - Return of the Jedi", Length = 136, ReleaseDate = new DateTime(1983, 5, 23) });
}
public IEnumerable<Movie> GetAll()
{
return _movies;
}
public Movie Update(Movie updatedMovie)
{
var target = _movies.SingleOrDefault(m => m.Id == updatedMovie.Id);
_movies.Remove(target);
_movies.Add(updatedMovie);
return updatedMovie;
}
public Movie GetById(int id)
{
return _movies.FirstOrDefault(m => m.Id == id);
}
static List<Movie> _movies = new List<Movie>();
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace AtTheMovies.Data
{
public class MovieDataSource
{
static MovieDataSource()
{
_movies.Add(new Movie { Id = 1, Title="Star Wars", Length = 101, ReleaseDate = new DateTime(1977, 1, 1)});
_movies.Add(new Movie { Id=2, Title="Empire Strikes Back", Length=120, ReleaseDate=new DateTime(1981, 6, 1)});
_movies.Add(new Movie { Id = 3, Title="Return of the Jedi", Length=99, ReleaseDate=new DateTime(1984, 11,1)});
}
public IEnumerable<Movie> GetAll()
{
return _movies;
}
public Movie Update(Movie updatedMovie)
{
var target = _movies.SingleOrDefault(m => m.Id == updatedMovie.Id);
_movies.Remove(target);
_movies.Add(updatedMovie);
return updatedMovie;
}
public Movie GetById(int id)
{
return _movies.FirstOrDefault(m => m.Id == id);
}
static List<Movie> _movies = new List<Movie>();
}
} | mit | C# |
0ab088b7c62363c90d21836c39b67da0e80efea3 | Allow arbitrary amount of repeated prefixes in Simple | LouisTakePILLz/ArgumentParser | ArgumentParser/Patterns/SimpleParameterPattern.cs | ArgumentParser/Patterns/SimpleParameterPattern.cs | //-----------------------------------------------------------------------
// <copyright file="SimpleParameterPattern.cs" company="LouisTakePILLz">
// Copyright © 2015 LouisTakePILLz
// <author>LouisTakePILLz</author>
// </copyright>
//-----------------------------------------------------------------------
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
namespace ArgumentParser
{
public static partial class Parser
{
#if DEBUG
private const String SIMPLE_PARAMETER_PATTERN = @"
(?<=^|\s)
(
(?<prefix>-|\+)
(?<tag>[\w\-\+]+(?<!\-))
)
(
\s+
(?<value>
(
("" (?> \\. | [^""])* "")|
(' (?> \\. | [^'])* ')|
( \\.-?| [^\-\+""'] | (?<!\s) [\-\+]+ | [\-\+]+ (?=\d|[^\-\+\w\""]|$) )+
)+
)
)?
(?=\s|$)";
#else
private const String SIMPLE_PARAMETER_PATTERN = @"(?<=^|\s)((?<prefix>-|\+)(?<tag>[\w\-\+]+(?<!\-)))(\s+(?<value>((""(?>\\.|[^""])*"")|('(?>\\.|[^'])*')|(\\.-?|[^\-\+""']|(?<!\s)[\-\+]+|[\-\+]+(?=\d|[^\-\+\w\""]|$))+)+))?(?=\s|$)";
#endif
}
}
| //-----------------------------------------------------------------------
// <copyright file="SimpleParameterPattern.cs" company="LouisTakePILLz">
// Copyright © 2015 LouisTakePILLz
// <author>LouisTakePILLz</author>
// </copyright>
//-----------------------------------------------------------------------
/* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
using System;
namespace ArgumentParser
{
public static partial class Parser
{
#if DEBUG
private const String SIMPLE_PARAMETER_PATTERN = @"
(?<=^|\s)
(
(?<prefix>-|\+)
(?<tag>(?!-)[\w\-\+]+(?<!\-))
)
(
\s+
(?<value>
(
("" (?> \\. | [^""])* "")|
(' (?> \\. | [^'])* ')|
( \\.-?| [^\-\+""'] | (?<!\s) [\-\+]+ | [\-\+]+ (?=\d|[^\-\+\w\""]|$) )+
)+
)
)?
(?=\s|$)";
#else
private const String SIMPLE_PARAMETER_PATTERN = @"(?<=^|\s)((?<prefix>-|\+)(?<tag>[\w\-\+]+(?<!\-)))(\s+(?<value>((""(?>\\.|[^""])*"")|('(?>\\.|[^'])*')|(\\.-?|[^\-\+""']|(?<!\s)[\-\+]+|[\-\+]+(?=\d|[^\-\+\w\""]|$))+)+))?(?=\s|$)";
#endif
}
}
| apache-2.0 | C# |
b4a699d0110611dbb4b807cc7e8eb63140991195 | Use concat instead of union in ordering function (as ordering should not filter items) | Dootrix/Hearts | Hearts/Extensions/CardListOrderingExtensions.cs | Hearts/Extensions/CardListOrderingExtensions.cs | using Hearts.Model;
using System.Collections.Generic;
using System.Linq;
using Hearts.Collections;
namespace Hearts.Extensions
{
public static class CardListOrderingExtensions
{
public static IEnumerable<Card> Ascending(this IEnumerable<Card> self)
{
return self.OrderBy(i => i.Kind);
}
public static IEnumerable<Card> Descending(this IEnumerable<Card> self)
{
return self.OrderByDescending(i => i.Kind);
}
public static IEnumerable<Card> TwoThenDescendingClubs(this IEnumerable<Card> self)
{
return self.Contains(Cards.TwoOfClubs)
? new List<Card> { Cards.TwoOfClubs }.Concat(self.Where(i => i.Suit == Suit.Clubs && i.Kind != Kind.Two).Descending())
: self.Clubs().Descending().ToList();
}
public static IEnumerable<Card> GroupBySuitDescending(this IEnumerable<Card> self, params Suit[] suitOrder)
{
var result = new UniqueList<Card>();
foreach (var suit in suitOrder)
{
result.AddRange(self.OfSuit(suit).Descending());
}
// Add any suits not specified
result.AddRange(self.OrderBy(i => i.Suit).ThenByDescending(_ => _.Kind));
return result;
}
public static IEnumerable<Card> GroupBySuitAscending(this IEnumerable<Card> self, params Suit[] suitOrder)
{
var result = new UniqueList<Card>();
foreach (var suit in suitOrder)
{
result.AddRange(self.OfSuit(suit).Ascending());
}
// Add any suits not specified
result.AddRange(self.OrderBy(i => i.Suit).ThenBy(_ => _.Kind));
return result;
}
}
} | using Hearts.Model;
using System.Collections.Generic;
using System.Linq;
using Hearts.Collections;
namespace Hearts.Extensions
{
public static class CardListOrderingExtensions
{
public static IEnumerable<Card> Ascending(this IEnumerable<Card> self)
{
return self.OrderBy(i => i.Kind);
}
public static IEnumerable<Card> Descending(this IEnumerable<Card> self)
{
return self.OrderByDescending(i => i.Kind);
}
public static IEnumerable<Card> TwoThenDescendingClubs(this IEnumerable<Card> self)
{
return self.Contains(Cards.TwoOfClubs)
? new List<Card> { Cards.TwoOfClubs }.Union(self.Where(i => i.Suit == Suit.Clubs && i.Kind != Kind.Two).Descending())
: self.Clubs().Descending().ToList();
}
public static IEnumerable<Card> GroupBySuitDescending(this IEnumerable<Card> self, params Suit[] suitOrder)
{
var result = new UniqueList<Card>();
foreach (var suit in suitOrder)
{
result.AddRange(self.OfSuit(suit).Descending());
}
// Add any suits not specified
result.AddRange(self.OrderBy(i => i.Suit).ThenByDescending(_ => _.Kind));
return result;
}
public static IEnumerable<Card> GroupBySuitAscending(this IEnumerable<Card> self, params Suit[] suitOrder)
{
var result = new UniqueList<Card>();
foreach (var suit in suitOrder)
{
result.AddRange(self.OfSuit(suit).Ascending());
}
// Add any suits not specified
result.AddRange(self.OrderBy(i => i.Suit).ThenBy(_ => _.Kind));
return result;
}
}
} | mit | C# |
f9f19d70517b93b04cf54d9c0d67d0ff6f39ff93 | Allow Models Builder to have correct type | bomortensen/Our.Umbraco.OpeningHours,bomortensen/Our.Umbraco.OpeningHours,bomortensen/Our.Umbraco.OpeningHours | src/Our.Umbraco.OpeningHours/Converters/OpeningHoursValueConverter.cs | src/Our.Umbraco.OpeningHours/Converters/OpeningHoursValueConverter.cs | using System;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
using Our.Umbraco.OpeningHours.Model;
namespace Our.Umbraco.OpeningHours.Converters
{
[PropertyValueType(typeof(OpeningHours))]
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class OpeningHoursValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.InvariantEquals("OpeningHours");
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
try
{
return Model.OpeningHours.Deserialize(source as string);
}
catch (Exception e)
{
LogHelper.Error<OpeningHoursValueConverter>("Error converting value", e);
}
// Create default model
return new Model.OpeningHours();
}
}
}
| using System;
using Umbraco.Core;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors;
namespace Our.Umbraco.OpeningHours.Converters
{
[PropertyValueCache(PropertyCacheValue.All, PropertyCacheLevel.Content)]
public class OpeningHoursValueConverter : PropertyValueConverterBase
{
public override bool IsConverter(PublishedPropertyType propertyType)
{
return propertyType.PropertyEditorAlias.InvariantEquals("OpeningHours");
}
public override object ConvertDataToSource(PublishedPropertyType propertyType, object source, bool preview)
{
try
{
return Model.OpeningHours.Deserialize(source as string);
}
catch (Exception e)
{
LogHelper.Error<OpeningHoursValueConverter>("Error converting value", e);
}
// Create default model
return new Model.OpeningHours();
}
}
} | mit | C# |
c9d80eb8ed998c7e98187743f52b450156d7d019 | Disable F# test. | bahram-aliyev/linq2db,bahram-aliyev/linq2db | Tests/Linq/Linq/FSharpTest.cs | Tests/Linq/Linq/FSharpTest.cs | using System;
using NUnit.Framework;
namespace Tests.Linq
{
[TestFixture]
public class FSharpTest : TestBase
{
[Test, DataContextSource]
public void LoadSingle(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadSingle(db);
}
[Test, DataContextSource]
public void LoadSingleComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadSingleComplexPerson(db);
}
[Test, DataContextSource]
public void LoadSingleDeeplyComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadSingleDeeplyComplexPerson(db);
}
[Test, DataContextSource]
public void LoadColumnOfDeeplyComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadColumnOfDeeplyComplexPerson(db);
}
[Test, DataContextSource]
public void SelectField(string context)
{
using (var db = GetDataContext(context))
FSharp.SelectTest.SelectField(db);
}
[Test, DataContextSource, Ignore("Not currently supported")]
public void SelectFieldDeeplyComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.SelectTest.SelectFieldDeeplyComplexPerson(db);
}
[Test, DataContextSource]
public void Insert1(string context)
{
using (var db = GetDataContext(context))
FSharp.InsertTest.Insert1(db);
}
[Test, DataContextSource, Ignore("It breaks following tests.")]
public void Insert2(string context)
{
using (var db = GetDataContext(context))
FSharp.InsertTest.Insert2(db);
}
}
}
| using System;
using NUnit.Framework;
namespace Tests.Linq
{
[TestFixture]
public class FSharpTest : TestBase
{
[Test, DataContextSource]
public void LoadSingle(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadSingle(db);
}
[Test, DataContextSource]
public void LoadSingleComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadSingleComplexPerson(db);
}
[Test, DataContextSource]
public void LoadSingleDeeplyComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadSingleDeeplyComplexPerson(db);
}
[Test, DataContextSource]
public void LoadColumnOfDeeplyComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.WhereTest.LoadColumnOfDeeplyComplexPerson(db);
}
[Test, DataContextSource]
public void SelectField(string context)
{
using (var db = GetDataContext(context))
FSharp.SelectTest.SelectField(db);
}
[Test, DataContextSource, Ignore("Not currently supported")]
public void SelectFieldDeeplyComplexPerson(string context)
{
using (var db = GetDataContext(context))
FSharp.SelectTest.SelectFieldDeeplyComplexPerson(db);
}
[Test, DataContextSource]
public void Insert1(string context)
{
using (var db = GetDataContext(context))
FSharp.InsertTest.Insert1(db);
}
[Test, DataContextSource]
public void Insert2(string context)
{
using (var db = GetDataContext(context))
FSharp.InsertTest.Insert2(db);
}
}
}
| mit | C# |
0afb2e977a6390585d120cc7337ef78ff5c181de | Bump to version 8 of input files | ATLASCalRatio/Extrapolation,ATLASCalRatio/Extrapolation,ATLASCalRatio/Extrapolation | GenerateMCFiles/Program.cs | GenerateMCFiles/Program.cs | using CommandLine;
using libDataAccess.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static GenerateMCFiles.GeneratorManager;
namespace GenerateMCFiles
{
/// <summary>
/// For a given set of MC files, generate output files for everything:
/// - The beta info for all MC files
/// - The efficiency plot used to calculate the propagation
/// </summary>
class Program
{
class Options : CommandLineUtils.CommonOptions
{
[Value(1, MetaName = "Datasets", Required = true, HelpText = "List of dataset names that we should process")]
public IEnumerable<string> Datasets { get; set; }
}
static void Main(string[] args)
{
// Parse the command parameters
var opt = CommandLineUtils.ParseOptions<Options>(args);
libDataAccess.Files.JobVersionNumber = 8;
// Next, for each dataset, write out the files.
foreach (var ds in opt.Datasets)
{
WriteLine($"Looking at {ds}.");
GenerateExtrapolationMCFiles(ds);
}
FutureConsole.DumpToCout();
}
}
}
| using CommandLine;
using libDataAccess.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static GenerateMCFiles.GeneratorManager;
namespace GenerateMCFiles
{
/// <summary>
/// For a given set of MC files, generate output files for everything:
/// - The beta info for all MC files
/// - The efficiency plot used to calculate the propagation
/// </summary>
class Program
{
class Options : CommandLineUtils.CommonOptions
{
[Value(1, MetaName = "Datasets", Required = true, HelpText = "List of dataset names that we should process")]
public IEnumerable<string> Datasets { get; set; }
}
static void Main(string[] args)
{
// Parse the command parameters
var opt = CommandLineUtils.ParseOptions<Options>(args);
libDataAccess.Files.JobVersionNumber = 7;
// Next, for each dataset, write out the files.
foreach (var ds in opt.Datasets)
{
WriteLine($"Looking at {ds}.");
GenerateExtrapolationMCFiles(ds);
}
FutureConsole.DumpToCout();
}
}
}
| mit | C# |
b7add348eb9b1e133df3a8e78be609e2656257d6 | add method to interface IMappingProvider | sportingsolutions/SS.Integration.Adapter,jpendlebury/SS.Integration.Adapter,jpendlebury/SS.Integration.Adapter,jpendlebury/SS.Integration.Adapter,sportingsolutions/SS.Integration.Adapter,sportingsolutions/SS.Integration.Adapter | SS.Integration.Adapter.Plugin.Model/Interface/IMappingProvider.cs | SS.Integration.Adapter.Plugin.Model/Interface/IMappingProvider.cs | //Copyright 2014 Spin Services Limited
//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 SS.Integration.Adapter.Model;
namespace SS.Integration.Adapter.Plugin.Model.Interface
{
//TODO: Move this interface to adapter and it's data model to adaptor
public interface IMappingProvider
{
MarketMapping GetMarketMapping(string marketId);
SelectionMapping GetSelectionMapping(string selectionId);
void IncrementIndex(string marketId);
void UpdateHandicapMarkets(Fixture fixture, Mapping mapping);
void AddMappingsForNewMarkets(Fixture snapshot, Mapping mapping);
void RefreshMappings(Fixture snapshot, string[] marketIds, Mapping mapping);
bool IsHandicapLineShiftedUp(Fixture fixture);
string HandicapLineIndicatorMarketId { get; }
}
}
| //Copyright 2014 Spin Services Limited
//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 SS.Integration.Adapter.Model;
namespace SS.Integration.Adapter.Plugin.Model.Interface
{
//TODO: Move this interface to adapter and it's data model to adaptor
public interface IMappingProvider
{
MarketMapping GetMarketMapping(string marketId);
SelectionMapping GetSelectionMapping(string selectionId);
void IncrementIndex(string marketId);
void UpdateHandicapMarkets(Fixture fixture, Mapping mapping);
void AddMappingsForNewMarkets(Fixture snapshot, Mapping mapping);
bool IsHandicapLineShiftedUp(Fixture fixture);
string HandicapLineIndicatorMarketId { get; }
}
}
| apache-2.0 | C# |
56ffaf8d94499662c0a63bb76000a3f8241efafc | Handle the EEInfo fault information properly. | googleprojectzero/sandbox-attacksurface-analysis-tools | NtApiDotNet/Win32/Rpc/Transport/PDU/PDUFault.cs | NtApiDotNet/Win32/Rpc/Transport/PDU/PDUFault.cs | // Copyright 2020 Google Inc. All Rights Reserved.
//
// 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.IO;
namespace NtApiDotNet.Win32.Rpc.Transport.PDU
{
internal class PDUFault : PDUBase
{
public int AllocHint { get; }
public ushort ContextId { get; }
public byte CancelCount { get; }
public int Status { get; }
public ExtendedErrorInfo? ExtendedError { get; }
public PDUFault(byte[] data) : base(PDUType.Fault)
{
MemoryStream stm = new MemoryStream(data);
BinaryReader reader = new BinaryReader(stm);
AllocHint = reader.ReadInt32();
ContextId = reader.ReadUInt16();
CancelCount = reader.ReadByte();
bool extended_error_present = reader.ReadByte() != 0;
Status = reader.ReadInt32();
reader.ReadInt32(); // Reserved.
if (extended_error_present)
{
byte[] remaining_data = reader.ReadBytes(AllocHint - 0x20);
try
{
ExtendedError = ExtendedErrorInfoDecoder.Decode(remaining_data);
}
catch (Exception)
{
}
}
}
}
}
| // Copyright 2020 Google Inc. All Rights Reserved.
//
// 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.IO;
namespace NtApiDotNet.Win32.Rpc.Transport.PDU
{
internal class PDUFault : PDUBase
{
public int AllocHint { get; }
public ushort ContextId { get; }
public byte CancelCount { get; }
public int Status { get; }
public ExtendedErrorInfo? ExtendedError { get; }
public PDUFault(byte[] data) : base(PDUType.Fault)
{
MemoryStream stm = new MemoryStream(data);
BinaryReader reader = new BinaryReader(stm);
AllocHint = reader.ReadInt32();
ContextId = reader.ReadUInt16();
CancelCount = reader.ReadByte();
bool extended_error_present = reader.ReadByte() != 0;
Status = reader.ReadInt32();
reader.ReadInt32(); // Reserved.
if (extended_error_present)
{
byte[] remaining_data = reader.ReadBytes((int)(stm.Length - stm.Position));
try
{
ExtendedError = ExtendedErrorInfoDecoder.Decode(remaining_data);
}
catch (Exception)
{
}
}
}
}
}
| apache-2.0 | C# |
c15b75e6d7e5568a62264680612cef6c53d08ca8 | Update SlimyYoyo.cs | Minesap/TheMinepack | Items/Weapons/SlimyYoyo.cs | Items/Weapons/SlimyYoyo.cs | using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using TheMinepack.Items;
namespace TheMinepack.Items.Weapons {
public class SlimyYoyo : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
texture = "TheMinepack/Items/Weapons/SlimyYoyo";
return true;
}
public override void SetDefaults()
{
item.CloneDefaults(ItemID.Code1);
item.name = "Slimy Yoyo";
item.damage = 20;
item.useTime = 22;
item.useAnimation = 22;
item.useStyle = 5;
item.channel = true;
item.melee = true;
item.knockBack = 2;
item.value = Item.sellPrice(0, 0, 50, 0);
item.rare = 1;
item.autoReuse = false;
item.shoot = mod.ProjectileType("SlimyYoyoProjectile");
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "GelatinousBar", 10);
recipe.AddIngredient(null, "YoyoString", 1);
recipe.AddTile(TileID.Solidifier);
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
| using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
using Minepack.Items;
namespace Minepack.Items.Weapons {
public class SlimyYoyo : ModItem
{
public override bool Autoload(ref string name, ref string texture, IList<EquipType> equips)
{
texture = "TheMinepack/Items/Weapons/SlimyYoyo";
return true;
}
public override void SetDefaults()
{
item.CloneDefaults(ItemID.Code1);
item.name = "Slimy Yoyo";
item.damage = 20;
item.useTime = 22;
item.useAnimation = 22;
item.useStyle = 5;
item.channel = true;
item.melee = true;
item.knockBack = 2;
item.value = Item.sellPrice(0, 0, 50, 0);
item.rare = 1;
item.autoReuse = false;
item.shoot = mod.ProjectileType("SlimyYoyoProjectile");
}
public override void AddRecipes()
{
ModRecipe recipe = new ModRecipe(mod);
recipe.AddIngredient(null, "GelatinousBar", 10);
recipe.AddIngredient(null, "YoyoString", 1);
recipe.AddTile(TileID.Solidifier);
recipe.SetResult(this);
recipe.AddRecipe();
}
}}
| mit | C# |
d1afb3821048a2823f4b626855149be17bd4a78f | Add native iif function to MsSql2012Dialect | nkreipke/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,alobakov/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,ngbrown/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,ManufacturingIntelligence/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core | src/NHibernate/Dialect/MsSql2012Dialect.cs | src/NHibernate/Dialect/MsSql2012Dialect.cs | using NHibernate.Dialect.Function;
namespace NHibernate.Dialect
{
public class MsSql2012Dialect : MsSql2008Dialect
{
public override bool SupportsSequences
{
get { return true; }
}
public override bool SupportsPooledSequences
{
get { return true; }
}
public override string GetCreateSequenceString(string sequenceName)
{
// by default sequence is created as bigint start with long.MinValue
return GetCreateSequenceString(sequenceName, 1, 1);
}
protected override string GetCreateSequenceString(string sequenceName, int initialValue, int incrementSize)
{
// by default sequence is created as bigint
return string.Format("create sequence {0} as int start with {1} increment by {2}", sequenceName, initialValue, incrementSize);
}
public override string GetDropSequenceString(string sequenceName)
{
return "drop sequence " + sequenceName;
}
public override string GetSequenceNextValString(string sequenceName)
{
return "select " + GetSelectSequenceNextValString(sequenceName) + " as seq";
}
public override string GetSelectSequenceNextValString(string sequenceName)
{
return "next value for " + sequenceName;
}
public override string QuerySequencesString
{
get { return "select name from sys.sequences"; }
}
protected override void RegisterFunctions()
{
base.RegisterFunctions();
RegisterFunction("iif", new StandardSafeSQLFunction("iif", 3));
}
}
}
| using NHibernate.Dialect.Function;
namespace NHibernate.Dialect
{
public class MsSql2012Dialect : MsSql2008Dialect
{
public override bool SupportsSequences
{
get { return true; }
}
public override bool SupportsPooledSequences
{
get { return true; }
}
public override string GetCreateSequenceString(string sequenceName)
{
// by default sequence is created as bigint start with long.MinValue
return GetCreateSequenceString(sequenceName, 1, 1);
}
protected override string GetCreateSequenceString(string sequenceName, int initialValue, int incrementSize)
{
// by default sequence is created as bigint
return string.Format("create sequence {0} as int start with {1} increment by {2}", sequenceName, initialValue, incrementSize);
}
public override string GetDropSequenceString(string sequenceName)
{
return "drop sequence " + sequenceName;
}
public override string GetSequenceNextValString(string sequenceName)
{
return "select " + GetSelectSequenceNextValString(sequenceName) + " as seq";
}
public override string GetSelectSequenceNextValString(string sequenceName)
{
return "next value for " + sequenceName;
}
public override string QuerySequencesString
{
get { return "select name from sys.sequences"; }
}
}
}
| lgpl-2.1 | C# |
7daa46584c0a97113ffc410f800cf8f939b71ff8 | Use reflection helper | nkreipke/nhibernate-core,nkreipke/nhibernate-core,nkreipke/nhibernate-core | src/NHibernate/Util/MakeQueryableHelper.cs | src/NHibernate/Util/MakeQueryableHelper.cs | using System;
using System.Collections;
using System.Linq;
using System.Reflection;
namespace NHibernate.Util
{
internal static class MakeQueryableHelper
{
private static readonly MethodInfo _implMethodDefinition =
ReflectHelper.GetMethodDefinition(() => MakeQueryableImpl<object>(null));
public static object MakeQueryable(IEnumerable enumerable, System.Type elementType)
{
return _implMethodDefinition.MakeGenericMethod(elementType).Invoke(null, new object[] { enumerable });
}
private static object MakeQueryableImpl<TElement>(IEnumerable enumerable)
{
return enumerable.Cast<TElement>().AsQueryable();
}
}
}
| using System;
using System.Collections;
using System.Linq;
using System.Reflection;
namespace NHibernate.Util
{
internal static class MakeQueryableHelper
{
private static readonly Lazy<MethodInfo> _implMethod = new Lazy<MethodInfo>(() =>
typeof(MakeQueryableHelper).GetMethod(nameof(MakeQueryableImpl), BindingFlags.Static | BindingFlags.NonPublic));
public static object MakeQueryable(IEnumerable enumerable, System.Type elementType)
{
return _implMethod.Value.MakeGenericMethod(elementType).Invoke(null, new object[] { enumerable });
}
private static object MakeQueryableImpl<TElement>(IEnumerable enumerable)
{
return enumerable.Cast<TElement>().AsQueryable();
}
}
}
| lgpl-2.1 | C# |
22b6a27746bfad6eeb0d878c4929fed0b07898d3 | Fix AW error - creating new phone number | NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework | Samples/AdventureWorksModel/Person/PersonPhone.cs | Samples/AdventureWorksModel/Person/PersonPhone.cs | using NakedObjects;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AdventureWorksModel
{
public partial class PersonPhone {
#region Injected Services
public IDomainObjectContainer Container { set; protected get; }
#endregion
#region Lifecycle methods
public void Persisting()
{
ModifiedDate = DateTime.Now;
}
#endregion
#region Title
public override string ToString() {
var t = Container.NewTitleBuilder();
t.Append(PhoneNumberType).Append(":", PhoneNumber);
return t.ToString();
}
#endregion
[NakedObjectsIgnore]
public virtual int BusinessEntityID { get; set; }
public virtual string PhoneNumber { get; set; }
[NakedObjectsIgnore]
public virtual int PhoneNumberTypeID { get; set; }
[ConcurrencyCheck]
public virtual DateTime ModifiedDate { get; set; }
[NakedObjectsIgnore]
public virtual Person Person { get; set; }
public virtual PhoneNumberType PhoneNumberType { get; set; }
}
}
| using NakedObjects;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace AdventureWorksModel
{
public partial class PersonPhone {
#region Injected Services
public IDomainObjectContainer Container { set; protected get; }
#endregion
#region Title
public override string ToString() {
var t = Container.NewTitleBuilder();
t.Append(PhoneNumberType).Append(":", PhoneNumber);
return t.ToString();
}
#endregion
[NakedObjectsIgnore]
public virtual int BusinessEntityID { get; set; }
public virtual string PhoneNumber { get; set; }
[NakedObjectsIgnore]
public virtual int PhoneNumberTypeID { get; set; }
[ConcurrencyCheck]
public virtual DateTime ModifiedDate { get; set; }
[NakedObjectsIgnore]
public virtual Person Person { get; set; }
public virtual PhoneNumberType PhoneNumberType { get; set; }
}
}
| apache-2.0 | C# |
74797b93d7f842a9a54b79699c1fb1023cbb83ec | fix release build | Microsoft/ApplicationInsights-SDK-Labs | AggregateMetrics/AggregateMetrics.Tests/AzureWebApp/SumUpGaugeTests.cs | AggregateMetrics/AggregateMetrics.Tests/AzureWebApp/SumUpGaugeTests.cs | namespace AggregateMetrics.Tests.AzureWebApp
{
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility.AggregateMetrics.AzureWebApp;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class SumUpGaugeTests
{
[TestMethod]
public void SumUpGaugeGetValueAndResetWorking()
{
SumUpGauge twoTimesPrivateBytes = new SumUpGauge("twoTimesPrivateBytes",
new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes * 2", "privateBytes", new CacheHelperTests()),
new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", new CacheHelperTests()));
PerformanceCounterFromJsonGauge privateBytes = new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", new CacheHelperTests());
MetricTelemetry expectedTelemetry = privateBytes.GetValueAndReset();
MetricTelemetry actualTelemetry = twoTimesPrivateBytes.GetValueAndReset();
// twoTimesPrivateBytes is -greater than (privateBytes * 1.85) but lower than (privateBytes * 2.15).
Assert.IsTrue((expectedTelemetry.Value * 1.85) < actualTelemetry.Value && (expectedTelemetry.Value * 2.15) > actualTelemetry.Value);
}
}
}
| namespace AggregateMetrics.Tests.AzureWebApp
{
using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Extensibility.AggregateMetrics.AzureWebApp;
using Microsoft.VisualStudio.TestTools.UnitTesting;
[TestClass]
public class SumUpGaugeTests
{
[TestMethod]
public void SumUpGaugeGetValueAndResetWorking()
{
SumUpGauge twoTimesPrivateBytes = new SumUpGauge("twoTimesPrivateBytes", new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes * 2", "privateBytes", new CacheHelperTests()), new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", new CacheHelperTests()));
PerformanceCounterFromJsonGauge privateBytes = new PerformanceCounterFromJsonGauge(@"\Process(??APP_WIN32_PROC??)\Private Bytes", "privateBytes", new CacheHelperTests());
MetricTelemetry expectedTelemetry = privateBytes.GetValueAndReset();
MetricTelemetry actualTelemetry = twoTimesPrivateBytes.GetValueAndReset();
// twoTimesPrivateBytes is -greater than (privateBytes * 1.85) but lower than (privateBytes * 2.15).
Assert.IsTrue((expectedTelemetry.Value * 1.85) < actualTelemetry.Value && (expectedTelemetry.Value * 2.15) > actualTelemetry.Value);
}
}
}
| mit | C# |
97b359630cde7b6e8753b8162ab12004acbd7a15 | add conditional compilation to fix build | tewarid/net-tools | KafkaClientTool/Program.cs | KafkaClientTool/Program.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KafkaClientTool
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
#if NETCOREAPP3_0
Application.SetHighDpiMode(HighDpiMode.SystemAware);
#endif
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace KafkaClientTool
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}
| mit | C# |
fdfe67cce86a762ef51c74701a7ee9992f227d83 | Remove unnecessary usings | Team-Code-Ninjas/SpaceBlog,Team-Code-Ninjas/SpaceBlog,Team-Code-Ninjas/SpaceBlog | SpaceBlog/SpaceBlog/Controllers/HomeController.cs | SpaceBlog/SpaceBlog/Controllers/HomeController.cs | using System.Web.Mvc;
using SpaceBlog.Models;
namespace SpaceBlog.Controllers
{
public class HomeController : Controller
{
private readonly BlogDBContext _dbContext =
new BlogDBContext();
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Title = "About";
ViewBag.ContactInfo = "Contact info:";
return View();
}
[HttpGet]
[Authorize]
public ActionResult Contact()
{
ViewBag.Title = "Contact Us";
ViewBag.Message = "Get in touch";
return View();
}
[HttpPost]
[Authorize]
public ActionResult Contact(Contact contact)
{
if (!ModelState.IsValid)
return View(contact);
_dbContext.Contacts.Add(contact);
_dbContext.SaveChanges();
return RedirectToAction("Index");
}
public ActionResult Team()
{
ViewBag.Title = "Team";
ViewBag.Message = "Our Team";
return View();
}
public ActionResult Create()
{
ViewBag.Title = "Create";
ViewBag.Message = "New Post";
return View();
}
protected override void Dispose(bool disposing)
{
_dbContext.Dispose();
}
}
} | using System.Web.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Web;
using System.Linq;
using SpaceBlog.Models;
namespace SpaceBlog.Controllers
{
public class HomeController : Controller
{
private readonly BlogDBContext _dbContext =
new BlogDBContext();
public ActionResult Index()
{
return View();
}
public ActionResult About()
{
ViewBag.Title = "About";
ViewBag.ContactInfo = "Contact info:";
return View();
}
[HttpGet]
[Authorize]
public ActionResult Contact()
{
ViewBag.Title = "Contact Us";
ViewBag.Message = "Get in touch";
return View();
}
[HttpPost]
[Authorize]
public ActionResult Contact(Contact contact)
{
if (!ModelState.IsValid)
return View(contact);
_dbContext.Contacts.Add(contact);
_dbContext.SaveChanges();
return RedirectToAction("Index");
}
public ActionResult Team()
{
ViewBag.Title = "Team";
ViewBag.Message = "Our Team";
return View();
}
public ActionResult Create()
{
ViewBag.Title = "Create";
ViewBag.Message = "New Post";
return View();
}
protected override void Dispose(bool disposing)
{
_dbContext.Dispose();
}
}
} | mit | C# |
f864f20a96c0e6cc2a37f135247167b994b1d5a7 | Add more test cases | Fody/PropertyChanged | TestAssemblies/AssemblyWithInheritance/Classes.cs | TestAssemblies/AssemblyWithInheritance/Classes.cs | using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
public abstract class BaseClass : INotifyPropertyChanged
{
public IList<string> Notifications = new List<string>();
public virtual int Property1 { get; set; }
public virtual int Property4 { get; set; }
public abstract int Property5 { get; set; }
public int Property2 => Property1 - Property5 + Property4;
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
Notifications.Add(propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
void OnProperty1Changed()
{
ReportOnChanged();
}
void OnProperty2Changed()
{
ReportOnChanged();
}
void OnProperty3Changed()
{
ReportOnChanged();
}
void OnProperty4Changed()
{
ReportOnChanged();
}
void OnProperty5Changed()
{
ReportOnChanged();
}
void ReportOnChanged([CallerMemberName] string callerMemberName = null)
{
Notifications.Add("base:" + callerMemberName);
}
}
public class DerivedClass : BaseClass
{
public override int Property1
{
get => base.Property1;
set => base.Property1 = value;
}
public override int Property4 { get; set; }
public override int Property5 { get; set; }
public int Property3 => Property1 - Property5 + Property4;
void OnProperty1Changed()
{
ReportOnChanged();
}
void OnProperty2Changed()
{
ReportOnChanged();
}
void OnProperty3Changed()
{
ReportOnChanged();
}
void OnProperty4Changed()
{
ReportOnChanged();
}
void OnProperty5Changed()
{
ReportOnChanged();
}
void ReportOnChanged([CallerMemberName] string callerMemberName = null)
{
Notifications.Add("derived:" + callerMemberName);
}
}
public class DerivedNoOverrides : BaseClass
{
public override int Property5 { get; set; }
public int Property3 => Property1 - Property5 + Property4;
void OnProperty1Changed()
{
ReportOnChanged();
}
void OnProperty2Changed()
{
ReportOnChanged();
}
void OnProperty3Changed()
{
ReportOnChanged();
}
void OnProperty4Changed()
{
ReportOnChanged();
}
void OnProperty5Changed()
{
ReportOnChanged();
}
void ReportOnChanged([CallerMemberName] string callerMemberName = null)
{
Notifications.Add("derived:" + callerMemberName);
}
} | using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
public abstract class BaseClass : INotifyPropertyChanged
{
public IList<string> Notifications = new List<string>();
public virtual int Property1 { get; set; }
public virtual int Property4 { get; set; }
public int Property2 => Property1 + Property4;
public abstract int Property5 { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string propertyName)
{
Notifications.Add(propertyName);
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
void OnProperty1Changed()
{
ReportOnChanged();
}
void OnProperty2Changed()
{
ReportOnChanged();
}
void OnProperty3Changed()
{
ReportOnChanged();
}
void OnProperty4Changed()
{
ReportOnChanged();
}
void OnProperty5Changed()
{
ReportOnChanged();
}
void ReportOnChanged([CallerMemberName] string callerMemberName = null)
{
Notifications.Add("base:" + callerMemberName);
}
}
public class DerivedClass : BaseClass
{
public override int Property1
{
get => base.Property1;
set => base.Property1 = value;
}
public override int Property4 { get; set; }
public override int Property5 { get; set; }
public int Property3 => Property1 - Property5 + Property4;
void OnProperty1Changed()
{
ReportOnChanged();
}
void OnProperty2Changed()
{
ReportOnChanged();
}
void OnProperty3Changed()
{
ReportOnChanged();
}
void OnProperty4Changed()
{
ReportOnChanged();
}
void OnProperty5Changed()
{
ReportOnChanged();
}
void ReportOnChanged([CallerMemberName] string callerMemberName = null)
{
Notifications.Add("derived:" + callerMemberName);
}
}
public class DerivedNoOverrides : BaseClass
{
public override int Property5 { get; set; }
public int Property3 => Property1 - Property5 + Property4;
void OnProperty1Changed()
{
ReportOnChanged();
}
void OnProperty2Changed()
{
ReportOnChanged();
}
void OnProperty3Changed()
{
ReportOnChanged();
}
void OnProperty4Changed()
{
ReportOnChanged();
}
void OnProperty5Changed()
{
ReportOnChanged();
}
void ReportOnChanged([CallerMemberName] string callerMemberName = null)
{
Notifications.Add("derived:" + callerMemberName);
}
} | mit | C# |
e6f5b9ad436961c9d8c9d9a6f1048d8105bb3426 | Call disconnect when application quit. | 0angelic0/dgt-net_demo,0angelic0/dgt-net_demo | unity/Assets/Scripts/DGTMainController.cs | unity/Assets/Scripts/DGTMainController.cs | using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DGTMainController : MonoBehaviour
{
public Text m_chat;
public InputField m_inputText;
void OnApplicationQuit()
{
DGTRemote.GetInstance().Disconnect();
}
void Update ()
{
DGTRemote.GetInstance ().ProcessEvents ();
}
// Use this for initialization
void Start ()
{
StartCoroutine (ConnectToServer ());
}
public IEnumerator ConnectToServer ()
{
DGTPacket.Config pc = new DGTPacket.Config ("localhost", 3456);
DGTRemote.resetGameState ();
DGTRemote gamestate = DGTRemote.GetInstance ();
gamestate.Connect (pc.host, pc.port);
gamestate.ProcessEvents ();
yield return new WaitForSeconds (0.1f);
for (int i = 0; i < 10; i++) {
if (gamestate.Connected ()) {
break;
}
if (gamestate.ConnectFailed ()) {
break;
}
gamestate.ProcessEvents ();
yield return new WaitForSeconds (i * 0.1f);
}
if (gamestate.Connected ()) {
Debug.Log ("Login Finish");
// send login
gamestate.RequestLogin ();
gamestate.mainController = this;
} else {
yield return new WaitForSeconds (5f);
Debug.Log ("Cannot connect");
}
// StartCoroutine(PingTest());
yield break;
}
public IEnumerator PingTest ()
{
int i = 0;
while (true) {
DGTRemote.GetInstance ().TryPing(i);
i++;
yield return new WaitForSeconds(3);
}
}
public void sendChat()
{
if(DGTRemote.Instance.Connected())
{
DGTRemote.Instance.RequestSendChat(m_inputText.text);
DGTRemote.Instance.RequestSendFloat(1.445f);
}
}
}
| using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class DGTMainController : MonoBehaviour
{
public Text m_chat;
public InputField m_inputText;
void Update ()
{
DGTRemote.GetInstance ().ProcessEvents ();
}
// Use this for initialization
void Start ()
{
StartCoroutine (ConnectToServer ());
}
public IEnumerator ConnectToServer ()
{
DGTPacket.Config pc = new DGTPacket.Config ("localhost", 3456);
DGTRemote.resetGameState ();
DGTRemote gamestate = DGTRemote.GetInstance ();
gamestate.Connect (pc.host, pc.port);
gamestate.ProcessEvents ();
yield return new WaitForSeconds (0.1f);
for (int i = 0; i < 10; i++) {
if (gamestate.Connected ()) {
break;
}
if (gamestate.ConnectFailed ()) {
break;
}
gamestate.ProcessEvents ();
yield return new WaitForSeconds (i * 0.1f);
}
if (gamestate.Connected ()) {
Debug.Log ("Login Finish");
// send login
gamestate.RequestLogin ();
gamestate.mainController = this;
} else {
yield return new WaitForSeconds (5f);
Debug.Log ("Cannot connect");
}
// StartCoroutine(PingTest());
yield break;
}
public IEnumerator PingTest ()
{
int i = 0;
while (true) {
DGTRemote.GetInstance ().TryPing(i);
i++;
yield return new WaitForSeconds(3);
}
}
public void sendChat()
{
if(DGTRemote.Instance.Connected())
{
DGTRemote.Instance.RequestSendChat(m_inputText.text);
DGTRemote.Instance.RequestSendFloat(1.445f);
}
}
}
| mit | C# |
f48dcbf658eee4cd81ed12fd822c1657fe3cfe63 | Tidy up [libSemVer.NET]'s [AssemblyInfo.cs] file. | McSherry/McSherry.SemanticVersioning,McSherry/libSemVer.NET | libSemVer.NET/Properties/AssemblyInfo.cs | libSemVer.NET/Properties/AssemblyInfo.cs | // Copyright (c) 2015 Liam McSherry
//
// 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.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CLSCompliantAttribute = System.CLSCompliantAttribute;
// 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("Semantic Versioning for .NET")]
[assembly: AssemblyProduct("Semantic Versioning for .NET")]
[assembly: AssemblyCopyright("Copyright 2015 © Liam McSherry")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("libSemVer.NET.Testing")]
[assembly: CLSCompliant(true)]
// We're using Semantic Versioning for the library, but this doesn't translate
// exactly to .NET versioning. To get around this, we're going to specify two
// version attributes:
//
// [AssemblyInformationalVersion]: We're using this for the "actual" (semantic)
// version number.
//
// [AssemblyVersion]: This will track the "actual" version number's
// major and minor versions. This should allow any
// patched versions to be swapped out without
// needing a recompile (e.g. you built against
// v1.0.0, but you should be able to use v1.0.1 or
// v1.0.2 without needing to recompile).
//
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0-rc.1")]
| // Copyright (c) 2015 Liam McSherry
//
// 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.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using CLSCompliantAttribute = System.CLSCompliantAttribute;
// 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("Semantic Versioning for .NET")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Semantic Versioning for .NET")]
[assembly: AssemblyCopyright("Copyright 2015 © Liam McSherry")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("libSemVer.NET.Testing")]
[assembly: CLSCompliant(true)]
// 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("8c0fd5fe-7c51-45c7-a6b6-7d73fa74588f")]
// 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("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.