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 |
|---|---|---|---|---|---|---|---|---|
10ff33ec17a2529641c4d7fa01fef24f165bd2e5 | refactor random utils | BigEggTools/PowerMode | PowerMode/Utils/RandomUtils.cs | PowerMode/Utils/RandomUtils.cs | namespace BigEgg.Tools.PowerMode.Utils
{
using System;
using System.Collections.Generic;
using System.Drawing;
public class RandomUtils
{
public static Random Random { get; } = new Random(DateTime.Now.Millisecond);
public static string NextString(IList<string> stringList)
{
return stringList[Random.Next(0, stringList.Count)];
}
public static int NextSignal()
{
return Random.Next(0, 2) == 1 ? 1 : -1;
}
public static Color NextColor()
{
var bytes = new byte[3];
Random.NextBytes(bytes);
return Color.FromArgb(bytes[0], bytes[1], bytes[2]);
}
}
}
| namespace BigEgg.Tools.PowerMode.Utils
{
using System;
using System.Collections.Generic;
using System.Drawing;
public class RandomUtils
{
private static Random random = new Random(DateTime.Now.Millisecond);
public static Random Random { get { return random; } }
public static string NextString(IList<string> stringList)
{
return stringList[random.Next(0, stringList.Count)];
}
public static int NextSignal()
{
return random.Next(0, 2) == 1 ? 1 : -1;
}
public static Color NextColor()
{
var bytes = new byte[3];
random.NextBytes(bytes);
return Color.FromArgb(bytes[0], bytes[1], bytes[2]);
}
}
}
| mit | C# |
76377305645ffeab0f769b1d2c8f58f992bdef02 | Update HeapSort.cs | natalya-k/algorithms | sort/HeapSort.cs | sort/HeapSort.cs | namespace Algorithms
{
public static class HeapSort
{
public static void Run(int[] array)
{
//индекс последнего узла, у которого есть хотя бы один потомок
int begin = array.Length / 2 - 1;
for (int i = begin; i >= 0; i--)
{
Heapify(array, array.Length, i);
}
for (int i = array.Length - 1; i >= 0; i--)
{
Swap(array, 0, i);
Heapify(array, i, 0);
}
}
private static void Heapify(int[] array, int length, int current)
{
int max = current;
int left = 2 * current + 1;
int right = left + 1;
if (left < length && array[left] > array[max])
{
max = left;
}
if (right < length && array[right] > array[max])
{
max = right;
}
if (current != max)
{
Swap(array, current, max);
//перестраивание получившегося поддерева
Heapify(array, length, max);
}
}
private static void Swap(int[] array, int i, int j)
{
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
| namespace Algorithms
{
public static class HeapSort
{
public static void Run(int[] array)
{
int begin = array.Length / 2 - 1;
for (int i = begin; i >= 0; i--)
{
Heapify(array, array.Length, i);
}
for (int i = array.Length - 1; i >= 0; i--)
{
Swap(array, 0, i);
Heapify(array, i, 0);
}
}
private static void Heapify(int[] array, int length, int current)
{
int max = current;
int left = 2 * current + 1;
int right = left + 1;
if (left < length && array[left] > array[max])
{
max = left;
}
if (right < length && array[right] > array[max])
{
max = right;
}
if (current != max)
{
Swap(array, current, max);
//перестраивание получившегося поддерева
Heapify(array, length, max);
}
}
private static void Swap(int[] array, int i, int j)
{
int temp = array[i];
array[i] = array[j];
array[j] = temp;
}
}
}
| mit | C# |
899f5ddf46d565c8e4be7cd5339de3629ef11f53 | Fix issue vertigra/NetTelebot-2.0#113 | vertigra/NetTelebot-2.0,themehrdad/NetTelebot | NetTelebot.ReplyKeyboardMarkup.TestApplication/ReplyKeyboard.cs | NetTelebot.ReplyKeyboardMarkup.TestApplication/ReplyKeyboard.cs | using NetTelebot.Type.Keyboard;
namespace NetTelebot.ReplyKeyboardMarkups.TestApplication
{
internal static class ReplyKeyboard
{
internal static ReplyKeyboardMarkup GetKeyboard()
{
KeyboardButton[] line1 =
{
new KeyboardButton {Text = "1"},
new KeyboardButton {Text = "2"},
new KeyboardButton {Text = "3"}
};
KeyboardButton[] line2 =
{
new KeyboardButton {Text = "4"},
new KeyboardButton {Text = "5"},
new KeyboardButton {Text = "6"}
};
KeyboardButton[] line3 =
{
new KeyboardButton {Text = "7"},
new KeyboardButton {Text = "8"},
new KeyboardButton {Text = "9"}
};
KeyboardButton[] line4 =
{
new KeyboardButton {Text = "Exit"},
};
KeyboardButton[][] buttons = { line1, line2, line3, line4 };
ReplyKeyboardMarkup keyboard = new ReplyKeyboardMarkup
{
Keyboard = buttons,
ResizeKeyboard = true
};
return keyboard;
}
internal static readonly ReplyKeyboardRemove ReplyKeyboardRemove = new ReplyKeyboardRemove
{
Selective = false
};
}
}
| using NetTelebot.Type.Keyboard;
namespace NetTelebot.ReplyKeyboardMarkups.TestApplication
{
internal static class ReplyKeyboard
{
internal static ReplyKeyboardMarkup GetKeyboard()
{
KeyboardButton[] line1 =
{
new KeyboardButton {Text = "1"},
new KeyboardButton {Text = "2"},
new KeyboardButton {Text = "3"}
};
KeyboardButton[] line2 =
{
new KeyboardButton {Text = "4"},
new KeyboardButton {Text = "5"},
new KeyboardButton {Text = "6"}
};
KeyboardButton[] line3 =
{
new KeyboardButton {Text = "7"},
new KeyboardButton {Text = "8"},
new KeyboardButton {Text = "9"}
};
KeyboardButton[] line4 =
{
new KeyboardButton {Text = "Exit"},
};
KeyboardButton[][] buttons = { line1, line2, line3, line4 };
ReplyKeyboardMarkup keyboard = new ReplyKeyboardMarkup
{
Keyboard = buttons,
ResizeKeyboard = true
};
return keyboard;
}
internal static ReplyKeyboardRemove ReplyKeyboardRemove = new ReplyKeyboardRemove
{
Selective = false
};
}
}
| mit | C# |
068b0f46765cb79ca1169fe3ecf313427fd1c024 | fix versions in Upgrade_20220812_ReplaceToReplaceAll | signumsoftware/framework,signumsoftware/framework | Signum.Upgrade/Upgrades/Upgrade_20220812_ReplaceToReplaceAll.cs | Signum.Upgrade/Upgrades/Upgrade_20220812_ReplaceToReplaceAll.cs | namespace Signum.Upgrade.Upgrades;
class Upgrade_20220812_ReplaceToReplaceAll : CodeUpgradeBase
{
public override string Description => "columnOptionMode: 'Replace' -> 'ReplaceAll'";
public static Regex ColumnOptionModeRegex = new Regex(@"columnOptionsMode\s*:\s*['""]Replace['""]");
public override void Execute(UpgradeContext uctx)
{
uctx.ForeachCodeFile(@"*.tsx, *.ts", file =>
{
file.Replace(ColumnOptionModeRegex, m => m.Value.Replace("Replace", "ReplaceAll"));
});
uctx.ForeachCodeFile("*.csproj", file =>
{
file.UpdateNugetReference("Microsoft.Graph", "4.36.0");
file.UpdateNugetReference("Microsoft.Identity.Client", "4.46.0");
file.UpdateNugetReference("Microsoft.NET.Test.Sdk", "17.3.0");
file.UpdateNugetReference("xunit", "2.4.2");
file.UpdateNugetReference("Selenium.WebDriver.ChromeDriver", "104.0.5112.7900");
file.UpdateNugetReference("Selenium.WebDriver", "4.4.0");
file.UpdateNugetReference("Selenium.Suppor", "4.4.0");
file.UpdateNugetReference("Npgsql", "6.0.6");
file.UpdateNugetReference("Microsoft.VisualStudio.Azure.Containers.Tools.Targets", "1.16.1");
file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.4.0");
file.UpdateNugetReference("Unofficial.Microsoft.SqlServer.Types", "5.0.0");
file.UpdateNugetReference("Microsoft.Data.SqlClient", "5.0.0");
file.UpdateNugetReference("DocumentFormat.OpenXml", "2.17.1");
file.UpdateNugetReference("Azure.Storage.Blobs", "12.13.0");
});
}
}
| namespace Signum.Upgrade.Upgrades;
class Upgrade_20220812_ReplaceToReplaceAll : CodeUpgradeBase
{
public override string Description => "columnOptionMode: 'Replace' -> 'ReplaceAll'";
public static Regex ColumnOptionModeRegex = new Regex(@"columnOptionsMode\s*:\s*['""]Replace['""]");
public override void Execute(UpgradeContext uctx)
{
uctx.ForeachCodeFile(@"*.tsx, *.ts", file =>
{
file.Replace(ColumnOptionModeRegex, m => m.Value.Replace("Replace", "ReplaceAll"));
});
uctx.ForeachCodeFile("*.csproj", file =>
{
file.UpdateNugetReference("Microsoft.Graph", "4.46.0");
file.UpdateNugetReference("Microsoft.Identity.Client", "4.46.0");
file.UpdateNugetReference("Microsoft.NET.Test.Sdk", "17.3.0");
file.UpdateNugetReference("xunit", "2.4.2");
file.UpdateNugetReference("Selenium.WebDriver.ChromeDriver", "104.0.5112.7900");
file.UpdateNugetReference("Selenium.WebDriver", "4.4.0");
file.UpdateNugetReference("Selenium.Suppor", "4.4.0");
file.UpdateNugetReference("Npgsql", "6.0.6");
file.UpdateNugetReference("Microsoft.VisualStudio.Azure.Containers.Tools.Targets", "1.16.1");
file.UpdateNugetReference("Swashbuckle.AspNetCore", "6.4.0");
file.UpdateNugetReference("Unofficial.Microsoft.SqlServer.Types", "5.0.0");
file.UpdateNugetReference("Microsoft.Data.SqlClient", "4.1.0");
});
}
}
| mit | C# |
d090e2502db68f0e366e8e31b40084de0af18dc7 | Modify ClipRect.cs to expose bug with coordinate systems when using cliprects. | eylvisaker/AgateLib | Tests/DisplayTests/ClipRect.cs | Tests/DisplayTests/ClipRect.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AgateLib;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
namespace Tests.DisplayTests
{
class ClipRect : IAgateTest
{
#region IAgateTest Members
public string Name
{
get { return "Clip Rects"; }
}
public string Category
{
get { return "Display"; }
}
public void Main(string[] args)
{
using (AgateSetup setup = new AgateSetup())
{
setup.AskUser = true;
setup.Initialize(true, false, false);
if (setup.WasCanceled)
return;
DisplayWindow wind = DisplayWindow.CreateWindowed(
"Test clip rects", 640, 480);
Color[] colors = new Color[] {
Color.Red, Color.Orange, Color.Yellow, Color.YellowGreen, Color.Green, Color.Turquoise, Color.Blue, Color.Violet, Color.Wheat, Color.White};
Surface surf = new Surface("Data/wallpaper.png");
while (wind.IsClosed == false)
{
Display.BeginFrame();
Display.Clear();
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
Display.SetClipRect(new Rectangle(5 + i * 32, 5 + j * 32, 30, 30));
surf.Draw();
}
}
int index = 0;
for (int i = 10; i < 100; i += 10)
{
Display.SetClipRect(new Rectangle(320 + i, i, 310 - i * 2, 310 - i * 2));
Display.FillRect(0,0,640,480, colors[index]);
index++;
}
Display.EndFrame();
Core.KeepAlive();
}
}
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AgateLib;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
namespace Tests.DisplayTests
{
class ClipRect:IAgateTest
{
#region IAgateTest Members
public string Name
{
get { return "Clip Rects"; }
}
public string Category
{
get { return "Display"; }
}
public void Main(string[] args)
{
using (AgateSetup setup = new AgateSetup())
{
setup.AskUser = true;
setup.Initialize(true, false, false);
if (setup.WasCanceled)
return;
DisplayWindow wind = DisplayWindow.CreateWindowed(
"Test clip rects", 640, 480);
Color[] colors = new Color[] {
Color.Red, Color.Orange, Color.Yellow, Color.YellowGreen, Color.Green, Color.Turquoise, Color.Blue, Color.Violet, Color.Wheat, Color.White};
while (wind.IsClosed == false)
{
Display.BeginFrame();
Display.Clear();
int index = 0;
for (int i = 10; i < 100; i += 10)
{
Display.SetClipRect(new Rectangle(i, i, 310 - i * 2, 310 - i * 2));
Display.FillRect(0,0,640,480, colors[index]);
index++;
}
Display.EndFrame();
Core.KeepAlive();
}
}
}
#endregion
}
}
| mit | C# |
5340e356b468665968581e5293341f92d43171bd | Fix unit test | EdAllonby/NiuNiu | NiuNiu/NiuNiu.Library.Tests/Solver/NiuNiuSolverTests.cs | NiuNiu/NiuNiu.Library.Tests/Solver/NiuNiuSolverTests.cs | using System.Configuration;
using NiuNiu.Library.Domain;
using NiuNiu.Library.Solver;
using NiuNiu.Library.Tests.Domain;
using NUnit.Framework;
namespace NiuNiu.Library.Tests.Solver
{
[TestFixture]
public class NiuNiuSolverTests
{
[Test]
public void NumbersShouldMakeModulus10()
{
Hand hand = CardCollectionHelper.AllRoyalsHand;
var solver = new HandSolver();
HandValue values = solver.Solve(hand);
Assert.IsTrue(values.IsUltimate);
}
}
} | using NiuNiu.Library.Domain;
using NiuNiu.Library.Solver;
using NiuNiu.Library.Tests.Domain;
using NUnit.Framework;
namespace NiuNiu.Library.Tests.Solver
{
[TestFixture]
public class NiuNiuSolverTests
{
[Test]
public void NumbersShouldMakeModulus10()
{
Hand hand = CardCollectionHelper.AllRoyalsHand;
var solver = new HandSolver();
HandValue values = solver.Solve(hand);
}
}
} | mit | C# |
b5af39a216a9df9cddd1ec2e9d1f48bf980ccd9c | bump version to 2.0.3 | piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker | Piwik.Tracker/Properties/AssemblyInfo.cs | Piwik.Tracker/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.3")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2")]
| bsd-3-clause | C# |
d7da15ab4ee49daa864818e8cf26a6992ba0fab3 | update version | prodot/ReCommended-Extension | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2021 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.5.3.0")]
[assembly: AssemblyFileVersion("5.5.3")] | using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2021 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.5.2.0")]
[assembly: AssemblyFileVersion("5.5.2")] | apache-2.0 | C# |
1b4604488555d2f537c6f4687a73e1b8ab0d8a53 | Remove useless method call | BenPhegan/NuGet.Extensions | NuGet.Extensions/ReferenceAnalysers/HintPathGenerator.cs | NuGet.Extensions/ReferenceAnalysers/HintPathGenerator.cs | using System;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
namespace NuGet.Extensions.ReferenceAnalysers
{
public class HintPathGenerator : IHintPathGenerator
{
public HintPathGenerator()
{}
public string ForAssembly(DirectoryInfo solutionDir, DirectoryInfo projectDir, IPackage package, string assemblyFilename)
{
var fileLocation = GetFileLocationFromPackage(package, assemblyFilename);
var newHintPathFull = Path.Combine(solutionDir.FullName, "packages", package.Id, fileLocation);
var newHintPathRelative = GetRelativePath(projectDir.FullName, newHintPathFull);
return newHintPathRelative;
}
private static String GetRelativePath(string root, string child)
{
// Validate paths.
Contract.Assert(!String.IsNullOrEmpty(root));
Contract.Assert(!String.IsNullOrEmpty(child));
// Create Uris
var rootUri = new Uri(root);
var childUri = new Uri(child);
// Get relative path.
var relativeUri = rootUri.MakeRelativeUri(childUri);
// Clean path and return.
return Uri.UnescapeDataString(relativeUri.ToString()).Replace('/', Path.DirectorySeparatorChar);
}
private string GetFileLocationFromPackage(IPackage package, string key)
{
return (from fileLocation in package.GetFiles()
where fileLocation.Path.ToLowerInvariant().EndsWith(key, StringComparison.OrdinalIgnoreCase)
select fileLocation.Path).FirstOrDefault();
}
}
} | using System;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
namespace NuGet.Extensions.ReferenceAnalysers
{
public class HintPathGenerator : IHintPathGenerator
{
public HintPathGenerator()
{}
public string ForAssembly(DirectoryInfo solutionDir, DirectoryInfo projectDir, IPackage package, string assemblyFilename)
{
var fileLocation = GetFileLocationFromPackage(package, assemblyFilename);
var newHintPathFull = Path.Combine(solutionDir.FullName, "packages", package.Id, fileLocation);
var newHintPathRelative = String.Format(GetRelativePath(projectDir.FullName, newHintPathFull));
return newHintPathRelative;
}
private static String GetRelativePath(string root, string child)
{
// Validate paths.
Contract.Assert(!String.IsNullOrEmpty(root));
Contract.Assert(!String.IsNullOrEmpty(child));
// Create Uris
var rootUri = new Uri(root);
var childUri = new Uri(child);
// Get relative path.
var relativeUri = rootUri.MakeRelativeUri(childUri);
// Clean path and return.
return Uri.UnescapeDataString(relativeUri.ToString()).Replace('/', Path.DirectorySeparatorChar);
}
private string GetFileLocationFromPackage(IPackage package, string key)
{
return (from fileLocation in package.GetFiles()
where fileLocation.Path.ToLowerInvariant().EndsWith(key, StringComparison.OrdinalIgnoreCase)
select fileLocation.Path).FirstOrDefault();
}
}
} | mit | C# |
af9a29a495bcb7e25e955c42a55e2db533967676 | Fix menu item | naoey/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,paparony03/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,default0/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,paparony03/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,naoey/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,Nabile-Rahmani/osu-framework,default0/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework | osu.Framework/Graphics/UserInterface/ContextMenuItem.cs | osu.Framework/Graphics/UserInterface/ContextMenuItem.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Framework.Graphics.UserInterface
{
public class ContextMenuItem : MenuItem
{
private readonly Container textContainer;
protected virtual Container CreateTextContainer(string title) => new Container
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new SpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
TextSize = 17,
Text = title,
}
}
};
public new float DrawWidth => textContainer.DrawWidth;
public ContextMenuItem(string title)
{
Add(textContainer = CreateTextContainer(title));
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
namespace osu.Framework.Graphics.UserInterface
{
public class ContextMenuItem : MenuItem
{
protected virtual Container CreateContentContainer() => new Container();
private readonly Container contentContainer;
public new float DrawWidth => contentContainer.DrawWidth;
public ContextMenuItem(string title)
{
Children = new Drawable[]
{
contentContainer = new Container
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new SpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
TextSize = 17,
Text = title,
},
}
}
};
}
}
}
| mit | C# |
f4fb5b850e5cb6410f25320c211bd170d5cda223 | Add description from https://github.com/JasperFx/marten/pull/1712#discussion_r563350157 | ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten,ericgreenmix/marten | src/Marten/Events/Daemon/HighWater/HighWaterStatistics.cs | src/Marten/Events/Daemon/HighWater/HighWaterStatistics.cs | using System;
namespace Marten.Events.Daemon.HighWater
{
internal class HighWaterStatistics
{
public long LastMark { get; set; }
public long HighestSequence { get; set; }
public long CurrentMark { get; set; }
public bool HasChanged => CurrentMark > LastMark;
public DateTimeOffset? LastUpdated { get; set; }
public long SafeStartMark { get; set; }
public DateTimeOffset Timestamp { get; set; }
public HighWaterStatus InterpretStatus(HighWaterStatistics previous)
{
// Postgres sequences start w/ 1 by default. So the initial state is "HighestSequence = 1".
if (HighestSequence == 1 && CurrentMark == 0) return HighWaterStatus.CaughtUp;
if (CurrentMark == HighestSequence) return HighWaterStatus.CaughtUp;
if (CurrentMark > previous.CurrentMark)
{
return HighWaterStatus.Changed;
}
return HighWaterStatus.Stale;
}
}
public enum HighWaterStatus
{
CaughtUp, // CurrentMark == HighestSequence, okay to pause
Changed, // The CurrentMark has progressed
Stale, // The CurrentMark isn't changing, but the sequence is ahead. Implies that there's some skips in the sequence
}
}
| using System;
namespace Marten.Events.Daemon.HighWater
{
internal class HighWaterStatistics
{
public long LastMark { get; set; }
public long HighestSequence { get; set; }
public long CurrentMark { get; set; }
public bool HasChanged => CurrentMark > LastMark;
public DateTimeOffset? LastUpdated { get; set; }
public long SafeStartMark { get; set; }
public DateTimeOffset Timestamp { get; set; }
public HighWaterStatus InterpretStatus(HighWaterStatistics previous)
{
if (HighestSequence == 1 && CurrentMark == 0) return HighWaterStatus.CaughtUp;
if (CurrentMark == HighestSequence) return HighWaterStatus.CaughtUp;
if (CurrentMark > previous.CurrentMark)
{
return HighWaterStatus.Changed;
}
return HighWaterStatus.Stale;
}
}
public enum HighWaterStatus
{
CaughtUp, // CurrentMark == HighestSequence, okay to pause
Changed, // The CurrentMark has progressed
Stale, // The CurrentMark isn't changing, but the sequence is ahead. Implies that there's some skips in the sequence
}
}
| mit | C# |
5f2c00bc80849f5b61b6c76398d0d8df2eb745d9 | Add doc comments for `DirectiveUsage`. | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/Microsoft.AspNetCore.Razor.Language/DirectiveUsage.cs | src/Microsoft.AspNetCore.Razor.Language/DirectiveUsage.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.
namespace Microsoft.AspNetCore.Razor.Language
{
/// <summary>
/// The way a directive can be used. The usage determines how many, and where directives can exist per file.
/// </summary>
public enum DirectiveUsage
{
/// <summary>
/// Directive can exist anywhere in the file.
/// </summary>
Unrestricted,
/// <summary>
/// Directive must exist prior to any HTML or code and have no duplicates. When importing the directive, if it is
/// <see cref="DirectiveKind.SingleLine"/>, the last occurrence of the directive is imported.
/// </summary>
FileScopedSinglyOccurring,
}
}
| // 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.
namespace Microsoft.AspNetCore.Razor.Language
{
public enum DirectiveUsage
{
Unrestricted,
FileScopedSinglyOccurring,
}
}
| apache-2.0 | C# |
800641ce9d290e10d335ca5351db44b24e290582 | use cache dir on ios | mgj/fetcher,mgj/fetcher | Fetcher.Touch/Services/FetcherRepositoryStoragePathService.cs | Fetcher.Touch/Services/FetcherRepositoryStoragePathService.cs | using artm.Fetcher.Core.Services;
using System;
using System.IO;
namespace artm.Fetcher.Touch.Services
{
public class FetcherRepositoryStoragePathService : IFetcherRepositoryStoragePathService
{
public string GetPath(string filename = "fetcher.db3")
{
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
var cache = Path.Combine(documents, "..", "Library", "Caches");
var fullPath = Path.Combine(cache, filename);
return fullPath;
}
}
}
| using artm.Fetcher.Core.Services;
namespace artm.Fetcher.Touch.Services
{
public class FetcherRepositoryStoragePathService : IFetcherRepositoryStoragePathService
{
public string GetPath(string filename = "fetcher.db3")
{
return System.IO.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), filename);
}
}
}
| apache-2.0 | C# |
f4d0bef897f7305799bd8b8573e13962970ee2c4 | Fix timing screen test crashing due to missing dependency | NeoAdonis/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,UselessToucan/osu,smoogipoo/osu,ppy/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,UselessToucan/osu,smoogipooo/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu | osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.cs | osu.Game.Tests/Visual/Editing/TestSceneTimingScreen.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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Timing;
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimingScreen : EditorClockTestScene
{
[Cached(typeof(EditorBeatmap))]
[Cached(typeof(IBeatSnapProvider))]
private readonly EditorBeatmap editorBeatmap;
public TestSceneTimingScreen()
{
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Child = new TimingScreen();
}
}
}
| // 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Timing;
namespace osu.Game.Tests.Visual.Editing
{
[TestFixture]
public class TestSceneTimingScreen : EditorClockTestScene
{
[Cached(typeof(EditorBeatmap))]
private readonly EditorBeatmap editorBeatmap;
public TestSceneTimingScreen()
{
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
}
[BackgroundDependencyLoader]
private void load()
{
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
Child = new TimingScreen();
}
}
}
| mit | C# |
18b309a195e9aea1890a726dc1c77ed1f2e7afdb | Make disposal of tracker operation idempotent | UselessToucan/osu,ppy/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,smoogipooo/osu,peppy/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,peppy/osu-new,peppy/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;
using osu.Framework.Graphics;
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 : Component
{
/// <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;
public OngoingOperationTracker()
{
AlwaysPresent = true;
}
/// <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;
// for extra safety, marshal the end of operation back to the update thread if necessary.
return new InvokeOnDisposal(() => Scheduler.Add(endOperation, false));
}
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.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
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 : Component
{
/// <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;
public OngoingOperationTracker()
{
AlwaysPresent = true;
}
/// <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;
// for extra safety, marshal the end of operation back to the update thread if necessary.
return new InvokeOnDisposal(() => Scheduler.Add(endOperation, false));
}
private void endOperation()
{
if (leasedInProgress == null)
throw new InvalidOperationException("Cannot end operation multiple times.");
leasedInProgress.Return();
leasedInProgress = null;
}
}
}
| mit | C# |
d638e0e31f5d9f615346c804fa81fcdb4094035c | Validate data types | campersau/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer | PackageExplorer/Converters/TaskShortcutVisibilityConverter.cs | PackageExplorer/Converters/TaskShortcutVisibilityConverter.cs | using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace PackageExplorer
{
public class TaskShortcutVisibilityConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if(values[0] == null)
{
if(values[1] is bool val1)
{
return val1 ? Visibility.Visible : Visibility.Collapsed;
}
}
return Visibility.Collapsed;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
| using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace PackageExplorer
{
public class TaskShortcutVisibilityConverter : IMultiValueConverter
{
#region IMultiValueConverter Members
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
var visible = values[0] == null && (bool)values[1];
return visible ? Visibility.Visible : Visibility.Collapsed;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
#endregion
}
} | mit | C# |
5a17c6fafbbf937f69b9b61a202409a876cbc0ba | change version to 1.0.0.4 | poumason/Mixpanel.Net.Client,poumason/MixpanelClientDotNet | Library/MixpanelClientDotNet/Properties/AssemblyInfo.cs | Library/MixpanelClientDotNet/Properties/AssemblyInfo.cs | using System.Resources;
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("MixpanelDotNet")]
[assembly: AssemblyDescription("Integration Mixpanel track event for Windows Universal Apps and WPF.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Pou")]
[assembly: AssemblyProduct("MixpanelDotNet")]
[assembly: AssemblyCopyright("Copyright © Pou 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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.4")]
[assembly: AssemblyFileVersion("1.0.0.4")]
| using System.Resources;
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("MixpanelDotNet")]
[assembly: AssemblyDescription("Integration Mixpanel track event for Windows Universal Apps and WPF.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Pou")]
[assembly: AssemblyProduct("MixpanelDotNet")]
[assembly: AssemblyCopyright("Copyright © Pou 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
// 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.3")]
[assembly: AssemblyFileVersion("1.0.0.3")]
| apache-2.0 | C# |
efa3a8e1aa0542abb2416f8a551f24134a64e55f | Update Program.cs | natintosh/Numerical-Methods | NumericalMethods/NewtonRaphson/NewtonRaphson/Program.cs | NumericalMethods/NewtonRaphson/NewtonRaphson/Program.cs | using System;
namespace NewtonRaphson
{
class MainClass:NumericalMethods
{
public static void Main(string[] args)
{
Double[] equation = { 5, 6, 1 };
Console.Write("Enter initial guess: ");
Double guess = Convert.ToDouble(Console.ReadLine());
NewtonRaphson newtonRaphson = new NewtonRaphson(equation, guess);
newtonRaphson.NewtonRaphsonMethod();
}
}
}
| using System;
namespace NewtonRaphson
{
class MainClass:NumericalMethods
{
public static void Main(string[] args)
{
// x^3 + 3x^2 - 3x - 4 = 0
//Double[] equation = { 1, 3, -3, -4 };
Double[] equation = { 1, 2, 1 };
Console.Write("Enter initial guess: ");
Double guess = Convert.ToDouble(Console.ReadLine());
NewtonRaphson newtonRaphson = new NewtonRaphson(equation, guess);
newtonRaphson.NewtonRaphsonMethod();
}
}
}
| mit | C# |
c1d6fd0202200b0b79f8f47b9646d921ec0fd5c7 | Resolve an issue with the FAQ / Spoiler Component where it does not open and close as intended | tommcclean/PortalCMS,tommcclean/PortalCMS,tommcclean/PortalCMS | Portal.CMS.Web/Areas/PageBuilder/Views/Page/Guest.cshtml | Portal.CMS.Web/Areas/PageBuilder/Views/Page/Guest.cshtml |
@model Portal.CMS.Entities.Entities.Page
@{
ViewBag.Title = Model.PageName;
}
<div id="page-wrapper" class="visitor">
@Html.Partial("/Areas/PageBuilder/Views/Page/_Page.cshtml", Model)
</div> | @model Portal.CMS.Entities.Entities.Page
@{
ViewBag.Title = Model.PageName;
}
<div id="page-wrapper">
@Html.Partial("/Areas/PageBuilder/Views/Page/_Page.cshtml", Model)
</div> | mit | C# |
fe9611694906fedbba709baf697874f47fbf8567 | Fix the 'CA1800: Do not cast unnecessarily' code analysis error | sbrockway/AutoFixture,sergeyshushlyapin/AutoFixture,dcastro/AutoFixture,zvirja/AutoFixture,hackle/AutoFixture,sergeyshushlyapin/AutoFixture,adamchester/AutoFixture,dcastro/AutoFixture,hackle/AutoFixture,sbrockway/AutoFixture,AutoFixture/AutoFixture,Pvlerick/AutoFixture,adamchester/AutoFixture,sean-gilliam/AutoFixture | Src/AutoFixture.xUnit.net2/CustomizeAttributeComparer.cs | Src/AutoFixture.xUnit.net2/CustomizeAttributeComparer.cs | using System.Collections.Generic;
namespace Ploeh.AutoFixture.Xunit2
{
internal class CustomizeAttributeComparer : Comparer<CustomizeAttribute>
{
public override int Compare(CustomizeAttribute x, CustomizeAttribute y)
{
var xfrozen = x is FrozenAttribute;
var yfrozen = y is FrozenAttribute;
if (xfrozen && !yfrozen)
{
return 1;
}
if (yfrozen && !xfrozen)
{
return -1;
}
return 0;
}
}
} | using System.Collections.Generic;
namespace Ploeh.AutoFixture.Xunit2
{
internal class CustomizeAttributeComparer : Comparer<CustomizeAttribute>
{
public override int Compare(CustomizeAttribute x, CustomizeAttribute y)
{
if (x is FrozenAttribute && !(y is FrozenAttribute))
{
return 1;
}
if (y is FrozenAttribute && !(x is FrozenAttribute))
{
return -1;
}
return 0;
}
}
} | mit | C# |
2b6e15c7441a0831ffeebe44e3222b5ef5a0f96c | Update MachineParts.cs | krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Construction/MachineParts.cs | UnityProject/Assets/Scripts/Construction/MachineParts.cs | using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
namespace Machines
{
[CreateAssetMenu(fileName = "MachineParts", menuName = "ScriptableObjects/MachineParts", order = 1)]
public class MachineParts : ScriptableObject
{
[Serializable]
public class MachinePartList
{
public ItemTrait itemTrait;// The machine part needed to build machine
public GameObject basicItem; //Basic item prefab used for when deconstructing mapped machines.
public int amountOfThisPart = 1; // Amount of that part
}
public GameObject machine;// Machine which will be spawned
public string NameOfCircuitBoard;
public string DescriptionOfCircuitBoard;
/// <summary>
/// If null will use the sprite on the prefab.
/// </summary>
public Sprite machineCircuitBoardSprite;
public MachinePartList[] machineParts;
}
} | using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
namespace Machines
{
[CreateAssetMenu(fileName = "MachineParts", menuName = "ScriptableObjects/MachineParts", order = 1)]
public class MachineParts : ScriptableObject
{
[Serializable]
public class MachinePartList
{
public ItemTrait itemTrait;// The machine part needed to build machine
public GameObject basicItem; //Basic item prefab used for when deconstructing mapped machines.
public int amountOfThisPart = 1; // Amount of that part
}
public GameObject machine;// Machine which will be spawned
public string NameOfCircuitBoard;
public string DescriptionOfCircuitBoard;
public Sprite machineCircuitBoardSprite;
public MachinePartList[] machineParts;
}
} | agpl-3.0 | C# |
3dfad3bc79fcdceb680aabfa363ac528ef90fcef | Remove redudant test | grokys/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,grokys/Perspex,SuperJMN/Avalonia | tests/Avalonia.Base.UnitTests/Media/GeometryGroupTests.cs | tests/Avalonia.Base.UnitTests/Media/GeometryGroupTests.cs | using Avalonia.Media;
using Xunit;
namespace Avalonia.Visuals.UnitTests.Media
{
public class GeometryGroupTests
{
[Fact]
public void Children_Should_Have_Initial_Collection()
{
var target = new GeometryGroup();
Assert.NotNull(target.Children);
}
[Fact]
public void Children_Change_Should_Raise_Changed()
{
var target = new GeometryGroup();
var children = new GeometryCollection();
target.Children = children;
var isCalled = false;
target.Changed += (s, e) => isCalled = true;
children.Add(new StreamGeometry());
Assert.True(isCalled);
}
}
}
| using Avalonia.Media;
using Xunit;
namespace Avalonia.Visuals.UnitTests.Media
{
public class GeometryGroupTests
{
[Fact]
public void Children_Should_Have_Initial_Collection()
{
var target = new GeometryGroup();
Assert.NotNull(target.Children);
}
[Fact]
public void Children_Can_Be_Set_To_Null()
{
var target = new GeometryGroup();
target.Children = null;
Assert.Null(target.Children);
}
[Fact]
public void Children_Change_Should_Raise_Changed()
{
var target = new GeometryGroup();
var children = new GeometryCollection();
target.Children = children;
var isCalled = false;
target.Changed += (s, e) => isCalled = true;
children.Add(new StreamGeometry());
Assert.True(isCalled);
}
}
}
| mit | C# |
63afa1d982c4f6cba8c44537df0364ae4b04e422 | Disable OnDialogClosed navigation for now | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs | WalletWasabi.Fluent/ViewModels/Dialogs/TestDialogViewModel.cs | using System.Windows.Input;
using ReactiveUI;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
public class TestDialogViewModel : DialogViewModelBase<bool>
{
private NavigationStateViewModel _navigationState;
private string _message;
public TestDialogViewModel(NavigationStateViewModel navigationState, string message)
{
_navigationState = navigationState;
_message = message;
CancelCommand = ReactiveCommand.Create(() => Close(false));
NextCommand = ReactiveCommand.Create(() => Close(true));
}
public string Message
{
get => _message;
set => this.RaiseAndSetIfChanged(ref _message, value);
}
public ICommand CancelCommand { get; }
public ICommand NextCommand { get; }
protected override void OnDialogClosed()
{
// TODO: Disable when using Dialog inside DialogScreenViewModel / Settings
//_navigationState.HomeScreen?.Invoke().Router.NavigateAndReset.Execute(new AddWalletPageViewModel(_navigationState));
}
public void Close()
{
// TODO: Dialog.xaml back Button binding to Close() method on base class which is protected so exception is thrown.
Close(false);
}
}
} | using System.Windows.Input;
using ReactiveUI;
namespace WalletWasabi.Fluent.ViewModels.Dialogs
{
public class TestDialogViewModel : DialogViewModelBase<bool>
{
private NavigationStateViewModel _navigationState;
private string _message;
public TestDialogViewModel(NavigationStateViewModel navigationState, string message)
{
_navigationState = navigationState;
_message = message;
CancelCommand = ReactiveCommand.Create(() => Close(false));
NextCommand = ReactiveCommand.Create(() => Close(true));
}
public string Message
{
get => _message;
set => this.RaiseAndSetIfChanged(ref _message, value);
}
public ICommand CancelCommand { get; }
public ICommand NextCommand { get; }
protected override void OnDialogClosed()
{
_navigationState.HomeScreen?.Invoke().Router.NavigateAndReset.Execute(new AddWalletPageViewModel(_navigationState));
}
public void Close()
{
// TODO: Dialog.xaml back Button binding to Close() method on base class which is protected so exception is thrown.
Close(false);
}
}
} | mit | C# |
94f637bbd40636069f71c17289ea95a0cc9710ef | Add xmldoc | naoey/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,Tom94/osu-framework,DrabWeb/osu-framework,ZLima12/osu-framework,paparony03/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,paparony03/osu-framework,default0/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,naoey/osu-framework,EVAST9919/osu-framework,Nabile-Rahmani/osu-framework,Nabile-Rahmani/osu-framework,peppy/osu-framework,peppy/osu-framework,default0/osu-framework | osu.Framework/Graphics/Shapes/Circle.cs | osu.Framework/Graphics/Shapes/Circle.cs | // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics.Shapes
{
/// <summary>
/// A simple <see cref="CircularContainer"/> with a fill using a <see cref="Box"/>. Can be coloured using the <see cref="Drawable.Colour"/> property.
/// </summary>
public class Circle : CircularContainer
{
public Circle()
{
Masking = true;
AddInternal(new Box()
{
RelativeSizeAxes = Axes.Both,
});
}
}
}
| // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Graphics.Containers;
namespace osu.Framework.Graphics.Shapes
{
public class Circle : CircularContainer
{
public Circle()
{
Masking = true;
AddInternal(new Box()
{
RelativeSizeAxes = Axes.Both,
});
}
}
}
| mit | C# |
99caf5a892df8539efd9abb63491dd4f6163a652 | Fix for #55 | Q42/Q42.HueApi | src/Q42.HueApi/Models/State.cs | src/Q42.HueApi/Models/State.cs | using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Q42.HueApi
{
[DataContract]
public class State
{
[DataMember (Name = "on")]
public bool On { get; set; }
[DataMember (Name = "bri")]
public byte Brightness { get; set; }
[DataMember (Name = "hue")]
public int? Hue { get; set; }
[DataMember (Name = "sat")]
public int? Saturation { get; set; }
[DataMember (Name = "xy")]
public double[] ColorCoordinates { get; set; }
[DataMember (Name = "ct")]
public int? ColorTemperature { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember (Name = "alert")]
public Alert Alert { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember (Name = "effect")]
public Effect? Effect { get; set; }
[DataMember (Name = "colormode")]
public string ColorMode { get; set; }
[DataMember (Name = "reachable")]
public bool IsReachable { get; set; }
public string ToHex(string model = "LCT001")
{
return HueColorConverter.HexFromState(this, model);
}
public RGBColor ToRgb(string model = "LCT001")
{
return HueColorConverter.RgbFromState(this, model);
}
}
} | using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Q42.HueApi
{
[DataContract]
public class State
{
[DataMember (Name = "on")]
public bool On { get; set; }
[DataMember (Name = "bri")]
public byte Brightness { get; set; }
[DataMember (Name = "hue")]
public int? Hue { get; set; }
[DataMember (Name = "sat")]
public int? Saturation { get; set; }
[DataMember (Name = "xy")]
public double[] ColorCoordinates { get; set; }
[DataMember (Name = "ct")]
public int? ColorTemperature { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember (Name = "alert")]
public Alert Alert { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember (Name = "effect")]
public Effect Effect { get; set; }
[DataMember (Name = "colormode")]
public string ColorMode { get; set; }
[DataMember (Name = "reachable")]
public bool IsReachable { get; set; }
public string ToHex(string model = "LCT001")
{
return HueColorConverter.HexFromState(this, model);
}
public RGBColor ToRgb(string model = "LCT001")
{
return HueColorConverter.RgbFromState(this, model);
}
}
} | mit | C# |
48129c52d676d8e33d63852031e530fe4cef6b32 | Change get-only property for now | UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,peppy/osu-new,smoogipooo/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu | osu.Game/Online/RealtimeMultiplayer/MultiplayerClientState.cs | osu.Game/Online/RealtimeMultiplayer/MultiplayerClientState.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;
#nullable enable
namespace osu.Game.Online.RealtimeMultiplayer
{
[Serializable]
public class MultiplayerClientState
{
public readonly long CurrentRoomID;
public MultiplayerClientState(in long roomId)
{
CurrentRoomID = roomId;
}
}
}
| // 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.
#nullable enable
namespace osu.Game.Online.RealtimeMultiplayer
{
public class MultiplayerClientState
{
public long CurrentRoomID { get; set; }
public MultiplayerClientState(in long roomId)
{
CurrentRoomID = roomId;
}
}
}
| mit | C# |
d81f9599a0462b270cf6988c48f66b52beab54c6 | Update AntimalwareScannerOptions.cs | tiksn/TIKSN-Framework | TIKSN.Framework.Core/Antimalware/AntimalwareScannerOptions.cs | TIKSN.Framework.Core/Antimalware/AntimalwareScannerOptions.cs | namespace TIKSN.Security.Antimalware
{
public class AntimalwareScannerOptions
{
public string ApplicationName { get; set; }
}
}
| namespace TIKSN.Security.Antimalware
{
public class AntimalwareScannerOptions
{
public string ApplicationName { get; set; }
}
} | mit | C# |
0eb05ab817e4e5e8887a82cf55497b9a19dedba5 | add debugging to HFTRouter | greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d,greggman/hft-unity3d | Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTRouter.cs | Assets/HappyFunTimes/HappyFunTimesCore/Server/HFTRouter.cs |
using System.Collections.Generic;
using WebSocketSharp.Net;
namespace HappyFunTimes
{
public delegate bool RouteHandler(string path, HttpListenerRequest req, HttpListenerResponse res);
public class HFTRouter
{
public bool Route(string path, HttpListenerRequest req, HttpListenerResponse res) {
for (int i = 0; i < handlers_.Count; ++i)
{
RouteHandler handler = handlers_[i];
//UnityEngine.Debug.Log("Route Checking: " + handler.Method.Name + " path: " + path);
if (handler(path, req, res))
{
return true;
}
}
return false; // not handled
}
public void Add(RouteHandler handler)
{
handlers_.Add(handler);
}
private List<RouteHandler> handlers_ = new List<RouteHandler>();
}
}
|
using System.Collections.Generic;
using WebSocketSharp.Net;
namespace HappyFunTimes
{
public delegate bool RouteHandler(string path, HttpListenerRequest req, HttpListenerResponse res);
public class HFTRouter
{
public bool Route(string path, HttpListenerRequest req, HttpListenerResponse res) {
for (int i = 0; i < handlers_.Count; ++i)
{
if (handlers_[i](path, req, res))
{
return true;
}
}
return false; // not handled
}
public void Add(RouteHandler handler)
{
handlers_.Add(handler);
}
private List<RouteHandler> handlers_ = new List<RouteHandler>();
}
}
| bsd-3-clause | C# |
195027f4749bd61d71c8fb69ee3eae4f82351548 | Revert "Added revision to version" | MatthiasKainer/DotNetRules.Events.Data.MongoDb,MatthiasKainer/DotNetRules.Events.Data.MongoDb,MatthiasKainer/DotNetRules.Events.Data.MongoDb | DotNetRules.Events.Data.MongoDb/Properties/AssemblyInfo.cs | DotNetRules.Events.Data.MongoDb/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("DotNetRules.Events.Data.MongoDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Matthias Kainer")]
[assembly: AssemblyProduct("DotNetRules.Events.Data.MongoDb")]
[assembly: AssemblyCopyright("Copyright © Matthias Kainer 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("b5b202d3-c64a-4520-91cf-bb357b8bf52e")]
// 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.*")]
[assembly: AssemblyFileVersion("1.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("DotNetRules.Events.Data.MongoDb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Matthias Kainer")]
[assembly: AssemblyProduct("DotNetRules.Events.Data.MongoDb")]
[assembly: AssemblyCopyright("Copyright © Matthias Kainer 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("b5b202d3-c64a-4520-91cf-bb357b8bf52e")]
// 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.*.*")]
[assembly: AssemblyFileVersion("1.0.*.*")]
| mit | C# |
249472483af491842ed76c9ffbea1f439ab50c9e | Revert PropertyBuilder | InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform,InfinniPlatform/InfinniPlatform | InfinniPlatform.Core/Json/EventBuilders/PropertyBuilder.cs | InfinniPlatform.Core/Json/EventBuilders/PropertyBuilder.cs | using System;
using System.Linq;
using InfinniPlatform.Sdk.Events;
using Newtonsoft.Json.Linq;
namespace InfinniPlatform.Json.EventBuilders
{
public class PropertyBuilder : IJsonObjectBuilder
{
public void BuildJObject(JToken backboneObject, EventDefinition eventDefinition)
{
var parent = GetParent(backboneObject, eventDefinition);
if (parent == null)
{
throw new ArgumentException("object to apply event is not defined");
}
var ownerProperty = parent is JObject ? parent as JObject : parent.First() as JObject;
if (ownerProperty == null)
{
throw new ArgumentException("specified json object is not an object.");
}
UpdateProperty(GetPropertyName(eventDefinition.Property), ownerProperty, eventDefinition.Value);
}
private string GetPropertyName(string property)
{
return property.Split('.').LastOrDefault();
}
private void UpdateProperty(string propertyName, JObject parentObject, dynamic value)
{
var prop = parentObject.Properties().FirstOrDefault(p => p.Name == propertyName);
if (prop != null)
{
prop.Value = value is JValue
? ((JValue)value).Value
: value;
}
else
{
parentObject.Add(propertyName, value);
}
}
private JToken GetParent(JToken startObject, EventDefinition eventDefinition)
{
var path = eventDefinition.Property.Split('.');
if (path.Count() == 1)
{
return startObject;
}
return
new JsonParser().FindJsonToken(startObject, string.Join(".", path.Take(path.Count() - 1)))
.FirstOrDefault();
}
}
} | using System;
using System.Linq;
using InfinniPlatform.Sdk.Events;
using Newtonsoft.Json.Linq;
namespace InfinniPlatform.Json.EventBuilders
{
public class PropertyBuilder : IJsonObjectBuilder
{
public void BuildJObject(JToken backboneObject, EventDefinition eventDefinition)
{
var parent = GetParent(backboneObject, eventDefinition);
if (parent == null)
{
throw new ArgumentException("object to apply event is not defined");
}
var ownerProperty = parent is JObject ? parent as JObject : parent.First() as JObject;
if (ownerProperty == null)
{
throw new ArgumentException("specified json object is not an object.");
}
UpdateProperty(GetPropertyName(eventDefinition.Property), ownerProperty, eventDefinition.Value);
}
private string GetPropertyName(string property)
{
return property.Split('.').LastOrDefault();
}
private void UpdateProperty(string propertyName, JObject parentObject, object value)
{
var prop = parentObject.Properties().FirstOrDefault(p => p.Name == propertyName);
if (prop != null)
{
prop.Value = (JToken)((value is JValue) ? ((JValue)value).Value : value);
}
else
{
parentObject.Add(propertyName, (JToken)value);
}
}
private JToken GetParent(JToken startObject, EventDefinition eventDefinition)
{
var path = eventDefinition.Property.Split('.');
if (path.Count() == 1)
{
return startObject;
}
return
new JsonParser().FindJsonToken(startObject, string.Join(".", path.Take(path.Count() - 1)))
.FirstOrDefault();
}
}
} | agpl-3.0 | C# |
4cbce2fda399775daed8641fa36955db0a97a09b | Update ConfigureWebHostDefaults comments (#32025) | aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore | src/DefaultBuilder/src/GenericHostBuilderExtensions.cs | src/DefaultBuilder/src/GenericHostBuilderExtensions.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 Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore;
namespace Microsoft.Extensions.Hosting
{
/// <summary>
/// Extension methods for configuring the <see cref="IHostBuilder" />.
/// </summary>
public static class GenericHostBuilderExtensions
{
/// <summary>
/// Configures a <see cref="IHostBuilder" /> with defaults for hosting a web app. This should be called
/// before application specific configuration to avoid it overwriting provided services, configuration sources,
/// environments, content root, etc.
/// </summary>
/// <remarks>
/// The following defaults are applied to the <see cref="IHostBuilder"/>:
/// <list type="bullet">
/// <item><description>use Kestrel as the web server and configure it using the application's configuration providers</description></item>
/// <item><description>configure <see cref="IWebHostEnvironment.WebRootFileProvider"/> to include static web assets from projects referenced by the entry assembly during development</description></item>
/// <item><description>adds the HostFiltering middleware</description></item>
/// <item><description>adds the ForwardedHeaders middleware if ASPNETCORE_FORWARDEDHEADERS_ENABLED=true,</description></item>
/// <item><description>enable IIS integration</description></item>
/// </list>
/// </remarks>
/// <param name="builder">The <see cref="IHostBuilder" /> instance to configure.</param>
/// <param name="configure">The configure callback</param>
/// <returns>A reference to the <paramref name="builder"/> after the operation has completed.</returns>
public static IHostBuilder ConfigureWebHostDefaults(this IHostBuilder builder, Action<IWebHostBuilder> configure)
{
if (configure is null)
{
throw new ArgumentNullException(nameof(configure));
}
return builder.ConfigureWebHost(webHostBuilder =>
{
WebHost.ConfigureWebDefaults(webHostBuilder);
configure(webHostBuilder);
});
}
}
}
| // 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 Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore;
namespace Microsoft.Extensions.Hosting
{
/// <summary>
/// Extension methods for configuring the <see cref="IHostBuilder" />.
/// </summary>
public static class GenericHostBuilderExtensions
{
/// <summary>
/// Configures a <see cref="IHostBuilder" /> with defaults for hosting a web app.
/// </summary>
/// <remarks>
/// The following defaults are applied to the <see cref="IHostBuilder"/>:
/// <list type="bullet">
/// <item><description>use Kestrel as the web server and configure it using the application's configuration providers</description></item>
/// <item><description>configure <see cref="IWebHostEnvironment.WebRootFileProvider"/> to include static web assets from projects referenced by the entry assembly during development</description></item>
/// <item><description>adds the HostFiltering middleware</description></item>
/// <item><description>adds the ForwardedHeaders middleware if ASPNETCORE_FORWARDEDHEADERS_ENABLED=true,</description></item>
/// <item><description>enable IIS integration</description></item>
/// </list>
/// </remarks>
/// <param name="builder">The <see cref="IHostBuilder" /> instance to configure.</param>
/// <param name="configure">The configure callback</param>
/// <returns>A reference to the <paramref name="builder"/> after the operation has completed.</returns>
public static IHostBuilder ConfigureWebHostDefaults(this IHostBuilder builder, Action<IWebHostBuilder> configure)
{
if (configure is null)
{
throw new ArgumentNullException(nameof(configure));
}
return builder.ConfigureWebHost(webHostBuilder =>
{
WebHost.ConfigureWebDefaults(webHostBuilder);
configure(webHostBuilder);
});
}
}
}
| apache-2.0 | C# |
e37912eec792bf96b2347660618efcb62b99b88a | Update version | FreedomMercenary/Elmah.AzureTableStorage,LionLai/Elmah.AzureTableStorage,MisinformedDNA/Elmah.AzureTableStorage | src/Elmah.AzureTableStorage/Properties/AssemblyInfo.cs | src/Elmah.AzureTableStorage/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("ELMAH on Azure Table Storage")]
[assembly: AssemblyDescription("ELMAH with configuration for getting started quickly on Azure Table Storage as the error log.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dan Friedman, Dragon Door Publications")]
[assembly: AssemblyProduct("ELMAH on Azure Table Storage")]
[assembly: AssemblyCopyright("Copyright © 2013. All rights reserved.")]
[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("9bff690b-8426-4e8a-8a93-5a2055b1f410")]
// 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.5.1.0")]
[assembly: AssemblyFileVersion("0.5.1.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("ELMAH on Azure Table Storage")]
[assembly: AssemblyDescription("ELMAH with configuration for getting started quickly on Azure Table Storage as the error log.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Dan Friedman, Dragon Door Publications")]
[assembly: AssemblyProduct("ELMAH on Azure Table Storage")]
[assembly: AssemblyCopyright("Copyright © 2013. All rights reserved.")]
[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("9bff690b-8426-4e8a-8a93-5a2055b1f410")]
// 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.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]
| apache-2.0 | C# |
35de2e3a3e97fe649c7861042afc25506b811454 | Remove unused ParsedArgumentExpression.Value property | FakeItEasy/FakeItEasy,thomaslevesque/FakeItEasy,adamralph/FakeItEasy,thomaslevesque/FakeItEasy,blairconrad/FakeItEasy,adamralph/FakeItEasy,FakeItEasy/FakeItEasy,blairconrad/FakeItEasy | src/FakeItEasy/Expressions/ParsedArgumentExpression.cs | src/FakeItEasy/Expressions/ParsedArgumentExpression.cs | namespace FakeItEasy.Expressions
{
using System.Linq.Expressions;
using System.Reflection;
internal class ParsedArgumentExpression
{
public ParsedArgumentExpression(Expression expression, ParameterInfo argumentInformation)
{
this.Expression = expression;
this.ArgumentInformation = argumentInformation;
}
public Expression Expression { get; }
public ParameterInfo ArgumentInformation { get; }
}
}
| namespace FakeItEasy.Expressions
{
using System.Linq.Expressions;
using System.Reflection;
internal class ParsedArgumentExpression
{
public ParsedArgumentExpression(Expression expression, ParameterInfo argumentInformation)
{
this.Expression = expression;
this.ArgumentInformation = argumentInformation;
}
public Expression Expression { get; }
public object Value => this.Expression.Evaluate();
public ParameterInfo ArgumentInformation { get; }
}
}
| mit | C# |
55b79e827ce6ded27669897e4dd1095ccf11f4c9 | Update to use new ArchiveManager methods | SkeptiForum/facebook-archive,SkeptiForum/facebook-archive,SkeptiForum/facebook-archive | Website/Controllers/ThreadsController.cs | Website/Controllers/ThreadsController.cs | /*==============================================================================================================================
| Author Jeremy Caney (Jeremy@Caney.net)
| Client Skepti-Forum Project
| Project Forum Archive
\=============================================================================================================================*/
using System;
using System.Web.Mvc;
using Newtonsoft.Json.Linq;
using System.Threading.Tasks;
namespace SkeptiForum.Archive.Controllers {
/*============================================================================================================================
| CLASS: THREADS CONTROLLER
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to individual threads via the routing rules established in the
/// <see cref="SkeptiForum.Archive.Web.RouteConfig"/> class.
/// </summary>
public class ThreadsController : Controller {
/*==========================================================================================================================
| GET: /GROUPS/5/PERMALINK/5/
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to a specific JSON file previously archived on the server via the Facebook Graph API.
/// </summary>
/// <remarks>
/// <para>
/// Provides a view model containing basic metadata necessary for the rendering of the server-side view (which, namely,
/// includes metadata for search engines and Facebook's Open Graph schema.
/// </para>
/// <para>
/// Note: If the associated JSON file cannot be found, the view will redirect to the corresponding URL on Facebook.
/// This may happen because the thread hasn't yet been indexed. It may also occur, however, if the IDs provided
/// are invalid. In the latter case, Facebook will notify the user that this is the case by displaying an error.
/// </para>
/// </remarks>
/// <returns>A view containing all details of the requested current thread.</returns>
public async Task<ActionResult> Details(long groupId, long postId = 0) {
/*------------------------------------------------------------------------------------------------------------------------
| Validate group Id
\-----------------------------------------------------------------------------------------------------------------------*/
if (groupId < 1 || !ArchiveManager.Groups.Contains(groupId)) {
return HttpNotFound("A group with the ID '" + groupId + "' does not exist.");
}
/*------------------------------------------------------------------------------------------------------------------------
| If the post doesn't exist in the archive, redirect to Facebook
\-----------------------------------------------------------------------------------------------------------------------*/
if (!await ArchiveManager.StorageProvider.PostExistsAsync(groupId, postId)) {
return Redirect("https://www.facebook.com/groups/" + groupId + "/permalink/" + postId);
}
/*------------------------------------------------------------------------------------------------------------------------
| Retreive post
\-----------------------------------------------------------------------------------------------------------------------*/
dynamic json = await ArchiveManager.StorageProvider.GetPostAsync(groupId, postId);
/*------------------------------------------------------------------------------------------------------------------------
| Provide preprocessing of variables required by the view
\-----------------------------------------------------------------------------------------------------------------------*/
FacebookPost post = new FacebookPost(json);
/*------------------------------------------------------------------------------------------------------------------------
| Return data to view
\-----------------------------------------------------------------------------------------------------------------------*/
return View(post);
}
} //Class
} //Namespace | /*==============================================================================================================================
| Author Jeremy Caney (Jeremy@Caney.net)
| Client Skepti-Forum Project
| Project Forum Archive
\=============================================================================================================================*/
using System;
using System.Web.Mvc;
using Newtonsoft.Json.Linq;
namespace SkeptiForum.Archive.Controllers {
/*============================================================================================================================
| CLASS: THREADS CONTROLLER
\---------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to individual threads via the routing rules established in the
/// <see cref="SkeptiForum.Archive.Web.RouteConfig"/> class.
/// </summary>
public class ThreadsController : Controller {
/*==========================================================================================================================
| GET: /GROUPS/5/PERMALINK/5/
\-------------------------------------------------------------------------------------------------------------------------*/
/// <summary>
/// Provides access to a specific JSON file previously archived on the server via the Facebook Graph API.
/// </summary>
/// <remarks>
/// <para>
/// Provides a view model containing basic metadata necessary for the rendering of the server-side view (which, namely,
/// includes metadata for search engines and Facebook's Open Graph schema.
/// </para>
/// <para>
/// Note: If the associated JSON file cannot be found, the view will redirect to the corresponding URL on Facebook.
/// This may happen because the thread hasn't yet been indexed. It may also occur, however, if the IDs provided
/// are invalid. In the latter case, Facebook will notify the user that this is the case by displaying an error.
/// </para>
/// </remarks>
/// <returns>A view containing all details of the requested current thread.</returns>
public ActionResult Details(long groupId, long postId = 0) {
/*------------------------------------------------------------------------------------------------------------------------
| Establish variables
\-----------------------------------------------------------------------------------------------------------------------*/
var jsonPath = Server.MapPath("/Archives/" + groupId + "/" + groupId + "_" + postId + ".json");
/*------------------------------------------------------------------------------------------------------------------------
| Validate group Id
\-----------------------------------------------------------------------------------------------------------------------*/
if (groupId < 1 || !System.IO.Directory.Exists(Server.MapPath("/Archives/" + groupId))) {
return HttpNotFound("A group with the ID '" + groupId + "' does not exist.");
}
/*------------------------------------------------------------------------------------------------------------------------
| If the post doesn't exist in the archive, redirect to Facebook
\-----------------------------------------------------------------------------------------------------------------------*/
if (postId > 0 && !System.IO.File.Exists(jsonPath)) {
//return HttpNotFound("A post with the name '" + postId + "' does not exist. If it is a newer post, it may not have been archived yet.");
return Redirect("https://www.facebook.com/groups/" + groupId + "/permalink/" + postId);
}
dynamic json = JObject.Parse(System.IO.File.ReadAllText(jsonPath));
/*------------------------------------------------------------------------------------------------------------------------
| Provide preprocessing of variables required by the view
\-----------------------------------------------------------------------------------------------------------------------*/
FacebookPost post = new FacebookPost(json);
/*------------------------------------------------------------------------------------------------------------------------
| Return data to view
\-----------------------------------------------------------------------------------------------------------------------*/
return View(post);
}
} //Class
} //Namespace | mit | C# |
c1e795c2fa7138ab92f49c1e51b8809e1ea19764 | remove commented code from org tests | gregsdennis/Manatee.Json,gregsdennis/Manatee.Json | Manatee.Json.Tests/JsonOrgTests.cs | Manatee.Json.Tests/JsonOrgTests.cs | using System;
using System.Net;
using NUnit.Framework;
namespace Manatee.Json.Tests
{
[TestFixture]
public class JsonOrgTests
{
[Test]
public void JsonCheckerTest()
{
var text = new WebClient().DownloadString("http://www.json.org/JSON_checker/test/pass1.json");
Console.WriteLine($"{text}\n");
// Just make sure the parser doesn't fail.
var json = JsonValue.Parse(text);
Console.WriteLine(json);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
namespace Manatee.Json.Tests
{
[TestFixture]
public class JsonOrgTests
{
[Test]
//[Ignore("not ready yet.")]
public void JsonCheckerTest()
{
var text = new WebClient().DownloadString("http://www.json.org/JSON_checker/test/pass1.json");
Console.WriteLine($"{text}\n");
// Just make sure the parser doesn't fail.
var json = JsonValue.Parse(text);
Console.WriteLine(json);
}
}
}
| mit | C# |
5f01ebcfa7e5841f6c74d1f36975584072c887b8 | Check for null dependencies | feanz/Thinktecture.IdentityServer.v3,tonyeung/IdentityServer3,delloncba/IdentityServer3,mvalipour/IdentityServer3,codeice/IdentityServer3,jackswei/IdentityServer3,paulofoliveira/IdentityServer3,EternalXw/IdentityServer3,bodell/IdentityServer3,tuyndv/IdentityServer3,openbizgit/IdentityServer3,bestwpw/IdentityServer3,wondertrap/IdentityServer3,EternalXw/IdentityServer3,roflkins/IdentityServer3,kouweizhong/IdentityServer3,tonyeung/IdentityServer3,uoko-J-Go/IdentityServer,johnkors/Thinktecture.IdentityServer.v3,IdentityServer/IdentityServer3,yanjustino/IdentityServer3,faithword/IdentityServer3,olohmann/IdentityServer3,SonOfSam/IdentityServer3,mvalipour/IdentityServer3,AscendXYZ/Thinktecture.IdentityServer.v3,tbitowner/IdentityServer3,kouweizhong/IdentityServer3,codeice/IdentityServer3,tuyndv/IdentityServer3,remunda/IdentityServer3,uoko-J-Go/IdentityServer,SonOfSam/IdentityServer3,bodell/IdentityServer3,olohmann/IdentityServer3,SonOfSam/IdentityServer3,wondertrap/IdentityServer3,delloncba/IdentityServer3,buddhike/IdentityServer3,AscendXYZ/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,iamkoch/IdentityServer3,Agrando/IdentityServer3,chicoribas/IdentityServer3,openbizgit/IdentityServer3,huoxudong125/Thinktecture.IdentityServer.v3,buddhike/IdentityServer3,buddhike/IdentityServer3,mvalipour/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,charoco/IdentityServer3,bodell/IdentityServer3,tbitowner/IdentityServer3,paulofoliveira/IdentityServer3,roflkins/IdentityServer3,jackswei/IdentityServer3,kouweizhong/IdentityServer3,jonathankarsh/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,18098924759/IdentityServer3,Agrando/IdentityServer3,Agrando/IdentityServer3,olohmann/IdentityServer3,iamkoch/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,huoxudong125/Thinktecture.IdentityServer.v3,remunda/IdentityServer3,faithword/IdentityServer3,paulofoliveira/IdentityServer3,openbizgit/IdentityServer3,angelapper/IdentityServer3,faithword/IdentityServer3,charoco/IdentityServer3,angelapper/IdentityServer3,chicoribas/IdentityServer3,maz100/Thinktecture.IdentityServer.v3,ryanvgates/IdentityServer3,18098924759/IdentityServer3,jonathankarsh/IdentityServer3,tuyndv/IdentityServer3,delloncba/IdentityServer3,tonyeung/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,yanjustino/IdentityServer3,tbitowner/IdentityServer3,delRyan/IdentityServer3,ryanvgates/IdentityServer3,jackswei/IdentityServer3,yanjustino/IdentityServer3,18098924759/IdentityServer3,bestwpw/IdentityServer3,IdentityServer/IdentityServer3,delRyan/IdentityServer3,feanz/Thinktecture.IdentityServer.v3,EternalXw/IdentityServer3,bestwpw/IdentityServer3,johnkors/Thinktecture.IdentityServer.v3,angelapper/IdentityServer3,iamkoch/IdentityServer3,charoco/IdentityServer3,delRyan/IdentityServer3,IdentityServer/IdentityServer3,roflkins/IdentityServer3,codeice/IdentityServer3,jonathankarsh/IdentityServer3,remunda/IdentityServer3,ryanvgates/IdentityServer3,wondertrap/IdentityServer3,uoko-J-Go/IdentityServer,chicoribas/IdentityServer3 | source/WsFed/Configuration/WsFederationPluginOptions.cs | source/WsFed/Configuration/WsFederationPluginOptions.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Configuration;
using Thinktecture.IdentityServer.WsFed.Services;
namespace Thinktecture.IdentityServer.WsFed.Configuration
{
public class WsFederationPluginOptions
{
PluginDependencies _dependencies;
public WsFederationPluginOptions(PluginDependencies dependencies)
{
if (dependencies == null)
{
throw new ArgumentNullException("dependencies");
}
_dependencies = dependencies;
}
public const string WsFedCookieAuthenticationType = "WsFedSignInOut";
public PluginDependencies Dependencies
{
get
{
return _dependencies;
}
}
public Func<IRelyingPartyService> RelyingPartyService { get; set; }
public bool EnabledFederationMetadata { get; set; }
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Thinktecture.IdentityServer.Core.Configuration;
using Thinktecture.IdentityServer.WsFed.Services;
namespace Thinktecture.IdentityServer.WsFed.Configuration
{
public class WsFederationPluginOptions
{
PluginDependencies _dependencies;
public WsFederationPluginOptions(PluginDependencies dependencies)
{
_dependencies = dependencies;
}
public const string WsFedCookieAuthenticationType = "WsFedSignInOut";
public PluginDependencies Dependencies
{
get
{
return _dependencies;
}
}
public Func<IRelyingPartyService> RelyingPartyService { get; set; }
public bool EnabledFederationMetadata { get; set; }
}
} | apache-2.0 | C# |
d68adbaa0616e8ff291212153114773896e620ab | Sort quotes by date descending. | Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW | MitternachtWeb/Areas/Guild/Controllers/QuotesController.cs | MitternachtWeb/Areas/Guild/Controllers/QuotesController.cs | using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Mitternacht.Services;
using MitternachtWeb.Areas.Guild.Models;
using System.Linq;
namespace MitternachtWeb.Areas.Guild.Controllers {
[Authorize]
[Area("Guild")]
public class QuotesController : GuildBaseController {
private readonly DbService _db;
public QuotesController(DbService db) {
_db = db;
}
public IActionResult Index() {
if(PermissionReadQuotes) {
using var uow = _db.UnitOfWork;
var quotes = uow.Quotes.GetAllForGuild(GuildId).OrderByDescending(q => q.DateAdded).ToList().Select(q => {
var user = Guild.GetUser(q.AuthorId);
return new Quote {
Id = q.Id,
AuthorId = q.AuthorId,
Authorname = user?.ToString() ?? uow.UsernameHistory.GetUsernamesDescending(q.AuthorId).FirstOrDefault()?.ToString() ?? q.AuthorName ?? "-",
AvatarUrl = user?.GetAvatarUrl() ?? user?.GetDefaultAvatarUrl(),
Keyword = q.Keyword,
Text = q.Text,
AddedAt = q.DateAdded,
};
}).ToList();
return View(quotes);
} else {
return Unauthorized();
}
}
public IActionResult Delete(int id) {
if(PermissionWriteQuotes) {
using var uow = _db.UnitOfWork;
var quote = uow.Quotes.Get(id);
if(quote != null && quote.GuildId == GuildId) {
uow.Quotes.Remove(quote);
uow.SaveChanges();
return RedirectToAction("Index");
} else {
return NotFound();
}
} else {
return Unauthorized();
}
}
}
}
| using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Mitternacht.Services;
using MitternachtWeb.Areas.Guild.Models;
using System.Linq;
namespace MitternachtWeb.Areas.Guild.Controllers {
[Authorize]
[Area("Guild")]
public class QuotesController : GuildBaseController {
private readonly DbService _db;
public QuotesController(DbService db) {
_db = db;
}
public IActionResult Index() {
if(PermissionReadQuotes) {
using var uow = _db.UnitOfWork;
var quotes = uow.Quotes.GetAllForGuild(GuildId).ToList().Select(q => {
var user = Guild.GetUser(q.AuthorId);
return new Quote {
Id = q.Id,
AuthorId = q.AuthorId,
Authorname = user?.ToString() ?? uow.UsernameHistory.GetUsernamesDescending(q.AuthorId).FirstOrDefault()?.ToString() ?? q.AuthorName ?? "-",
AvatarUrl = user?.GetAvatarUrl() ?? user?.GetDefaultAvatarUrl(),
Keyword = q.Keyword,
Text = q.Text,
AddedAt = q.DateAdded,
};
}).ToList();
return View(quotes);
} else {
return Unauthorized();
}
}
public IActionResult Delete(int id) {
if(PermissionWriteQuotes) {
using var uow = _db.UnitOfWork;
var quote = uow.Quotes.Get(id);
if(quote != null && quote.GuildId == GuildId) {
uow.Quotes.Remove(quote);
uow.SaveChanges();
return RedirectToAction("Index");
} else {
return NotFound();
}
} else {
return Unauthorized();
}
}
}
}
| mit | C# |
773a39f8322a590360f335b5c26af3a2b979c8d7 | Remove unnecessary assignment | Weingartner/SolidworksAddinFramework | SolidworksAddinFramework/OpenGl/Animation/MultiAnimator.cs | SolidworksAddinFramework/OpenGl/Animation/MultiAnimator.cs | using System;
using System.Collections.Immutable;
using System.Linq;
using JetBrains.Annotations;
namespace SolidworksAddinFramework.OpenGl.Animation
{
public sealed class MultiAnimator : AnimatorBase
{
private readonly ImmutableList<AnimatorBase> _Animators;
private DateTime _ReferenceTime;
public override TimeSpan Duration => _Animators.Aggregate(TimeSpan.Zero, (sum, a) => sum + a.Duration);
public override ImmutableList<IAnimationSection> Sections => _Animators.SelectMany(a => a.Sections).ToImmutableList();
public MultiAnimator([NotNull] ImmutableList<AnimatorBase> animators)
{
if (animators == null) throw new ArgumentNullException(nameof(animators));
_Animators = animators;
}
public override void OnStart(DateTime startTime)
{
if (_Animators.Count == 0) return;
_ReferenceTime = startTime;
var animatorStartTime = _ReferenceTime;
foreach (var animator in _Animators)
{
animator.OnStart(animatorStartTime);
animatorStartTime += animator.Duration;
}
}
public override void Render(DateTime now)
{
if (_Animators.Count == 0) return;
var passedTime = now - _ReferenceTime;
var value = (passedTime.TotalMilliseconds % Duration.TotalMilliseconds) / Duration.TotalMilliseconds;
var time = TimeSpan.FromMilliseconds(Duration.TotalMilliseconds * value);
FindAnimator(time).Render(_ReferenceTime + time);
}
private AnimatorBase FindAnimator(TimeSpan time)
{
var duration = TimeSpan.Zero;
foreach (var animator in _Animators)
{
duration += animator.Duration;
if (duration > time)
{
return animator;
}
}
return _Animators.Last();
}
}
} | using System;
using System.Collections.Immutable;
using System.Linq;
using JetBrains.Annotations;
namespace SolidworksAddinFramework.OpenGl.Animation
{
public sealed class MultiAnimator : AnimatorBase
{
private readonly ImmutableList<AnimatorBase> _Animators;
private DateTime _ReferenceTime;
public override TimeSpan Duration => _Animators.Aggregate(TimeSpan.Zero, (sum, a) => sum + a.Duration);
public override ImmutableList<IAnimationSection> Sections => _Animators.SelectMany(a => a.Sections).ToImmutableList();
public MultiAnimator([NotNull] ImmutableList<AnimatorBase> animators)
{
if (animators == null) throw new ArgumentNullException(nameof(animators));
_Animators = animators;
}
public override void OnStart(DateTime startTime)
{
if (_Animators.Count == 0) return;
_ReferenceTime = startTime;
var animatorStartTime = _ReferenceTime = startTime;
foreach (var animator in _Animators)
{
animator.OnStart(animatorStartTime);
animatorStartTime += animator.Duration;
}
}
public override void Render(DateTime now)
{
if (_Animators.Count == 0) return;
var passedTime = now - _ReferenceTime;
var value = (passedTime.TotalMilliseconds % Duration.TotalMilliseconds) / Duration.TotalMilliseconds;
var time = TimeSpan.FromMilliseconds(Duration.TotalMilliseconds * value);
FindAnimator(time).Render(_ReferenceTime + time);
}
private AnimatorBase FindAnimator(TimeSpan time)
{
var duration = TimeSpan.Zero;
foreach (var animator in _Animators)
{
duration += animator.Duration;
if (duration > time)
{
return animator;
}
}
return _Animators.Last();
}
}
} | mit | C# |
1ec1f3ce23ceb182e9dcfb56ef6d3b95e0810154 | Add handlng of invalid arguments when instanciating a SmoBatchRunner | Seddryck/NBi,Seddryck/NBi | NBi.Core.SqlServer/Smo/SmoBatchRunnerFactory.cs | NBi.Core.SqlServer/Smo/SmoBatchRunnerFactory.cs | using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NBi.Core.Batch;
using System.Data.SqlClient;
namespace NBi.Core.SqlServer.Smo
{
public class SmoBatchRunnerFactory : IBatchRunnerFatory
{
public IDecorationCommandImplementation Get(IBatchCommand command, IDbConnection connection)
{
if (command is IBatchRunCommand)
{
if (connection == null)
throw new ArgumentNullException("connection");
if (connection is SqlConnection)
throw new ArgumentException(
String.Format("To execute a SQL Batch on a SQL Server, you must provide a connection-string that is associated to a '{0}'. The connection-string '{1}' is associated to a '{2}'"
, typeof(SqlConnection).AssemblyQualifiedName
, connection.ConnectionString
, connection.GetType().AssemblyQualifiedName)
, "connection");
return new BatchRunCommand(command as IBatchRunCommand, connection as SqlConnection);
}
throw new ArgumentException();
}
}
}
| using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NBi.Core.Batch;
using System.Data.SqlClient;
namespace NBi.Core.SqlServer.Smo
{
public class SmoBatchRunnerFactory : IBatchRunnerFatory
{
public IDecorationCommandImplementation Get(IBatchCommand command, IDbConnection connection)
{
if (command is IBatchRunCommand)
return new BatchRunCommand(command as IBatchRunCommand, connection as SqlConnection);
throw new ArgumentException();
}
}
}
| apache-2.0 | C# |
7aaa08e89b5f7feedb8586d5b3a57c50e4ebc6aa | Correct loading of 9patch textures (#459) | ericmbernier/Nez,prime31/Nez,prime31/Nez,prime31/Nez | Nez.Portable/PipelineRuntime/TextureAtlas/TextureAtlasReader.cs | Nez.Portable/PipelineRuntime/TextureAtlas/TextureAtlasReader.cs | using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Nez.Textures;
namespace Nez.TextureAtlases
{
public class TextureAtlasReader : ContentTypeReader<TextureAtlas>
{
protected override TextureAtlas Read( ContentReader input, TextureAtlas existingInstance )
{
if( existingInstance != null )
{
// read the texture
var texture = input.ReadObject<Texture2D>();
foreach( var subtexture in existingInstance.subtextures )
subtexture.texture2D = texture;
// discard the rest of the SpriteSheet data as we are only reloading GPU resources for now
input.ReadObject<List<Rectangle>>();
input.ReadObject<string[]>();
input.ReadObject<Dictionary<string,Point>>();
input.ReadObject<Dictionary<string,int[]>>();
input.ReadInt32();
return existingInstance;
}
else
{
// create a fresh TextureAtlas instance
var texture = input.ReadObject<Texture2D>();
var spriteRectangles = input.ReadObject<List<Rectangle>>();
var spriteNames = input.ReadObject<string[]>();
var spriteAnimationDetails = input.ReadObject<Dictionary<string,Point>>();
var splits = input.ReadObject < Dictionary<string,int[]>>();
var animationFPS = input.ReadInt32();
// create subtextures
var subtextures = new Subtexture[spriteNames.Length];
for( var i = 0; i < spriteNames.Length; i++ )
{
// check to see if this is a nine patch
if( splits.ContainsKey( spriteNames[i] ) )
{
var split = splits[spriteNames[i]];
subtextures[i] = new NinePatchSubtexture( texture, spriteRectangles[i], split[0], split[1], split[2], split[3] );
}
else
{
subtextures[i] = new Subtexture( texture, spriteRectangles[i] );
}
}
return new TextureAtlas( spriteNames, subtextures, spriteAnimationDetails, animationFPS );
}
}
}
}
| using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using Nez.Textures;
namespace Nez.TextureAtlases
{
public class TextureAtlasReader : ContentTypeReader<TextureAtlas>
{
protected override TextureAtlas Read( ContentReader input, TextureAtlas existingInstance )
{
if( existingInstance != null )
{
// read the texture
var texture = input.ReadObject<Texture2D>();
foreach( var subtexture in existingInstance.subtextures )
subtexture.texture2D = texture;
// discard the rest of the SpriteSheet data as we are only reloading GPU resources for now
input.ReadObject<List<Rectangle>>();
input.ReadObject<string[]>();
input.ReadObject<Dictionary<string,Point>>();
input.ReadObject<Dictionary<string,int[]>>();
input.ReadInt32();
return existingInstance;
}
else
{
// create a fresh TextureAtlas instance
var texture = input.ReadObject<Texture2D>();
var spriteRectangles = input.ReadObject<List<Rectangle>>();
var spriteNames = input.ReadObject<string[]>();
var spriteAnimationDetails = input.ReadObject<Dictionary<string,Point>>();
var splits = input.ReadObject < Dictionary<string,int[]>>();
var animationFPS = input.ReadInt32();
// create subtextures
var subtextures = new Subtexture[spriteNames.Length];
for( var i = 0; i < spriteNames.Length; i++ )
{
// check to see if this is a nine patch
if( splits.ContainsKey( spriteNames[i] ) )
{
var split = splits[spriteNames[i]];
subtextures[i] = new NinePatchSubtexture( texture, split[0], split[1], split[2], split[3] );
}
else
{
subtextures[i] = new Subtexture( texture, spriteRectangles[i] );
}
}
return new TextureAtlas( spriteNames, subtextures, spriteAnimationDetails, animationFPS );
}
}
}
}
| mit | C# |
69dc93daa3c5460e91a7518d2ddab26544c7d13f | Make test work also in environments with few cores. | RogerKratz/mbcache | MbCacheTest/Logic/Performance/CacheMissPerformanceTest.cs | MbCacheTest/Logic/Performance/CacheMissPerformanceTest.cs | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using MbCacheTest.TestData;
using NUnit.Framework;
using SharpTestsEx;
namespace MbCacheTest.Logic.Performance
{
public class CacheMissPerformanceTest : TestCase
{
private ObjectTakes100MsToFill instance;
public CacheMissPerformanceTest(Type proxyType) : base(proxyType)
{
}
protected override void TestSetup()
{
CacheBuilder.For<ObjectTakes100MsToFill>()
.CacheMethod(c => c.Execute(0))
.AsImplemented();
var factory = CacheBuilder.BuildFactory();
instance = factory.Create<ObjectTakes100MsToFill>();
}
[Test]
public void MeasureCacheMissPerf()
{
if(Environment.ProcessorCount < 3)
Assert.Ignore("Not enough power...");
var tasks = new List<Task>();
10.Times(i =>
{
tasks.Add(Task.Factory.StartNew(() => instance.Execute(i)));
});
var stopwatch = new Stopwatch();
stopwatch.Start();
Task.WaitAll(tasks.ToArray());
stopwatch.Stop();
var timeTaken = stopwatch.Elapsed;
Console.WriteLine(timeTaken);
//If global lock, approx 10 * 0.1 => 1s
timeTaken.TotalMilliseconds.Should().Be.LessThan(700);
}
}
} | using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using MbCacheTest.TestData;
using NUnit.Framework;
using SharpTestsEx;
namespace MbCacheTest.Logic.Performance
{
public class CacheMissPerformanceTest : TestCase
{
private ObjectTakes100MsToFill instance;
public CacheMissPerformanceTest(Type proxyType) : base(proxyType)
{
}
protected override void TestSetup()
{
CacheBuilder.For<ObjectTakes100MsToFill>()
.CacheMethod(c => c.Execute(0))
.AsImplemented();
var factory = CacheBuilder.BuildFactory();
instance = factory.Create<ObjectTakes100MsToFill>();
}
[Test]
public void MeasureCacheMissPerf()
{
var tasks = new List<Task>();
10.Times(i =>
{
tasks.Add(Task.Factory.StartNew(() => instance.Execute(i)));
});
var stopwatch = new Stopwatch();
stopwatch.Start();
Task.WaitAll(tasks.ToArray());
stopwatch.Stop();
var timeTaken = stopwatch.Elapsed;
Console.WriteLine(timeTaken);
timeTaken.TotalMilliseconds.Should().Be.LessThan(100 * 3);
}
}
} | mit | C# |
0d44379948c7fed548947a7bb5fcbbcf203fc87e | Bump to 1.1 | KlappPc/ArchiSteamFarm,KlappPc/ArchiSteamFarm,blackpanther989/ArchiSteamFarm,JustArchi/ArchiSteamFarm,JustArchi/ArchiSteamFarm,KlappPc/ArchiSteamFarm,JustArchi/ArchiSteamFarm,i3at/ArchiSteamFarm,i3at/ArchiSteamFarm,JustArchi/ArchiSteamFarm,blackpanther989/ArchiSteamFarm | ArchiSteamFarm/Properties/AssemblyInfo.cs | ArchiSteamFarm/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("ArchiSteamFarm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ArchiSteamFarm")]
[assembly: AssemblyCopyright("Copyright © Łukasz Domeradzki 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("35af7887-08b9-40e8-a5ea-797d8b60b30c")]
// 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.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.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("ArchiSteamFarm")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ArchiSteamFarm")]
[assembly: AssemblyCopyright("Copyright © Łukasz Domeradzki 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("35af7887-08b9-40e8-a5ea-797d8b60b30c")]
// 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")]
| apache-2.0 | C# |
1e3c5ae6270252c43d231752488b0410dee13df6 | Fix a globalization test failure | ericstj/corefx,marksmeltzer/corefx,lggomez/corefx,rahku/corefx,krk/corefx,ptoonen/corefx,cydhaselton/corefx,shmao/corefx,dhoehna/corefx,adamralph/corefx,shimingsg/corefx,mazong1123/corefx,Petermarcu/corefx,ravimeda/corefx,yizhang82/corefx,ericstj/corefx,DnlHarvey/corefx,ravimeda/corefx,mazong1123/corefx,Priya91/corefx-1,tijoytom/corefx,richlander/corefx,cartermp/corefx,tijoytom/corefx,JosephTremoulet/corefx,YoupHulsebos/corefx,krytarowski/corefx,alexperovich/corefx,JosephTremoulet/corefx,ellismg/corefx,mazong1123/corefx,MaggieTsang/corefx,MaggieTsang/corefx,Priya91/corefx-1,tijoytom/corefx,seanshpark/corefx,jlin177/corefx,stephenmichaelf/corefx,ericstj/corefx,Ermiar/corefx,weltkante/corefx,nbarbettini/corefx,rjxby/corefx,nchikanov/corefx,pallavit/corefx,stephenmichaelf/corefx,wtgodbe/corefx,shahid-pk/corefx,krytarowski/corefx,rubo/corefx,Petermarcu/corefx,cartermp/corefx,yizhang82/corefx,shahid-pk/corefx,krytarowski/corefx,iamjasonp/corefx,elijah6/corefx,tstringer/corefx,Petermarcu/corefx,cydhaselton/corefx,shmao/corefx,alphonsekurian/corefx,krytarowski/corefx,lggomez/corefx,khdang/corefx,SGuyGe/corefx,parjong/corefx,ptoonen/corefx,DnlHarvey/corefx,Priya91/corefx-1,shahid-pk/corefx,ericstj/corefx,stone-li/corefx,dsplaisted/corefx,weltkante/corefx,nchikanov/corefx,billwert/corefx,marksmeltzer/corefx,iamjasonp/corefx,rubo/corefx,ViktorHofer/corefx,wtgodbe/corefx,MaggieTsang/corefx,marksmeltzer/corefx,Jiayili1/corefx,MaggieTsang/corefx,nbarbettini/corefx,weltkante/corefx,manu-silicon/corefx,rjxby/corefx,richlander/corefx,nchikanov/corefx,nbarbettini/corefx,the-dwyer/corefx,rjxby/corefx,krk/corefx,twsouthwick/corefx,richlander/corefx,JosephTremoulet/corefx,JosephTremoulet/corefx,alphonsekurian/corefx,nchikanov/corefx,billwert/corefx,BrennanConroy/corefx,JosephTremoulet/corefx,jlin177/corefx,mazong1123/corefx,manu-silicon/corefx,dotnet-bot/corefx,manu-silicon/corefx,Chrisboh/corefx,Chrisboh/corefx,alexperovich/corefx,lggomez/corefx,dhoehna/corefx,ellismg/corefx,cydhaselton/corefx,ravimeda/corefx,khdang/corefx,Chrisboh/corefx,khdang/corefx,alphonsekurian/corefx,weltkante/corefx,rahku/corefx,stone-li/corefx,weltkante/corefx,mmitche/corefx,alexperovich/corefx,dhoehna/corefx,cartermp/corefx,the-dwyer/corefx,shimingsg/corefx,dotnet-bot/corefx,Priya91/corefx-1,Ermiar/corefx,Jiayili1/corefx,gkhanna79/corefx,zhenlan/corefx,cartermp/corefx,shimingsg/corefx,axelheer/corefx,tstringer/corefx,jlin177/corefx,gkhanna79/corefx,Petermarcu/corefx,cydhaselton/corefx,fgreinacher/corefx,elijah6/corefx,alphonsekurian/corefx,twsouthwick/corefx,ViktorHofer/corefx,Ermiar/corefx,the-dwyer/corefx,weltkante/corefx,fgreinacher/corefx,alphonsekurian/corefx,dhoehna/corefx,dhoehna/corefx,billwert/corefx,elijah6/corefx,BrennanConroy/corefx,axelheer/corefx,billwert/corefx,wtgodbe/corefx,stephenmichaelf/corefx,ellismg/corefx,twsouthwick/corefx,nchikanov/corefx,iamjasonp/corefx,pallavit/corefx,nchikanov/corefx,shahid-pk/corefx,Jiayili1/corefx,ellismg/corefx,krk/corefx,cydhaselton/corefx,ViktorHofer/corefx,dotnet-bot/corefx,shmao/corefx,adamralph/corefx,billwert/corefx,mmitche/corefx,Chrisboh/corefx,Jiayili1/corefx,JosephTremoulet/corefx,rahku/corefx,YoupHulsebos/corefx,krk/corefx,gkhanna79/corefx,tstringer/corefx,YoupHulsebos/corefx,richlander/corefx,tstringer/corefx,jhendrixMSFT/corefx,YoupHulsebos/corefx,jlin177/corefx,SGuyGe/corefx,khdang/corefx,ravimeda/corefx,nchikanov/corefx,khdang/corefx,DnlHarvey/corefx,shimingsg/corefx,ericstj/corefx,twsouthwick/corefx,yizhang82/corefx,seanshpark/corefx,krytarowski/corefx,BrennanConroy/corefx,rjxby/corefx,parjong/corefx,alexperovich/corefx,shmao/corefx,yizhang82/corefx,stephenmichaelf/corefx,ericstj/corefx,SGuyGe/corefx,dotnet-bot/corefx,the-dwyer/corefx,mazong1123/corefx,stephenmichaelf/corefx,iamjasonp/corefx,DnlHarvey/corefx,rjxby/corefx,alphonsekurian/corefx,Jiayili1/corefx,lggomez/corefx,stone-li/corefx,Jiayili1/corefx,Ermiar/corefx,tijoytom/corefx,manu-silicon/corefx,weltkante/corefx,seanshpark/corefx,ptoonen/corefx,dotnet-bot/corefx,rubo/corefx,marksmeltzer/corefx,adamralph/corefx,Ermiar/corefx,mazong1123/corefx,pallavit/corefx,ptoonen/corefx,ericstj/corefx,Priya91/corefx-1,mmitche/corefx,MaggieTsang/corefx,alexperovich/corefx,ellismg/corefx,stone-li/corefx,elijah6/corefx,krk/corefx,nbarbettini/corefx,alexperovich/corefx,cartermp/corefx,yizhang82/corefx,parjong/corefx,iamjasonp/corefx,tijoytom/corefx,axelheer/corefx,yizhang82/corefx,jlin177/corefx,dotnet-bot/corefx,the-dwyer/corefx,manu-silicon/corefx,ViktorHofer/corefx,jhendrixMSFT/corefx,seanshpark/corefx,manu-silicon/corefx,tijoytom/corefx,jlin177/corefx,krytarowski/corefx,ravimeda/corefx,jhendrixMSFT/corefx,lggomez/corefx,gkhanna79/corefx,jlin177/corefx,rahku/corefx,jhendrixMSFT/corefx,wtgodbe/corefx,pallavit/corefx,stone-li/corefx,wtgodbe/corefx,DnlHarvey/corefx,cartermp/corefx,nbarbettini/corefx,richlander/corefx,SGuyGe/corefx,khdang/corefx,seanshpark/corefx,ellismg/corefx,Chrisboh/corefx,lggomez/corefx,shimingsg/corefx,ViktorHofer/corefx,seanshpark/corefx,SGuyGe/corefx,dsplaisted/corefx,shmao/corefx,alphonsekurian/corefx,lggomez/corefx,rahku/corefx,SGuyGe/corefx,parjong/corefx,wtgodbe/corefx,jhendrixMSFT/corefx,gkhanna79/corefx,dhoehna/corefx,Ermiar/corefx,seanshpark/corefx,twsouthwick/corefx,rjxby/corefx,stephenmichaelf/corefx,fgreinacher/corefx,wtgodbe/corefx,tstringer/corefx,Ermiar/corefx,Petermarcu/corefx,elijah6/corefx,ViktorHofer/corefx,dhoehna/corefx,marksmeltzer/corefx,Petermarcu/corefx,marksmeltzer/corefx,rahku/corefx,manu-silicon/corefx,Petermarcu/corefx,zhenlan/corefx,YoupHulsebos/corefx,fgreinacher/corefx,twsouthwick/corefx,mazong1123/corefx,shahid-pk/corefx,shmao/corefx,billwert/corefx,billwert/corefx,iamjasonp/corefx,axelheer/corefx,gkhanna79/corefx,nbarbettini/corefx,krk/corefx,ptoonen/corefx,zhenlan/corefx,mmitche/corefx,rubo/corefx,rjxby/corefx,ravimeda/corefx,the-dwyer/corefx,zhenlan/corefx,stone-li/corefx,mmitche/corefx,rubo/corefx,nbarbettini/corefx,tstringer/corefx,rahku/corefx,marksmeltzer/corefx,axelheer/corefx,yizhang82/corefx,Jiayili1/corefx,mmitche/corefx,axelheer/corefx,Priya91/corefx-1,stephenmichaelf/corefx,ravimeda/corefx,dotnet-bot/corefx,ViktorHofer/corefx,richlander/corefx,shahid-pk/corefx,stone-li/corefx,JosephTremoulet/corefx,dsplaisted/corefx,shmao/corefx,pallavit/corefx,Chrisboh/corefx,jhendrixMSFT/corefx,cydhaselton/corefx,gkhanna79/corefx,YoupHulsebos/corefx,YoupHulsebos/corefx,DnlHarvey/corefx,MaggieTsang/corefx,the-dwyer/corefx,zhenlan/corefx,pallavit/corefx,parjong/corefx,ptoonen/corefx,krytarowski/corefx,zhenlan/corefx,richlander/corefx,elijah6/corefx,jhendrixMSFT/corefx,DnlHarvey/corefx,elijah6/corefx,alexperovich/corefx,ptoonen/corefx,parjong/corefx,twsouthwick/corefx,shimingsg/corefx,mmitche/corefx,zhenlan/corefx,iamjasonp/corefx,shimingsg/corefx,krk/corefx,cydhaselton/corefx,tijoytom/corefx,parjong/corefx,MaggieTsang/corefx | src/System.Globalization/tests/CultureInfo/CultureInfoNativeName.cs | src/System.Globalization/tests/CultureInfo/CultureInfoNativeName.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.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class CultureInfoNativeName
{
public static IEnumerable<object[]> NativeName_TestData()
{
yield return new object[] { CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.NativeName };
yield return new object[] { "en-US", "English (United States)" };
yield return new object[] { "en-CA", "English (Canada)" };
}
[Theory]
[MemberData(nameof(NativeName_TestData))]
public void NativeName(string name, string expected)
{
CultureInfo myTestCulture = new CultureInfo(name);
Assert.Equal(expected, myTestCulture.NativeName);
}
}
}
| // 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.
using System.Collections.Generic;
using Xunit;
namespace System.Globalization.Tests
{
public class CultureInfoNativeName
{
public static IEnumerable<object[]> NativeName_TestData()
{
yield return new object[] { CultureInfo.CurrentCulture.Name, CultureInfo.CurrentCulture.NativeName };
yield return new object[] { "en-US", "English (United States)" };
yield return new object[] { "en-CA", "English (Canada)" };
}
[Theory]
[MemberData(nameof(NativeName_TestData))]
public void EnglishName(string name, string expected)
{
CultureInfo myTestCulture = new CultureInfo(name);
Assert.Equal(expected, myTestCulture.EnglishName);
}
}
}
| mit | C# |
6a8af8507ed35fd413bf06a4cb5b7267ab59b38b | Remove reference to NUnit.Framework in Rainy.csproj | Dynalon/Rainy,Dynalon/Rainy,Dynalon/Rainy,Dynalon/Rainy | Rainy/WebService/Admin/AdminServiceContracts.cs | Rainy/WebService/Admin/AdminServiceContracts.cs | using Rainy.UserManagement;
using Rainy.WebService.Admin;
using ServiceStack.ServiceHost;
using System.Collections.Generic;
namespace Rainy.WebService.Management
{
//-- ADMIN INTERFACE
[AdminPasswordRequired]
[Route("/api/admin/user/","POST, PUT",
Summary = "Creates/Updates a user's details. Admin authentication is required",
Notes = "Note that passwords can't be changed due to encryption, thus the password field will be ignored.")]
[Route("/api/admin/user/{Username}","GET, DELETE, OPTIONS",
Summary = "Gets user details or delete a user")]
public class UserRequest : DTOUser, IReturn<DTOUser>
{
}
[AdminPasswordRequired]
[Route("/api/admin/alluser/","GET",
Summary = "Gets a list of all users registered and their user details")]
public class AllUserRequest : IReturn<List<DTOUser>>
{
}
// allows admin to activate users if signup requires moderation
[AdminPasswordRequired]
[Route("/api/user/signup/activate/{Username}/", "POST",
Summary = "Activates a user if moderation is required. Requires admin authentication.")]
public class ActivateUserRequest : IReturnVoid
{
public string Username { get; set; }
}
// list all pending users that await activation/moderation
[AdminPasswordRequired]
[Route("/api/user/signup/pending/", "GET",
Summary = "Get a list of all pending users that await moderation.")]
public class PendingActivationsRequest : IReturn<DTOUser[]>
{
}
//-- USER INTERFACE
// allows user to update hisself user data (especially the password)
[Route("/api/user/{Username}/", "PUT",
Summary = "Update a users information. can only be called by the user himself (credentials required)")]
public class UpdateUserRequest : DTOUser, IReturn<DTOUser>
{
}
// check if a username is available
public class CheckUsernameResponse
{
public bool Available { get; set; }
public string Username { get; set; }
}
[Route("/api/user/signup/check_username/{Username}", "GET",
Summary = "Simple request that checks if a username is already taken or not. Taken usernames can not be used for signup.")]
public class CheckUsernameRequest : IReturn<CheckUsernameResponse>
{
public string Username { get; set; }
}
// allows anyone to register a new account
[Route("/api/user/signup/new/", "POST",
Summary = "Signup a new user. Everyone can use this signup as long as it is enabled by the server config")]
public class SignupUserRequest : DTOUser, IReturnVoid
{
}
// email double-opt in verifiycation
[Api]
[Route("/api/user/signup/verify/{VerifySecret}/", "GET",
Summary = "Verify a secret that is send to the user by mail for email verification.")]
public class VerifyUserRequest : IReturnVoid
{
[ApiMember(Description="The verification key that is sent by email")]
public string VerifySecret { get; set; }
}
} | using System;
using NUnit.Framework;
using System.Web.Routing;
using Rainy.UserManagement;
using ServiceStack.ServiceHost;
using Rainy.WebService.Admin;
using System.Collections.Generic;
namespace Rainy.WebService.Management
{
//-- ADMIN INTERFACE
[AdminPasswordRequired]
[Route("/api/admin/user/","POST, PUT",
Summary = "Creates/Updates a user's details. Admin authentication is required",
Notes = "Note that passwords can't be changed due to encryption, thus the password field will be ignored.")]
[Route("/api/admin/user/{Username}","GET, DELETE, OPTIONS",
Summary = "Gets user details or delete a user")]
public class UserRequest : DTOUser, IReturn<DTOUser>
{
}
[AdminPasswordRequired]
[Route("/api/admin/alluser/","GET",
Summary = "Gets a list of all users registered and their user details")]
public class AllUserRequest : IReturn<List<DTOUser>>
{
}
// allows admin to activate users if signup requires moderation
[AdminPasswordRequired]
[Route("/api/user/signup/activate/{Username}/", "POST",
Summary = "Activates a user if moderation is required. Requires admin authentication.")]
public class ActivateUserRequest : IReturnVoid
{
public string Username { get; set; }
}
// list all pending users that await activation/moderation
[AdminPasswordRequired]
[Route("/api/user/signup/pending/", "GET",
Summary = "Get a list of all pending users that await moderation.")]
public class PendingActivationsRequest : IReturn<DTOUser[]>
{
}
//-- USER INTERFACE
// allows user to update hisself user data (especially the password)
[Route("/api/user/{Username}/", "PUT",
Summary = "Update a users information. can only be called by the user himself (credentials required)")]
public class UpdateUserRequest : DTOUser, IReturn<DTOUser>
{
}
// check if a username is available
public class CheckUsernameResponse
{
public bool Available { get; set; }
public string Username { get; set; }
}
[Route("/api/user/signup/check_username/{Username}", "GET",
Summary = "Simple request that checks if a username is already taken or not. Taken usernames can not be used for signup.")]
public class CheckUsernameRequest : IReturn<CheckUsernameResponse>
{
public string Username { get; set; }
}
// allows anyone to register a new account
[Route("/api/user/signup/new/", "POST",
Summary = "Signup a new user. Everyone can use this signup as long as it is enabled by the server config")]
public class SignupUserRequest : DTOUser, IReturnVoid
{
}
// email double-opt in verifiycation
[Api]
[Route("/api/user/signup/verify/{VerifySecret}/", "GET",
Summary = "Verify a secret that is send to the user by mail for email verification.")]
public class VerifyUserRequest : IReturnVoid
{
[ApiMember(Description="The verification key that is sent by email")]
public string VerifySecret { get; set; }
}
} | agpl-3.0 | C# |
863503bf17c47c1e3760b75adc9b479084086fce | Change made class public | Zalodu/Schedutalk,Zalodu/Schedutalk | Schedutalk/Schedutalk/Schedutalk/Model/MDate.cs | Schedutalk/Schedutalk/Schedutalk/Model/MDate.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Schedutalk.Model
{
public class MDate : ViewModel.VMBase
{
private int hour;
private int minute;
public MDate(int hour, int minute)
{
Hour = hour;
Minute = minute;
}
public int Hour
{
get
{
return hour;
}
set
{
hour = value;
OnPropertyChanged("Hour");
}
}
public int Minute
{
get
{
return minute;
}
set
{
minute = value;
OnPropertyChanged("Minute");
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Schedutalk.Model
{
class MDate : ViewModel.VMBase
{
private int hour;
private int minute;
public MDate(int hour, int minute)
{
Hour = hour;
Minute = minute;
}
public int Hour
{
get
{
return hour;
}
set
{
hour = value;
OnPropertyChanged("Hour");
}
}
public int Minute
{
get
{
return minute;
}
set
{
minute = value;
OnPropertyChanged("Minute");
}
}
}
}
| mit | C# |
8680e8d9f4cefc378e240028f151f7746b1e4085 | 升级版本号。 :nut_and_bolt: :pager: | Zongsoft/Zongsoft.Externals.Json | src/Properties/AssemblyInfo.cs | src/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Zongsoft.Externals.Json")]
[assembly: AssemblyDescription("This is a library about JSON serialization based Newtonsoft.Json.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zongsoft Corporation")]
[assembly: AssemblyProduct("Zongsoft.Externals.Json Library")]
[assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2015-2016. All rights reserved.")]
[assembly: AssemblyTrademark("Zongsoft is registered trademarks of Zongsoft Corporation in the P.R.C. and/or other countries.")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.1.0.1603")]
[assembly: AssemblyFileVersion("1.1.0.1603")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Zongsoft.Externals.Json")]
[assembly: AssemblyDescription("This is a library about JSON serialization based Newtonsoft.Json.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Zongsoft Corporation")]
[assembly: AssemblyProduct("Zongsoft.Externals.Json Library")]
[assembly: AssemblyCopyright("Copyright(C) Zongsoft Corporation 2015. All rights reserved.")]
[assembly: AssemblyTrademark("Zongsoft is registered trademarks of Zongsoft Corporation in the P.R.C. and/or other countries.")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.1505.0")]
[assembly: AssemblyFileVersion("1.0.1505.0")]
| lgpl-2.1 | C# |
a7732770b24352b9fdf8ee54f505beda3e1c0505 | Improve IEnumrabme.AreAllEqual() | VirtualPuzzles/CsharpExtensionMethods | CsharpExtensions/IEnumerableExtensions.cs | CsharpExtensions/IEnumerableExtensions.cs | using System;
using System.Collections.Generic;
using System.Linq;
namespace CsharpExtensions
{
public static partial class Extensions
{
public static bool AreAllEqual<TSource>(this IEnumerable<TSource> enumerable) where TSource : IEquatable<TSource>
{
if (enumerable.Count() == 1)
return true;
var temp = enumerable.FirstOrDefault();
if (temp == null)
return enumerable.Skip(1).All(o => o == null);
else
return enumerable.Skip(1).All(o => o?.Equals(temp) ?? false);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
namespace CsharpExtensions
{
public static partial class Extensions
{
public static bool AreAllEqual<TSource>(this IEnumerable<TSource> enumerable) where TSource : IEquatable<TSource>
{
if (enumerable.Count() == 1)
return true;
bool isFirstSet = false;
TSource firstItem = default;
bool isFirstItemNull = false;
using (var iter = enumerable.GetEnumerator())
{
while (iter.MoveNext())
{
if (!isFirstSet)
{
var temp = iter.Current;
if (!iter.MoveNext())
return true;
firstItem = temp;
isFirstSet = true;
isFirstItemNull = firstItem == null;
}
if (iter.Current == null && !isFirstItemNull)
return false;
if (iter.Current != null && !iter.Current.Equals(firstItem))
return false;
}
}
return true;
}
}
}
| mit | C# |
f58a38559a422279652510d00de33bc09ca5261f | Throw exception rather than return invalid schema reference "#". | drewnoakes/dasher | Dasher.Schemata/Utils/SchemaExtensions.cs | Dasher.Schemata/Utils/SchemaExtensions.cs | using System;
namespace Dasher.Schemata.Utils
{
public static class SchemaExtensions
{
public static string ToReferenceString(this IWriteSchema schema) => ToReferenceStringInternal(schema);
public static string ToReferenceString(this IReadSchema schema) => ToReferenceStringInternal(schema);
private static string ToReferenceStringInternal(object schema)
{
var byRefSchema = schema as ByRefSchema;
if (byRefSchema != null)
{
if (string.IsNullOrWhiteSpace(byRefSchema.Id))
throw new Exception("ByRefSchema must have an ID to produce a reference string.");
return '#' + byRefSchema.Id;
}
return ((ByValueSchema)schema).MarkupValue;
}
}
}
| namespace Dasher.Schemata.Utils
{
public static class SchemaExtensions
{
public static string ToReferenceString(this IWriteSchema schema) => ToReferenceStringInternal(schema);
public static string ToReferenceString(this IReadSchema schema) => ToReferenceStringInternal(schema);
private static string ToReferenceStringInternal(object schema)
{
var byRefSchema = schema as ByRefSchema;
return byRefSchema != null
? '#' + byRefSchema.Id
: ((ByValueSchema)schema).MarkupValue;
}
}
} | apache-2.0 | C# |
facf39190f1ee088a8a337ed7afe159708d16668 | Make sleep shorter in test project | lpatalas/ExpressRunner | ExpressRunner.TestProject/ExampleTests.cs | ExpressRunner.TestProject/ExampleTests.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Extensions;
namespace ExpressRunner.TestProject
{
public class ExampleTests
{
[Fact]
public void Should_fail_always()
{
Assert.Equal("text", "wrong text");
}
[Fact]
public void Should_pass_always()
{
Assert.True(true);
}
[Fact]
public void Should_pass_also()
{
Assert.True(true);
}
[Theory]
[InlineData(1)]
[InlineData(2)]
public void Should_support_theory(int input)
{
Assert.Equal(1, input);
}
[Fact]
public void Should_take_one_second_to_finish()
{
Thread.Sleep(1000);
Assert.True(true);
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xunit;
using Xunit.Extensions;
namespace ExpressRunner.TestProject
{
public class ExampleTests
{
[Fact]
public void Should_fail_always()
{
Assert.Equal("text", "wrong text");
}
[Fact]
public void Should_pass_always()
{
Assert.True(true);
}
[Fact]
public void Should_pass_also()
{
Assert.True(true);
}
[Theory]
[InlineData(1)]
[InlineData(2)]
public void Should_support_theory(int input)
{
Assert.Equal(1, input);
}
[Fact]
public void Should_take_a_long_time_to_run()
{
Thread.Sleep(5000);
Assert.True(true);
}
}
}
| mit | C# |
4b767a5052c69b7fbf12a7a222dbf9ee75551c22 | Return SubTotal as string | idoban/FinBotApp,idoban/FinBotApp | FinBot/Engine/ExpenseByCategoryAdapter.cs | FinBot/Engine/ExpenseByCategoryAdapter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
using Syn.Bot.Siml;
using FinBot.Expenses;
using System.Xml.Linq;
namespace FinBot.Engine
{
public class ExpenseByCategoryAdapter : BaseAdapter
{
private IExpenseService ExpenseService { get; }
public ExpenseByCategoryAdapter(IExpenseService expenseService)
{
ExpenseService = expenseService;
}
public override string Evaluate(Context context)
{
var categoryValue = context.Element.Nodes().OfType<XText>().First().Value;
var category = ExpenseService.Text2Category(categoryValue);
return ExpenseService.GenerateReport(category, Period.Monthly).Subtotal.ToString();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web;
using Syn.Bot.Siml;
using FinBot.Expenses;
using System.Xml.Linq;
namespace FinBot.Engine
{
public class ExpenseByCategoryAdapter : BaseAdapter
{
private IExpenseService ExpenseService { get; }
public ExpenseByCategoryAdapter(IExpenseService expenseService)
{
ExpenseService = expenseService;
}
public override string Evaluate(Context context)
{
var categoryValue = context.Element.Nodes().OfType<XText>().First().Value;
var category = ExpenseService.Text2Category(categoryValue);
return ExpenseService.GenerateReport(category, Period.Monthly).ToString();
}
}
} | mit | C# |
5a7d0853f8c5d405c1006e550b6b3c8ad0d61754 | Allow DiskFreespace for Nix | allansson/Calamari,merbla/Calamari,NoesisLabs/Calamari,NoesisLabs/Calamari,allansson/Calamari,merbla/Calamari | source/Calamari/Integration/FileSystem/NixPhysicalFileSystem.cs | source/Calamari/Integration/FileSystem/NixPhysicalFileSystem.cs | using System.IO;
namespace Calamari.Integration.FileSystem
{
public class NixCalamariPhysicalFileSystem : CalamariPhysicalFileSystem
{
protected override bool GetFiskFreeSpace(string directoryPath, out ulong totalNumberOfFreeBytes)
{
var pathRoot = Path.GetPathRoot(directoryPath);
foreach (var drive in DriveInfo.GetDrives())
{
if (!drive.Name.Equals(pathRoot)) continue;
totalNumberOfFreeBytes = (ulong)drive.TotalFreeSpace;
return true;
}
totalNumberOfFreeBytes = 0;
return false;
}
}
}
| namespace Calamari.Integration.FileSystem
{
public class NixCalamariPhysicalFileSystem : CalamariPhysicalFileSystem
{
protected override bool GetFiskFreeSpace(string directoryPath, out ulong totalNumberOfFreeBytes)
{
totalNumberOfFreeBytes = 0;
return false;
}
}
}
| apache-2.0 | C# |
2b9cedd9dfd515edd35d29a298c59e04fa026dac | Update logging.cs | RogueException/Discord.Net,LassieME/Discord.Net,AntiTcb/Discord.Net,Confruggy/Discord.Net | docs/guides/samples/logging.cs | docs/guides/samples/logging.cs | using Discord;
using Discord.Rest;
public class Program
{
// Note: This is the light client, it only supports REST calls.
private DiscordSocketClient _client;
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
public async Task Start()
{
_client = new DiscordSocketClient(new DiscordSocketConfig() {
LogLevel = LogSeverity.Info
});
_client.Log += (message) =>
{
Console.WriteLine($"{message.ToString()}");
return Task.CompletedTask;
};
await _client.LoginAsync(TokenType.Bot, "bot token");
await _client.ConnectAsync();
await Task.Delay(-1);
}
}
| using Discord;
using Discord.Rest;
public class Program
{
// Note: This is the light client, it only supports REST calls.
private DiscordSocketClient _client;
static void Main(string[] args) => new Program().Start().GetAwaiter().GetResult();
public async Task Start()
{
_client = new DiscordSocketClient(new DiscordConfig() {
LogLevel = LogSeverity.Info
});
_client.Log += (message) =>
{
Console.WriteLine($"{message.ToString()}");
return Task.CompletedTask;
};
await _client.LoginAsync(TokenType.Bot, "bot token");
await _client.ConnectAsync();
await Task.Delay(-1);
}
}
| mit | C# |
343db6c26e6d65000d2b7f4b09dcb8e3e2709da6 | add readonly flag for identifierVlue | dhawalharsora/connectedcare-sdk,SnapMD/connectedcare-sdk | SnapMD.VirtualCare.ApiModels/IdentifierValue.cs | SnapMD.VirtualCare.ApiModels/IdentifierValue.cs | using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SnapMD.VirtualCare.ApiModels;
using SnapMD.VirtualCare.ApiModels.Enums;
using System;
namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
/// Value of HL7 FHIR's identifier for Web API methods
/// </summary>
public class IdentifierValue
{
/// <summary>
/// Alphanumeric identifier usage code
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public IdentifierUsageCode? IdentifierUsageCode { get; set; }
/// <summary>
/// Readable name of identifier usage
/// </summary>
public string IdentifierUsageTitle { get; set; }
/// <summary>
/// Alphanumeric identifier type code
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public IdentifierTypeCode IdentifierTypeCode { get; set; }
/// <summary>
/// Readable name of identifier type
/// </summary>
public string IdentifierTypeTitle { get; set; }
/// <summary>
/// FHIR's system
/// </summary>
public string Namespace { get; set; }
/// <summary>
/// Value of the identifier
/// </summary>
public string Value { get; set; }
/// <summary>
/// Date/time from which identifier value is valid
/// </summary>
public DateTime EffectiveDate { get; set; }
/// <summary>
/// Date/time until which identifier value is valid. If null, identifier will never expire
/// </summary>
public DateTime? ExpiredDate { get; set; }
/// <summary>
/// Organization assigned the iddentifier
/// </summary>
public string AssignerOrg { get; set; }
/// <summary>
/// Current status of the identifier value in the system
/// </summary>
public GlobalStatusCode StatusCode { get; set; }
/// <summary>
/// Is the identifier read only for the requested user
/// </summary>
public bool ReadOnly { get; set; }
}
} | using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SnapMD.VirtualCare.ApiModels;
using SnapMD.VirtualCare.ApiModels.Enums;
using System;
namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
/// Value of HL7 FHIR's identifier for Web API methods
/// </summary>
public class IdentifierValue
{
/// <summary>
/// Alphanumeric identifier usage code
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public IdentifierUsageCode? IdentifierUsageCode { get; set; }
/// <summary>
/// Readable name of identifier usage
/// </summary>
public string IdentifierUsageTitle { get; set; }
/// <summary>
/// Alphanumeric identifier type code
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public IdentifierTypeCode IdentifierTypeCode { get; set; }
/// <summary>
/// Readable name of identifier type
/// </summary>
public string IdentifierTypeTitle { get; set; }
/// <summary>
/// FHIR's system
/// </summary>
public string Namespace { get; set; }
/// <summary>
/// Value of the identifier
/// </summary>
public string Value { get; set; }
/// <summary>
/// Date/time from which identifier value is valid
/// </summary>
public DateTime EffectiveDate { get; set; }
/// <summary>
/// Date/time until which identifier value is valid. If null, identifier will never expire
/// </summary>
public DateTime? ExpiredDate { get; set; }
/// <summary>
/// Organization assigned the iddentifier
/// </summary>
public string AssignerOrg { get; set; }
/// <summary>
/// Current status of the identifier value in the system
/// </summary>
public GlobalStatusCode StatusCode { get; set; }
}
} | apache-2.0 | C# |
2806733f89ccb8b6937fd77e0271f32d3e43851e | Remove IValidator protocol | Miruken-DotNet/Miruken | Source/Miruken.Validate/ValidationExtensions.cs | Source/Miruken.Validate/ValidationExtensions.cs | namespace Miruken.Validate
{
using Callback;
using Concurrency;
public static class ValidationExtensions
{
public static ValidationOutcome Validate(this IHandler handler,
object target, params object[] scopes)
{
var options = handler.GetOptions<ValidationOptions>();
var validation = new Validation(target, scopes)
{
StopOnFailure = options?.StopOnFailure == true
};
handler.Handle(validation, true);
var outcome = validation.Outcome;
if (target is IValidationAware validationAware)
validationAware.ValidationOutcome = outcome;
return outcome;
}
public static Promise<ValidationOutcome> ValidateAsync(
this IHandler handler, object target, params object[] scopes)
{
var options = handler.GetOptions<ValidationOptions>();
var validation = new Validation(target, scopes)
{
StopOnFailure = options?.StopOnFailure == true,
WantsAsync = true
};
handler.Handle(validation, true);
return ((Promise)validation.Result).Then((r, s) =>
{
var outcome = validation.Outcome;
if (target is IValidationAware validationAware)
validationAware.ValidationOutcome = outcome;
return outcome;
});
}
public static IHandler Valid(this IHandler handler,
object target, params object[] scopes)
{
return handler.Aspect((_, composer) =>
composer.Validate(target, scopes).IsValid);
}
public static IHandler ValidAsync(this IHandler handler,
object target, params object[] scopes)
{
return handler.Aspect((_, composer) =>
composer.ValidateAsync(target, scopes)
.Then((outcome, s) => outcome.IsValid));
}
}
}
| namespace Miruken.Validate
{
using Callback;
using Concurrency;
public static class ValidationExtensions
{
public static ValidationOutcome Validate(this IHandler handler,
object target, params object[] scopes)
{
var options = handler.GetOptions<ValidationOptions>();
var validation = new Validation(target, scopes)
{
StopOnFailure = options?.StopOnFailure == true
};
handler.Handle(validation, true);
var result = validation.Result;
var outcome = validation.Outcome;
if (target is IValidationAware validationAware)
validationAware.ValidationOutcome = outcome;
return outcome;
}
public static Promise<ValidationOutcome> ValidateAsync(
this IHandler handler, object target, params object[] scopes)
{
var options = handler.GetOptions<ValidationOptions>();
var validation = new Validation(target, scopes)
{
StopOnFailure = options?.StopOnFailure == true,
WantsAsync = true
};
handler.Handle(validation, true);
return ((Promise)validation.Result).Then((r, s) =>
{
var outcome = validation.Outcome;
if (target is IValidationAware validationAware)
validationAware.ValidationOutcome = outcome;
return outcome;
});
}
public static IHandler Valid(this IHandler handler,
object target, params object[] scopes)
{
return handler.Aspect((_, composer) =>
composer.Validate(target, scopes).IsValid);
}
public static IHandler ValidAsync(this IHandler handler,
object target, params object[] scopes)
{
return handler.Aspect((_, composer) =>
composer.ValidateAsync(target, scopes)
.Then((outcome, s) => outcome.IsValid));
}
}
}
| mit | C# |
c21cdacc8e93ab0ddf202ae6212617b1ddd4cf0d | Update reasoning behind why AgentBus hack exists | pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype | src/Glimpse.Agent.Common/Broker/DefaultMessageAgentBus.cs | src/Glimpse.Agent.Common/Broker/DefaultMessageAgentBus.cs | using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reflection;
using System.Threading.Tasks;
namespace Glimpse.Agent
{
public class DefaultAgentBroker : IAgentBroker
{
private readonly ISubject<IMessage> _subject;
// TODO: Review if we care about unifying which thread message is published on
// and which thread it is recieved on. If so need to use IScheduler.
public DefaultAgentBroker(IChannelSender channelSender)
{
_subject = new BehaviorSubject<IMessage>(null);
// TODO: This probably shouldn't be here but don't want to setup
// more infrasture atm. Deciding whether it should be users
// code which instantiates listners or if we provider infrasturcture
// which starts them up and triggers the subscription.
ListenAll().Subscribe(async msg => await channelSender.PublishMessage(msg));
}
public IObservable<T> Listen<T>()
where T : IMessage
{
return ListenIncludeLatest<T>().Skip(1);
}
public IObservable<T> ListenIncludeLatest<T>()
where T : IMessage
{
return _subject
.Where(msg => typeof(T).GetTypeInfo().IsAssignableFrom(msg.GetType().GetTypeInfo()))
.Select(msg => (T)msg);
}
public IObservable<IMessage> ListenAll()
{
return ListenAllIncludeLatest().Skip(1);
}
public IObservable<IMessage> ListenAllIncludeLatest()
{
return _subject;
}
public async Task SendMessage(IMessage message)
{
await Task.Run(() => _subject.OnNext(message));
}
}
} | using System;
using System.Collections.Generic;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Reflection;
using System.Threading.Tasks;
namespace Glimpse.Agent
{
public class DefaultAgentBroker : IAgentBroker
{
private readonly ISubject<IMessage> _subject;
// TODO: Review if we care about unifying which thread message is published on
// and which thread it is recieved on. If so need to use IScheduler.
public DefaultAgentBroker(IChannelSender channelSender)
{
_subject = new BehaviorSubject<IMessage>(null);
// TODO: This probably shouldn't be here but don't want to setup more infrasture atm
ListenAll().Subscribe(async msg => await channelSender.PublishMessage(msg));
}
public IObservable<T> Listen<T>()
where T : IMessage
{
return ListenIncludeLatest<T>().Skip(1);
}
public IObservable<T> ListenIncludeLatest<T>()
where T : IMessage
{
return _subject
.Where(msg => typeof(T).GetTypeInfo().IsAssignableFrom(msg.GetType().GetTypeInfo()))
.Select(msg => (T)msg);
}
public IObservable<IMessage> ListenAll()
{
return ListenAllIncludeLatest().Skip(1);
}
public IObservable<IMessage> ListenAllIncludeLatest()
{
return _subject;
}
public async Task SendMessage(IMessage message)
{
await Task.Run(() => _subject.OnNext(message));
}
}
} | mit | C# |
7429e2fce72e656f4295b8f1703a4acc427684bd | test ParallelOptions | zhouyongtao/my_aspnetmvc_learning,zhouyongtao/my_aspnetmvc_learning | my_aspnetmvc_learning/Controllers/ParallelController.cs | my_aspnetmvc_learning/Controllers/ParallelController.cs | using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace my_aspnetmvc_learning.Controllers
{
public class ParallelController : Controller
{
// GET: Parallel
public ActionResult Index()
{
var options = new ParallelOptions();
//指定使用的硬件线程数为1
options.MaxDegreeOfParallelism = 1;
Parallel.For(0, 20000000, options,(i,state) =>
{
if (i == 1000)
{
state.Break();
return;
}
});
return View();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace my_aspnetmvc_learning.Controllers
{
public class ParallelController : Controller
{
// GET: Parallel
public ActionResult Index()
{
return View();
}
}
} | mit | C# |
d01cd489ed92638163d5163d690de1d1fe78c9b5 | Access operator for array is now "item" | hahoyer/reni.cs,hahoyer/reni.cs,hahoyer/reni.cs | src/reni2/FeatureTest/Reference/ArrayReferenceDumpLoop.cs | src/reni2/FeatureTest/Reference/ArrayReferenceDumpLoop.cs | using System;
using System.Collections.Generic;
using System.Linq;
using hw.UnitTest;
namespace Reni.FeatureTest.Reference
{
[TestFixture]
[ArrayReferenceDumpSimple]
[Target(@"
repeat: /\ ^ while() then(^ body(), repeat(^));
o:
/\
{
data: ^ array_reference ;
count: ^ count;
dump_print:
/!\
{
!mutable position: count type instance (0) ;
repeat
(
while: /\ position < count,
body: /\
(
data item(position) dump_print,
position := (position + 1) enable_cut
)
)
}
};
o('abcdef') dump_print
")]
[Output("abcdef")]
public sealed class ArrayReferenceDumpLoop : CompilerTest {}
} | using System;
using System.Collections.Generic;
using System.Linq;
using hw.UnitTest;
namespace Reni.FeatureTest.Reference
{
[TestFixture]
[ArrayReferenceDumpSimple]
[Target(@"
repeat: /\ ^ while() then(^ body(), repeat(^));
o:
/\
{
data: ^ array_reference ;
count: ^ count;
dump_print:
/!\
{
!mutable position: count type instance (0) ;
repeat
(
while: /\ position < count,
body: /\
(
(data >> position) dump_print,
position := (position + 1) enable_cut
)
)
}
};
o('abcdef') dump_print
")]
[Output("abcdef")]
public sealed class ArrayReferenceDumpLoop : CompilerTest {}
} | mit | C# |
7eb51fa4a39abd1540d713617452fe48c6e581f5 | Fix test | glorylee/FluentValidation,mgmoody42/FluentValidation,pacificIT/FluentValidation,robv8r/FluentValidation,ruisebastiao/FluentValidation,roend83/FluentValidation,IRlyDontKnow/FluentValidation,deluxetiky/FluentValidation,roend83/FluentValidation,cecilphillip/FluentValidation,GDoronin/FluentValidation,regisbsb/FluentValidation,olcayseker/FluentValidation | src/FluentValidation.Tests/RegularExpressionValidatorTests.cs | src/FluentValidation.Tests/RegularExpressionValidatorTests.cs | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
namespace FluentValidation.Tests {
using System.Globalization;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Validators;
[TestFixture]
public class RegularExpressionValidatorTests {
TestValidator validator;
[SetUp]
public void Setup() {
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
validator = new TestValidator {
v => v.RuleFor(x => x.Surname).Matches(@"^\w\d$")
};
}
[Test]
public void When_the_text_matches_the_regular_expression_then_the_validator_should_pass() {
string input = "S3";
var result = validator.Validate(new Person{Surname = input });
result.IsValid.ShouldBeTrue();
}
[Test]
public void When_the_text_does_not_match_the_regular_expression_then_the_validator_should_fail() {
var result = validator.Validate(new Person{Surname = "S33"});
result.IsValid.ShouldBeFalse();
result = validator.Validate(new Person{Surname = " 5"});
result.IsValid.ShouldBeFalse();
}
[Test]
public void When_the_text_is_empty_then_the_validator_should_fail() {
var result = validator.Validate(new Person{Surname = ""});
result.IsValid.ShouldBeFalse();
}
[Test]
public void When_the_text_is_null_then_the_validator_should_pass() {
var result = validator.Validate(new Person{Surname = null});
result.IsValid.ShouldBeTrue();
}
[Test]
public void When_validation_fails_the_default_error_should_be_set() {
var result = validator.Validate(new Person{Surname = "S33"});
result.Errors.Single().ErrorMessage.ShouldEqual("'Surname' is not in the correct format.");
}
}
} | #region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// 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.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion
namespace FluentValidation.Tests {
using System.Globalization;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Validators;
[TestFixture]
public class RegularExpressionValidatorTests {
TestValidator validator;
[SetUp]
public void Setup() {
Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
validator = new TestValidator {
v => v.RuleFor(x => x.Surname).Matches(@"^\w\d$")
};
}
[Test]
public void When_the_text_matches_the_regular_expression_then_the_validator_should_pass() {
string input = "S3";
var result = validator.Validate(new Person{Surname = input });
result.IsValid.ShouldBeTrue();
}
[Test]
public void When_the_text_does_not_match_the_regular_expression_then_the_validator_should_fail() {
var result = validator.Validate(new Person{Surname = "S33"});
result.IsValid.ShouldBeFalse();
result = validator.Validate(new Person{Surname = " 5"});
result.IsValid.ShouldBeFalse();
}
[Test]
public void When_the_text_is_empty_then_the_validator_should_fail() {
var result = validator.Validate(new Person{Surname = ""});
result.IsValid.ShouldBeFalse();
}
[Test]
public void When_the_text_is_null_then_the_validator_should_pass() {
var result = validator.Validate(new Person{Surname = null});
result.IsValid.ShouldBeTrue();
}
[Test]
public void When_validation_fails_the_default_error_should_be_set() {
var result = validator.Validate(new Person{Surname = "S33"});
result.Errors.Single().ErrorMessage.ShouldEqual("'Name' is not in the correct format.");
}
}
} | apache-2.0 | C# |
cb13c304671913df8811cf59c21501bae4d81c73 | Enable nullable: System.Management.Automation.Provider.IContentWriter (#14152) | TravisEz13/PowerShell,PaulHigin/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,PaulHigin/PowerShell,JamesWTruher/PowerShell-1,daxian-dbw/PowerShell,TravisEz13/PowerShell,JamesWTruher/PowerShell-1,daxian-dbw/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,PaulHigin/PowerShell,TravisEz13/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1 | src/System.Management.Automation/namespaces/IContentWriter.cs | src/System.Management.Automation/namespaces/IContentWriter.cs | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections;
using System.IO;
#nullable enable
namespace System.Management.Automation.Provider
{
#region IContentWriter
/// <summary>
/// A Cmdlet provider that implements the IContentCmdletProvider interface must provide an
/// object that implements this interface when GetContentWriter() is called.
///
/// The interface allows for writing content to an item.
/// </summary>
public interface IContentWriter : IDisposable
{
/// <summary>
/// Writes content to the item.
/// </summary>
/// <param name="content">
/// An array of content "blocks" to be written to the item.
/// </param>
/// <returns>
/// The blocks of content that were successfully written to the item.
/// </returns>
/// <remarks>
/// A "block" of content is provider specific. For the file system
/// a "block" may be considered a byte, a character, or delimited string.
///
/// The implementation of this method should treat each element in the
/// <paramref name="content"/> parameter as a block. Each additional
/// call to this method should append any new values to the content
/// writer's current location until <see cref="IContentWriter.Close"/> is called.
/// </remarks>
IList Write(IList content);
/// <summary>
/// Moves the current "block" to be written to a position relative to a place
/// in the writer.
/// </summary>
/// <param name="offset">
/// An offset of the number of blocks to seek from the origin.
/// </param>
/// <param name="origin">
/// The place in the stream to start the seek from.
/// </param>
/// <remarks>
/// The implementation of this method moves the content writer <paramref name="offset"/>
/// number of blocks from the specified <paramref name="origin"/>. See <see cref="System.Management.Automation.Provider.IContentWriter.Write(IList)"/>
/// for a description of what a block is.
/// </remarks>
void Seek(long offset, SeekOrigin origin);
/// <summary>
/// Closes the writer. Further writes should fail if the writer
/// has been closed.
/// </summary>
/// <remarks>
/// The implementation of this method should close any resources held open by the
/// writer.
/// </remarks>
void Close();
}
#endregion IContentWriter
}
| // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections;
using System.IO;
namespace System.Management.Automation.Provider
{
#region IContentWriter
/// <summary>
/// A Cmdlet provider that implements the IContentCmdletProvider interface must provide an
/// object that implements this interface when GetContentWriter() is called.
///
/// The interface allows for writing content to an item.
/// </summary>
public interface IContentWriter : IDisposable
{
/// <summary>
/// Writes content to the item.
/// </summary>
/// <param name="content">
/// An array of content "blocks" to be written to the item.
/// </param>
/// <returns>
/// The blocks of content that were successfully written to the item.
/// </returns>
/// <remarks>
/// A "block" of content is provider specific. For the file system
/// a "block" may be considered a byte, a character, or delimited string.
///
/// The implementation of this method should treat each element in the
/// <paramref name="content"/> parameter as a block. Each additional
/// call to this method should append any new values to the content
/// writer's current location until <see cref="IContentWriter.Close"/> is called.
/// </remarks>
IList Write(IList content);
/// <summary>
/// Moves the current "block" to be written to a position relative to a place
/// in the writer.
/// </summary>
/// <param name="offset">
/// An offset of the number of blocks to seek from the origin.
/// </param>
/// <param name="origin">
/// The place in the stream to start the seek from.
/// </param>
/// <remarks>
/// The implementation of this method moves the content writer <paramref name="offset"/>
/// number of blocks from the specified <paramref name="origin"/>. See <see cref="System.Management.Automation.Provider.IContentWriter.Write(IList)"/>
/// for a description of what a block is.
/// </remarks>
void Seek(long offset, SeekOrigin origin);
/// <summary>
/// Closes the writer. Further writes should fail if the writer
/// has been closed.
/// </summary>
/// <remarks>
/// The implementation of this method should close any resources held open by the
/// writer.
/// </remarks>
void Close();
}
#endregion IContentWriter
}
| mit | C# |
01cbb8d31af38a3d2284de374699a2c47cfce985 | test debug | EsWork/Es.Logging,EsWork/Es.Logging | src/Sample/MicrosoftLogDemo.cs | src/Sample/MicrosoftLogDemo.cs |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Es.Logging;
using Microsoft.Extensions.Logging;
namespace Sample
{
public class MicrosoftLogDemo
{
private readonly Es.Logging.LoggerFactory _logFactory;
public MicrosoftLogDemo()
{
_logFactory = new Es.Logging.LoggerFactory();
var logFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(builder =>
{
builder.AddConsole();
builder.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Debug);
});
_logFactory.AddMicrosoftLog(logFactory);
}
[Demo]
public void WriteLog()
{
var log = _logFactory.CreateLogger("MicrosoftLogDemo");
log.Trace("Trace....");
log.Debug("Debug...");
log.Info("Information....");
log.Error("Error...");
log.Warn("Warning...");
log.Fatal("Fatal...");
var exception = new InvalidOperationException("Invalid value");
log.Error(exception);
}
}
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Es.Logging;
using Microsoft.Extensions.Logging;
namespace Sample
{
public class MicrosoftLogDemo
{
private readonly Es.Logging.LoggerFactory _logFactory;
public MicrosoftLogDemo() {
_logFactory = new Es.Logging.LoggerFactory();
var logFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(builder =>
{
builder .AddConsole();
});
_logFactory.AddMicrosoftLog(logFactory);
}
[Demo]
public void WriteLog() {
var log = _logFactory.CreateLogger("MicrosoftLogDemo");
log.Trace("Trace....");
log.Debug("Debug...");
log.Info("Information....");
log.Error("Error...");
log.Warn("Warning...");
log.Fatal("Fatal...");
var exception = new InvalidOperationException("Invalid value");
log.Error(exception);
}
}
} | mit | C# |
d0e530a4f205673ff826780b67d3401a70b10b3c | Fix broken test | erikbarke/apinterest,erikbarke/apinterest,erikbarke/apinterest | src/server/webapi/Apinterest.UnitTests/LocalhostOnlyAttributeTest.cs | src/server/webapi/Apinterest.UnitTests/LocalhostOnlyAttributeTest.cs | using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Routing;
using Apinterest.Security;
using Apinterest.UnitTests.Mocks;
using Moq;
using NUnit.Framework;
namespace Apinterest.UnitTests
{
[TestFixture]
public class LocalhostOnlyAttributeTest
{
private HttpControllerContext _httpControllerContext;
private Mock<HttpActionDescriptor> _mockHttpActionDescriptor;
[SetUp]
public void Setup()
{
var config = new HttpConfiguration();
var route = new HttpRouteData(new HttpRoute());
var request = new HttpRequestMessage();
_httpControllerContext = new HttpControllerContext(config, route, request)
{
ControllerDescriptor = new HttpControllerDescriptor(config, "", typeof(MockController))
};
_mockHttpActionDescriptor = new Mock<HttpActionDescriptor>
{
CallBase = true
};
}
[Test]
public void Should_Authorize_Local_Requests()
{
var attribute = new LocalhostOnlyAttribute();
var context = new HttpActionContext(_httpControllerContext, _mockHttpActionDescriptor.Object);
_httpControllerContext.RequestContext.IsLocal = true;
attribute.OnAuthorization(context);
//Assert.That(_httpControllerContext.RequestContext, Is.True);
}
}
}
| using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Controllers;
using System.Web.Http.Routing;
using Apinterest.UnitTests.Mocks;
using Moq;
using NUnit.Framework;
namespace Apinterest.UnitTests
{
[TestFixture]
public class LocalhostOnlyAttributeTest
{
private HttpControllerContext _httpControllerContext;
private Mock<HttpActionDescriptor> _mockHttpActionDescriptor;
[SetUp]
public void Setup()
{
var config = new HttpConfiguration();
var route = new HttpRouteData(new HttpRoute());
var request = new HttpRequestMessage();
_httpControllerContext = new HttpControllerContext(config, route, request)
{
ControllerDescriptor = new HttpControllerDescriptor(config, "", typeof(MockController))
};
_mockHttpActionDescriptor = new Mock<HttpActionDescriptor>
{
CallBase = true
};
}
[Test]
public void Should_Authorize_Local_Requests()
{
var attribute = new LocalhostOnlyAttribute();
var context = new HttpActionContext(_httpControllerContext, _mockHttpActionDescriptor.Object);
_httpControllerContext.RequestContext.IsLocal = true;
attribute.OnAuthorization(context);
//Assert.That(_httpControllerContext.RequestContext, Is.True);
}
}
}
| mit | C# |
c5d21cfe65e901cd1ffbf0e2902821443a468c6b | Improve compatibility with Move It! | earalov/Skylines-ToggleableWhiteness | ToggleableWhiteness/ToolMonitor.cs | ToggleableWhiteness/ToolMonitor.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using ToggleableWhiteness.Detours;
using UnityEngine;
using ColossalFramework;
namespace ToggleableWhiteness
{
public class ToolMonitor : MonoBehaviour
{
private static ToolBase _previousTool;
public void Awake()
{
_previousTool = null;
}
public void Update()
{
var currentTool = ToolsModifierControl.GetCurrentTool<ToolBase>();
if (currentTool != _previousTool)
{
ToolBaseDetour.ResetForceMode();
}
_previousTool = currentTool;
if (currentTool is ResourceTool || currentTool is TreeTool)
{
ToolBaseDetour.ForceInfoMode(InfoManager.InfoMode.NaturalResources, InfoManager.SubInfoMode.Default);
}
else if (currentTool is DistrictTool)
{
ToolBaseDetour.ForceInfoMode(InfoManager.InfoMode.Districts, InfoManager.SubInfoMode.Default);
}
else if (currentTool is TransportTool)
{
TransportManager.instance.LinesVisible = ToolsModifierControl.GetCurrentTool<TransportTool>().m_prefab?.m_class?.m_service == ItemClass.Service.Disaster ? 128 : -129;
TransportManager.instance.TunnelsVisible = true;
}
else if (currentTool is TerrainTool || currentTool.GetType().Name == "InGameTerrainTool")
{
ToolBaseDetour.ForceInfoMode(InfoManager.InfoMode.None, InfoManager.SubInfoMode.Default);
}
else
{
var nextInfoMode = InfoManager.instance.NextMode;
TransportManager.instance.LinesVisible = (nextInfoMode == InfoManager.InfoMode.Transport) ? -129 : (nextInfoMode == InfoManager.InfoMode.EscapeRoutes ? 128 : 0);
TransportManager.instance.TunnelsVisible =
(nextInfoMode == InfoManager.InfoMode.Transport || nextInfoMode == InfoManager.InfoMode.Traffic);
}
}
public void Destroy()
{
_previousTool = null;
}
}
} | using System.Reflection;
using System.Runtime.CompilerServices;
using ToggleableWhiteness.Detours;
using UnityEngine;
using ColossalFramework;
namespace ToggleableWhiteness
{
public class ToolMonitor : MonoBehaviour
{
private static ToolBase _previousTool;
public void Awake()
{
_previousTool = null;
}
public void Update()
{
var currentTool = ToolsModifierControl.GetCurrentTool<ToolBase>();
if (currentTool != _previousTool)
{
ToolBaseDetour.ResetForceMode();
}
_previousTool = currentTool;
if (currentTool is ResourceTool || currentTool is TreeTool)
{
ToolBaseDetour.ForceInfoMode(InfoManager.InfoMode.NaturalResources, InfoManager.SubInfoMode.Default);
}
else if (currentTool is DistrictTool)
{
ToolBaseDetour.ForceInfoMode(InfoManager.InfoMode.Districts, InfoManager.SubInfoMode.Default);
}
else if (currentTool is TransportTool)
{
TransportManager.instance.LinesVisible = ToolsModifierControl.GetCurrentTool<TransportTool>().m_prefab.m_class.m_service == ItemClass.Service.Disaster ? 128 : -129;
TransportManager.instance.TunnelsVisible = true;
}
else if (currentTool is TerrainTool || currentTool.GetType().Name == "InGameTerrainTool")
{
ToolBaseDetour.ForceInfoMode(InfoManager.InfoMode.None, InfoManager.SubInfoMode.Default);
}
else
{
var nextInfoMode = InfoManager.instance.NextMode;
TransportManager.instance.LinesVisible = (nextInfoMode == InfoManager.InfoMode.Transport) ? -129 : (nextInfoMode == InfoManager.InfoMode.EscapeRoutes ? 128 : 0);
TransportManager.instance.TunnelsVisible =
(nextInfoMode == InfoManager.InfoMode.Transport || nextInfoMode == InfoManager.InfoMode.Traffic);
}
}
public void Destroy()
{
_previousTool = null;
}
}
} | mit | C# |
598871b40a5bc29e438316026d724957dfe1122f | update version | rvdkooy/BrockAllen.MembershipReboot,eric-swann-q2/BrockAllen.MembershipReboot,DosGuru/MembershipReboot,tomascassidy/BrockAllen.MembershipReboot,vankooch/BrockAllen.MembershipReboot,rajendra1809/BrockAllen.MembershipReboot,brockallen/BrockAllen.MembershipReboot,vinneyk/BrockAllen.MembershipReboot | src/BrockAllen.MembershipReboot/Properties/AssemblyInfo.cs | src/BrockAllen.MembershipReboot/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("BrockAllen.MembershipReboot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Brock Allen Consulting, LLC")]
[assembly: AssemblyProduct("BrockAllen.MembershipReboot")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8989a0f1-3a88-4c55-9922-474837136343")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: InternalsVisibleTo("BrockAllen.MembershipReboot.Test")] | 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("BrockAllen.MembershipReboot")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BrockAllen.MembershipReboot")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8989a0f1-3a88-4c55-9922-474837136343")]
// 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")]
[assembly: InternalsVisibleTo("BrockAllen.MembershipReboot.Test")] | bsd-3-clause | C# |
acd66d73d2aefb3775cf52a2d1b2025521468e48 | add StaticTypingFeature.TryingToGetANullConfigurationItem | config-r/config-r | tests/ConfigR.Tests.Acceptance.Roslyn.CSharp/StaticTypingFeature.cs | tests/ConfigR.Tests.Acceptance.Roslyn.CSharp/StaticTypingFeature.cs | // <copyright file="StaticTypingFeature.cs" company="ConfigR contributors">
// Copyright (c) ConfigR contributors. (configr.net@gmail.com)
// </copyright>
namespace ConfigR.Tests.Acceptance
{
using System;
using ConfigR.Tests.Acceptance.Roslyn.CSharp.Support;
using FluentAssertions;
using Xbehave;
using Xunit;
public static class StaticTypingFeature
{
[Scenario]
public static void TryingToGetAnIncorrectlyTypedConfigurationItem(Exception ex)
{
dynamic config = null;
"Given a config file with a Foo string"
.f(c => ConfigFile.Create(@"Config.Foo = ""abc"";").Using(c));
"When I load the file"
.f(async () => config = await new Config().UseRoslynCSharpLoader().Load());
"And I try to get an integer named 'foo'"
.f(() => ex = Record.Exception(() => config.Foo<int>()));
"Then an exception is thrown"
.f(() => ex.Should().NotBeNull());
"And the exception message contains 'Foo'"
.f(() => ex.Message.Should().Contain("Foo"));
"And the exception message contains the full type name of int"
.f(() => ex.Message.Should().Contain(typeof(int).FullName));
"And the exception message contains the full type name of string"
.f(() => ex.Message.Should().Contain(typeof(string).FullName));
}
[Scenario]
public static void TryingToGetANullConfigurationItem(Exception ex)
{
dynamic config = null;
"Given a config file with a Foo null"
.f(c => ConfigFile.Create(@"Config.Foo = null;").Using(c));
"When I load the file"
.f(async () => config = await new Config().UseRoslynCSharpLoader().Load());
"And I try to get an integer named 'foo'"
.f(() => ex = Record.Exception(() => config.Foo<int>()));
"Then an exception is thrown"
.f(() => ex.Should().NotBeNull());
"And the exception message contains 'Foo'"
.f(() => ex.Message.Should().Contain("Foo"));
"And the exception message contains the full type name of int"
.f(() => ex.Message.Should().Contain(typeof(int).FullName));
"And the exception message contains 'null'"
.f(() => ex.Message.Should().Contain("null"));
}
}
}
| // <copyright file="StaticTypingFeature.cs" company="ConfigR contributors">
// Copyright (c) ConfigR contributors. (configr.net@gmail.com)
// </copyright>
namespace ConfigR.Tests.Acceptance
{
using System;
using ConfigR.Tests.Acceptance.Roslyn.CSharp.Support;
using FluentAssertions;
using Xbehave;
using Xunit;
public static class StaticTypingFeature
{
[Scenario]
public static void TryingToGetAnIncorrectlyTypedConfigurationItem(Exception ex)
{
dynamic config = null;
"Given a config file with a Foo string"
.f(c => ConfigFile.Create(@"Config.Foo = ""abc"";").Using(c));
"When I load the file"
.f(async () => config = await new Config().UseRoslynCSharpLoader().Load());
"And I try to get an integer named 'foo'"
.f(() => ex = Record.Exception(() => config.Foo<int>()));
"Then an exception is thrown"
.f(() => ex.Should().NotBeNull());
"And the exception message contains 'Foo'"
.f(() => ex.Message.Should().Contain("Foo"));
"And the exception message contains the full type name of int"
.f(() => ex.Message.Should().Contain(typeof(int).FullName));
"And the exception message contains the full type name of string"
.f(() => ex.Message.Should().Contain(typeof(string).FullName));
}
}
}
| mit | C# |
db6383d456fbef38accdba76662d6268159ab37c | Set version to 0.9, as API is still fluid (comply with SemVer rules) | jackawatts/ionfar-sharepoint-migration,sgryphon/ionfar-sharepoint-migration,jackawatts/ionfar-sharepoint-migration,sgryphon/ionfar-sharepoint-migration | src/IonFar.SharePoint.Migration/Properties/AssemblyInfo.cs | src/IonFar.SharePoint.Migration/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("IonFar.SharePoint.Migration")]
[assembly: AssemblyDescription("Library that helps you to deploy and manage changes to a SharePoint Site collection using the client side object model (CSOM). Changes are recorded once run in a SharePoint environment so that only changes that need to be run will be applied.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jack Watts")]
[assembly: AssemblyProduct("IonFar.SharePoint.Migration")]
[assembly: AssemblyCopyright("Copyright © Jack Watts 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("4f643f6d-aec9-42f4-94dd-d033f074088c")]
// 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("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
[assembly: AssemblyInformationalVersion("0.9.0.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("IonFar.SharePoint.Migration")]
[assembly: AssemblyDescription("Library that helps you to deploy and manage changes to a SharePoint Site collection using the client side object model (CSOM). Changes are recorded once run in a SharePoint environment so that only changes that need to be run will be applied.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jack Watts")]
[assembly: AssemblyProduct("IonFar.SharePoint.Migration")]
[assembly: AssemblyCopyright("Copyright © Jack Watts 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("4f643f6d-aec9-42f4-94dd-d033f074088c")]
// 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.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
| mit | C# |
1695bfcf0a45c1d534608baf7b931cdfd40c9785 | Switch back to the correct url | Azure-Samples/MyDriving,Azure-Samples/MyDriving,Azure-Samples/MyDriving | src/MobileApps/MyDriving/MyDriving.AzureClient/AzureClient.cs | src/MobileApps/MyDriving/MyDriving.AzureClient/AzureClient.cs | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using Microsoft.WindowsAzure.MobileServices;
namespace MyDriving.AzureClient
{
public class AzureClient : IAzureClient
{
const string DefaultMobileServiceUrl = "https://mydriving.azurewebsites.net";
IMobileServiceClient client;
string mobileServiceUrl;
public IMobileServiceClient Client => client ?? (client = CreateClient());
IMobileServiceClient CreateClient()
{
client = new MobileServiceClient(DefaultMobileServiceUrl, new AuthHandler())
{
SerializerSettings = new MobileServiceJsonSerializerSettings()
{
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
CamelCasePropertyNames = true
}
};
return client;
}
}
} | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.
using Microsoft.WindowsAzure.MobileServices;
namespace MyDriving.AzureClient
{
public class AzureClient : IAzureClient
{
const string DefaultMobileServiceUrl = "https://smartkar.azurewebsites.net/";
IMobileServiceClient client;
string mobileServiceUrl;
public IMobileServiceClient Client => client ?? (client = CreateClient());
IMobileServiceClient CreateClient()
{
client = new MobileServiceClient(DefaultMobileServiceUrl, new AuthHandler())
{
SerializerSettings = new MobileServiceJsonSerializerSettings()
{
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore,
CamelCasePropertyNames = true
}
};
return client;
}
}
} | mit | C# |
72b6bb25a5c1125f038d4b079e2e57fd31fdbcd1 | Allow nulls and hide if missing dependencies | peppy/osu,NeoAdonis/osu,smoogipooo/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu,smoogipoo/osu,peppy/osu-new,peppy/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,smoogipoo/osu,ppy/osu,NeoAdonis/osu | osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs | osu.Game/Overlays/Settings/Sections/General/UpdateSettings.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;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
protected override string Header => "Updates";
[BackgroundDependencyLoader(true)]
private void load(Storage storage, OsuConfigManager config, OsuGameBase game, UpdateManager updateManager)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
if (game != null && updateManager != null)
{
Add(new SettingsButton
{
Text = "Check for updates",
Action = updateManager.CheckForUpdate,
Enabled = { Value = game.IsDeployedBuild }
});
}
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
});
}
}
}
}
| // 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;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Updater;
namespace osu.Game.Overlays.Settings.Sections.General
{
public class UpdateSettings : SettingsSubsection
{
protected override string Header => "Updates";
[BackgroundDependencyLoader]
private void load(Storage storage, OsuConfigManager config, OsuGameBase game, UpdateManager updateManager)
{
Add(new SettingsEnumDropdown<ReleaseStream>
{
LabelText = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuSetting.ReleaseStream),
});
Add(new SettingsButton
{
Text = "Check for updates",
Action = updateManager.CheckForUpdate,
Enabled = { Value = game.IsDeployedBuild }
});
if (RuntimeInfo.IsDesktop)
{
Add(new SettingsButton
{
Text = "Open osu! folder",
Action = storage.OpenInNativeExplorer,
});
}
}
}
}
| mit | C# |
47982ae03d9480a66a24716e7b8804e8b6ada951 | Use GameObject transform for GLTFScenes | robertlong/UnityGLTFLoader,AltspaceVR/UnityGLTF | Assets/GLTF/Scripts/GLTFScene.cs | Assets/GLTF/Scripts/GLTFScene.cs | using System.Collections;
using UnityEngine;
namespace GLTF
{
/// <summary>
/// The root nodes of a scene.
/// </summary>
public class GLTFScene
{
/// <summary>
/// The indices of each root node.
/// </summary>
public GLTFNodeId[] nodes = { };
public string name;
/// <summary>
/// Create the GameObject for the GLTFScene and set it as a child of the gltfRoot's GameObject.
/// </summary>
/// <param name="parent">The gltfRoot's GameObject</param>
public GameObject Create(GameObject gltfRoot)
{
GameObject sceneObj = new GameObject(name ?? "GLTFScene");
sceneObj.transform.SetParent(gltfRoot.transform, false);
foreach (var node in nodes)
{
node.Value.Create(sceneObj);
}
return sceneObj;
}
}
}
| using System.Collections;
using UnityEngine;
namespace GLTF
{
/// <summary>
/// The root nodes of a scene.
/// </summary>
public class GLTFScene
{
/// <summary>
/// The indices of each root node.
/// </summary>
public GLTFNodeId[] nodes = { };
public string name;
/// <summary>
/// Create the GameObject for the GLTFScene and set it as a child of the gltfRoot's GameObject.
/// </summary>
/// <param name="parent">The gltfRoot's GameObject</param>
public GameObject Create(GameObject gltfRoot)
{
GameObject sceneObj = new GameObject(name ?? "GLTFScene");
sceneObj.transform.parent = gltfRoot.transform;
foreach (var node in nodes)
{
node.Value.Create(sceneObj);
}
return sceneObj;
}
}
}
| mit | C# |
f9818fb2a3bae47835375a929dfbc27605d4340a | Fix bugs. | Wentao-Xu/GraphEngine,Wentao-Xu/GraphEngine,Wentao-Xu/GraphEngine,Wentao-Xu/GraphEngine | src/Trinity.Core/Utilities/MISC/Misc.cs | src/Trinity.Core/Utilities/MISC/Misc.cs | // Graph Engine
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Trinity.Utilities
{
internal class Misc<T>
{
public static string ToString(ICollection<T> collection, int indent = 0, string separator = " ")
{
string indent_space = new string(' ', indent);
return string.Join(separator, collection.Select(c => indent_space + c));
}
}
internal class Misc
{
public static void DisplayByteArray(byte[] bytes)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
sb.Append(bytes[i]);
sb.Append('\t');
// 8 bytes per line
if ((i + 1) % 8 == 0 || i == bytes.Length - 1)
{
sb.AppendLine();
}
}
Console.Write(sb.ToString());
}
}
}
| // Graph Engine
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Trinity.Utilities
{
internal class Misc<T>
{
public static string ToString(ICollection<T> collection, int indent = 0, string separator = " ")
{
string indent_space = new string(' ', indent);
return string.Join(separator, collection.Select(c => indent_space + c));
}
}
internal class Misc
{
public static void DisplayByteArray(byte[] bytes)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < bytes.Length; i++)
{
sb.Append(bytes[i++]);
sb.Append('\t');
// 8 bytes per line
if (((i % 8) == 0) || (i == (bytes.Length - 1)))
{
sb.AppendLine();
}
}
Console.Write(sb.ToString());
}
}
}
| mit | C# |
bbc8686775b0dc2733352792aff2a77e8dafb647 | remove ForceValidate from IReactiveProperty interface | runceel/ReactiveProperty,runceel/ReactiveProperty,runceel/ReactiveProperty | Source/ReactiveProperty.Portable-NET45+WINRT+WP8/IReactiveProperty.cs | Source/ReactiveProperty.Portable-NET45+WINRT+WP8/IReactiveProperty.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Reactive.Bindings
{
// for EventToReactive and Serialization
public interface IReactiveProperty : IHasErrors
{
object Value { get; set; }
}
public interface IReactiveProperty<T> : IReactiveProperty, IObservable<T>, IDisposable, INotifyPropertyChanged, INotifyDataErrorInfo
{
new T Value { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Reactive.Bindings
{
// for EventToReactive and Serialization
public interface IReactiveProperty : IHasErrors
{
object Value { get; set; }
void ForceValidate();
}
public interface IReactiveProperty<T> : IReactiveProperty, IObservable<T>, IDisposable, INotifyPropertyChanged, INotifyDataErrorInfo
{
new T Value { get; set; }
}
}
| mit | C# |
1db5d3b33220d3a4f7f61780d0f5d18ea60ace1f | Use 2 spaces instead of tab for output indentation | mono/dbus-sharp,Tragetaschen/dbus-sharp,Tragetaschen/dbus-sharp,openmedicus/dbus-sharp,arfbtwn/dbus-sharp,openmedicus/dbus-sharp,mono/dbus-sharp,arfbtwn/dbus-sharp | tools/Monitor.cs | tools/Monitor.cs | // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
public class Monitor
{
public static void Main (string[] args)
{
Connection bus;
if (args.Length >= 1) {
string arg = args[0];
switch (arg)
{
case "--system":
bus = Bus.System;
break;
case "--session":
bus = Bus.Session;
break;
default:
Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]");
Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used.");
return;
}
} else {
bus = Bus.Session;
}
if (args.Length > 1) {
//install custom match rules only
for (int i = 1 ; i != args.Length ; i++)
bus.AddMatch (args[i]);
} else {
//no custom match rules, install the defaults
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall));
}
while (true) {
Message msg = bus.ReadMessage ();
if (msg == null)
break;
PrintMessage (msg);
Console.WriteLine ();
}
}
const string indent = " ";
internal static void PrintMessage (Message msg)
{
Console.WriteLine ("Message (" + msg.Header.Endianness + " endian, v" + msg.Header.MajorVersion + "):");
Console.WriteLine (indent + "Type: " + msg.Header.MessageType);
Console.WriteLine (indent + "Flags: " + msg.Header.Flags);
Console.WriteLine (indent + "Serial: " + msg.Header.Serial);
//foreach (HeaderField hf in msg.HeaderFields)
// Console.WriteLine (indent + hf.Code + ": " + hf.Value);
Console.WriteLine (indent + "Header Fields:");
foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields)
Console.WriteLine (indent + indent + field.Key + ": " + field.Value);
Console.WriteLine (indent + "Body (" + msg.Header.Length + " bytes):");
if (msg.Body != null) {
MessageReader reader = new MessageReader (msg);
//TODO: this needs to be done more intelligently
//TODO: number the args
try {
foreach (DType dtype in msg.Signature.GetBuffer ()) {
if (dtype == DType.Invalid)
continue;
object arg;
reader.GetValue (dtype, out arg);
Console.WriteLine (indent + indent + dtype + ": " + arg);
}
} catch {
Console.WriteLine (indent + indent + "monitor is too dumb to decode message body");
}
}
}
}
| // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using System.Collections.Generic;
using NDesk.DBus;
using org.freedesktop.DBus;
public class Monitor
{
public static void Main (string[] args)
{
Connection bus;
if (args.Length >= 1) {
string arg = args[0];
switch (arg)
{
case "--system":
bus = Bus.System;
break;
case "--session":
bus = Bus.Session;
break;
default:
Console.Error.WriteLine ("Usage: monitor.exe [--system | --session] [watch expressions]");
Console.Error.WriteLine (" If no watch expressions are provided, defaults will be used.");
return;
}
} else {
bus = Bus.Session;
}
if (args.Length > 1) {
//install custom match rules only
for (int i = 1 ; i != args.Length ; i++)
bus.AddMatch (args[i]);
} else {
//no custom match rules, install the defaults
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Signal));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodReturn));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.Error));
bus.AddMatch (MessageFilter.CreateMatchRule (MessageType.MethodCall));
}
while (true) {
Message msg = bus.ReadMessage ();
if (msg == null)
break;
PrintMessage (msg);
Console.WriteLine ();
}
}
internal static void PrintMessage (Message msg)
{
Console.WriteLine ("Message (" + msg.Header.Endianness + " endian, v" + msg.Header.MajorVersion + "):");
Console.WriteLine ("\t" + "Type: " + msg.Header.MessageType);
Console.WriteLine ("\t" + "Flags: " + msg.Header.Flags);
Console.WriteLine ("\t" + "Serial: " + msg.Header.Serial);
//foreach (HeaderField hf in msg.HeaderFields)
// Console.WriteLine ("\t" + hf.Code + ": " + hf.Value);
Console.WriteLine ("\tHeader Fields:");
foreach (KeyValuePair<FieldCode,object> field in msg.Header.Fields)
Console.WriteLine ("\t\t" + field.Key + ": " + field.Value);
Console.WriteLine ("\tBody (" + msg.Header.Length + " bytes):");
if (msg.Body != null) {
MessageReader reader = new MessageReader (msg);
//TODO: this needs to be done more intelligently
try {
foreach (DType dtype in msg.Signature.GetBuffer ()) {
if (dtype == DType.Invalid)
continue;
object arg;
reader.GetValue (dtype, out arg);
Console.WriteLine ("\t\t" + dtype + ": " + arg);
}
} catch {
Console.WriteLine ("\t\tmonitor is too dumb to decode message body");
}
}
}
}
| mit | C# |
32817e7b985c1f79e73fe74ae4fa75968505123a | Fix answer checking routine | mayth/fafrotskies | fafrotskies/Case.cs | fafrotskies/Case.cs | using System;
namespace fafrotskies
{
public class Case
{
private readonly string problem;
public string Problem
{
get { return problem; }
}
private readonly object answer;
private readonly int limit;
public int Limit
{
get { return limit; }
}
private readonly MatchType matchType;
public MatchType MatchType
{
get { return matchType; }
}
private Case(string problem, object answer, int limit, MatchType type)
{
this.problem = problem;
this.answer = answer;
this.limit = limit;
this.matchType = type;
}
public static Case Create(string problem, object answer, int limit)
{
string s = (string)answer;
int i;
if (int.TryParse(s, out i))
return new Case(problem, i, limit, MatchType.Integer);
double d;
if (double.TryParse(s, out d))
return new Case(problem, d, limit, MatchType.Float);
return new Case(problem, s, limit, MatchType.String);
}
public bool Check(object answer)
{
switch (MatchType)
{
case MatchType.String:
return answer.ToString() == (string)this.answer;
case MatchType.Integer:
{
int i;
return int.TryParse(answer.ToString(), out i) && i == (int)this.answer;
}
case MatchType.Float:
{
double d;
return double.TryParse(answer.ToString(), out d) && d == (double)this.answer;
}
}
throw new InvalidOperationException("unknown `MatchType`.");
}
}
}
| using System;
namespace fafrotskies
{
public class Case
{
private readonly string problem;
public string Problem
{
get { return problem; }
}
private readonly object answer;
private readonly int limit;
public int Limit
{
get { return limit; }
}
private readonly MatchType matchType;
public MatchType MatchType
{
get { return matchType; }
}
private Case(string problem, object answer, int limit, MatchType type)
{
this.problem = problem;
this.answer = answer;
this.limit = limit;
this.matchType = type;
}
public static Case Create(string problem, object answer, int limit)
{
string s = (string)answer;
int i;
if (int.TryParse(s, out i))
return new Case(problem, i, limit, MatchType.Integer);
double d;
if (double.TryParse(s, out d))
return new Case(problem, d, limit, MatchType.Float);
return new Case(problem, s, limit, MatchType.String);
}
public bool Check(object answer)
{
switch (MatchType)
{
case MatchType.String:
return (answer is string && (string)answer == (string)this.answer);
case MatchType.Integer:
return (answer is int && (int)answer == (int)this.answer);
case MatchType.Float:
return (answer is double && (double)answer == (double)this.answer);
}
throw new InvalidOperationException("unknown `MatchType`.");
}
}
}
| mit | C# |
cea5818326b6abcaa28ede762a70a06b93878268 | Fix wrapper fact to show proper type | prashanthr/NRules,StanleyGoldman/NRules,NRules/NRules,StanleyGoldman/NRules | src/NRules/NRules/Rete/Fact.cs | src/NRules/NRules/Rete/Fact.cs | using System;
using System.Diagnostics;
namespace NRules.Rete
{
[DebuggerDisplay("Fact {Object}")]
internal class Fact
{
private readonly Type _factType;
private readonly object _object;
public Fact()
{
}
public Fact(object @object)
{
_object = @object;
_factType = @object.GetType();
}
public virtual Type FactType
{
get { return _factType; }
}
public object RawObject
{
get { return _object; }
}
public virtual object Object
{
get { return _object; }
}
}
internal class WrapperFact : Fact
{
public WrapperFact(Tuple tuple)
: base(tuple)
{
}
public override Type FactType
{
get { return WrappedTuple.RightFact.FactType; }
}
public override object Object
{
get { return WrappedTuple.RightFact.Object; }
}
public Tuple WrappedTuple
{
get { return (Tuple) RawObject; }
}
}
} | using System;
using System.Diagnostics;
namespace NRules.Rete
{
[DebuggerDisplay("Fact {Object}")]
internal class Fact
{
private readonly Type _factType;
private readonly object _object;
public Fact()
{
}
public Fact(object @object)
{
_object = @object;
_factType = @object.GetType();
}
public Type FactType
{
get { return _factType; }
}
public object RawObject
{
get { return _object; }
}
public virtual object Object
{
get { return _object; }
}
}
internal class WrapperFact : Fact
{
public WrapperFact(Tuple tuple)
: base(tuple)
{
}
public override object Object
{
get { return WrappedTuple.RightFact.Object; }
}
public Tuple WrappedTuple
{
get { return (Tuple) RawObject; }
}
}
} | mit | C# |
0ef7c313add90ac59c7e78a5454f0341110a1e7b | Fix a bug that causes the LegacyLogger to not be dynamically instantiate as a ILoggerFactory. This is caused by the fact that a ILoggerFactory implies a constructor with no parameters and the LegacyLogger class does not have such constructor. | nohros/must,nohros/must,nohros/must | src/impl/log4net/LegacyLoggerFactory.cs | src/impl/log4net/LegacyLoggerFactory.cs | using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Nohros.Configuration;
namespace Nohros.Logging.log4net
{
public partial class LegacyLogger : ILoggerFactory
{
#region .ctor
/// <summary>
/// Constructor required by the <see cref="ILoggerFactory"/> class.
/// </summary>
LegacyLogger() {
}
#endregion
#region ILoggerFactory Members
/// <summary>
/// Creates an instance of the <see cref="LegacyLogger"/> class using the
/// specified provider node.
/// </summary>
/// <param name="options">
/// A <see cref="IDictionary{TKey,TValue}"/> object that contains the
/// options for the logger to be created.
/// </param>
/// <param name="configuration">
/// A <see cref="IMustConfiguration"/> object taht can be used to get
/// configuration inforamtions related with the logger to be created - such
/// as the configuration of a related logger.
/// </param>
/// <returns>
/// The newly created <see cref="LegacyLogger"/> object.
/// </returns>
public ILogger CreateLogger(IDictionary<string, string> options,
IMustConfiguration configuration) {
string logger_name = options[Strings.kLoggerName];
string xml_element_name = ProviderOptions.GetIfExists(options,
Strings.kLegacyLoggerXmlElementName,
Strings.kDefaultLegacyLoggerXmlElementName);
// Get the xml element that is used to configure the legacy log4net
// logger.
XmlElement element =
configuration.XmlElements[xml_element_name];
LegacyLogger legacy_logger = new LegacyLogger(element, logger_name);
legacy_logger.Configure();
return legacy_logger;
}
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Nohros.Configuration;
namespace Nohros.Logging.log4net
{
public partial class LegacyLogger : ILoggerFactory
{
#region ILoggerFactory Members
/// <summary>
/// Creates an instance of the <see cref="LegacyLogger"/> class using the
/// specified provider node.
/// </summary>
/// <param name="options">
/// A <see cref="IDictionary{TKey,TValue}"/> object that contains the
/// options for the logger to be created.
/// </param>
/// <param name="configuration">
/// A <see cref="IMustConfiguration"/> object taht can be used to get
/// configuration inforamtions related with the logger to be created - such
/// as the configuration of a related logger.
/// </param>
/// <returns>
/// The newly created <see cref="LegacyLogger"/> object.
/// </returns>
public ILogger CreateLogger(IDictionary<string, string> options,
IMustConfiguration configuration) {
string logger_name = options[Strings.kLoggerName];
string xml_element_name = ProviderOptions.GetIfExists(options,
Strings.kLegacyLoggerXmlElementName,
Strings.kDefaultLegacyLoggerXmlElementName);
// Get the xml element that is used to configure the legacy log4net
// logger.
XmlElement element =
configuration.XmlElements[xml_element_name];
LegacyLogger legacy_logger = new LegacyLogger(element, logger_name);
legacy_logger.Configure();
return legacy_logger;
}
#endregion
}
}
| mit | C# |
3a5f5d1edb82d63a8eeac520c9a5061bc0642799 | Reduce logging level to ERROR | boumenot/Grobid.NET | test/Grobid.Test/GrobidTest.cs | test/Grobid.Test/GrobidTest.cs | using System;
using System.IO;
using ApprovalTests;
using ApprovalTests.Reporters;
using FluentAssertions;
using Xunit;
using Grobid.NET;
using org.apache.log4j;
using org.grobid.core;
namespace Grobid.Test
{
[UseReporter(typeof(DiffReporter))]
public class GrobidTest
{
static GrobidTest()
{
BasicConfigurator.configure();
org.apache.log4j.Logger.getRootLogger().setLevel(Level.ERROR);
}
[Fact]
[Trait("Test", "EndToEnd")]
public void ExtractTest()
{
var binPath = Environment.GetEnvironmentVariable("PDFTOXMLEXE");
var factory = new GrobidFactory(
"grobid.zip",
binPath,
Directory.GetCurrentDirectory());
var grobid = factory.Create();
var result = grobid.Extract(@"essence-linq.pdf");
result.Should().NotBeEmpty();
Approvals.Verify(result);
}
[Fact]
public void Test()
{
var x = GrobidModels.NAMES_HEADER;
x.name().Should().Be("NAMES_HEADER");
x.toString().Should().Be("name/header");
}
}
}
| using System;
using System.IO;
using ApprovalTests;
using ApprovalTests.Reporters;
using FluentAssertions;
using Xunit;
using Grobid.NET;
using org.apache.log4j;
using org.grobid.core;
namespace Grobid.Test
{
[UseReporter(typeof(DiffReporter))]
public class GrobidTest
{
static GrobidTest()
{
BasicConfigurator.configure();
org.apache.log4j.Logger.getRootLogger().setLevel(Level.DEBUG);
}
[Fact]
[Trait("Test", "EndToEnd")]
public void ExtractTest()
{
var binPath = Environment.GetEnvironmentVariable("PDFTOXMLEXE");
org.apache.log4j.Logger.getRootLogger().info("PDFTOXMLEXE=" + binPath);
var factory = new GrobidFactory(
"grobid.zip",
binPath,
Directory.GetCurrentDirectory());
var grobid = factory.Create();
var result = grobid.Extract(@"essence-linq.pdf");
result.Should().NotBeEmpty();
Approvals.Verify(result);
}
[Fact]
public void Test()
{
var x = GrobidModels.NAMES_HEADER;
x.name().Should().Be("NAMES_HEADER");
x.toString().Should().Be("name/header");
}
}
}
| apache-2.0 | C# |
6d48e2f0783dfd9e60625c72dee0be2f3124fff0 | Update ReverserTest.cs | NMSLanX/Natasha | test/NatashaUT/ReverserTest.cs | test/NatashaUT/ReverserTest.cs | using Natasha;
using NatashaUT.Model;
using System.Collections.Generic;
using Xunit;
namespace NatashaUT
{
[Trait("反解测试","参数")]
public class ReverserTest
{
[Fact(DisplayName = "参数与类型反解 in")]
public void TestIn()
{
var info = typeof(ReverserTestModel).GetMethod("Test1");
Assert.Equal("in Rsm<GRsm>",DeclarationReverser.GetParametersType(info.GetParameters()[0]));
}
[Fact(DisplayName = "参数与类型反解 out")]
public void TestOut()
{
var info = typeof(ReverserTestModel).GetMethod("Test2");
Assert.Equal("out Rsm<Rsm<GRsm>[]>", DeclarationReverser.GetParametersType(info.GetParameters()[0]));
}
[Fact(DisplayName = "参数与类型反解 ref")]
public void TestRef()
{
var info = typeof(ReverserTestModel).GetMethod("Test3");
Assert.Equal("ref Rsm<Rsm<GRsm>[]>[]", DeclarationReverser.GetParametersType(info.GetParameters()[0]));
}
[Fact(DisplayName = "多维数组解析")]
public void TestType()
{
Assert.Equal("List<Int32>[]", typeof(List<int>[]).GetDevelopName());
Assert.Equal("List<Int32>[,]", typeof(List<int>[,]).GetDevelopName());
Assert.Equal("List<Int32>[,][][,,,,]", typeof(List<int>[,][][,,,,]).GetDevelopName());
Assert.Equal("Int32[,]", typeof(int[,]).GetDevelopName());
Assert.Equal("Int32[][]", typeof(int[][]).GetDevelopName());
Assert.Equal("Int32[][,,,]", typeof(int[][,,,]).GetDevelopName());
Assert.Equal("Dictionary<Int32[][,,,],String[,,,][]>[]", typeof(Dictionary<int[][,,,], string[,,,][]>[]).GetDevelopName());
}
}
}
| using Natasha;
using NatashaUT.Model;
using System.Collections.Generic;
using Xunit;
namespace NatashaUT
{
[Trait("反解测试","参数")]
public class ReverserTest
{
[Fact(DisplayName = "参数与类型反解 in")]
public void TestIn()
{
var info = typeof(ReverserTestModel).GetMethod("Test1");
Assert.Equal("in Rsm<GRsm>",DeclarationReverser.GetParametersType(info.GetParameters()[0]));
}
[Fact(DisplayName = "参数与类型反解 out")]
public void TestOut()
{
var info = typeof(ReverserTestModel).GetMethod("Test2");
Assert.Equal("out Rsm<Rsm<GRsm>[]>", DeclarationReverser.GetParametersType(info.GetParameters()[0]));
}
[Fact(DisplayName = "参数与类型反解 ref")]
public void TestRef()
{
var info = typeof(ReverserTestModel).GetMethod("Test3");
Assert.Equal("ref Rsm<Rsm<GRsm>[]>[]", DeclarationReverser.GetParametersType(info.GetParameters()[0]));
}
[Fact(DisplayName = "多维数组解析")]
public void TestType()
{
Assert.Equal("List<Int32>[]", typeof(List<int>[]).GetDevelopName());
Assert.Equal("List<Int32>[,]", typeof(List<int>[,]).GetDevelopName());
Assert.Equal("List<Int32>[,][][,,,,]", typeof(List<int>[,][][,,,,]).GetDevelopName());
Assert.Equal("Int32[,]", typeof(int[,]).GetDevelopName());
Assert.Equal("Int32[][]", typeof(int[][]).GetDevelopName());
Assert.Equal("Int32[][,,,]", typeof(int[][,,,]).GetDevelopName());
}
}
}
| mpl-2.0 | C# |
83558fcedc55b8702acd464c77b8cbb6bca6b868 | Enhance coverage | B2MSolutions/reyna.net,B2MSolutions/reyna.net | src/reyna.Facts/GivenAnInMemoryQueue.cs | src/reyna.Facts/GivenAnInMemoryQueue.cs | namespace Reyna.Facts
{
using System;
using Xunit;
public class GivenAnInMemoryQueue
{
[Fact]
public void WhenConstructingShouldNotThrow()
{
new InMemoryQueue();
}
[Fact]
public void WhenCallingAddShouldAddAndRaiseEvent()
{
var messageUri = new Uri("http://www.google.com");
var messageBody = string.Empty;
var queue = new InMemoryQueue();
var enqueueCounter = 0;
queue.MessageAdded += (sender, e) => { enqueueCounter++; };
queue.Add(new Message(messageUri, messageBody));
Assert.NotNull(queue.Get());
Assert.Equal(messageUri, queue.Get().Url);
Assert.Equal(messageBody, queue.Get().Body);
Assert.Equal(1, enqueueCounter);
}
[Fact]
public void WhenCallingGetAndIsEmptyShouldNotThrow()
{
var queue = new InMemoryQueue();
Assert.Null(queue.Get());
}
[Fact]
public void WhenCallingRemoveAndIsEmptyShouldNotThrow()
{
var queue = new InMemoryQueue();
Assert.Null(queue.Remove());
}
[Fact]
public void WhenCallingRemoveAndIsNotEmptyShouldRemove()
{
var queue = new InMemoryQueue();
queue.Add(new Message(null, null));
var actual = queue.Remove();
Assert.NotNull(actual);
Assert.Null(actual.Url);
Assert.Null(actual.Body);
}
[Fact]
public void WhenCallingAddMessageWithSizeThenRemoveAndIsNotEmptyShouldRemove()
{
var queue = new InMemoryQueue();
queue.Add(new Message(null, null), 1);
var actual = queue.Remove();
Assert.NotNull(actual);
Assert.Null(actual.Url);
Assert.Null(actual.Body);
}
}
}
| namespace Reyna.Facts
{
using System;
using Xunit;
public class GivenAnInMemoryQueue
{
[Fact]
public void WhenConstructingShouldNotThrow()
{
new InMemoryQueue();
}
[Fact]
public void WhenCallingAddShouldAddAndRaiseEvent()
{
var messageUri = new Uri("http://www.google.com");
var messageBody = string.Empty;
var queue = new InMemoryQueue();
var enqueueCounter = 0;
queue.MessageAdded += (sender, e) => { enqueueCounter++; };
queue.Add(new Message(messageUri, messageBody));
Assert.NotNull(queue.Get());
Assert.Equal(messageUri, queue.Get().Url);
Assert.Equal(messageBody, queue.Get().Body);
Assert.Equal(1, enqueueCounter);
}
[Fact]
public void WhenCallingGetAndIsEmptyShouldNotThrow()
{
var queue = new InMemoryQueue();
Assert.Null(queue.Get());
}
[Fact]
public void WhenCallingRemoveAndIsEmptyShouldNotThrow()
{
var queue = new InMemoryQueue();
Assert.Null(queue.Remove());
}
[Fact]
public void WhenCallingRemoveAndIsNotEmptyShouldRemove()
{
var queue = new InMemoryQueue();
queue.Add(new Message(null, null));
var actual = queue.Remove();
Assert.NotNull(actual);
Assert.Null(actual.Url);
Assert.Null(actual.Body);
}
}
}
| mit | C# |
5cac1d2b43f6ed8fc6b6d5b88d0979340831faef | Update InjectOutgoingMessageBehavior.cs | SimonCropp/NServiceBus.Serilog | src/NServiceBus.Serilog/LogInjection/InjectOutgoingMessageBehavior.cs | src/NServiceBus.Serilog/LogInjection/InjectOutgoingMessageBehavior.cs | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Pipeline;
using Serilog.Core.Enrichers;
class InjectOutgoingMessageBehavior :
Behavior<IOutgoingLogicalMessageContext>
{
LogBuilder logBuilder;
public InjectOutgoingMessageBehavior(LogBuilder logBuilder)
{
this.logBuilder = logBuilder;
}
public override Task Invoke(IOutgoingLogicalMessageContext context, Func<Task> next)
{
var headers = context.Headers;
var messageTypeName = context.Message.Instance.GetType().FullName;
var logger = logBuilder.GetLogger(messageTypeName);
var properties = new List<PropertyEnricher>
{
new PropertyEnricher("OutgoingMessageId", context.MessageId),
new PropertyEnricher("OutgoingMessageType", messageTypeName),
};
if (headers.TryGetValue(Headers.CorrelationId, out var correlationId))
{
properties.Add(new PropertyEnricher("CorrelationId", correlationId));
}
if (headers.TryGetValue(Headers.ConversationId, out var conversationId))
{
properties.Add(new PropertyEnricher("ConversationId", conversationId));
}
var forContext = logger.ForContext(properties);
context.Extensions.Set(forContext);
return next();
}
public class Registration :
RegisterStep
{
public Registration(LogBuilder logBuilder)
: base(
stepId: $"Serilog{nameof(InjectOutgoingMessageBehavior)}",
behavior: typeof(InjectOutgoingMessageBehavior),
description: "Injects a logger into the outgoing context",
factoryMethod: builder => new InjectOutgoingMessageBehavior(logBuilder))
{
}
}
} | using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Pipeline;
using Serilog.Core.Enrichers;
class InjectOutgoingMessageBehavior : Behavior<IOutgoingLogicalMessageContext>
{
LogBuilder logBuilder;
public InjectOutgoingMessageBehavior(LogBuilder logBuilder)
{
this.logBuilder = logBuilder;
}
public override Task Invoke(IOutgoingLogicalMessageContext context, Func<Task> next)
{
var headers = context.Headers;
var messageTypeName = context.Message.Instance.GetType().FullName;
var logger = logBuilder.GetLogger(messageTypeName);
var properties = new List<PropertyEnricher>
{
new PropertyEnricher("OutgoingMessageId", context.MessageId),
new PropertyEnricher("OutgoingMessageType", messageTypeName),
};
if (headers.TryGetValue(Headers.CorrelationId, out var correlationId))
{
properties.Add(new PropertyEnricher("CorrelationId", correlationId));
}
if (headers.TryGetValue(Headers.ConversationId, out var conversationId))
{
properties.Add(new PropertyEnricher("ConversationId", conversationId));
}
var forContext = logger.ForContext(properties);
context.Extensions.Set(forContext);
return next();
}
public class Registration : RegisterStep
{
public Registration(LogBuilder logBuilder)
: base(
stepId: $"Serilog{nameof(InjectOutgoingMessageBehavior)}",
behavior: typeof(InjectOutgoingMessageBehavior),
description: "Injects a logger into the outgoing context",
factoryMethod: builder => new InjectOutgoingMessageBehavior(logBuilder))
{
}
}
} | mit | C# |
13d25ab519d159c29fa44b5bede370ca72f3e64d | bump ver | AntonyCorbett/OnlyT,AntonyCorbett/OnlyT | SolutionInfo.cs | SolutionInfo.cs | using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.60")] | using System.Reflection;
[assembly: AssemblyCompany("SoundBox")]
[assembly: AssemblyProduct("OnlyT")]
[assembly: AssemblyCopyright("Copyright © 2018 Antony Corbett")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.1.0.59")] | mit | C# |
ee300752f60460825bdbb4d79078e24ccd6e2187 | make dng use the dng loader. | Yetangitu/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,mans0954/f-spot,mono/f-spot,Sanva/f-spot,Sanva/f-spot,GNOME/f-spot,dkoeb/f-spot,mans0954/f-spot,mans0954/f-spot,NguyenMatthieu/f-spot,dkoeb/f-spot,Yetangitu/f-spot,dkoeb/f-spot,Sanva/f-spot,dkoeb/f-spot,nathansamson/F-Spot-Album-Exporter,nathansamson/F-Spot-Album-Exporter,mono/f-spot,NguyenMatthieu/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,mans0954/f-spot,nathansamson/F-Spot-Album-Exporter,Yetangitu/f-spot,GNOME/f-spot,nathansamson/F-Spot-Album-Exporter,mono/f-spot,mono/f-spot,NguyenMatthieu/f-spot,Sanva/f-spot,GNOME/f-spot,mono/f-spot,mans0954/f-spot,mono/f-spot,GNOME/f-spot,mans0954/f-spot,Yetangitu/f-spot,dkoeb/f-spot,GNOME/f-spot,Yetangitu/f-spot | src/ImageFile.cs | src/ImageFile.cs | using System.IO;
namespace FSpot {
public class ImageFile {
protected string path;
static System.Collections.Hashtable name_table;
protected ImageFile (string path)
{
this.path = path;
}
public virtual System.IO.Stream PixbufStream ()
{
return System.IO.File.OpenRead (this.path);
}
static ImageFile ()
{
name_table = new System.Collections.Hashtable ();
name_table [".jpeg"] = typeof (JpegFile);
name_table [".jpg"] = typeof (JpegFile);
name_table [".png"] = typeof (FSpot.Png.PngFile);
name_table [".cr2"] = typeof (FSpot.Tiff.Cr2File);
name_table [".nef"] = typeof (FSpot.Tiff.NefFile);
name_table [".tiff"] = typeof (FSpot.Tiff.TiffFile);
name_table [".tif"] = typeof (FSpot.Tiff.TiffFile);
name_table [".dng"] = typeof (FSpot.Tiff.DngFile);
name_table [".crw"] = typeof (FSpot.Ciff.CiffFile);
name_table [".ppm"] = typeof (FSpot.Pnm.PnmFile);
}
public string Path {
get {
return this.path;
}
}
public PixbufOrientation Orientation {
get {
return GetOrientation ();
}
}
public virtual void Save (Gdk.Pixbuf pixbuf, System.IO.Stream stream)
{
PixbufUtils.Save (pixbuf, stream, "jpeg", null, null);
}
protected Gdk.Pixbuf TransformAndDispose (Gdk.Pixbuf orig)
{
if (orig == null)
return null;
Gdk.Pixbuf rotated = PixbufUtils.TransformOrientation (orig, this.Orientation, true);
//ValidateThumbnail (photo, rotated);
if (rotated != orig)
orig.Dispose ();
return rotated;
}
public virtual Gdk.Pixbuf Load ()
{
Gdk.Pixbuf orig = new Gdk.Pixbuf (this.Path);
return TransformAndDispose (orig);
}
public virtual Gdk.Pixbuf Load (int max_width, int max_height)
{
return PixbufUtils.LoadAtMaxSize (this.Path, max_width, max_height);
}
public virtual PixbufOrientation GetOrientation ()
{
return PixbufOrientation.TopLeft;
}
public virtual System.DateTime Date ()
{
return File.GetCreationTimeUtc (this.path);
}
public static ImageFile Create (string path)
{
string extension = System.IO.Path.GetExtension (path).ToLower ();
System.Type t = (System.Type) name_table [extension];
ImageFile img;
if (t != null)
img = (ImageFile) System.Activator.CreateInstance (t, new object[] {path});
else
img = new ImageFile (path);
return img;
}
}
}
| using System.IO;
namespace FSpot {
public class ImageFile {
protected string path;
static System.Collections.Hashtable name_table;
protected ImageFile (string path)
{
this.path = path;
}
public virtual System.IO.Stream PixbufStream ()
{
return System.IO.File.OpenRead (this.path);
}
static ImageFile ()
{
name_table = new System.Collections.Hashtable ();
name_table [".jpeg"] = typeof (JpegFile);
name_table [".jpg"] = typeof (JpegFile);
name_table [".png"] = typeof (FSpot.Png.PngFile);
name_table [".cr2"] = typeof (FSpot.Tiff.Cr2File);
name_table [".nef"] = typeof (FSpot.Tiff.NefFile);
name_table [".tiff"] = typeof (FSpot.Tiff.TiffFile);
name_table [".tif"] = typeof (FSpot.Tiff.TiffFile);
name_table [".dng"] = typeof (FSpot.Tiff.TiffFile);
name_table [".crw"] = typeof (FSpot.Ciff.CiffFile);
name_table [".ppm"] = typeof (FSpot.Pnm.PnmFile);
}
public string Path {
get {
return this.path;
}
}
public PixbufOrientation Orientation {
get {
return GetOrientation ();
}
}
public virtual void Save (Gdk.Pixbuf pixbuf, System.IO.Stream stream)
{
PixbufUtils.Save (pixbuf, stream, "jpeg", null, null);
}
protected Gdk.Pixbuf TransformAndDispose (Gdk.Pixbuf orig)
{
if (orig == null)
return null;
Gdk.Pixbuf rotated = PixbufUtils.TransformOrientation (orig, this.Orientation, true);
//ValidateThumbnail (photo, rotated);
if (rotated != orig)
orig.Dispose ();
return rotated;
}
public virtual Gdk.Pixbuf Load ()
{
Gdk.Pixbuf orig = new Gdk.Pixbuf (this.Path);
return TransformAndDispose (orig);
}
public virtual Gdk.Pixbuf Load (int max_width, int max_height)
{
return PixbufUtils.LoadAtMaxSize (this.Path, max_width, max_height);
}
public virtual PixbufOrientation GetOrientation ()
{
return PixbufOrientation.TopLeft;
}
public virtual System.DateTime Date ()
{
return File.GetCreationTimeUtc (this.path);
}
public static ImageFile Create (string path)
{
string extension = System.IO.Path.GetExtension (path).ToLower ();
System.Type t = (System.Type) name_table [extension];
ImageFile img;
if (t != null)
img = (ImageFile) System.Activator.CreateInstance (t, new object[] {path});
else
img = new ImageFile (path);
return img;
}
}
}
| mit | C# |
2b7beeff0030010c280551a832d08c8a44a1050d | Check session for null | SimplePersistence/SimplePersistence.UoW.NH | SimplePersistence.UoW.NH/src/SimplePersistence.UoW.NH/NHLogicalArea.cs | SimplePersistence.UoW.NH/src/SimplePersistence.UoW.NH/NHLogicalArea.cs | #region License
// The MIT License (MIT)
//
// Copyright (c) 2016 SimplePersistence
//
// 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.
#endregion
namespace SimplePersistence.UoW.NH
{
using System;
using System.Linq;
using NHibernate;
using NHibernate.Linq;
/// <summary>
/// Represents an area used to aggregate Unit of Work logic,
/// like data transformations or procedures, specialized for NHibernate.
/// </summary>
public abstract class NHLogicalArea : INHLogicalArea
{
#region Implementation of INHLogicalArea
/// <summary>
/// The database session object
/// </summary>
public ISession Session { get; }
/// <summary>
/// Prepares an <see cref="IQueryable{T}"/> for the specified entity type.
/// </summary>
/// <typeparam name="TEntity">The entity type</typeparam>
/// <returns>The <see cref="IQueryable{T}"/> for the specified entity type.</returns>
public IQueryable<TEntity> Query<TEntity>() where TEntity : class
{
return Session.Query<TEntity>();
}
#endregion
/// <summary>
/// Creates a new logical area that will use the given database session
/// </summary>
/// <param name="session">The database session object</param>
/// <exception cref="ArgumentNullException"></exception>
protected NHLogicalArea(ISession session)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Session = session;
}
}
} | #region License
// The MIT License (MIT)
//
// Copyright (c) 2016 SimplePersistence
//
// 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.
#endregion
namespace SimplePersistence.UoW.NH
{
using System.Linq;
using NHibernate;
using NHibernate.Linq;
/// <summary>
/// Represents an area used to aggregate Unit of Work logic,
/// like data transformations or procedures, specialized for NHibernate.
/// </summary>
public abstract class NHLogicalArea : INHLogicalArea
{
#region Implementation of INHLogicalArea
/// <summary>
/// The database session object
/// </summary>
public ISession Session { get; }
/// <summary>
/// Prepares an <see cref="IQueryable{T}"/> for the specified entity type.
/// </summary>
/// <typeparam name="TEntity">The entity type</typeparam>
/// <returns>The <see cref="IQueryable{T}"/> for the specified entity type.</returns>
public IQueryable<TEntity> Query<TEntity>() where TEntity : class
{
return Session.Query<TEntity>();
}
#endregion
/// <summary>
/// Creates a new logical area that will use the given database session
/// </summary>
/// <param name="session"></param>
protected NHLogicalArea(ISession session)
{
Session = session;
}
}
} | mit | C# |
40df7c02f4db242ab599b21bd02de0d9ef048707 | Add ToString() for Invoice | jcvandan/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,XeroAPI/XeroAPI.Net,TDaphneB/XeroAPI.Net | source/XeroApi/Model/Invoice.cs | source/XeroApi/Model/Invoice.cs | using System;
namespace XeroApi.Model
{
public class Invoice : ModelBase
{
[ItemId]
public virtual Guid InvoiceID { get; set; }
[ItemNumber]
public string InvoiceNumber { get; set; }
[ItemUpdatedDate]
public DateTime? UpdatedDateUTC { get; set; }
public string Type { get; set; }
public string Reference { get; set; }
[ReadOnly]
public Payments Payments { get; set; }
[ReadOnly]
public CreditNotes CreditNotes { get; set; }
[ReadOnly]
public decimal? AmountDue { get; set; }
[ReadOnly]
public decimal? AmountPaid { get; set; }
[ReadOnly]
public decimal? AmountCredited { get; set; }
public string Url { get; set; }
[ReadOnly]
public string ExternalLinkProviderName { get; set; }
[ReadOnly]
public bool? SentToContact { get; set; }
public decimal? CurrencyRate { get; set; }
public Contact Contact { get; set; }
public DateTime? Date { get; set; }
public DateTime? DueDate { get; set; }
public virtual Guid? BrandingThemeID { get; set; }
public virtual string Status { get; set; }
public LineAmountType LineAmountTypes { get; set; }
public virtual LineItems LineItems { get; set; }
public virtual decimal? SubTotal { get; set; }
public virtual decimal? TotalTax { get; set; }
public virtual decimal? Total { get; set; }
public virtual string CurrencyCode { get; set; }
[ReadOnly]
public DateTime? FullyPaidOnDate { get; set; }
public override string ToString()
{
return string.Format("Invoice:{0} Id:{1}", InvoiceNumber, InvoiceID);
}
}
public class Invoices : ModelList<Invoice>
{
}
} | using System;
namespace XeroApi.Model
{
public class Invoice : ModelBase
{
[ItemId]
public virtual Guid InvoiceID { get; set; }
[ItemNumber]
public string InvoiceNumber { get; set; }
[ItemUpdatedDate]
public DateTime? UpdatedDateUTC { get; set; }
public string Type { get; set; }
public string Reference { get; set; }
[ReadOnly]
public Payments Payments { get; set; }
[ReadOnly]
public CreditNotes CreditNotes { get; set; }
[ReadOnly]
public decimal? AmountDue { get; set; }
[ReadOnly]
public decimal? AmountPaid { get; set; }
[ReadOnly]
public decimal? AmountCredited { get; set; }
public string Url { get; set; }
[ReadOnly]
public string ExternalLinkProviderName { get; set; }
[ReadOnly]
public bool? SentToContact { get; set; }
public decimal? CurrencyRate { get; set; }
public Contact Contact { get; set; }
public DateTime? Date { get; set; }
public DateTime? DueDate { get; set; }
public virtual Guid? BrandingThemeID { get; set; }
public virtual string Status { get; set; }
public LineAmountType LineAmountTypes { get; set; }
public virtual LineItems LineItems { get; set; }
public virtual decimal? SubTotal { get; set; }
public virtual decimal? TotalTax { get; set; }
public virtual decimal? Total { get; set; }
public virtual string CurrencyCode { get; set; }
[ReadOnly]
public DateTime? FullyPaidOnDate { get; set; }
}
public class Invoices : ModelList<Invoice>
{
}
} | mit | C# |
c9ee3101e1942e910ca6582f0be9f7eec76bacd0 | Remove unecessary private field | Seddryck/NBi,Seddryck/NBi | NBi.Core/Transformation/Transformer/Native/LocalToUtc.cs | NBi.Core/Transformation/Transformer/Native/LocalToUtc.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBi.Core.Transformation.Transformer.Native
{
class LocalToUtc : UtcToLocal
{
public LocalToUtc(string timeZoneLabel)
: base(timeZoneLabel)
{ }
protected override object EvaluateDateTime(DateTime value) =>
TimeZoneInfo.ConvertTimeToUtc(value, InstantiateTimeZoneInfo(TimeZoneLabel));
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NBi.Core.Transformation.Transformer.Native
{
class LocalToUtc : UtcToLocal
{
private readonly string timeZoneLabel;
public LocalToUtc(string timeZoneLabel)
: base(timeZoneLabel)
{ }
protected override object EvaluateDateTime(DateTime value) =>
TimeZoneInfo.ConvertTimeToUtc(value, InstantiateTimeZoneInfo(TimeZoneLabel));
}
}
| apache-2.0 | C# |
6cf19cc4d8f3b5e2766b5c4c82e31746dedb8e75 | Add ContentType to InitiateMultipartUploadRequest | carbon/Amazon | src/Amazon.S3/Actions/InitiateMultipartUploadRequest.cs | src/Amazon.S3/Actions/InitiateMultipartUploadRequest.cs | using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Headers;
using Amazon.S3.Helpers;
namespace Amazon.S3
{
public sealed class InitiateMultipartUploadRequest : S3Request
{
public InitiateMultipartUploadRequest(string host, string bucketName, string key)
: base(HttpMethod.Post, host, bucketName, objectName: key + "?uploads")
{
if (key is null) throw new ArgumentNullException(nameof(key));
CompletionOption = HttpCompletionOption.ResponseContentRead;
Content = new ByteArrayContent(Array.Empty<byte>());
}
public InitiateMultipartUploadRequest(
string host,
string bucketName,
string key,
IReadOnlyDictionary<string, string> properties)
: this(host, bucketName, key)
{
this.UpdateHeaders(properties);
}
public string? ContentType
{
get => Content.Headers.ContentType?.ToString();
set
{
if (value is null)
{
Content.Headers.ContentType = null;
}
else
{
Content.Headers.ContentType = MediaTypeHeaderValue.Parse(value);
}
}
}
}
}
/*
POST /ObjectName?uploads HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: signatureValue
*/ | using System;
using System.Net.Http;
namespace Amazon.S3
{
public sealed class InitiateMultipartUploadRequest : S3Request
{
public InitiateMultipartUploadRequest(string host, string bucketName, string key)
: base(HttpMethod.Post, host, bucketName, key + "?uploads")
{
if (key is null) throw new ArgumentNullException(nameof(key));
CompletionOption = HttpCompletionOption.ResponseContentRead;
}
}
}
/*
POST /ObjectName?uploads HTTP/1.1
Host: BucketName.s3.amazonaws.com
Date: date
Authorization: signatureValue
*/
| mit | C# |
455ff5b458c998ad4cd1d7d0e43b3c5c6a834299 | Handle a couple more options for how to describe the limits | AlexGhiondea/SmugMug.NET | src/SmugMugShared/Descriptors/Limits.cs | src/SmugMugShared/Descriptors/Limits.cs | // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace SmugMug.Shared.Descriptors
{
public class Limits
{
// INFINITY, NEGATIVE_INFINITY, POSITIVE_INFINITY, and numbers
private double maxVal, minVal;
public Limits(string min, string max)
{
minVal = Parse(min);
maxVal = Parse(max);
}
private double Parse(string value)
{
if (string.IsNullOrEmpty(value))
return 0;
if (StringComparer.OrdinalIgnoreCase.Equals("infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("positive_infinity", value))
return double.PositiveInfinity;
if (StringComparer.OrdinalIgnoreCase.Equals("-infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("negative_infinity", value))
return double.NegativeInfinity;
if (StringComparer.OrdinalIgnoreCase.Equals("all", value))
return double.PositiveInfinity;
return double.Parse(value);
}
public double Min { get { return minVal; } }
public double Max { get { return maxVal; } }
}
}
| // Copyright (c) Alex Ghiondea. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
namespace SmugMug.Shared.Descriptors
{
public class Limits
{
// INFINITY, NEGATIVE_INFINITY, POSITIVE_INFINITY, and numbers
private double maxVal, minVal;
public Limits(string min, string max)
{
minVal = Parse(min);
maxVal = Parse(max);
}
private double Parse(string value)
{
if (StringComparer.OrdinalIgnoreCase.Equals("infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("positive_infinity", value))
return double.PositiveInfinity;
if (StringComparer.OrdinalIgnoreCase.Equals("-infinity", value) ||
StringComparer.OrdinalIgnoreCase.Equals("negative_infinity", value))
return double.NegativeInfinity;
return double.Parse(value);
}
public double Min { get { return minVal; } }
public double Max { get { return maxVal; } }
}
}
| mit | C# |
933fe9f6e2359ae0fdbdee0a9308dac233503663 | Add obsolete message for misspelled CreatIndex method | junlapong/elasticsearch-net,robrich/elasticsearch-net,jonyadamit/elasticsearch-net,geofeedia/elasticsearch-net,tkirill/elasticsearch-net,cstlaurent/elasticsearch-net,starckgates/elasticsearch-net,robertlyson/elasticsearch-net,CSGOpenSource/elasticsearch-net,LeoYao/elasticsearch-net,ststeiger/elasticsearch-net,adam-mccoy/elasticsearch-net,amyzheng424/elasticsearch-net,jonyadamit/elasticsearch-net,LeoYao/elasticsearch-net,faisal00813/elasticsearch-net,tkirill/elasticsearch-net,geofeedia/elasticsearch-net,TheFireCookie/elasticsearch-net,starckgates/elasticsearch-net,mac2000/elasticsearch-net,CSGOpenSource/elasticsearch-net,azubanov/elasticsearch-net,RossLieberman/NEST,robertlyson/elasticsearch-net,UdiBen/elasticsearch-net,amyzheng424/elasticsearch-net,mac2000/elasticsearch-net,wawrzyn/elasticsearch-net,SeanKilleen/elasticsearch-net,UdiBen/elasticsearch-net,gayancc/elasticsearch-net,SeanKilleen/elasticsearch-net,CSGOpenSource/elasticsearch-net,TheFireCookie/elasticsearch-net,junlapong/elasticsearch-net,gayancc/elasticsearch-net,wawrzyn/elasticsearch-net,adam-mccoy/elasticsearch-net,SeanKilleen/elasticsearch-net,abibell/elasticsearch-net,RossLieberman/NEST,cstlaurent/elasticsearch-net,joehmchan/elasticsearch-net,junlapong/elasticsearch-net,cstlaurent/elasticsearch-net,KodrAus/elasticsearch-net,abibell/elasticsearch-net,DavidSSL/elasticsearch-net,UdiBen/elasticsearch-net,robrich/elasticsearch-net,DavidSSL/elasticsearch-net,LeoYao/elasticsearch-net,wawrzyn/elasticsearch-net,joehmchan/elasticsearch-net,KodrAus/elasticsearch-net,mac2000/elasticsearch-net,faisal00813/elasticsearch-net,faisal00813/elasticsearch-net,joehmchan/elasticsearch-net,amyzheng424/elasticsearch-net,robrich/elasticsearch-net,tkirill/elasticsearch-net,ststeiger/elasticsearch-net,DavidSSL/elasticsearch-net,geofeedia/elasticsearch-net,TheFireCookie/elasticsearch-net,azubanov/elasticsearch-net,elastic/elasticsearch-net,KodrAus/elasticsearch-net,abibell/elasticsearch-net,robertlyson/elasticsearch-net,starckgates/elasticsearch-net,jonyadamit/elasticsearch-net,RossLieberman/NEST,elastic/elasticsearch-net,adam-mccoy/elasticsearch-net,azubanov/elasticsearch-net,ststeiger/elasticsearch-net,gayancc/elasticsearch-net | src/Nest/ConvenienceExtensions/CreateIndexExtensions.cs | src/Nest/ConvenienceExtensions/CreateIndexExtensions.cs | using System;
using System.Threading.Tasks;
namespace Nest
{
/// <summary>
/// Provides convenience extension to open an index by string or type.
/// </summary>
public static class CreateIndexExtensions
{
/// <summary>
/// The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices,
/// including executing operations across several indices.
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
/// </summary>
/// <param name="client"></param>
/// <param name="index">The name of the index to be created</param>
/// <param name="createIndexSelector">A descriptor that further describes the parameters for the create index operation</param>
public static IIndicesOperationResponse CreateIndex(this IElasticClient client, string index,
Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector = null )
{
index.ThrowIfNullOrEmpty("index");
createIndexSelector = createIndexSelector ?? (c => c);
return client.CreateIndex(c=> createIndexSelector(c).Index(index));
}
/// <summary>
/// The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices,
/// including executing operations across several indices.
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
/// </summary>
/// <param name="client"></param>
/// <param name="index">The name of the index to be created</param>
/// <param name="createIndexSelector">A descriptor that further describes the parameters for the create index operation</param>
[Obsolete("Scheduled to be removed in 2.0, please use CreateIndex instead.")]
public static IIndicesOperationResponse CreatIndex(this IElasticClient client, string index,
Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector = null )
{
return CreateIndex(client, index, createIndexSelector);
}
/// <summary>
/// The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices,
/// including executing operations across several indices.
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
/// </summary>
/// <param name="client"></param>
/// <param name="index">The name of the index to be created</param>
/// <param name="createIndexSelector">A descriptor that further describes the parameters for the create index operation</param>
public static Task<IIndicesOperationResponse> CreateIndexAsync(this IElasticClient client, string index,
Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector = null)
{
index.ThrowIfNullOrEmpty("index");
createIndexSelector = createIndexSelector ?? (c => c);
return client.CreateIndexAsync(c => createIndexSelector(c).Index(index));
}
}
}
| using System;
using System.Threading.Tasks;
namespace Nest
{
/// <summary>
/// Provides convenience extension to open an index by string or type.
/// </summary>
public static class CreateIndexExtensions
{
/// <summary>
/// The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices,
/// including executing operations across several indices.
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
/// </summary>
/// <param name="client"></param>
/// <param name="index">The name of the index to be created</param>
/// <param name="createIndexSelector">A descriptor that further describes the parameters for the create index operation</param>
public static IIndicesOperationResponse CreateIndex(this IElasticClient client, string index,
Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector = null )
{
index.ThrowIfNullOrEmpty("index");
createIndexSelector = createIndexSelector ?? (c => c);
return client.CreateIndex(c=> createIndexSelector(c).Index(index));
}
/// <summary>
/// The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices,
/// including executing operations across several indices.
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
/// </summary>
/// <param name="client"></param>
/// <param name="index">The name of the index to be created</param>
/// <param name="createIndexSelector">A descriptor that further describes the parameters for the create index operation</param>
[Obsolete]
public static IIndicesOperationResponse CreatIndex(this IElasticClient client, string index,
Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector = null )
{
return CreateIndex(client, index, createIndexSelector);
}
/// <summary>
/// The create index API allows to instantiate an index. Elasticsearch provides support for multiple indices,
/// including executing operations across several indices.
/// <para> </para>http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
/// </summary>
/// <param name="client"></param>
/// <param name="index">The name of the index to be created</param>
/// <param name="createIndexSelector">A descriptor that further describes the parameters for the create index operation</param>
public static Task<IIndicesOperationResponse> CreateIndexAsync(this IElasticClient client, string index,
Func<CreateIndexDescriptor, CreateIndexDescriptor> createIndexSelector = null)
{
index.ThrowIfNullOrEmpty("index");
createIndexSelector = createIndexSelector ?? (c => c);
return client.CreateIndexAsync(c => createIndexSelector(c).Index(index));
}
}
}
| apache-2.0 | C# |
ec3183a019f76246769bc74cfeb29b4599357abd | Add advisory message in dashboard | SeyDutch/Airbrush,Serlead/Orchard,cooclsee/Orchard,ehe888/Orchard,xiaobudian/Orchard,neTp9c/Orchard,MpDzik/Orchard,NIKASoftwareDevs/Orchard,caoxk/orchard,patricmutwiri/Orchard,kouweizhong/Orchard,jchenga/Orchard,IDeliverable/Orchard,tobydodds/folklife,johnnyqian/Orchard,sfmskywalker/Orchard,austinsc/Orchard,openbizgit/Orchard,dcinzona/Orchard-Harvest-Website,mvarblow/Orchard,xkproject/Orchard,sfmskywalker/Orchard,hannan-azam/Orchard,Fogolan/OrchardForWork,aaronamm/Orchard,spraiin/Orchard,MpDzik/Orchard,RoyalVeterinaryCollege/Orchard,cryogen/orchard,OrchardCMS/Orchard,xiaobudian/Orchard,armanforghani/Orchard,Cphusion/Orchard,AEdmunds/beautiful-springtime,dcinzona/Orchard,planetClaire/Orchard-LETS,jagraz/Orchard,Serlead/Orchard,johnnyqian/Orchard,aaronamm/Orchard,rtpHarry/Orchard,harmony7/Orchard,brownjordaninternational/OrchardCMS,infofromca/Orchard,sebastienros/msc,TaiAivaras/Orchard,Dolphinsimon/Orchard,LaserSrl/Orchard,ehe888/Orchard,Cphusion/Orchard,caoxk/orchard,Morgma/valleyviewknolls,tobydodds/folklife,salarvand/orchard,TalaveraTechnologySolutions/Orchard,KeithRaven/Orchard,hhland/Orchard,SeyDutch/Airbrush,SzymonSel/Orchard,caoxk/orchard,yonglehou/Orchard,yonglehou/Orchard,cryogen/orchard,neTp9c/Orchard,mvarblow/Orchard,stormleoxia/Orchard,grapto/Orchard.CloudBust,hannan-azam/Orchard,li0803/Orchard,omidnasri/Orchard,Anton-Am/Orchard,alejandroaldana/Orchard,omidnasri/Orchard,alejandroaldana/Orchard,Praggie/Orchard,cooclsee/Orchard,MpDzik/Orchard,Sylapse/Orchard.HttpAuthSample,dburriss/Orchard,alejandroaldana/Orchard,bigfont/orchard-cms-modules-and-themes,NIKASoftwareDevs/Orchard,dburriss/Orchard,qt1/orchard4ibn,hbulzy/Orchard,salarvand/Portal,NIKASoftwareDevs/Orchard,dozoft/Orchard,sfmskywalker/Orchard,ehe888/Orchard,Ermesx/Orchard,yersans/Orchard,vard0/orchard.tan,jersiovic/Orchard,abhishekluv/Orchard,yersans/Orchard,hhland/Orchard,oxwanawxo/Orchard,abhishekluv/Orchard,kouweizhong/Orchard,phillipsj/Orchard,Sylapse/Orchard.HttpAuthSample,rtpHarry/Orchard,salarvand/Portal,xkproject/Orchard,Morgma/valleyviewknolls,mgrowan/Orchard,Morgma/valleyviewknolls,jchenga/Orchard,Serlead/Orchard,patricmutwiri/Orchard,kouweizhong/Orchard,m2cms/Orchard,openbizgit/Orchard,Cphusion/Orchard,Praggie/Orchard,DonnotRain/Orchard,DonnotRain/Orchard,jtkech/Orchard,JRKelso/Orchard,escofieldnaxos/Orchard,ericschultz/outercurve-orchard,yonglehou/Orchard,harmony7/Orchard,jaraco/orchard,phillipsj/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,bigfont/orchard-continuous-integration-demo,vairam-svs/Orchard,kgacova/Orchard,OrchardCMS/Orchard-Harvest-Website,mvarblow/Orchard,mvarblow/Orchard,smartnet-developers/Orchard,cooclsee/Orchard,sebastienros/msc,qt1/orchard4ibn,omidnasri/Orchard,bigfont/orchard-continuous-integration-demo,harmony7/Orchard,planetClaire/Orchard-LETS,jerryshi2007/Orchard,dcinzona/Orchard,gcsuk/Orchard,vairam-svs/Orchard,Ermesx/Orchard,JRKelso/Orchard,TalaveraTechnologySolutions/Orchard,kgacova/Orchard,andyshao/Orchard,luchaoshuai/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,qt1/orchard4ibn,AEdmunds/beautiful-springtime,Inner89/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,TaiAivaras/Orchard,qt1/orchard4ibn,yersans/Orchard,tobydodds/folklife,omidnasri/Orchard,hbulzy/Orchard,patricmutwiri/Orchard,stormleoxia/Orchard,AndreVolksdorf/Orchard,fassetar/Orchard,sfmskywalker/Orchard,li0803/Orchard,Anton-Am/Orchard,Lombiq/Orchard,OrchardCMS/Orchard,jerryshi2007/Orchard,dcinzona/Orchard-Harvest-Website,vard0/orchard.tan,geertdoornbos/Orchard,vard0/orchard.tan,jaraco/orchard,jimasp/Orchard,bedegaming-aleksej/Orchard,aaronamm/Orchard,IDeliverable/Orchard,hannan-azam/Orchard,smartnet-developers/Orchard,salarvand/orchard,dcinzona/Orchard-Harvest-Website,Codinlab/Orchard,jchenga/Orchard,Praggie/Orchard,OrchardCMS/Orchard,LaserSrl/Orchard,Fogolan/OrchardForWork,oxwanawxo/Orchard,ericschultz/outercurve-orchard,TaiAivaras/Orchard,stormleoxia/Orchard,infofromca/Orchard,Fogolan/OrchardForWork,Lombiq/Orchard,abhishekluv/Orchard,spraiin/Orchard,AdvantageCS/Orchard,Codinlab/Orchard,gcsuk/Orchard,omidnasri/Orchard,jimasp/Orchard,bedegaming-aleksej/Orchard,MetSystem/Orchard,bigfont/orchard-cms-modules-and-themes,Sylapse/Orchard.HttpAuthSample,JRKelso/Orchard,infofromca/Orchard,Serlead/Orchard,marcoaoteixeira/Orchard,bigfont/orchard-cms-modules-and-themes,kouweizhong/Orchard,omidnasri/Orchard,SouleDesigns/SouleDesigns.Orchard,grapto/Orchard.CloudBust,kgacova/Orchard,austinsc/Orchard,stormleoxia/Orchard,tobydodds/folklife,austinsc/Orchard,xiaobudian/Orchard,spraiin/Orchard,kgacova/Orchard,abhishekluv/Orchard,marcoaoteixeira/Orchard,asabbott/chicagodevnet-website,jchenga/Orchard,bedegaming-aleksej/Orchard,xkproject/Orchard,alejandroaldana/Orchard,dburriss/Orchard,Ermesx/Orchard,rtpHarry/Orchard,cooclsee/Orchard,xiaobudian/Orchard,bigfont/orchard-continuous-integration-demo,OrchardCMS/Orchard-Harvest-Website,Serlead/Orchard,qt1/Orchard,vard0/orchard.tan,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,jtkech/Orchard,harmony7/Orchard,arminkarimi/Orchard,jaraco/orchard,andyshao/Orchard,sfmskywalker/Orchard,yonglehou/Orchard,SzymonSel/Orchard,IDeliverable/Orchard,KeithRaven/Orchard,huoxudong125/Orchard,johnnyqian/Orchard,qt1/Orchard,kgacova/Orchard,enspiral-dev-academy/Orchard,jagraz/Orchard,OrchardCMS/Orchard,fassetar/Orchard,arminkarimi/Orchard,escofieldnaxos/Orchard,jerryshi2007/Orchard,patricmutwiri/Orchard,qt1/orchard4ibn,spraiin/Orchard,abhishekluv/Orchard,phillipsj/Orchard,Lombiq/Orchard,RoyalVeterinaryCollege/Orchard,jtkech/Orchard,sebastienros/msc,KeithRaven/Orchard,sebastienros/msc,austinsc/Orchard,grapto/Orchard.CloudBust,gcsuk/Orchard,asabbott/chicagodevnet-website,salarvand/orchard,OrchardCMS/Orchard-Harvest-Website,andyshao/Orchard,RoyalVeterinaryCollege/Orchard,jimasp/Orchard,cryogen/orchard,harmony7/Orchard,austinsc/Orchard,tobydodds/folklife,planetClaire/Orchard-LETS,tobydodds/folklife,oxwanawxo/Orchard,LaserSrl/Orchard,OrchardCMS/Orchard-Harvest-Website,marcoaoteixeira/Orchard,angelapper/Orchard,Inner89/Orchard,huoxudong125/Orchard,salarvand/Portal,jerryshi2007/Orchard,marcoaoteixeira/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,emretiryaki/Orchard,planetClaire/Orchard-LETS,huoxudong125/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,hbulzy/Orchard,vard0/orchard.tan,vairam-svs/Orchard,hannan-azam/Orchard,MetSystem/Orchard,NIKASoftwareDevs/Orchard,SouleDesigns/SouleDesigns.Orchard,KeithRaven/Orchard,AdvantageCS/Orchard,rtpHarry/Orchard,bigfont/orchard-cms-modules-and-themes,jagraz/Orchard,dozoft/Orchard,fortunearterial/Orchard,brownjordaninternational/OrchardCMS,luchaoshuai/Orchard,infofromca/Orchard,SouleDesigns/SouleDesigns.Orchard,Fogolan/OrchardForWork,SouleDesigns/SouleDesigns.Orchard,li0803/Orchard,salarvand/Portal,AndreVolksdorf/Orchard,armanforghani/Orchard,bedegaming-aleksej/Orchard,qt1/Orchard,MpDzik/Orchard,escofieldnaxos/Orchard,Dolphinsimon/Orchard,emretiryaki/Orchard,gcsuk/Orchard,TalaveraTechnologySolutions/Orchard,MetSystem/Orchard,TalaveraTechnologySolutions/Orchard,armanforghani/Orchard,geertdoornbos/Orchard,Sylapse/Orchard.HttpAuthSample,bigfont/orchard-cms-modules-and-themes,IDeliverable/Orchard,jaraco/orchard,Fogolan/OrchardForWork,enspiral-dev-academy/Orchard,andyshao/Orchard,TalaveraTechnologySolutions/Orchard,mgrowan/Orchard,neTp9c/Orchard,salarvand/orchard,dcinzona/Orchard-Harvest-Website,Inner89/Orchard,dcinzona/Orchard-Harvest-Website,SzymonSel/Orchard,johnnyqian/Orchard,jtkech/Orchard,jimasp/Orchard,jchenga/Orchard,bigfont/orchard-continuous-integration-demo,enspiral-dev-academy/Orchard,Praggie/Orchard,jersiovic/Orchard,Ermesx/Orchard,RoyalVeterinaryCollege/Orchard,huoxudong125/Orchard,Dolphinsimon/Orchard,angelapper/Orchard,hbulzy/Orchard,mgrowan/Orchard,openbizgit/Orchard,SouleDesigns/SouleDesigns.Orchard,dozoft/Orchard,geertdoornbos/Orchard,luchaoshuai/Orchard,Cphusion/Orchard,aaronamm/Orchard,jagraz/Orchard,ehe888/Orchard,m2cms/Orchard,SeyDutch/Airbrush,MetSystem/Orchard,hhland/Orchard,Lombiq/Orchard,cooclsee/Orchard,huoxudong125/Orchard,Anton-Am/Orchard,emretiryaki/Orchard,infofromca/Orchard,smartnet-developers/Orchard,Praggie/Orchard,salarvand/orchard,emretiryaki/Orchard,xiaobudian/Orchard,grapto/Orchard.CloudBust,jerryshi2007/Orchard,jagraz/Orchard,cryogen/orchard,OrchardCMS/Orchard-Harvest-Website,jersiovic/Orchard,ericschultz/outercurve-orchard,phillipsj/Orchard,escofieldnaxos/Orchard,fassetar/Orchard,m2cms/Orchard,LaserSrl/Orchard,qt1/Orchard,Codinlab/Orchard,NIKASoftwareDevs/Orchard,omidnasri/Orchard,abhishekluv/Orchard,Anton-Am/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,JRKelso/Orchard,TalaveraTechnologySolutions/Orchard,OrchardCMS/Orchard,spraiin/Orchard,asabbott/chicagodevnet-website,dcinzona/Orchard-Harvest-Website,hannan-azam/Orchard,AndreVolksdorf/Orchard,dozoft/Orchard,yersans/Orchard,Codinlab/Orchard,RoyalVeterinaryCollege/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,patricmutwiri/Orchard,planetClaire/Orchard-LETS,Inner89/Orchard,Lombiq/Orchard,sebastienros/msc,qt1/Orchard,enspiral-dev-academy/Orchard,gcsuk/Orchard,dcinzona/Orchard,geertdoornbos/Orchard,m2cms/Orchard,AndreVolksdorf/Orchard,fortunearterial/Orchard,grapto/Orchard.CloudBust,TalaveraTechnologySolutions/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,angelapper/Orchard,DonnotRain/Orchard,armanforghani/Orchard,Sylapse/Orchard.HttpAuthSample,DonnotRain/Orchard,AndreVolksdorf/Orchard,mgrowan/Orchard,geertdoornbos/Orchard,oxwanawxo/Orchard,arminkarimi/Orchard,armanforghani/Orchard,emretiryaki/Orchard,fassetar/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,rtpHarry/Orchard,vairam-svs/Orchard,Anton-Am/Orchard,qt1/orchard4ibn,jersiovic/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,sfmskywalker/Orchard,SzymonSel/Orchard,aaronamm/Orchard,openbizgit/Orchard,li0803/Orchard,dcinzona/Orchard,JRKelso/Orchard,AEdmunds/beautiful-springtime,xkproject/Orchard,ehe888/Orchard,dburriss/Orchard,luchaoshuai/Orchard,escofieldnaxos/Orchard,mvarblow/Orchard,fortunearterial/Orchard,yonglehou/Orchard,bedegaming-aleksej/Orchard,SzymonSel/Orchard,sfmskywalker/Orchard,arminkarimi/Orchard,openbizgit/Orchard,DonnotRain/Orchard,dcinzona/Orchard,Morgma/valleyviewknolls,vard0/orchard.tan,jersiovic/Orchard,caoxk/orchard,smartnet-developers/Orchard,jtkech/Orchard,fassetar/Orchard,mgrowan/Orchard,LaserSrl/Orchard,Dolphinsimon/Orchard,SeyDutch/Airbrush,MpDzik/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,KeithRaven/Orchard,hbulzy/Orchard,salarvand/Portal,dburriss/Orchard,brownjordaninternational/OrchardCMS,andyshao/Orchard,johnnyqian/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,TaiAivaras/Orchard,hhland/Orchard,sfmskywalker/Orchard,Dolphinsimon/Orchard,angelapper/Orchard,Cphusion/Orchard,ericschultz/outercurve-orchard,angelapper/Orchard,Ermesx/Orchard,OrchardCMS/Orchard-Harvest-Website,omidnasri/Orchard,alejandroaldana/Orchard,Inner89/Orchard,Morgma/valleyviewknolls,li0803/Orchard,vairam-svs/Orchard,oxwanawxo/Orchard,IDeliverable/Orchard,kouweizhong/Orchard,yersans/Orchard,brownjordaninternational/OrchardCMS,fortunearterial/Orchard,TaiAivaras/Orchard,grapto/Orchard.CloudBust,omidnasri/Orchard,MpDzik/Orchard,phillipsj/Orchard,xkproject/Orchard,smartnet-developers/Orchard,TalaveraTechnologySolutions/Orchard,AdvantageCS/Orchard,enspiral-dev-academy/Orchard,marcoaoteixeira/Orchard,brownjordaninternational/OrchardCMS,AEdmunds/beautiful-springtime,dozoft/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,asabbott/chicagodevnet-website,m2cms/Orchard,neTp9c/Orchard,hhland/Orchard,MetSystem/Orchard,AdvantageCS/Orchard,arminkarimi/Orchard,stormleoxia/Orchard,SeyDutch/Airbrush,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,jimasp/Orchard,fortunearterial/Orchard,luchaoshuai/Orchard,neTp9c/Orchard,AdvantageCS/Orchard,Codinlab/Orchard | src/Orchard.Web/Core/Dashboard/Views/Admin/Index.cshtml | src/Orchard.Web/Core/Dashboard/Views/Admin/Index.cshtml | @model dynamic
<h1>@Html.TitleForPage(T("Welcome to Orchard").ToString())</h1>
<p>@T("This is the place where you can manage your web site, its appearance and its contents. Please take a moment to explore the different menu items on the left of the screen to familiarize yourself with the features of the application. For example, try to change the theme through the “Manage Themes” menu entry. You can also create new pages and manage existing ones through the “Manage Pages” menu entry or create blogs through “Manage Blogs”.")</p>
<p>@T("Have fun!")<br />@T("The Orchard Team")</p>
<h2>@T("Advisory from <a href=\"{0}\">{0}</a>", "http://www.orchardproject.net/advisory")</h2>
<iframe id="advisory" src="http://www.orchardproject.net/advisory" frameborder="0" height="64" width="100%" >
<p>@T("Your browser does not support iframes. You can't see advisory messages.")</p>
</iframe>
| @model dynamic
<h1>@Html.TitleForPage(T("Welcome to Orchard").ToString())</h1>
<p>@T("This is the place where you can manage your web site, its appearance and its contents. Please take a moment to explore the different menu items on the left of the screen to familiarize yourself with the features of the application. For example, try to change the theme through the “Manage Themes” menu entry. You can also create new pages and manage existing ones through the “Manage Pages” menu entry or create blogs through “Manage Blogs”.")</p>
<p>@T("Have fun!")<br />@T("The Orchard Team")</p>
<iframe id="advisory" src="http://www.orchardproject.net/advisory" frameborder="0" height="64" width="100%" >
<p>@T("Your browser does not support iframes. You can't see advisory messages.")</p>
</iframe>
| bsd-3-clause | C# |
b59d9f6700da26f6b8fb0aa4a2689e03e004a0ff | Remove indexing on TitlePart (it's performed thru ITitleAspect) | fassetar/Orchard,sebastienros/msc,geertdoornbos/Orchard,xiaobudian/Orchard,arminkarimi/Orchard,Dolphinsimon/Orchard,patricmutwiri/Orchard,escofieldnaxos/Orchard,grapto/Orchard.CloudBust,asabbott/chicagodevnet-website,Praggie/Orchard,jchenga/Orchard,AdvantageCS/Orchard,Dolphinsimon/Orchard,asabbott/chicagodevnet-website,aaronamm/Orchard,planetClaire/Orchard-LETS,phillipsj/Orchard,Ermesx/Orchard,yonglehou/Orchard,Inner89/Orchard,m2cms/Orchard,stormleoxia/Orchard,bigfont/orchard-continuous-integration-demo,dozoft/Orchard,dcinzona/Orchard,abhishekluv/Orchard,jerryshi2007/Orchard,austinsc/Orchard,Ermesx/Orchard,alejandroaldana/Orchard,angelapper/Orchard,huoxudong125/Orchard,AEdmunds/beautiful-springtime,grapto/Orchard.CloudBust,patricmutwiri/Orchard,Codinlab/Orchard,dozoft/Orchard,TaiAivaras/Orchard,mgrowan/Orchard,salarvand/orchard,LaserSrl/Orchard,Sylapse/Orchard.HttpAuthSample,qt1/orchard4ibn,yersans/Orchard,jagraz/Orchard,mvarblow/Orchard,DonnotRain/Orchard,jaraco/orchard,bigfont/orchard-cms-modules-and-themes,bedegaming-aleksej/Orchard,cooclsee/Orchard,Morgma/valleyviewknolls,patricmutwiri/Orchard,OrchardCMS/Orchard,sfmskywalker/Orchard,rtpHarry/Orchard,kouweizhong/Orchard,luchaoshuai/Orchard,KeithRaven/Orchard,Lombiq/Orchard,enspiral-dev-academy/Orchard,johnnyqian/Orchard,Codinlab/Orchard,Dolphinsimon/Orchard,omidnasri/Orchard,TalaveraTechnologySolutions/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,salarvand/orchard,bigfont/orchard-cms-modules-and-themes,Sylapse/Orchard.HttpAuthSample,hhland/Orchard,smartnet-developers/Orchard,jtkech/Orchard,IDeliverable/Orchard,ehe888/Orchard,neTp9c/Orchard,OrchardCMS/Orchard-Harvest-Website,Praggie/Orchard,brownjordaninternational/OrchardCMS,Cphusion/Orchard,grapto/Orchard.CloudBust,planetClaire/Orchard-LETS,rtpHarry/Orchard,jagraz/Orchard,gcsuk/Orchard,LaserSrl/Orchard,SouleDesigns/SouleDesigns.Orchard,geertdoornbos/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,marcoaoteixeira/Orchard,jchenga/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,vard0/orchard.tan,kgacova/Orchard,yersans/Orchard,li0803/Orchard,dburriss/Orchard,kouweizhong/Orchard,kgacova/Orchard,enspiral-dev-academy/Orchard,NIKASoftwareDevs/Orchard,oxwanawxo/Orchard,ericschultz/outercurve-orchard,andyshao/Orchard,angelapper/Orchard,infofromca/Orchard,smartnet-developers/Orchard,jchenga/Orchard,tobydodds/folklife,ericschultz/outercurve-orchard,yonglehou/Orchard,sfmskywalker/Orchard,austinsc/Orchard,qt1/orchard4ibn,jersiovic/Orchard,SeyDutch/Airbrush,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,ehe888/Orchard,marcoaoteixeira/Orchard,bedegaming-aleksej/Orchard,Fogolan/OrchardForWork,JRKelso/Orchard,bigfont/orchard-cms-modules-and-themes,Inner89/Orchard,jchenga/Orchard,abhishekluv/Orchard,spraiin/Orchard,ehe888/Orchard,huoxudong125/Orchard,TaiAivaras/Orchard,vard0/orchard.tan,bigfont/orchard-continuous-integration-demo,ericschultz/outercurve-orchard,emretiryaki/Orchard,RoyalVeterinaryCollege/Orchard,kgacova/Orchard,stormleoxia/Orchard,qt1/Orchard,escofieldnaxos/Orchard,sfmskywalker/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,arminkarimi/Orchard,oxwanawxo/Orchard,sfmskywalker/Orchard,patricmutwiri/Orchard,hhland/Orchard,openbizgit/Orchard,m2cms/Orchard,omidnasri/Orchard,vairam-svs/Orchard,hannan-azam/Orchard,brownjordaninternational/OrchardCMS,gcsuk/Orchard,geertdoornbos/Orchard,OrchardCMS/Orchard,omidnasri/Orchard,Morgma/valleyviewknolls,emretiryaki/Orchard,fortunearterial/Orchard,kgacova/Orchard,andyshao/Orchard,AdvantageCS/Orchard,AndreVolksdorf/Orchard,hbulzy/Orchard,dcinzona/Orchard,AndreVolksdorf/Orchard,abhishekluv/Orchard,cooclsee/Orchard,tobydodds/folklife,TalaveraTechnologySolutions/Orchard,OrchardCMS/Orchard,neTp9c/Orchard,IDeliverable/Orchard,dburriss/Orchard,Sylapse/Orchard.HttpAuthSample,mvarblow/Orchard,NIKASoftwareDevs/Orchard,asabbott/chicagodevnet-website,emretiryaki/Orchard,asabbott/chicagodevnet-website,harmony7/Orchard,dozoft/Orchard,dcinzona/Orchard-Harvest-Website,cooclsee/Orchard,SzymonSel/Orchard,hhland/Orchard,LaserSrl/Orchard,SouleDesigns/SouleDesigns.Orchard,hannan-azam/Orchard,m2cms/Orchard,escofieldnaxos/Orchard,huoxudong125/Orchard,MetSystem/Orchard,Anton-Am/Orchard,Fogolan/OrchardForWork,omidnasri/Orchard,Lombiq/Orchard,huoxudong125/Orchard,Praggie/Orchard,planetClaire/Orchard-LETS,mgrowan/Orchard,li0803/Orchard,salarvand/Portal,JRKelso/Orchard,tobydodds/folklife,cryogen/orchard,IDeliverable/Orchard,luchaoshuai/Orchard,armanforghani/Orchard,armanforghani/Orchard,yonglehou/Orchard,MpDzik/Orchard,spraiin/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,Lombiq/Orchard,andyshao/Orchard,xkproject/Orchard,Serlead/Orchard,Lombiq/Orchard,jimasp/Orchard,TalaveraTechnologySolutions/Orchard,cryogen/orchard,bedegaming-aleksej/Orchard,ehe888/Orchard,jaraco/orchard,cryogen/orchard,dcinzona/Orchard,salarvand/Portal,OrchardCMS/Orchard-Harvest-Website,Anton-Am/Orchard,Fogolan/OrchardForWork,Dolphinsimon/Orchard,xkproject/Orchard,dburriss/Orchard,TalaveraTechnologySolutions/Orchard,yersans/Orchard,aaronamm/Orchard,qt1/Orchard,SzymonSel/Orchard,Fogolan/OrchardForWork,li0803/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,NIKASoftwareDevs/Orchard,harmony7/Orchard,grapto/Orchard.CloudBust,kouweizhong/Orchard,infofromca/Orchard,dburriss/Orchard,li0803/Orchard,grapto/Orchard.CloudBust,caoxk/orchard,NIKASoftwareDevs/Orchard,Praggie/Orchard,MetSystem/Orchard,infofromca/Orchard,jagraz/Orchard,marcoaoteixeira/Orchard,Codinlab/Orchard,enspiral-dev-academy/Orchard,omidnasri/Orchard,Morgma/valleyviewknolls,andyshao/Orchard,caoxk/orchard,xiaobudian/Orchard,bedegaming-aleksej/Orchard,phillipsj/Orchard,ehe888/Orchard,omidnasri/Orchard,salarvand/orchard,AEdmunds/beautiful-springtime,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,salarvand/Portal,fortunearterial/Orchard,JRKelso/Orchard,omidnasri/Orchard,vairam-svs/Orchard,mvarblow/Orchard,OrchardCMS/Orchard,Lombiq/Orchard,harmony7/Orchard,brownjordaninternational/OrchardCMS,dcinzona/Orchard-Harvest-Website,qt1/Orchard,Anton-Am/Orchard,xiaobudian/Orchard,geertdoornbos/Orchard,Morgma/valleyviewknolls,dmitry-urenev/extended-orchard-cms-v10.1,bigfont/orchard-cms-modules-and-themes,vairam-svs/Orchard,sfmskywalker/Orchard,alejandroaldana/Orchard,TalaveraTechnologySolutions/Orchard,Inner89/Orchard,Serlead/Orchard,alejandroaldana/Orchard,vard0/orchard.tan,jersiovic/Orchard,jtkech/Orchard,vairam-svs/Orchard,SouleDesigns/SouleDesigns.Orchard,bedegaming-aleksej/Orchard,RoyalVeterinaryCollege/Orchard,austinsc/Orchard,smartnet-developers/Orchard,sfmskywalker/Orchard,xiaobudian/Orchard,alejandroaldana/Orchard,phillipsj/Orchard,fassetar/Orchard,kgacova/Orchard,mgrowan/Orchard,gcsuk/Orchard,andyshao/Orchard,aaronamm/Orchard,ericschultz/outercurve-orchard,neTp9c/Orchard,RoyalVeterinaryCollege/Orchard,m2cms/Orchard,MpDzik/Orchard,dcinzona/Orchard-Harvest-Website,spraiin/Orchard,brownjordaninternational/OrchardCMS,austinsc/Orchard,hannan-azam/Orchard,xiaobudian/Orchard,SeyDutch/Airbrush,Serlead/Orchard,fassetar/Orchard,jersiovic/Orchard,openbizgit/Orchard,jerryshi2007/Orchard,sfmskywalker/Orchard,JRKelso/Orchard,Ermesx/Orchard,neTp9c/Orchard,emretiryaki/Orchard,hannan-azam/Orchard,jerryshi2007/Orchard,yonglehou/Orchard,omidnasri/Orchard,stormleoxia/Orchard,IDeliverable/Orchard,geertdoornbos/Orchard,DonnotRain/Orchard,marcoaoteixeira/Orchard,Anton-Am/Orchard,fortunearterial/Orchard,fortunearterial/Orchard,Ermesx/Orchard,MetSystem/Orchard,dozoft/Orchard,johnnyqian/Orchard,AndreVolksdorf/Orchard,LaserSrl/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard,omidnasri/Orchard,RoyalVeterinaryCollege/Orchard,yonglehou/Orchard,arminkarimi/Orchard,AdvantageCS/Orchard,MetSystem/Orchard,sebastienros/msc,cooclsee/Orchard,infofromca/Orchard,salarvand/orchard,jaraco/orchard,hbulzy/Orchard,gcsuk/Orchard,xkproject/Orchard,salarvand/Portal,mgrowan/Orchard,jerryshi2007/Orchard,spraiin/Orchard,Ermesx/Orchard,sebastienros/msc,KeithRaven/Orchard,qt1/Orchard,dcinzona/Orchard,jagraz/Orchard,DonnotRain/Orchard,MpDzik/Orchard,openbizgit/Orchard,alejandroaldana/Orchard,hbulzy/Orchard,hbulzy/Orchard,brownjordaninternational/OrchardCMS,TalaveraTechnologySolutions/Orchard,abhishekluv/Orchard,rtpHarry/Orchard,hhland/Orchard,OrchardCMS/Orchard-Harvest-Website,rtpHarry/Orchard,grapto/Orchard.CloudBust,enspiral-dev-academy/Orchard,AndreVolksdorf/Orchard,bigfont/orchard-cms-modules-and-themes,TalaveraTechnologySolutions/Orchard,jimasp/Orchard,oxwanawxo/Orchard,TaiAivaras/Orchard,planetClaire/Orchard-LETS,fassetar/Orchard,jimasp/Orchard,AndreVolksdorf/Orchard,armanforghani/Orchard,rtpHarry/Orchard,luchaoshuai/Orchard,Morgma/valleyviewknolls,Inner89/Orchard,Codinlab/Orchard,angelapper/Orchard,jchenga/Orchard,jaraco/orchard,KeithRaven/Orchard,openbizgit/Orchard,mvarblow/Orchard,tobydodds/folklife,Sylapse/Orchard.HttpAuthSample,qt1/orchard4ibn,IDeliverable/Orchard,KeithRaven/Orchard,SzymonSel/Orchard,hannan-azam/Orchard,sfmskywalker/Orchard,salarvand/Portal,kouweizhong/Orchard,dcinzona/Orchard-Harvest-Website,stormleoxia/Orchard,OrchardCMS/Orchard-Harvest-Website,Cphusion/Orchard,TaiAivaras/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,OrchardCMS/Orchard-Harvest-Website,SzymonSel/Orchard,luchaoshuai/Orchard,fortunearterial/Orchard,vard0/orchard.tan,marcoaoteixeira/Orchard,huoxudong125/Orchard,arminkarimi/Orchard,kouweizhong/Orchard,phillipsj/Orchard,aaronamm/Orchard,tobydodds/folklife,Serlead/Orchard,angelapper/Orchard,jerryshi2007/Orchard,hbulzy/Orchard,NIKASoftwareDevs/Orchard,MpDzik/Orchard,SeyDutch/Airbrush,yersans/Orchard,planetClaire/Orchard-LETS,dozoft/Orchard,AEdmunds/beautiful-springtime,jagraz/Orchard,DonnotRain/Orchard,yersans/Orchard,abhishekluv/Orchard,dburriss/Orchard,vard0/orchard.tan,aaronamm/Orchard,salarvand/orchard,qt1/Orchard,spraiin/Orchard,SeyDutch/Airbrush,phillipsj/Orchard,openbizgit/Orchard,stormleoxia/Orchard,jersiovic/Orchard,johnnyqian/Orchard,qt1/orchard4ibn,enspiral-dev-academy/Orchard,SeyDutch/Airbrush,infofromca/Orchard,vairam-svs/Orchard,mvarblow/Orchard,johnnyqian/Orchard,armanforghani/Orchard,smartnet-developers/Orchard,OrchardCMS/Orchard-Harvest-Website,JRKelso/Orchard,dcinzona/Orchard-Harvest-Website,mgrowan/Orchard,Dolphinsimon/Orchard,jtkech/Orchard,Anton-Am/Orchard,xkproject/Orchard,jtkech/Orchard,Fogolan/OrchardForWork,oxwanawxo/Orchard,harmony7/Orchard,dcinzona/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,TalaveraTechnologySolutions/Orchard,Codinlab/Orchard,MpDzik/Orchard,qt1/orchard4ibn,jimasp/Orchard,SzymonSel/Orchard,oxwanawxo/Orchard,AdvantageCS/Orchard,dcinzona/Orchard-Harvest-Website,Sylapse/Orchard.HttpAuthSample,TaiAivaras/Orchard,MetSystem/Orchard,Inner89/Orchard,vard0/orchard.tan,jtkech/Orchard,fassetar/Orchard,SouleDesigns/SouleDesigns.Orchard,MpDzik/Orchard,qt1/orchard4ibn,Serlead/Orchard,AdvantageCS/Orchard,sebastienros/msc,dmitry-urenev/extended-orchard-cms-v10.1,sebastienros/msc,li0803/Orchard,cryogen/orchard,bigfont/orchard-continuous-integration-demo,armanforghani/Orchard,AEdmunds/beautiful-springtime,escofieldnaxos/Orchard,harmony7/Orchard,hhland/Orchard,escofieldnaxos/Orchard,DonnotRain/Orchard,angelapper/Orchard,jersiovic/Orchard,Cphusion/Orchard,emretiryaki/Orchard,Praggie/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,gcsuk/Orchard,RoyalVeterinaryCollege/Orchard,tobydodds/folklife,luchaoshuai/Orchard,SouleDesigns/SouleDesigns.Orchard,johnnyqian/Orchard,bigfont/orchard-continuous-integration-demo,Cphusion/Orchard,caoxk/orchard,m2cms/Orchard,arminkarimi/Orchard,LaserSrl/Orchard,abhishekluv/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,Cphusion/Orchard,caoxk/orchard,KeithRaven/Orchard,cooclsee/Orchard,austinsc/Orchard,neTp9c/Orchard,jimasp/Orchard,smartnet-developers/Orchard,xkproject/Orchard,patricmutwiri/Orchard | src/Orchard.Web/Core/Title/Handlers/TitlePartHandler.cs | src/Orchard.Web/Core/Title/Handlers/TitlePartHandler.cs | using Orchard.ContentManagement.Handlers;
using Orchard.Core.Title.Models;
using Orchard.Data;
namespace Orchard.Core.Title.Handlers {
public class TitlePartHandler : ContentHandler {
public TitlePartHandler(IRepository<TitlePartRecord> repository) {
Filters.Add(StorageFilter.For(repository));
}
}
}
| using Orchard.ContentManagement.Handlers;
using Orchard.Core.Title.Models;
using Orchard.Data;
namespace Orchard.Core.Title.Handlers {
public class TitlePartHandler : ContentHandler {
public TitlePartHandler(IRepository<TitlePartRecord> repository) {
Filters.Add(StorageFilter.For(repository));
OnIndexing<TitlePart>((context, part) => context.DocumentIndex.Add("title", part.Record.Title).RemoveTags().Analyze());
}
}
}
| bsd-3-clause | C# |
20e753a34b0ea0b4cd2fde278a67cc6cfd8e4336 | fix TerminateTorOnExit saving issue | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Fluent/ViewModels/Settings/NetworkSettingsTabViewModel.cs | WalletWasabi.Fluent/ViewModels/Settings/NetworkSettingsTabViewModel.cs | using System;
using System.Net;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Gui;
using WalletWasabi.Gui.Validation;
using WalletWasabi.Helpers;
using WalletWasabi.Models;
using WalletWasabi.Userfacing;
namespace WalletWasabi.Fluent.ViewModels.Settings
{
[NavigationMetaData(
Title = "Network",
Caption = "Manage network settings",
Order = 2,
Category = "Settings",
Keywords = new[]
{
"Settings", "Network", "Encryption", "Tor", "Terminate", "Wasabi", "Shutdown", "SOCKS5", "Endpoint"
},
IconName = "settings_network_regular")]
public partial class NetworkSettingsTabViewModel : SettingsTabViewModelBase
{
[AutoNotify] private bool _useTor;
[AutoNotify] private bool _terminateTorOnExit;
[AutoNotify] private string _torSocks5EndPoint;
public NetworkSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
{
this.ValidateProperty(x => x.TorSocks5EndPoint, ValidateTorSocks5EndPoint);
_useTor = config.UseTor;
_terminateTorOnExit = config.TerminateTorOnExit;
_torSocks5EndPoint = config.TorSocks5EndPoint.ToString(-1);
this.WhenAnyValue(
x => x.UseTor,
x => x.TerminateTorOnExit,
x => x.TorSocks5EndPoint)
.ObserveOn(RxApp.TaskpoolScheduler)
.Throttle(TimeSpan.FromMilliseconds(ThrottleTime))
.Skip(1)
.Subscribe(_ => Save());
}
private void ValidateTorSocks5EndPoint(IValidationErrors errors)
=> ValidateEndPoint(errors, TorSocks5EndPoint, Constants.DefaultTorSocksPort, whiteSpaceOk: true);
private void ValidateEndPoint(IValidationErrors errors, string endPoint, int defaultPort, bool whiteSpaceOk)
{
if (!whiteSpaceOk || !string.IsNullOrWhiteSpace(endPoint))
{
if (!EndPointParser.TryParse(endPoint, defaultPort, out _))
{
errors.Add(ErrorSeverity.Error, "Invalid endpoint.");
}
}
}
protected override void EditConfigOnSave(Config config)
{
if (EndPointParser.TryParse(TorSocks5EndPoint, Constants.DefaultTorSocksPort, out EndPoint torEp))
{
config.TorSocks5EndPoint = torEp;
}
config.UseTor = UseTor;
config.TerminateTorOnExit = TerminateTorOnExit;
}
}
} | using System;
using System.Net;
using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Gui;
using WalletWasabi.Gui.Validation;
using WalletWasabi.Helpers;
using WalletWasabi.Models;
using WalletWasabi.Userfacing;
namespace WalletWasabi.Fluent.ViewModels.Settings
{
[NavigationMetaData(
Title = "Network",
Caption = "Manage network settings",
Order = 2,
Category = "Settings",
Keywords = new[]
{
"Settings", "Network", "Encryption", "Tor", "Terminate", "Wasabi", "Shutdown", "SOCKS5", "Endpoint"
},
IconName = "settings_network_regular")]
public partial class NetworkSettingsTabViewModel : SettingsTabViewModelBase
{
[AutoNotify] private bool _useTor;
[AutoNotify] private bool _terminateTorOnExit;
[AutoNotify] private string _torSocks5EndPoint;
public NetworkSettingsTabViewModel(Config config, UiConfig uiConfig) : base(config, uiConfig)
{
this.ValidateProperty(x => x.TorSocks5EndPoint, ValidateTorSocks5EndPoint);
_useTor = config.UseTor;
_terminateTorOnExit = config.TerminateTorOnExit;
_torSocks5EndPoint = config.TorSocks5EndPoint.ToString(-1);
this.WhenAnyValue(
x => x.UseTor,
x => x.UseTor,
x => x.TorSocks5EndPoint)
.ObserveOn(RxApp.TaskpoolScheduler)
.Throttle(TimeSpan.FromMilliseconds(ThrottleTime))
.Skip(1)
.Subscribe(_ => Save());
}
private void ValidateTorSocks5EndPoint(IValidationErrors errors)
=> ValidateEndPoint(errors, TorSocks5EndPoint, Constants.DefaultTorSocksPort, whiteSpaceOk: true);
private void ValidateEndPoint(IValidationErrors errors, string endPoint, int defaultPort, bool whiteSpaceOk)
{
if (!whiteSpaceOk || !string.IsNullOrWhiteSpace(endPoint))
{
if (!EndPointParser.TryParse(endPoint, defaultPort, out _))
{
errors.Add(ErrorSeverity.Error, "Invalid endpoint.");
}
}
}
protected override void EditConfigOnSave(Config config)
{
if (EndPointParser.TryParse(TorSocks5EndPoint, Constants.DefaultTorSocksPort, out EndPoint torEp))
{
config.TorSocks5EndPoint = torEp;
}
config.UseTor = UseTor;
config.TerminateTorOnExit = TerminateTorOnExit;
}
}
} | mit | C# |
a3ef7d6c3aa4460670e163034324a24d8a059e03 | Update FluidityEditorFieldConfig.cs | mattbrailsford/umbraco-fluidity,mattbrailsford/umbraco-fluidity,mattbrailsford/umbraco-fluidity | src/Fluidity/Configuration/FluidityEditorFieldConfig.cs | src/Fluidity/Configuration/FluidityEditorFieldConfig.cs | // <copyright file="FluidityEditorFieldConfig.cs" company="Matt Brailsford">
// Copyright (c) 2017 Matt Brailsford and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
using System.Linq.Expressions;
using System;
using Fluidity.ValueMappers;
namespace Fluidity.Configuration
{
/// <summary>
/// Un typed base class for a <see cref="FluidityEditorFieldConfig{TEntityType, TValueType}"/>
/// </summary>
public abstract class FluidityEditorFieldConfig
{
protected FluidityPropertyConfig _property;
internal FluidityPropertyConfig Property => _property;
protected string _label;
internal string Label => _label;
protected string _description;
internal string Description => _description;
protected bool _isRequired;
internal bool IsRequired => _isRequired;
protected string _validationRegex;
internal string ValidationRegex => _validationRegex;
protected string _dataTypeName;
internal string DataTypeName => _dataTypeName;
protected int _dataTypeId;
internal int DataTypeId => _dataTypeId;
protected FluidityValueMapper _valueMapper;
internal FluidityValueMapper ValueMapper => _valueMapper;
protected Func<object> _defaultValueFunc;
internal Func<object> DefaultValueFunc => _defaultValueFunc;
protected bool _isReadOnly;
internal bool IsReadOnly => _isReadOnly;
/// <summary>
/// Initializes a new instance of the <see cref="FluidityEditorFieldConfig"/> class.
/// </summary>
/// <param name="propertyExpression">The property exp.</param>
protected FluidityEditorFieldConfig(LambdaExpression propertyExpression)
{
_property = propertyExpression;
}
}
}
| // <copyright file="FluidityEditorFieldConfig.cs" company="Matt Brailsford">
// Copyright (c) 2017 Matt Brailsford and contributors.
// Licensed under the Apache License, Version 2.0.
// </copyright>
using System.Linq.Expressions;
using System;
using Fluidity.ValueMappers;
namespace Fluidity.Configuration
{
/// <summary>
/// Un typed base class for a <see cref="FluidityEditorFieldConfig{TEntityType, TValueType}"/>
/// </summary>
public abstract class FluidityEditorFieldConfig
{
protected FluidityPropertyConfig _property;
internal FluidityPropertyConfig Property => _property;
protected string _label;
internal string Label => _label;
protected string _description;
internal string Description => _description;
protected bool _isRequired;
internal bool IsRequired => _isRequired;
protected string _validationRegex;
internal string ValidationRegex => _validationRegex;
protected string _dataTypeName;
internal string DataTypeName => _dataTypeName;
protected int _dataTypeId;
internal int DataTypeId => _dataTypeId;
protected FluidityValueMapper _valueMapper;
internal FluidityValueMapper ValueMapper => _valueMapper;
protected Func<object> _defaultValueFunc;
internal Func<object> DefaultValueFunc => _defaultValueFunc;
protected bool _isReadOnly;
internal bool IsReadOnly => _isReadOnly;
/// <summary>
/// Initializes a new instance of the <see cref="FluidityEditorFieldConfig"/> class.
/// </summary>
/// <param name="propertyExpression">The property exp.</param>
protected FluidityEditorFieldConfig(LambdaExpression propertyExpression)
{
_property = new FluidityPropertyConfig(propertyExpression);
}
}
}
| apache-2.0 | C# |
fa19360b70dee7ac8779b53282186ffcbc6657bb | Use var instead. | dlemstra/Magick.NET,dlemstra/Magick.NET | src/Magick.NET/Framework/Extensions/StreamExtensions.cs | src/Magick.NET/Framework/Extensions/StreamExtensions.cs | // Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/>
//
// Licensed under the ImageMagick License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
//
// https://www.imagemagick.org/script/license.php
//
// 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.
#if NET20
using System.IO;
namespace ImageMagick
{
internal static class StreamExtensions
{
public static void CopyTo(this Stream self, Stream output)
{
var buffer = new byte[81920];
int len;
while ((len = self.Read(buffer, 0, buffer.Length)) > 0)
output.Write(buffer, 0, len);
}
}
}
#endif
| // Copyright 2013-2020 Dirk Lemstra <https://github.com/dlemstra/Magick.NET/>
//
// Licensed under the ImageMagick License (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
//
// https://www.imagemagick.org/script/license.php
//
// 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.
#if NET20
using System.IO;
namespace ImageMagick
{
internal static class StreamExtensions
{
public static void CopyTo(this Stream self, Stream output)
{
byte[] buffer = new byte[81920];
int len;
while ((len = self.Read(buffer, 0, buffer.Length)) > 0)
output.Write(buffer, 0, len);
}
}
}
#endif
| apache-2.0 | C# |
6e4b6509bee7a88f0dec31b18f9bd35f791be8a8 | fix contact information | Team-Ressurrection/Asp.NetMVCApp,Team-Ressurrection/Asp.NetMVCApp,Team-Ressurrection/Asp.NetMVCApp | SalaryCalculator/SalaryCalculatorWeb/Views/Home/Contact.cshtml | SalaryCalculator/SalaryCalculatorWeb/Views/Home/Contact.cshtml | @{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
Sofia<br />
Bulgaria<br />
</address>
<address>
<strong>GitHub Source Code:</strong> <a href="https://github.com/Team-Ressurrection/Asp.NetMVCApp">View here</a><br />
<strong>Author:</strong> <a href="mailto:nestorov.alexander@gmail.com">nestorov.alexander@gmail.com</a>
</address> | @{
ViewBag.Title = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<address>
One Microsoft Way<br />
Redmond, WA 98052-6399<br />
<abbr title="Phone">P:</abbr>
425.555.0100
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address> | mit | C# |
8ac6429ac280cafdabbf7b6bb28a557dcd4397b7 | Update interface | JeremyAnsel/helix-toolkit,Iluvatar82/helix-toolkit,chrkon/helix-toolkit,smischke/helix-toolkit,helix-toolkit/helix-toolkit,holance/helix-toolkit | Source/HelixToolkit.Wpf.SharpDX/Controls/IRenderable.cs | Source/HelixToolkit.Wpf.SharpDX/Controls/IRenderable.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="IRenderable.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace HelixToolkit.Wpf.SharpDX
{
using System;
using System.Windows.Controls;
using global::SharpDX;
using System.Collections.Generic;
public interface IRenderable
{
void Attach(IRenderHost host);
void Detach();
void Update(TimeSpan timeSpan);
void Render(RenderContext context);
bool IsAttached { get; }
}
public interface IRenderer
{
void Attach(IRenderHost host);
void Detach();
void Update(TimeSpan timeSpan);
void Render(RenderContext context);
bool IsShadowMappingEnabled { get; }
RenderTechnique RenderTechnique { get; }
ItemCollection Items { get; }
Camera Camera { get; }
Color4 BackgroundColor { get; }
DeferredRenderer DeferredRenderer { get; set; }
IEnumerable<IRenderable> Renderables { get; }
}
} | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="IRenderable.cs" company="Helix Toolkit">
// Copyright (c) 2014 Helix Toolkit contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace HelixToolkit.Wpf.SharpDX
{
using System;
using System.Windows.Controls;
using global::SharpDX;
public interface IRenderable
{
void Attach(IRenderHost host);
void Detach();
void Update(TimeSpan timeSpan);
void Render(RenderContext context);
bool IsAttached { get; }
}
public interface IRenderer
{
void Attach(IRenderHost host);
void Detach();
void Update(TimeSpan timeSpan);
void Render(RenderContext context);
bool IsShadowMappingEnabled { get; }
RenderTechnique RenderTechnique { get; }
ItemCollection Items { get; }
Camera Camera { get; }
Color4 BackgroundColor { get; }
DeferredRenderer DeferredRenderer { get; set; }
}
} | mit | C# |
51376fcd7007fce8a9613dcbadca2370446d7e1a | Add LICENSE comment | dialectsoftware/DialectSoftware.Networking | DialectSoftware.Networking.Controls/Enums/Status.cs | DialectSoftware.Networking.Controls/Enums/Status.cs | using System;
/// ******************************************************************************************************************
/// * Copyright (c) 2011 Dialect Software LLC *
/// * This software is distributed under the terms of the Apache License http://www.apache.org/licenses/LICENSE-2.0 *
/// * *
/// ******************************************************************************************************************
namespace DialectSoftware.Networking.Controls
{
public enum Status:int
{
Idle = 0,
Connecting = 1,
Authenticating = 2,
Negotiating = 3,
Sending = 4,
Receiving = 5,
Terminating = 6
}
} | using System;
namespace DialectSoftware.Networking.Controls
{
public enum Status:int
{
Idle = 0,
Connecting = 1,
Authenticating = 2,
Negotiating = 3,
Sending = 4,
Receiving = 5,
Terminating = 6
}
} | apache-2.0 | C# |
d70e1cc4bef53e3673d35535f8444d8486ea2d46 | update version | prodot/ReCommended-Extension | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2020 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.2.0.0")]
[assembly: AssemblyFileVersion("5.2.0")] | using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2020 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.1.5.0")]
[assembly: AssemblyFileVersion("5.1.5")] | apache-2.0 | C# |
07388b0a6bceb921665cc34da0a1a86e93cb3825 | fix to ensure at least 1 archive is marked 'Default' | matortheeternal/mod-analyzer | ModAnalyzer/ViewModels/ClassifyArchivesViewModel.cs | ModAnalyzer/ViewModels/ClassifyArchivesViewModel.cs | using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using ModAnalyzer.Domain;
using ModAnalyzer.Messages;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;
namespace ModAnalyzer.ViewModels {
public class ClassifyArchivesViewModel : ViewModelBase {
public ObservableCollection<ModOption> ArchiveModOptions { get; set; }
public ICommand AnalyzeCommand { get; set; }
public ClassifyArchivesViewModel() {
ArchiveModOptions = new ObservableCollection<ModOption>();
AnalyzeCommand = new RelayCommand(AnalyzeMod);
MessengerInstance.Register<FilesSelectedMessage>(this, OnFilesSelected);
}
private void OnFilesSelected(FilesSelectedMessage message) {
ArchiveModOptions.Clear();
foreach (string file in message.FilePaths)
ArchiveModOptions.Add(new ModOption(Path.GetFileName(file), false, false) { SourceFilePath = file });
if (message.FilePaths.Count == 1) {
ArchiveModOptions.First().Default = true;
MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList()));
}
}
private void AnalyzeMod() {
if (ArchiveModOptions.Any(modOption => modOption.Default)) {
MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList()));
} else {
MessageBox.Show("Please specify at least 1 default archive.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
}
}
| using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using ModAnalyzer.Domain;
using ModAnalyzer.Messages;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows.Input;
namespace ModAnalyzer.ViewModels {
public class ClassifyArchivesViewModel : ViewModelBase {
public ObservableCollection<ModOption> ArchiveModOptions { get; set; }
public ICommand AnalyzeCommand { get; set; }
public ClassifyArchivesViewModel() {
ArchiveModOptions = new ObservableCollection<ModOption>();
AnalyzeCommand = new RelayCommand(() => MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList())));
MessengerInstance.Register<FilesSelectedMessage>(this, OnFilesSelected);
}
private void OnFilesSelected(FilesSelectedMessage message) {
ArchiveModOptions.Clear();
foreach (string file in message.FilePaths)
ArchiveModOptions.Add(new ModOption(Path.GetFileName(file), false, false) { SourceFilePath = file });
if (message.FilePaths.Count == 1) {
ArchiveModOptions.First().Default = true;
MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList()));
}
}
}
}
| mit | C# |
2204e6bafe752f9deca324c36ed795e280f39065 | Update ActionAboutImpl.cs | NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework | NakedLegacy/NakedLegacy.Reflector/Facet/ActionAboutImpl.cs | NakedLegacy/NakedLegacy.Reflector/Facet/ActionAboutImpl.cs | namespace NakedLegacy.Reflector.Facet;
public class ActionAboutImpl : ActionAbout {
public ActionAboutImpl(AboutTypeCodes typeCode) => TypeCode = typeCode;
public string Name { get; set; }
public string Description { get; set; }
public bool Visible { get; set; } = true;
public bool Usable { get; set; } = true;
public string UnusableReason { get; set; }
public string[] ParamLabels { get; set; } = new string[] { };
public object[] ParamDefaultValues { get; set; } = new object[] { };
public object[][] ParamOptions { get; set; } = new object[][] { };
public AboutTypeCodes TypeCode { get; }
} | namespace NakedLegacy.Reflector.Facet;
public class ActionAboutImpl : ActionAbout {
public ActionAboutImpl(AboutTypeCodes typeCode) => TypeCode = typeCode;
public string Name { get; set; }
public string Description { get; set; }
public bool Visible { get; set; } = true;
public bool Usable { get; set; } = true;
public string UnusableReason { get; set; }
public string[] ParamLabels { get; set; } = new string[] { };
public object[] ParamDefaultValues { get; set; } = new string[] { };
public object[][] ParamOptions { get; set; } = new string[][] { };
public AboutTypeCodes TypeCode { get; }
} | apache-2.0 | C# |
c73aced79336ce8e1c65e57b0217c9ab7b883d61 | Bump to 1.2.0.0 | chitoku-k/NowPlayingLib | NowPlayingLib/Properties/AssemblyInfo.cs | NowPlayingLib/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("NowPlayingLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chitoku")]
[assembly: AssemblyProduct("NowPlayingLib")]
[assembly: AssemblyCopyright("Copyright © Chitoku 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(true)]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid("c1cfaa36-fe7e-483a-ae4f-ba5aee4d7e5c")]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("NowPlayingLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Chitoku")]
[assembly: AssemblyProduct("NowPlayingLib")]
[assembly: AssemblyCopyright("Copyright © Chitoku 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(true)]
// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です
[assembly: Guid("c1cfaa36-fe7e-483a-ae4f-ba5aee4d7e5c")]
// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
| mit | C# |
fa567e185228aceb7c0e4374cf79f3fe751f8a7d | bump version to 2.11.1 | piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker,piwik/piwik-dotnet-tracker | Piwik.Tracker/Properties/AssemblyInfo.cs | Piwik.Tracker/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.11.1")]
| using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("PiwikTracker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Piwik")]
[assembly: AssemblyProduct("PiwikTracker")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8121d06f-a801-42d2-a144-0036a0270bf3")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.11.0")]
| bsd-3-clause | C# |
e698c2870ed100ea88202b4e4f130d18cf96bc22 | Remove --format parameter and use current bitmap format directly. | Prof9/PixelPet | PixelPet/CLI/Commands/ReadPalettesCmd.cs | PixelPet/CLI/Commands/ReadPalettesCmd.cs | using LibPixelPet;
using System;
using System.Linq;
namespace PixelPet.CLI.Commands {
internal class ReadPalettesCmd : CliCommand {
public ReadPalettesCmd()
: base("Read-Palettes",
new Parameter("palette-number", "pn", false, new ParameterValue("number", "-1")),
new Parameter("palette-size", "ps", false, new ParameterValue("count", "" + int.MaxValue))
) { }
public override void Run(Workbench workbench, ILogger logger) {
int palNum = FindNamedParameter("--palette-number").Values[0].ToInt32();
int palSize = FindNamedParameter("--palette-size").Values[0].ToInt32();
if (palNum < -1) {
logger?.Log("Invalid palette number.", LogLevel.Error);
return;
}
if (palSize < 1) {
logger?.Log("Invalid palette size.", LogLevel.Error);
return;
}
TileCutter cutter = new TileCutter(8, 8);
int ti = 0;
int addedColors = 0;
int addedPalettes = 0;
Palette pal = null;
foreach (Tile tile in cutter.CutTiles(workbench.Bitmap)) {
// Grab color from tile.
int color = tile[0, 0];
foreach (int otherColor in tile.EnumerateTile().Skip(1)) {
if (otherColor != color) {
logger?.Log("Palette tile " + ti + " is not a single color.", LogLevel.Error);
return;
}
}
// Create new palette if needed.
if (pal == null) {
pal = new Palette(workbench.BitmapFormat, palSize);
}
// Add finished palette to palette set.
pal.Add(color, workbench.BitmapFormat);
addedColors++;
// Add finished palette to palette set.
if (pal.Count >= palSize) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
addedPalettes++;
pal = null;
}
ti++;
}
if (pal != null) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
addedPalettes++;
}
logger?.Log("Read " + addedPalettes + " palettes with " + addedColors + " colors total.");
}
}
}
| using LibPixelPet;
using System;
using System.Linq;
namespace PixelPet.CLI.Commands {
internal class ReadPalettesCmd : CliCommand {
public ReadPalettesCmd()
: base("Read-Palettes",
new Parameter("format", "f", false, new ParameterValue("name", nameof(ColorFormat.BGRA8888))),
new Parameter("palette-number", "pn", false, new ParameterValue("number", "-1")),
new Parameter("palette-size", "ps", false, new ParameterValue("count", "" + int.MaxValue))
) { }
public override void Run(Workbench workbench, ILogger logger) {
string fmtName = FindNamedParameter("--format").Values[0].ToString();
int palNum = FindNamedParameter("--palette-number").Values[0].ToInt32();
int palSize = FindNamedParameter("--palette-size").Values[0].ToInt32();
if (palNum < -1) {
logger?.Log("Invalid palette number.", LogLevel.Error);
return;
}
if (palSize < 1) {
logger?.Log("Invalid palette size.", LogLevel.Error);
return;
}
if (!(ColorFormat.GetFormat(fmtName) is ColorFormat fmt)) {
logger?.Log("Unknown color format \"" + fmtName + "\".", LogLevel.Error);
return;
}
TileCutter cutter = new TileCutter(8, 8);
int ti = 0;
int addedColors = 0;
int addedPalettes = 0;
Palette pal = null;
foreach (Tile tile in cutter.CutTiles(workbench.Bitmap)) {
// Grab color from tile.
int color = tile[0, 0];
foreach (int otherColor in tile.EnumerateTile().Skip(1)) {
if (otherColor != color) {
logger?.Log("Palette tile " + ti + " is not a single color.", LogLevel.Error);
return;
}
}
// Create new palette if needed.
if (pal == null) {
pal = new Palette(fmt, palSize);
}
// Add finished palette to palette set.
pal.Add(color, ColorFormat.BGRA8888);
addedColors++;
// Add finished palette to palette set.
if (pal.Count >= palSize) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
addedPalettes++;
pal = null;
}
ti++;
}
if (pal != null) {
if (palNum < 0) {
workbench.PaletteSet.Add(pal);
} else {
workbench.PaletteSet.Add(pal, palNum++);
}
addedPalettes++;
}
logger?.Log("Read " + addedPalettes + " palettes with " + addedColors + " colors total.");
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.