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 |
---|---|---|---|---|---|---|---|---|
8698a52a4a5b35b9b4e73a882a185b7caefa9d82
|
Update Exercise8C.cs
|
lizaamini/CSharpExercises
|
Sheet-8/Exercise8C.cs
|
Sheet-8/Exercise8C.cs
|
using System;
namespace Exercise8C
{
class MainClass
{
public static void Main (string[] args)
{
Console.WriteLine ("Please enter your first name: ");
String firstName = Console.ReadLine ();
Console.WriteLine ("Please enter your last name: ");
String lastName = Console.ReadLine ();
String firstNameTrim = firstName.Substring(1, 2).ToUpper();
String lastNameTrim = lastName.Substring(1, 2);
String trim = firstNameTrim + lastNameTrim;
Console.WriteLine (trim);
}
}
}
|
mit
|
C#
|
|
deaffb79b58c1dd58bf68b009807aee4ea308d63
|
Add hack for HOF cards
|
HearthSim/HearthDb
|
HearthDb/Card.cs
|
HearthDb/Card.cs
|
#region
using System;
using System.Linq;
using HearthDb.CardDefs;
using HearthDb.Enums;
using static HearthDb.Enums.GameTag;
#endregion
namespace HearthDb
{
public class Card
{
internal Card(Entity entity)
{
Entity = entity;
}
public Entity Entity { get; }
public string Id => Entity.CardId;
public int DbfId => Entity.DbfId;
public string Name => GetLocName(DefaultLanguage);
public string Text => GetLocText(DefaultLanguage);
public string FlavorText => GetLocFlavorText(DefaultLanguage);
public CardClass Class => (CardClass)Entity.GetTag(CLASS);
public Rarity Rarity => (Rarity)Entity.GetTag(RARITY);
public CardType Type => (CardType)Entity.GetTag(CARDTYPE);
public Race Race => (Race)Entity.GetTag(CARDRACE);
public CardSet Set
{
get
{
// HACK to fix missing set value on Hall of Fame cards
if(new[]
{
CardIds.Collectible.Mage.IceBlock,
CardIds.Collectible.Neutral.ColdlightOracle,
CardIds.Collectible.Neutral.MoltenGiant
}.Contains(Id))
return CardSet.HOF;
return (CardSet)Entity.GetTag(CARD_SET);
}
}
public Faction Faction => (Faction)Entity.GetTag(FACTION);
public int Cost => Entity.GetTag(COST);
public int Attack => Entity.GetTag(ATK);
public int Health => Entity.GetTag(HEALTH);
public int Durability => Entity.GetTag(DURABILITY);
public int Armor => Entity.GetTag(ARMOR);
public string[] Mechanics
{
get
{
var mechanics = Dictionaries.Mechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0).Select(x => Dictionaries.Mechanics[x]);
var refMechanics =
Dictionaries.ReferencedMechanics.Keys.Where(mechanic => Entity.GetReferencedTag(mechanic) > 0)
.Select(x => Dictionaries.ReferencedMechanics[x]);
return mechanics.Concat(refMechanics).ToArray();
}
}
public string ArtistName => Entity.GetInnerValue(ARTISTNAME);
public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray();
public Locale DefaultLanguage { get; set; } = Locale.enUS;
public bool Collectible => Convert.ToBoolean(Entity.GetTag(COLLECTIBLE));
public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang);
public string GetLocText(Locale lang)
{
var text = Entity.GetLocString(CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim();
if(text == null)
return null;
var index = text.IndexOf('@');
return index > 0 ? text.Substring(index + 1) : text;
}
public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang);
}
}
|
#region
using System;
using System.Linq;
using HearthDb.CardDefs;
using HearthDb.Enums;
using static HearthDb.Enums.GameTag;
#endregion
namespace HearthDb
{
public class Card
{
internal Card(Entity entity)
{
Entity = entity;
}
public Entity Entity { get; }
public string Id => Entity.CardId;
public int DbfId => Entity.DbfId;
public string Name => GetLocName(DefaultLanguage);
public string Text => GetLocText(DefaultLanguage);
public string FlavorText => GetLocFlavorText(DefaultLanguage);
public CardClass Class => (CardClass)Entity.GetTag(CLASS);
public Rarity Rarity => (Rarity)Entity.GetTag(RARITY);
public CardType Type => (CardType)Entity.GetTag(CARDTYPE);
public Race Race => (Race)Entity.GetTag(CARDRACE);
public CardSet Set => (CardSet)Entity.GetTag(CARD_SET);
public Faction Faction => (Faction)Entity.GetTag(FACTION);
public int Cost => Entity.GetTag(COST);
public int Attack => Entity.GetTag(ATK);
public int Health => Entity.GetTag(HEALTH);
public int Durability => Entity.GetTag(DURABILITY);
public int Armor => Entity.GetTag(ARMOR);
public string[] Mechanics
{
get
{
var mechanics = Dictionaries.Mechanics.Keys.Where(mechanic => Entity.GetTag(mechanic) > 0).Select(x => Dictionaries.Mechanics[x]);
var refMechanics =
Dictionaries.ReferencedMechanics.Keys.Where(mechanic => Entity.GetReferencedTag(mechanic) > 0)
.Select(x => Dictionaries.ReferencedMechanics[x]);
return mechanics.Concat(refMechanics).ToArray();
}
}
public string ArtistName => Entity.GetInnerValue(ARTISTNAME);
public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray();
public Locale DefaultLanguage { get; set; } = Locale.enUS;
public bool Collectible => Convert.ToBoolean(Entity.GetTag(COLLECTIBLE));
public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang);
public string GetLocText(Locale lang)
{
var text = Entity.GetLocString(CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim();
if(text == null)
return null;
var index = text.IndexOf('@');
return index > 0 ? text.Substring(index + 1) : text;
}
public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang);
}
}
|
mit
|
C#
|
afeeb3e14b1e1c9447aec374835c457131fa12b6
|
Add code task
|
roman-yagodin/R7.DnnLocalization,roman-yagodin/R7.Dnn.Localization,roman-yagodin/R7.Dnn.Localization,roman-yagodin/R7.DnnLocalization
|
RemoveEmptyEntries.cs
|
RemoveEmptyEntries.cs
|
#!/usr/bin/csexec
using System;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.Diagnostics;
public static class Program
{
public static void Main (string [] args)
{
try
{
var script = new RemoveEmptyEntries () {
PackageName = args [1],
CultureCode = args [2].Replace ("_", "-")
};
script.Run ();
}
catch (Exception ex)
{
Console.WriteLine (ex.Message);
}
}
}
internal class RemoveEmptyEntries
{
#region Parameters
public string CultureCode { get; set; }
public string PackageName { get; set; }
#endregion
public void Run ()
{
try
{
// get translation files
Directory.SetCurrentDirectory (Path.Combine (PackageName, CultureCode));
var files = Directory.GetFiles (".",
string.Format ("*.{0}.resx", CultureCode), SearchOption.AllDirectories);
foreach (var file in files)
{
/*
var doc = new XPathDocument (file);
var writer = XmlWriter.Create (file + ".out");
writer.Settings.Indent = true;
writer.Settings.NewLineHandling = NewLineHandling.None;
var transform = new XslCompiledTransform ();
var settings = new XsltSettings ();
transform.Load("../../xslt/remove-empty-entries.xslt", settings, null);
transform.Transform (doc, writer);
*/
// invoke xlstproc
var xsltproc = new Process ();
xsltproc.StartInfo.FileName = "xsltproc";
xsltproc.StartInfo.Arguments = string.Format (
"--novalid -o \"{0}.out\" \"../../xslt/remove-empty-entries.xslt\" \"{0}\"", file);
xsltproc.StartInfo.UseShellExecute = false;
xsltproc.Start ();
xsltproc.WaitForExit ();
if (xsltproc.ExitCode == 0) {
var diff = new Process ();
diff.StartInfo.FileName = "diff";
diff.StartInfo.Arguments = string.Format ("-w \"{0}\" \"{0}.out\"", file);
diff.StartInfo.UseShellExecute = false;
diff.Start ();
diff.WaitForExit ();
if (diff.ExitCode == 0) {
// no difference except whitespace, keep original file
File.Delete (file + ".out");
}
else {
// TODO: Detect comments and schema removal
// replace original file
Console.WriteLine ("Empty entries removed from: {0}", file);
File.Delete (file);
File.Move (file + ".out", file);
}
}
}
Directory.SetCurrentDirectory (Path.Combine ("..", ".."));
}
catch (Exception ex)
{
throw ex;
}
}
}
|
#!/usr/bin/csexec
using System;
using System.IO;
using System.Text;
using System.Xml;
using System.Xml.Xsl;
using System.Xml.XPath;
using System.Diagnostics;
public static class Program
{
public static void Main (string [] args)
{
try
{
var script = new RemoveEmptyEntries () {
PackageName = args [1],
CultureCode = args [2].Replace ("_", "-")
};
script.Run ();
}
catch (Exception ex)
{
Console.WriteLine (ex.Message);
}
}
}
internal class RemoveEmptyEntries
{
#region Parameters
public string CultureCode { get; set; }
public string PackageName { get; set; }
#endregion
public void Run ()
{
try
{
// get translation files
Directory.SetCurrentDirectory (Path.Combine (PackageName, CultureCode));
var files = Directory.GetFiles (".",
string.Format ("*.{0}.resx", CultureCode), SearchOption.AllDirectories);
foreach (var file in files)
{
/*
var doc = new XPathDocument (file);
var writer = XmlWriter.Create (file + ".out");
writer.Settings.Indent = true;
writer.Settings.NewLineHandling = NewLineHandling.None;
var transform = new XslCompiledTransform ();
var settings = new XsltSettings ();
transform.Load("../../xslt/remove-empty-entries.xslt", settings, null);
transform.Transform (doc, writer);
*/
// invoke xlstproc
var xsltproc = new Process ();
xsltproc.StartInfo.FileName = "xsltproc";
xsltproc.StartInfo.Arguments = string.Format (
"--novalid -o \"{0}.out\" \"../../xslt/remove-empty-entries.xslt\" \"{0}\"", file);
xsltproc.StartInfo.UseShellExecute = false;
xsltproc.Start ();
xsltproc.WaitForExit ();
if (xsltproc.ExitCode == 0) {
var diff = new Process ();
diff.StartInfo.FileName = "diff";
diff.StartInfo.Arguments = string.Format ("-w \"{0}\" \"{0}.out\"", file);
diff.StartInfo.UseShellExecute = false;
diff.Start ();
diff.WaitForExit ();
if (diff.ExitCode == 0) {
// no difference except whitespace, keep original file
File.Delete (file + ".out");
}
else {
// replace original file
Console.WriteLine ("Empty entries removed from: {0}", file);
File.Delete (file);
File.Move (file + ".out", file);
}
}
}
Directory.SetCurrentDirectory (Path.Combine ("..", ".."));
}
catch (Exception ex)
{
throw ex;
}
}
}
|
mit
|
C#
|
bbe17cf6eaa16b06dce1861450d63ed8f827a996
|
Fix ShrineRoom to always be current spawner
|
MoyTW/MTW_AncestorSpirits
|
Source/MTW_AncestorSpirits/RoomRoleWorker_ShrineRoom.cs
|
Source/MTW_AncestorSpirits/RoomRoleWorker_ShrineRoom.cs
|
using RimWorld;
using Verse;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MTW_AncestorSpirits
{
class RoomRoleWorker_ShrineRoom : RoomRoleWorker
{
public override float GetScore(Room room)
{
// I don't know if there should be some "If it's full of joy objects/work benches, *don't* classify it as
// a Shrine - if you Shrine room wall gets broken down by a bug, this will probably push all the attached
// rooms into the "Shrine Room" - is that a desired behaviour?
var shrine = Find.Map.GetComponent<MapComponent_AncestorTicker>().CurrentSpawner;
if (room.AllContainedThings.Contains<Thing>(shrine))
{
return 9999.0f;
}
else
{
return 0.0f;
}
}
}
}
|
using RimWorld;
using Verse;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MTW_AncestorSpirits
{
class RoomRoleWorker_ShrineRoom : RoomRoleWorker
{
public override float GetScore(Room room)
{
// I don't know if there should be some "If it's full of joy objects/work benches, *don't* classify it as
// a Shrine - if you Shrine room wall gets broken down by a bug, this will probably push all the attached
// rooms into the "Shrine Room" - is that a desired behaviour?
Thing shrine = room.AllContainedThings.FirstOrDefault<Thing>(t => t is Building_Shrine);
if (shrine == null)
{
return 0.0f;
}
else
{
return 9999.0f;
}
}
}
}
|
mit
|
C#
|
80b723b08e50e7f74b32b8a6fa1dd8e1714f1786
|
copy pdbs into output path
|
mzboray/DynamicSoapWebService
|
scripts/build.cake
|
scripts/build.cake
|
using System;
using System.Diagnostics;
using IOPath = System.IO.Path;
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean directories.
CleanDirectory("../output");
CleanDirectory("../output/bin");
CleanDirectories("../src/**/bin/" + configuration);
});
Task("Restore-NuGet-Packages")
// .IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("../DynamicSoapWebService.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("../DynamicSoapWebService.sln", settings =>
settings.SetConfiguration(configuration));
});
Task("CopyFiles")
.IsDependentOn("Build")
.Does(() =>
{
var globStart = "../src/**/bin/" + configuration + "/**/";
var files = GetFiles(globStart + "*.dll")
+ GetFiles(globStart + "*.exe")
+ GetFiles(globStart + "*.pdb");
// Copy all exe and dll files to the output directory.
if (!System.IO.Directory.Exists("../output/bin"))
{
System.IO.Directory.CreateDirectory("../output/bin");
}
CopyFiles(files, "../output/bin");
});
Task("Run")
.IsDependentOn("CopyFiles")
.Does(() =>
{
ProcessStartInfo startInfo;
startInfo = new ProcessStartInfo()
{
WorkingDirectory = IOPath.GetFullPath("../output/bin"),
FileName = IOPath.GetFullPath("../output/bin/SoapWebService.exe"),
Verb = "runas"
};
// start the service process elevated so we can force port binding.
Process.Start(startInfo);
// start the client. no elevation needed.
string path = IOPath.GetFullPath("../output/bin/SoapWebServiceClient.exe");
Process.Start(path);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
using System;
using System.Diagnostics;
using IOPath = System.IO.Path;
//////////////////////////////////////////////////////////////////////
// ARGUMENTS
//////////////////////////////////////////////////////////////////////
var target = Argument("target", "Default");
var configuration = Argument("configuration", "Release");
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Clean")
.Does(() =>
{
// Clean directories.
CleanDirectory("../output");
CleanDirectory("../output/bin");
CleanDirectories("../src/**/bin/" + configuration);
});
Task("Restore-NuGet-Packages")
// .IsDependentOn("Clean")
.Does(() =>
{
NuGetRestore("../DynamicSoapWebService.sln");
});
Task("Build")
.IsDependentOn("Restore-NuGet-Packages")
.Does(() =>
{
MSBuild("../DynamicSoapWebService.sln", settings =>
settings.SetConfiguration(configuration));
});
Task("CopyFiles")
.IsDependentOn("Build")
.Does(() =>
{
var path = "../src/**/bin/" + configuration;
var files = GetFiles(path + "/**/*.dll")
+ GetFiles(path + "/**/*.exe");
// Copy all exe and dll files to the output directory.
if (!System.IO.Directory.Exists("../output/bin"))
{
System.IO.Directory.CreateDirectory("../output/bin");
}
CopyFiles(files, "../output/bin");
});
Task("Run")
.IsDependentOn("CopyFiles")
.Does(() =>
{
ProcessStartInfo startInfo;
startInfo = new ProcessStartInfo()
{
WorkingDirectory = IOPath.GetFullPath("../output/bin"),
FileName = IOPath.GetFullPath("../output/bin/SoapWebService.exe"),
Verb = "runas"
};
// start the service process elevated so we can force port binding.
Process.Start(startInfo);
// start the client. no elevation needed.
string path = IOPath.GetFullPath("../output/bin/SoapWebServiceClient.exe");
Process.Start(path);
});
//////////////////////////////////////////////////////////////////////
// TASK TARGETS
//////////////////////////////////////////////////////////////////////
Task("Default")
.IsDependentOn("Build");
//////////////////////////////////////////////////////////////////////
// EXECUTION
//////////////////////////////////////////////////////////////////////
RunTarget(target);
|
mit
|
C#
|
d755039fd802d97d0ce31e5f28238f1d423db43a
|
Clean using
|
Silphid/Silphid.Unity,Silphid/Silphid.Unity
|
Sources/Silphid.Loadzup/Sources/Abstractions/Options.cs
|
Sources/Silphid.Loadzup/Sources/Abstractions/Options.cs
|
using System.Collections.Generic;
using Silphid.Loadzup.Caching;
namespace Silphid.Loadzup
{
public class Options
{
public ContentType ContentType;
public CachePolicy? CachePolicy;
public Dictionary<string, string> RequestHeaders;
public bool IsSceneLoadAdditive = true;
public void SetRequestHeader(string key, string value)
{
if (RequestHeaders == null)
RequestHeaders = new Dictionary<string, string>();
RequestHeaders[key] = value;
}
public static implicit operator Options(CachePolicy cachePolicy) =>
new Options { CachePolicy = cachePolicy };
public static implicit operator Options(ContentType contentType) =>
new Options { ContentType = contentType };
public static implicit operator Options(Dictionary<string, string> requestHeaders) =>
new Options { RequestHeaders = requestHeaders };
}
}
|
using System.Collections.Generic;
using System.Net.Mime;
using Silphid.Loadzup.Caching;
namespace Silphid.Loadzup
{
public class Options
{
public ContentType ContentType;
public CachePolicy? CachePolicy;
public Dictionary<string, string> RequestHeaders;
public bool IsSceneLoadAdditive = true;
public void SetRequestHeader(string key, string value)
{
if (RequestHeaders == null)
RequestHeaders = new Dictionary<string, string>();
RequestHeaders[key] = value;
}
public static implicit operator Options(CachePolicy cachePolicy) =>
new Options { CachePolicy = cachePolicy };
public static implicit operator Options(ContentType contentType) =>
new Options { ContentType = contentType };
public static implicit operator Options(Dictionary<string, string> requestHeaders) =>
new Options { RequestHeaders = requestHeaders };
}
}
|
mit
|
C#
|
c10775eed4c562957d844475e3616f1be670f685
|
Fix property naming inconsistency
|
loicteixeira/gj-unity-api
|
Assets/Plugins/GameJolt/Objects/Trophy.cs
|
Assets/Plugins/GameJolt/Objects/Trophy.cs
|
using System;
using GJAPI.External.SimpleJSON;
namespace GJAPI.Objects
{
public enum TrophyDifficulty { Undefined, Bronze, Silver, Gold, Platinum }
public class Trophy : Base
{
#region Fields & Properties
public int ID { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public TrophyDifficulty Difficulty { get; set; }
public bool Unlocked { get; set; }
public string ImageURL { get; set; }
#endregion Fields & Properties
#region Constructors
public Trophy(int id, string title, string description, TrophyDifficulty difficulty, bool unlocked)
{
this.ID = id;
this.Title = title;
this.Description = description;
this.Difficulty = difficulty;
this.Unlocked = unlocked;
}
public Trophy(JSONClass data)
{
this.PopulateFromJSON(data);
}
#endregion Constructors
#region Update Attributes
protected override void PopulateFromJSON(JSONClass data)
{
this.ID = data["id"].AsInt;
this.Title = data["title"].Value;
this.Description = data["description"].Value;
this.ImageURL = data["image_url"].Value;
this.Unlocked = data["achieved"].Value != "false";
try
{
this.Difficulty = (TrophyDifficulty)Enum.Parse(typeof(TrophyDifficulty), data["difficulty"].Value);
}
catch
{
this.Difficulty = TrophyDifficulty.Undefined;
}
}
#endregion Update Attributes
#region Interface
public void Unlock(Action<bool> callback = null)
{
Trophies.Unlock(this, (bool success) => {
Unlocked = success;
if (callback != null)
{
callback(success);
}
});
}
#endregion Interface
public override string ToString()
{
return string.Format("GJAPI.Objects.Trophy: {0} - {1} - {2} - {3}Unlocked", Title, ID, Difficulty, Unlocked ? "" : "Not ");
}
}
}
|
using System;
using GJAPI.External.SimpleJSON;
namespace GJAPI.Objects
{
public enum TrophyDifficulty { Undefined, Bronze, Silver, Gold, Platinum }
public class Trophy : Base
{
#region Fields & Properties
public int ID { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public TrophyDifficulty Difficulty { get; set; }
public bool Unlocked { get; set; }
public string ImageUrl { get; set; }
#endregion Fields & Properties
#region Constructors
public Trophy(int id, string title, string description, TrophyDifficulty difficulty, bool unlocked)
{
this.ID = id;
this.Title = title;
this.Description = description;
this.Difficulty = difficulty;
this.Unlocked = unlocked;
}
public Trophy(JSONClass data)
{
this.PopulateFromJSON(data);
}
#endregion Constructors
#region Update Attributes
protected override void PopulateFromJSON(JSONClass data)
{
this.ID = data["id"].AsInt;
this.Title = data["title"].Value;
this.Description = data["description"].Value;
this.ImageUrl = data["image_url"].Value;
this.Unlocked = data["achieved"].Value != "false";
try
{
this.Difficulty = (TrophyDifficulty)Enum.Parse(typeof(TrophyDifficulty), data["difficulty"].Value);
}
catch
{
this.Difficulty = TrophyDifficulty.Undefined;
}
}
#endregion Update Attributes
#region Interface
public void Unlock(Action<bool> callback = null)
{
Trophies.Unlock(this, (bool success) => {
Unlocked = success;
if (callback != null)
{
callback(success);
}
});
}
#endregion Interface
public override string ToString()
{
return string.Format("GJAPI.Objects.Trophy: {0} - {1} - {2} - {3}Unlocked", Title, ID, Difficulty, Unlocked ? "" : "Not ");
}
}
}
|
mit
|
C#
|
6c1d9e4802668725506dc3c67e0e80b38be22929
|
bump version to 0.7.2
|
Dalet/140-speedrun-timer,Dalet/140-speedrun-timer,Dalet/140-speedrun-timer
|
SharedAssemblyInfo.cs
|
SharedAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyVersion("0.7.2")]
[assembly: AssemblyFileVersion("0.7.2")]
|
using System.Reflection;
[assembly: AssemblyVersion("0.7.1")]
[assembly: AssemblyFileVersion("0.7.1")]
|
unlicense
|
C#
|
bc7d8052c308cb714272616b7eaf098eb3800ca0
|
Refactor NumberEncoderService to match algorithms in EOSERV source more closely
|
ethanmoffat/EndlessClient
|
EOLib.IO/Services/NumberEncoderService.cs
|
EOLib.IO/Services/NumberEncoderService.cs
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using System.Linq;
namespace EOLib.IO.Services
{
public class NumberEncoderService : INumberEncoderService
{
public byte[] EncodeNumber(int number, int size)
{
var numArray = Enumerable.Repeat(254, 4).ToArray();
var original = number;
if (original >= NumericConstants.THREE_BYTE_MAX)
{
numArray[3] = number/NumericConstants.THREE_BYTE_MAX + 1;
number = number%NumericConstants.THREE_BYTE_MAX;
}
if (original >= NumericConstants.TWO_BYTE_MAX)
{
numArray[2] = number/NumericConstants.TWO_BYTE_MAX + 1;
number = number%NumericConstants.TWO_BYTE_MAX;
}
if (original >= NumericConstants.ONE_BYTE_MAX)
{
numArray[1] = number/NumericConstants.ONE_BYTE_MAX + 1;
number = number%NumericConstants.ONE_BYTE_MAX;
}
numArray[0] = number + 1;
return numArray.Select(x => (byte)x)
.Take(size)
.ToArray();
}
public int DecodeNumber(params byte[] b)
{
for (int index = 0; index < b.Length; ++index)
{
if (b[index] == 254)
b[index] = 1;
else if (b[index] == 0)
b[index] = 128;
--b[index];
}
var retNum = 0;
if (b.Length > 3)
retNum += b[3]*NumericConstants.THREE_BYTE_MAX;
if (b.Length > 2)
retNum += b[2]*NumericConstants.TWO_BYTE_MAX;
if (b.Length > 1)
retNum += b[1]*NumericConstants.ONE_BYTE_MAX;
return retNum + b[0];
}
}
}
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
namespace EOLib.IO.Services
{
public class NumberEncoderService : INumberEncoderService
{
public byte[] EncodeNumber(int number, int size)
{
byte[] numArray = new byte[size];
for (int index = 3; index >= 1; --index)
{
if (index >= numArray.Length)
{
if (number >= NumericConstants.NUMERIC_MAXIMUM[index - 1])
number %= NumericConstants.NUMERIC_MAXIMUM[index - 1];
}
else if (number >= NumericConstants.NUMERIC_MAXIMUM[index - 1])
{
numArray[index] = (byte)(number / NumericConstants.NUMERIC_MAXIMUM[index - 1] + 1);
number %= NumericConstants.NUMERIC_MAXIMUM[index - 1];
}
else
numArray[index] = 254;
}
numArray[0] = (byte)(number + 1);
return numArray;
}
public int DecodeNumber(params byte[] b)
{
for (int index = 0; index < b.Length; ++index)
{
if (b[index] == 254)
b[index] = 1;
else if (b[index] == 0)
b[index] = 128;
--b[index];
}
int num = 0;
for (int index = b.Length - 1; index >= 1; --index)
num += b[index] * NumericConstants.NUMERIC_MAXIMUM[index - 1];
return num + b[0];
}
}
}
|
mit
|
C#
|
6f82480f9ed3eee5e6f62f8ed51af073a50db5f4
|
Fix serverlist mod.
|
fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game,fr1tz/rotc-ethernet-game
|
serverlist/main.cs
|
serverlist/main.cs
|
//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2009, mEthLab Interactive
//------------------------------------------------------------------------------
// Game information used to query the master server
$Client::GameTypeQuery = $GameNameString;
$Client::MissionTypeQuery = "Any";
function printServers()
{
%sc = getServerCount();
for (%i = 0; %i < %sc; %i++) {
setServerInfo(%i);
%prefix = "#server" SPC $ServerInfo::Address;
echo(%prefix SPC "game_version" SPC $ServerInfo::GameVersion);
echo(%prefix SPC "name" SPC $ServerInfo::Name);
echo(%prefix SPC "ping" SPC $ServerInfo::Ping);
echo(%prefix SPC "mod" SPC $ServerInfo::ModString);
echo(%prefix SPC "player_count" SPC $ServerInfo::PlayerCount @ " of " @ $ServerInfo::MaxPlayers);
echo(%prefix SPC "map_name" SPC $ServerInfo::MissionName);
echo(%prefix SPC "map_homepage" SPC $ServerInfo::MissionHomepage);
echo(%prefix SPC "info" SPC $ServerInfo::Info);
}
}
function queryServers()
{
queryMasterServer(
0, // Query flags
$Client::GameTypeQuery, // gameTypes
$Client::MissionTypeQuery, // missionType
0, // minPlayers
100, // maxPlayers
0, // maxBots
2, // regionMask
0, // maxPing
100, // minCPU
0 // filterFlags
);
}
function onServerQueryStatus(%status, %msg, %value)
{
if(%status $= "done")
{
printServers();
quit();
}
}
package ServerList {
function onStart()
{
enableWinConsole(true);
setNetPort(0);
schedule(0, 0, queryServers);
}
function onExit()
{
}
}; // Client package
activatePackage(ServerList);
|
//------------------------------------------------------------------------------
// Revenge Of The Cats: Ethernet
// Copyright (C) 2009, mEthLab Interactive
//------------------------------------------------------------------------------
// Game information used to query the master server
$Client::GameTypeQuery = $GameNameString;
$Client::MissionTypeQuery = "Any";
function printServers()
{
%sc = getServerCount();
for (%i = 0; %i < %sc; %i++) {
setServerInfo(%i);
%prefix = "#server" SPC $ServerInfo::Address;
echo(%prefix SPC "game_version" SPC $ServerInfo::GameVersion);
echo(%prefix SPC "name" SPC $ServerInfo::Name);
echo(%prefix SPC "ping" SPC $ServerInfo::Ping);
echo(%prefix SPC "mod" SPC $ServerInfo::ModString);
echo(%prefix SPC "player_count" SPC $ServerInfo::PlayerCount @ " of " @ $ServerInfo::MaxPlayers);
echo(%prefix SPC "map_name" SPC $ServerInfo::MissionName);
echo(%prefix SPC "map_homepage" SPC $ServerInfo::MissionHomepage);
echo(%prefix SPC "info" SPC $ServerInfo::Info);
}
}
function queryServers()
{
queryMasterServer(
0, // Query flags
$Client::GameTypeQuery, // gameTypes
$Client::MissionTypeQuery, // missionType
0, // minPlayers
100, // maxPlayers
0, // maxBots
2, // regionMask
0, // maxPing
100, // minCPU
0 // filterFlags
);
}
function onServerQueryStatus(%status, %msg, %value)
{
if(%status $= "done")
{
printServers();
//quit();
}
}
package ServerList {
function onStart()
{
enableWinConsole(true);
setNetPort(0);
schedule(0, 0, queryServers);
}
function onExit()
{
}
}; // Client package
activatePackage(ServerList);
|
lgpl-2.1
|
C#
|
bb289e8622e1c939662cdcf8a1fd2d573b48e413
|
fix issue on incorrect click for GotoMyAccountPage
|
ProtoTest/ProtoTest.Golem,ProtoTest/ProtoTest.Golem
|
Golem.PageObjects.Cael/HeaderComponent.cs
|
Golem.PageObjects.Cael/HeaderComponent.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Golem.Framework;
using Golem.PageObjects.Cael.MyAccount;
using OpenQA.Selenium;
namespace Golem.PageObjects.Cael
{
public class HeaderComponent : BasePageObject
{
public Element Welcome_Link = new Element("Welcome Link", ByE.PartialText("Welcome,"));
public Element SignOut_Link = new Element("Sign Out Link", By.Id("p_lt_ctl00_SignOutButton_btnSignOutLink"));
public Element Logo_Button = new Element("Logo", By.Id("logo"));
public Element Dashboard_Link = new Element("Dashboard Link", By.LinkText("Dashboard"));
public Element Portfolios_Link = new Element("Portfolios Link", By.LinkText("Portfolios"));
public Element Advising_Link = new Element("Advising Link", By.LinkText("Advising"));
public Element MyAccount_Link = new Element("MyAccount Button", By.LinkText("My Account"));
public ContactInfoPage ClickWelcomeLink()
{
Welcome_Link.Click();
return new ContactInfoPage();
}
public ContactInfoPage GoToMyAccountPage()
{
MyAccount_Link.Click();
return new ContactInfoPage();
}
public HomePage SignOut()
{
SignOut_Link.Click();
return new HomePage();
}
public DashboardPage GoToDashboardPage()
{
Dashboard_Link.Click();
return new DashboardPage();
}
public void GoToPortfoliosPage()
{
Portfolios_Link.Click();
}
public void GoToAdvisingPage()
{
Advising_Link.Click();
//return new AdvisingPage();
}
public override void WaitForElements()
{
Welcome_Link.VerifyVisible(30);
SignOut_Link.VerifyVisible(30);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Golem.Framework;
using Golem.PageObjects.Cael.MyAccount;
using OpenQA.Selenium;
namespace Golem.PageObjects.Cael
{
public class HeaderComponent : BasePageObject
{
public Element Welcome_Link = new Element("Welcome Link", ByE.PartialText("Welcome,"));
public Element SignOut_Link = new Element("Sign Out Link", By.Id("p_lt_ctl00_SignOutButton_btnSignOutLink"));
public Element Logo_Button = new Element("Logo", By.Id("logo"));
public Element Dashboard_Link = new Element("Dashboard Link", By.LinkText("Dashboard"));
public Element Portfolios_Link = new Element("Portfolios Link", By.LinkText("Portfolios"));
public Element Advising_Link = new Element("Advising Link", By.LinkText("Advising"));
public Element MyAccount_Link = new Element("MyAccount Button", By.LinkText("My Account"));
public ContactInfoPage ClickWelcomeLink()
{
Welcome_Link.Click();
return new ContactInfoPage();
}
public ContactInfoPage GoToMyAccountPage()
{
SignOut_Link.Click();
return new ContactInfoPage();
}
public HomePage SignOut()
{
SignOut_Link.Click();
return new HomePage();
}
public DashboardPage GoToDashboardPage()
{
Dashboard_Link.Click();
return new DashboardPage();
}
public void GoToPortfoliosPage()
{
Portfolios_Link.Click();
}
public void GoToAdvisingPage()
{
Advising_Link.Click();
//return new AdvisingPage();
}
public override void WaitForElements()
{
Welcome_Link.VerifyVisible(30);
SignOut_Link.VerifyVisible(30);
}
}
}
|
apache-2.0
|
C#
|
2060aede20cdabfdcb82a2d420eb65bb0925312b
|
Remove unwanted COM using directive
|
jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode,jskeet/DemoCode
|
Drums/VDrumExplorer.ViewModel/IViewServices.cs
|
Drums/VDrumExplorer.ViewModel/IViewServices.cs
|
// Copyright 2020 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System.Threading.Tasks;
using VDrumExplorer.ViewModel.Audio;
using VDrumExplorer.ViewModel.Data;
using VDrumExplorer.ViewModel.Dialogs;
using VDrumExplorer.ViewModel.LogicalSchema;
namespace VDrumExplorer.ViewModel
{
/// <summary>
/// Interface implemented by the view to handle behavior that is inherently UI-related,
/// primarily around opening dialog boxes.
/// </summary>
public interface IViewServices
{
/// <summary>
/// Shows an "open file" dialog with the given filter.
/// </summary>
/// <param name="filter">The filter for which files to show. See FileDialog.Filter docs for details.</param>
/// <returns>The selected file, or null if the dialog was cancelled.</returns>
string? ShowOpenFileDialog(string filter);
/// <summary>
/// Shows a "save file" dialog with the given filter.
/// </summary>
/// <param name="filter">The filter for which files to show. See FileDialog.Filter docs for details.</param>
/// <returns>The selected file, or null if the dialog was cancelled.</returns>
string? ShowSaveFileDialog(string filter);
int? ChooseCopyKitTarget(CopyKitViewModel viewModel);
void ShowSchemaExplorer(ModuleSchemaViewModel viewModel);
void ShowKitExplorer(KitExplorerViewModel viewModel);
void ShowModuleExplorer(ModuleExplorerViewModel viewModel);
void ShowInstrumentAudioExplorer(InstrumentAudioExplorerViewModel viewModel);
void ShowInstrumentRecorderDialog(InstrumentAudioRecorderViewModel viewModel);
Task<T?> ShowDataTransferDialog<T>(DataTransferViewModel<T> viewModel)
where T : class;
}
}
|
// Copyright 2020 Jon Skeet. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using System.Runtime.InteropServices.ComTypes;
using System.Threading.Tasks;
using VDrumExplorer.ViewModel.Audio;
using VDrumExplorer.ViewModel.Data;
using VDrumExplorer.ViewModel.Dialogs;
using VDrumExplorer.ViewModel.LogicalSchema;
namespace VDrumExplorer.ViewModel
{
/// <summary>
/// Interface implemented by the view to handle behavior that is inherently UI-related,
/// primarily around opening dialog boxes.
/// </summary>
public interface IViewServices
{
/// <summary>
/// Shows an "open file" dialog with the given filter.
/// </summary>
/// <param name="filter">The filter for which files to show. See FileDialog.Filter docs for details.</param>
/// <returns>The selected file, or null if the dialog was cancelled.</returns>
string? ShowOpenFileDialog(string filter);
/// <summary>
/// Shows a "save file" dialog with the given filter.
/// </summary>
/// <param name="filter">The filter for which files to show. See FileDialog.Filter docs for details.</param>
/// <returns>The selected file, or null if the dialog was cancelled.</returns>
string? ShowSaveFileDialog(string filter);
int? ChooseCopyKitTarget(CopyKitViewModel viewModel);
void ShowSchemaExplorer(ModuleSchemaViewModel viewModel);
void ShowKitExplorer(KitExplorerViewModel viewModel);
void ShowModuleExplorer(ModuleExplorerViewModel viewModel);
void ShowInstrumentAudioExplorer(InstrumentAudioExplorerViewModel viewModel);
void ShowInstrumentRecorderDialog(InstrumentAudioRecorderViewModel viewModel);
Task<T?> ShowDataTransferDialog<T>(DataTransferViewModel<T> viewModel)
where T : class;
}
}
|
apache-2.0
|
C#
|
a2fe7e40d9dd2440cca5fbbe01cabbf25add754b
|
fix typo
|
bennettp123/test
|
ConsoleApplication1/ConsoleApplication1/Program.cs
|
ConsoleApplication1/ConsoleApplication1/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string blah = "Hello World";
System.Console.Out.WriteLine(blah);
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string blah = "Hello World";
System.Console.Out.WriteLine(blah)
}
}
}
|
mit
|
C#
|
41b94c962a2aecb8b9a2c0a7606b1cc7c9b61a5e
|
Add IoC registration for login data translator
|
ethanmoffat/EndlessClient
|
EOLib/Net/Translators/PacketTranslatorContainer.cs
|
EOLib/Net/Translators/PacketTranslatorContainer.cs
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using EOLib.Data.Login;
using EOLib.Data.Protocol;
using Microsoft.Practices.Unity;
namespace EOLib.Net.Translators
{
public class PacketTranslatorContainer : IDependencyContainer
{
public void RegisterDependencies(IUnityContainer container)
{
container.RegisterType<IPacketTranslator<IInitializationData>, InitDataTranslator>();
container.RegisterType<IPacketTranslator<IAccountLoginData>, AccountLoginPacketTranslator>();
}
}
}
|
// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file
using EOLib.Data.Protocol;
using Microsoft.Practices.Unity;
namespace EOLib.Net.Translators
{
public class PacketTranslatorContainer : IDependencyContainer
{
public void RegisterDependencies(IUnityContainer container)
{
container.RegisterType<IPacketTranslator<IInitializationData>, InitDataTranslator>();
}
}
}
|
mit
|
C#
|
7dbf613bc8d42cf410dbace46973a6d3079450e8
|
Remove string[] hack in ExportProperties.IconPaths since apparently it was already supported as one of the accessor types.
|
blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon,blakeohare/crayon
|
Compiler/Wax/ExportProperties.cs
|
Compiler/Wax/ExportProperties.cs
|
using System.Collections.Generic;
namespace Wax
{
public class ExportProperties : JsonBasedObject
{
public ExportProperties() : base() { }
public ExportProperties(IDictionary<string, object> data) : base(data) { }
public string ByteCode { get { return this.GetString("byteCode"); } set { this.SetString("byteCode", value); } }
public string ProjectID { get { return this.GetString("projectId"); } set { this.SetString("projectId", value); } }
public string GuidSeed { get { return this.GetString("guidSeed"); } set { this.SetString("guidSeed", value); } }
public string[] IconPaths { get { return this.GetStrings("iconPaths"); } set { this.SetStrings("iconPaths", value); } }
public string LaunchScreenPath { get { return this.GetString("launchScreenPath"); } set { this.SetString("launchScreenPath", value); } }
public string ProjectTitle { get { return this.GetString("title"); } set { this.SetString("title", value); } }
public string JsFilePrefix { get { return this.GetString("jsFilePrefix"); } set { this.SetString("jsFilePrefix", value); } }
public bool JsFullPage { get { return this.GetBoolean("jsFullPage"); } set { this.SetBoolean("jsFullPage", value); } }
public string IosBundlePrefix { get { return this.GetString("iosBundlePrefix"); } set { this.SetString("iosBundlePrefix", value); } }
public string JavaPackage { get { return this.GetString("javaPackage"); } set { this.SetString("javaPackage", value); } }
public string Orientations { get { return this.GetString("orientations"); } set { this.SetString("orientations", value); } }
public string Version { get { return this.GetString("version"); } set { this.SetString("version", value); } }
public string Description { get { return this.GetString("description"); } set { this.SetString("description", value); } }
}
}
|
using System.Collections.Generic;
namespace Wax
{
public class ExportProperties : JsonBasedObject
{
public ExportProperties() : base() { }
public ExportProperties(IDictionary<string, object> data) : base(data) { }
public string ByteCode { get { return this.GetString("byteCode"); } set { this.SetString("byteCode", value); } }
public string ProjectID { get { return this.GetString("projectId"); } set { this.SetString("projectId", value); } }
public string GuidSeed { get { return this.GetString("guidSeed"); } set { this.SetString("guidSeed", value); } }
private string IconPathsDelim { get { return this.GetString("iconPaths"); } set { this.SetString("iconPaths", value); } }
public string LaunchScreenPath { get { return this.GetString("launchScreenPath"); } set { this.SetString("launchScreenPath", value); } }
public string ProjectTitle { get { return this.GetString("title"); } set { this.SetString("title", value); } }
public string JsFilePrefix { get { return this.GetString("jsFilePrefix"); } set { this.SetString("jsFilePrefix", value); } }
public bool JsFullPage { get { return this.GetBoolean("jsFullPage"); } set { this.SetBoolean("jsFullPage", value); } }
public string IosBundlePrefix { get { return this.GetString("iosBundlePrefix"); } set { this.SetString("iosBundlePrefix", value); } }
public string JavaPackage { get { return this.GetString("javaPackage"); } set { this.SetString("javaPackage", value); } }
public string Orientations { get { return this.GetString("orientations"); } set { this.SetString("orientations", value); } }
public string Version { get { return this.GetString("version"); } set { this.SetString("version", value); } }
public string Description { get { return this.GetString("description"); } set { this.SetString("description", value); } }
public string[] IconPaths
{
get
{
string value = this.IconPathsDelim;
if (value != null) return value.Split(',');
return null;
}
set
{
this.IconPathsDelim = string.Join(',', value);
}
}
}
}
|
mit
|
C#
|
b07332640a76f0243261f8ab597304e72a5a4c3c
|
Fix SecretCache
|
bbqchickenrobot/Akavache,shana/Akavache,MathieuDSTP/MyAkavache,ghuntley/AkavacheSandpit,mms-/Akavache,christer155/Akavache,PureWeen/Akavache,martijn00/Akavache,kmjonmastro/Akavache,akavache/Akavache,MarcMagnin/Akavache,Loke155/Akavache,jcomtois/Akavache,shiftkey/Akavache,gimsum/Akavache,shana/Akavache
|
Akavache/WinRTEncryptedBlobCache.cs
|
Akavache/WinRTEncryptedBlobCache.cs
|
using System;
using System.IO;
using System.Reactive.Concurrency;
using System.Reactive.Windows.Foundation;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Reactive.Linq;
using System.Reflection;
using ReactiveUI;
using Windows.Security.Cryptography.DataProtection;
using Windows.Storage;
namespace Akavache
{
public abstract class EncryptedBlobCache : PersistentBlobCache, ISecureBlobCache
{
static Lazy<ISecureBlobCache> _Current = new Lazy<ISecureBlobCache>(() => new CEncryptedBlobCache(GetDefaultCacheDirectory()));
public static ISecureBlobCache Current
{
get { return _Current.Value; }
}
protected EncryptedBlobCache(string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null)
: base(cacheDirectory, filesystemProvider, scheduler)
{
}
class CEncryptedBlobCache : EncryptedBlobCache
{
public CEncryptedBlobCache(string cacheDirectory) : base(cacheDirectory, null, RxApp.TaskpoolScheduler) { }
}
protected override IObservable<byte[]> BeforeWriteToDiskFilter(byte[] data, IScheduler scheduler)
{
if (data.Length == 0)
{
return Observable.Return(data);
}
var dpapi = new DataProtectionProvider("LOCAL=user");
return dpapi.ProtectAsync(data.AsBuffer()).ToObservable()
.Select(x => x.ToArray());
}
protected override IObservable<byte[]> AfterReadFromDiskFilter(byte[] data, IScheduler scheduler)
{
if (data.Length == 0)
{
return Observable.Return(data);
}
var dpapi = new DataProtectionProvider();
return dpapi.UnprotectAsync(data.AsBuffer()).ToObservable()
.Select(x => x.ToArray());
}
protected static string GetDefaultCacheDirectory()
{
return Path.Combine(ApplicationData.Current.RoamingFolder.Path, "SecretCache");
}
}
}
|
using System;
using System.IO;
using System.Reactive.Concurrency;
using System.Reactive.Windows.Foundation;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Reactive.Linq;
using System.Reflection;
using ReactiveUI;
using Windows.Security.Cryptography.DataProtection;
using Windows.Storage;
namespace Akavache
{
public abstract class EncryptedBlobCache : PersistentBlobCache, ISecureBlobCache
{
static Lazy<ISecureBlobCache> _Current = new Lazy<ISecureBlobCache>(() => new CEncryptedBlobCache(GetDefaultCacheDirectory()));
public static ISecureBlobCache Current
{
get { return _Current.Value; }
}
readonly DataProtectionProvider dpapi = new DataProtectionProvider();
protected EncryptedBlobCache(string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null)
: base(cacheDirectory, filesystemProvider, scheduler)
{
}
class CEncryptedBlobCache : EncryptedBlobCache
{
public CEncryptedBlobCache(string cacheDirectory) : base(cacheDirectory, null, RxApp.TaskpoolScheduler) { }
}
protected override IObservable<byte[]> BeforeWriteToDiskFilter(byte[] data, IScheduler scheduler)
{
return dpapi.ProtectAsync(data.AsBuffer()).ToObservable()
.Select(x => x.ToArray());
}
protected override IObservable<byte[]> AfterReadFromDiskFilter(byte[] data, IScheduler scheduler)
{
return dpapi.UnprotectAsync(data.AsBuffer()).ToObservable()
.Select(x => x.ToArray());
}
protected static string GetDefaultCacheDirectory()
{
return Path.Combine(ApplicationData.Current.RoamingFolder.Path, "SecretCache");
}
}
}
|
mit
|
C#
|
7442ec14d7517ede71a7edc67e1fecf16caee1d1
|
Fix DB connection
|
pavel07/Proyecto_MiniTrello,pavel07/Proyecto_MiniTrello
|
MiniTrello.Infrastructure/ConfigureDatabase.cs
|
MiniTrello.Infrastructure/ConfigureDatabase.cs
|
using AcklenAvenue.Data.NHibernate;
using Autofac;
using FluentNHibernate.Cfg.Db;
using MiniTrello.Data;
using NHibernate;
namespace MiniTrello.Infrastructure
{
public class ConfigureDatabase : IBootstrapperTask
{
readonly ContainerBuilder container;
public ConfigureDatabase(ContainerBuilder containerBuilder)
{
container = containerBuilder;
}
#region IBootstrapperTask Members
public void Run()
{
MsSqlConfiguration databaseConfiguration = MsSqlConfiguration.MsSql2008.ShowSql().
ConnectionString(x => x.FromConnectionStringWithKey("MiniTrello.Remote"));
container.Register(c => c.Resolve<ISessionFactory>().OpenSession()).As
<ISession>()
.InstancePerLifetimeScope()
.OnActivating(c =>
{
if (!c.Instance.Transaction.IsActive)
c.Instance.BeginTransaction();
}
)
.OnRelease(c =>
{
if (c.Transaction.IsActive)
{
c.Transaction.Commit();
}
c.Dispose();
});
container.Register(c =>
new SessionFactoryBuilder(new MappingScheme(), databaseConfiguration).Build())
.SingleInstance()
.As<ISessionFactory>();
}
#endregion
}
}
|
using AcklenAvenue.Data.NHibernate;
using Autofac;
using FluentNHibernate.Cfg.Db;
using MiniTrello.Data;
using NHibernate;
namespace MiniTrello.Infrastructure
{
public class ConfigureDatabase : IBootstrapperTask
{
readonly ContainerBuilder container;
public ConfigureDatabase(ContainerBuilder containerBuilder)
{
container = containerBuilder;
}
#region IBootstrapperTask Members
public void Run()
{
MsSqlConfiguration databaseConfiguration = MsSqlConfiguration.MsSql2008.ShowSql().
ConnectionString(x => x.FromConnectionStringWithKey("MiniTrello.Local"));
container.Register(c => c.Resolve<ISessionFactory>().OpenSession()).As
<ISession>()
.InstancePerLifetimeScope()
.OnActivating(c =>
{
if (!c.Instance.Transaction.IsActive)
c.Instance.BeginTransaction();
}
)
.OnRelease(c =>
{
if (c.Transaction.IsActive)
{
c.Transaction.Commit();
}
c.Dispose();
});
container.Register(c =>
new SessionFactoryBuilder(new MappingScheme(), databaseConfiguration).Build())
.SingleInstance()
.As<ISessionFactory>();
}
#endregion
}
}
|
mit
|
C#
|
1232463ad86e59fe4c3aaef8022480f07942a24e
|
Ajuste no mapeamento de rotas para evitar duplicidade
|
cayodonatti/TopGearApi
|
TopGearApi/App_Start/WebApiConfig.cs
|
TopGearApi/App_Start/WebApiConfig.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web.Http;
namespace TopGearApi
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "ApiByAction",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { action = "Get", id = RouteParameter.Optional }
);
//config.Routes.MapHttpRoute(
// name: "DefaultApi",
// routeTemplate: "api/{controller}/{id}",
// defaults: new { action = "Get", id = RouteParameter.Optional }
//);
config.Formatters.Clear();
config.Formatters.Add(new JsonMediaTypeFormatter());
config.Formatters.Add(new XmlMediaTypeFormatter());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Formatting;
using System.Web.Http;
namespace TopGearApi
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
// Web API routes
config.Routes.MapHttpRoute(
name: "ApiByAction",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { action = "Get", id = RouteParameter.Optional }
);
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { action = "Get", id = RouteParameter.Optional }
);
config.Formatters.Clear();
config.Formatters.Add(new JsonMediaTypeFormatter());
config.Formatters.Add(new XmlMediaTypeFormatter());
}
}
}
|
mit
|
C#
|
68e5cf269b7c63ec17db2ca74fb635c34b31bd1c
|
Improve ISampleChannel.Play's xmldoc
|
ppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
|
osu.Framework/Audio/Sample/ISampleChannel.cs
|
osu.Framework/Audio/Sample/ISampleChannel.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.Audio.Track;
namespace osu.Framework.Audio.Sample
{
/// <summary>
/// A channel playing back an audio sample.
/// </summary>
public interface ISampleChannel : IHasAmplitudes
{
/// <summary>
/// Start a new playback of this sample.
/// Note that this will not stop previous playbacks (but concurrency will be limited by the source <see cref="ISampleStore.PlaybackConcurrency"/>.
/// </summary>
/// <param name="restart">Whether to restart the sample from the beginning.</param>
void Play(bool restart = true);
/// <summary>
/// Stop playback and reset position to beginning of sample.
/// </summary>
void Stop();
/// <summary>
/// Whether the sample is playing.
/// </summary>
bool Playing { get; }
/// <summary>
/// Whether the sample has finished playback.
/// </summary>
bool Played { get; }
/// <summary>
/// States if this sample should repeat.
/// </summary>
bool Looping { get; set; }
/// <summary>
/// The length of the underlying sample, in milliseconds.
/// </summary>
double Length { get; }
}
}
|
// 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.
namespace osu.Framework.Audio.Sample
{
/// <summary>
/// A channel playing back an audio sample.
/// </summary>
public interface ISampleChannel : IHasAmplitudes
{
/// <summary>
/// Start playback.
/// </summary>
/// <param name="restart">Whether to restart the sample from the beginning.</param>
void Play(bool restart = true);
/// <summary>
/// Stop playback and reset position to beginning of sample.
/// </summary>
void Stop();
/// <summary>
/// Whether the sample is playing.
/// </summary>
bool Playing { get; }
/// <summary>
/// Whether the sample has finished playback.
/// </summary>
bool Played { get; }
/// <summary>
/// States if this sample should repeat.
/// </summary>
bool Looping { get; set; }
/// <summary>
/// The length of the underlying sample, in milliseconds.
/// </summary>
double Length { get; }
}
}
|
mit
|
C#
|
1965b62b19396882d65bd39e122c04571835fe8d
|
Change enum value name
|
arnovb-github/CmcLibNet
|
CmcLibNet.Export/ValueFormatting.cs
|
CmcLibNet.Export/ValueFormatting.cs
|
namespace Vovin.CmcLibNet.Export
{
/// <summary>
/// Enum for data output formats.
/// </summary>
internal enum ValueFormatting
{
/// <summary>
/// No formatting, use data as-is. This means formatted to whatever formatting Commence inherits from the system.
/// </summary>
None = 0,
/// <summary>
/// Return canonical format as defined by Commence.
/// Unlike Commence, CmcLibNet returns connected data formatted as well. <seealso cref="CmcOptionFlags.Canonical"/>
/// </summary>
Canonical = 1,
/// <summary>
/// Return data compliant with ISO 8601 format. http://www.iso.org/iso/iso8601
/// </summary>
ISO8601 = 2,
}
}
|
namespace Vovin.CmcLibNet.Export
{
/// <summary>
/// Enum for data output formats.
/// </summary>
internal enum ValueFormatting
{
/// <summary>
/// No formatting, use data as-is. This means formatted to whatever formatting Commence inherits from the system.
/// </summary>
None = 0,
/// <summary>
/// Return canonical format as defined by Commence. Unlike Commence, CmcLibNet returns connected data in the format as well. <seealso cref="CmcOptionFlags.Canonical"/>
/// </summary>
Canonical = 1,
/// <summary>
/// Return data compliant with ISO 8601 format. http://www.iso.org/iso/iso8601
/// </summary>
XSD_ISO8601 = 2,
}
}
|
mit
|
C#
|
b3275ccae9377a75e063afdb619a0ea5be468b4d
|
Simplify dictionary logic
|
skyguy94/dynamic-wrapper
|
DynamicWrapper/WrapperDictionary.cs
|
DynamicWrapper/WrapperDictionary.cs
|
using System;
using System.Collections.Generic;
namespace DynamicWrapper
{
internal class WrapperDictionary
{
private readonly Dictionary<string, Type> _wrapperTypes = new Dictionary<string, Type>();
private static string GenerateKey(Type interfaceType, Type realObjectType)
{
return interfaceType.Name + "->" + realObjectType.Name;
}
public Type GetType(Type interfaceType, Type realObjectType)
{
var key = GenerateKey(interfaceType, realObjectType);
Type value;
_wrapperTypes.TryGetValue(key, out value);
return value;
}
public void SetType(Type interfaceType, Type realObjectType, Type wrapperType)
{
var key = GenerateKey(interfaceType, realObjectType);
_wrapperTypes[key] = wrapperType;
}
}
}
|
using System;
using System.Collections.Generic;
namespace DynamicWrapper
{
internal class WrapperDictionary
{
private readonly Dictionary<string, Type> _wrapperTypes = new Dictionary<string, Type>();
private static string GenerateKey(Type interfaceType, Type realObjectType)
{
return interfaceType.Name + "->" + realObjectType.Name;
}
public Type GetType(Type interfaceType, Type realObjectType)
{
string key = GenerateKey(interfaceType, realObjectType);
if (_wrapperTypes.ContainsKey(key))
return _wrapperTypes[key];
return null;
}
public void SetType(Type interfaceType, Type realObjectType, Type wrapperType)
{
string key = GenerateKey(interfaceType, realObjectType);
if (_wrapperTypes.ContainsKey(key))
_wrapperTypes[key] = wrapperType;
else
_wrapperTypes.Add(key, wrapperType);
}
}
}
|
mit
|
C#
|
988f8df05a009449cb0ec8645dc09286d8487b1c
|
clean up TabControl
|
jarmo/RAutomation,modulexcite/RAutomation,jarmo/RAutomation,jarmo/RAutomation,modulexcite/RAutomation,modulexcite/RAutomation,jarmo/RAutomation,modulexcite/RAutomation
|
ext/UiaDll/RAutomation.UIA/TabControl.cs
|
ext/UiaDll/RAutomation.UIA/TabControl.cs
|
using System.Collections.Generic;
using System.Linq;
using System.Windows.Automation;
namespace RAutomation.UIA
{
public class TabControl
{
private readonly AutomationElement _element;
public TabControl(AutomationElement element)
{
_element = element;
}
public string[] TabNames
{
get { return TabItems.Select(x => x.Current.Name).ToArray(); }
}
public string Selection
{
get { return TabItems.First(IsSelected).Current.Name; }
set { TabItems.First(x => x.Current.Name == value).AsSelectionItem().Select(); }
}
public int SelectedIndex
{
get { return TabItems.IndexOf(IsSelected); }
set { SelectionItems.ElementAt(value).Select(); }
}
private static bool IsSelected(AutomationElement tabItem)
{
return tabItem.AsSelectionItem().Current.IsSelected;
}
private IEnumerable<AutomationElement> TabItems
{
get { return _element.Find(IsTabItem); }
}
private IEnumerable<SelectionItemPattern> SelectionItems
{
get { return TabItems.AsSelectionItems(); }
}
private static Condition IsTabItem
{
get { return new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TabItem); }
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using System.Windows.Automation;
namespace RAutomation.UIA
{
public class TabControl
{
private readonly AutomationElement _element;
public TabControl(AutomationElement element)
{
_element = element;
}
public string[] TabNames
{
get { return TabItems.Select(x => x.Current.Name).ToArray(); }
}
public string Selection
{
get { return TabItems.First(x => x.AsSelectionItem().Current.IsSelected).Current.Name; }
set { TabItems.First(x => x.Current.Name == value).AsSelectionItem().Select(); }
}
public int SelectedIndex
{
get { return SelectionItems.IndexOf(x => x.Current.IsSelected); }
set { SelectionItems.ElementAt(value).Select(); }
}
private IEnumerable<AutomationElement> TabItems
{
get { return _element.Find(IsTabItem); }
}
private IEnumerable<SelectionItemPattern> SelectionItems
{
get { return TabItems.AsSelectionItems(); }
}
private static Condition IsTabItem
{
get { return new PropertyCondition(AutomationElement.ControlTypeProperty, ControlType.TabItem); }
}
}
}
|
mit
|
C#
|
7de732361e35815e3ff6aed2e41c96542108ce03
|
Fix port in arguments crashing app
|
Zyrio/ictus,Zyrio/ictus
|
src/Yio/Program.cs
|
src/Yio/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Yio.Utilities;
namespace Yio
{
public class Program
{
private static int _port { get; set; }
public static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
StartupUtilities.WriteStartupMessage(StartupUtilities.GetRelease(), ConsoleColor.Cyan);
if (!File.Exists("appsettings.json")) {
StartupUtilities.WriteFailure("configuration is missing");
Environment.Exit(1);
}
StartupUtilities.WriteInfo("setting port");
if(args == null || args.Length == 0)
{
_port = 5100;
StartupUtilities.WriteSuccess("port set to " + _port + " (default)");
}
else
{
_port = args[0] == null ? 5100 : Int32.Parse(args[0]);
StartupUtilities.WriteSuccess("port set to " + _port + " (user defined)");
}
StartupUtilities.WriteInfo("starting App");
BuildWebHost().Run();
Console.ResetColor();
}
public static IWebHost BuildWebHost() =>
WebHost.CreateDefaultBuilder()
.UseUrls("http://0.0.0.0:" + _port.ToString() + "/")
.UseStartup<Startup>()
.Build();
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Yio.Utilities;
namespace Yio
{
public class Program
{
private static int _port { get; set; }
public static void Main(string[] args)
{
Console.OutputEncoding = System.Text.Encoding.Unicode;
StartupUtilities.WriteStartupMessage(StartupUtilities.GetRelease(), ConsoleColor.Cyan);
if (!File.Exists("appsettings.json")) {
StartupUtilities.WriteFailure("configuration is missing");
Environment.Exit(1);
}
StartupUtilities.WriteInfo("setting port");
if(args == null || args.Length == 0)
{
_port = 5100;
StartupUtilities.WriteSuccess("port set to " + _port + " (default)");
}
else
{
_port = args[0] == null ? 5100 : Int32.Parse(args[0]);
StartupUtilities.WriteSuccess("port set to " + _port + " (user defined)");
}
StartupUtilities.WriteInfo("starting App");
BuildWebHost(args).Run();
Console.ResetColor();
}
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUrls("http://0.0.0.0:" + _port.ToString() + "/")
.UseStartup<Startup>()
.Build();
}
}
|
mit
|
C#
|
71035ce9d5506d22dd1cc296ee9d436820725685
|
bump version
|
MetacoSA/NBitcoin,stratisproject/NStratis,thepunctuatedhorizon/BrickCoinAlpha.0.0.1,lontivero/NBitcoin,dangershony/NStratis,bitcoinbrisbane/NBitcoin,MetacoSA/NBitcoin,HermanSchoenfeld/NBitcoin,NicolasDorier/NBitcoin
|
NBitcoin/Properties/AssemblyInfo.cs
|
NBitcoin/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("NBitcoin")]
[assembly: AssemblyDescription("Implementation of bitcoin protocol")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AO-IS")]
[assembly: AssemblyProduct("NBitcoin")]
[assembly: AssemblyCopyright("Copyright © AO-IS 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
#if !PORTABLE
[assembly:InternalsVisibleTo("NBitcoin.Tests")]
#else
[assembly: InternalsVisibleTo("NBitcoin.Portable.Tests")]
#endif
// 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)]
// 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("2.1.5.11")]
[assembly: AssemblyFileVersion("2.1.5.11")]
[assembly: AssemblyInformationalVersion("2.1.5.11")]
|
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("NBitcoin")]
[assembly: AssemblyDescription("Implementation of bitcoin protocol")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AO-IS")]
[assembly: AssemblyProduct("NBitcoin")]
[assembly: AssemblyCopyright("Copyright © AO-IS 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
#if !PORTABLE
[assembly:InternalsVisibleTo("NBitcoin.Tests")]
#else
[assembly: InternalsVisibleTo("NBitcoin.Portable.Tests")]
#endif
// 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)]
// 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("2.1.5.10")]
[assembly: AssemblyFileVersion("2.1.5.10")]
[assembly: AssemblyInformationalVersion("2.1.5.10")]
|
mit
|
C#
|
1a6e88d9b2919f98ba77a42d8a54be84d95c66b6
|
Fix integer overflow on large collection files
|
markmeeus/MarcelloDB
|
MarcelloDB/Helpers/DataHelper.cs
|
MarcelloDB/Helpers/DataHelper.cs
|
using System;
namespace MarcelloDB.Helpers
{
internal class DataHelper
{
internal static void CopyData(
Int64 sourceAddress,
byte[] sourceData,
Int64 targetAddress,
byte[] targetData)
{
Int64 lengthToCopy = sourceData.Length;
Int64 sourceIndex = 0;
Int64 targetIndex = 0;
if (sourceAddress < targetAddress)
{
sourceIndex = (targetAddress - sourceAddress);
lengthToCopy = sourceData.Length - sourceIndex;
}
if (sourceAddress > targetAddress)
{
targetIndex = (sourceAddress - targetAddress);
lengthToCopy = targetData.Length - targetIndex;
}
//max length to copy to not overrun the target array
lengthToCopy = Math.Min(lengthToCopy, targetData.Length - targetIndex);
//max length to copy to not overrrun the source array
lengthToCopy = Math.Min(lengthToCopy, sourceData.Length - sourceIndex);
if (lengthToCopy > 0)
{
Array.Copy(sourceData, (int)sourceIndex, targetData, (int)targetIndex, (int)lengthToCopy);
}
}
}
}
|
using System;
namespace MarcelloDB.Helpers
{
internal class DataHelper
{
internal static void CopyData(
Int64 sourceAddress,
byte[] sourceData,
Int64 targetAddress,
byte[] targetData)
{
var lengthToCopy = sourceData.Length;
var sourceIndex = 0;
var targetIndex = 0;
if (sourceAddress < targetAddress)
{
sourceIndex = (int)(targetAddress - sourceAddress);
lengthToCopy = sourceData.Length - sourceIndex;
}
if (sourceAddress > targetAddress)
{
targetIndex = (int)(sourceAddress - targetAddress);
lengthToCopy = targetData.Length - targetIndex;
}
//max length to copy to not overrun the target array
lengthToCopy = Math.Min(lengthToCopy, targetData.Length - targetIndex);
//max length to copy to not overrrude the source array
lengthToCopy = Math.Min(lengthToCopy, sourceData.Length - sourceIndex);
if (lengthToCopy > 0)
{
Array.Copy(sourceData, sourceIndex, targetData, targetIndex, lengthToCopy);
}
}
}
}
|
mit
|
C#
|
d3d52c7e384f9c04d52d5d6a7cc69a2aec9a5db6
|
Update UserInfoResponse.cs
|
pdcdeveloper/QpGoogleApi
|
OAuth/Models/UserInfoResponse.cs
|
OAuth/Models/UserInfoResponse.cs
|
/*
Date : Monday, June 13, 2016
Author : pdcdeveloper (https://github.com/pdcdeveloper)
Objective :
Version : 1.0
*/
using Newtonsoft.Json;
///
/// <summary>
/// Model of a GooglePlus user.
/// </summary>
///
namespace QPGoogleAPI.OAuth.Models
{
///
/// <remarks>
///
/// Scopes:
/// https://www.googleapis.com/auth/userinfo.profile
/// https://www.googleapis.com/auth/userinfo.email
///
/// GET https://www.googleapis.com/userinfo/v2/me
/// or
/// GET https://www.googleapis.com/oauth2/v2/userinfo
/// </remarks>
///
public class UserInfoResponse
{
[JsonProperty("family_name")]
public string FamilyName { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("picture")]
public string Picture { get; set; }
[JsonProperty("locale")]
public string Locale { get; set; }
[JsonProperty("email")]
public string Email { get; set; }
[JsonProperty("given_name")]
public string GivenName { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("verified_email")]
public string VerifiedEmail { get; set; }
}
}
|
/*
Date : Monday, June 13, 2016
Author : QualiP (https://github.com/QualiP)
Objective :
Version : 1.0
*/
using Newtonsoft.Json;
///
/// <summary>
/// Model of a GooglePlus user.
/// </summary>
///
namespace QPGoogleAPI.OAuth.Models
{
///
/// <remarks>
///
/// Scopes:
/// https://www.googleapis.com/auth/userinfo.profile
/// https://www.googleapis.com/auth/userinfo.email
///
/// GET https://www.googleapis.com/userinfo/v2/me
/// or
/// GET https://www.googleapis.com/oauth2/v2/userinfo
/// </remarks>
///
public class UserInfoResponse
{
[JsonProperty("family_name")]
public string FamilyName { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("picture")]
public string Picture { get; set; }
[JsonProperty("locale")]
public string Locale { get; set; }
[JsonProperty("email")]
public string Email { get; set; }
[JsonProperty("given_name")]
public string GivenName { get; set; }
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("verified_email")]
public string VerifiedEmail { get; set; }
}
}
|
mit
|
C#
|
d5c78771ecde0713a9f1b825b4c1b5f03c047b6b
|
Clean up.
|
otac0n/Pegasus,dmunch/Pegasus,dmunch/Pegasus
|
Pegasus.Tests/RegressionTests.cs
|
Pegasus.Tests/RegressionTests.cs
|
// -----------------------------------------------------------------------
// <copyright file="RegressionTests.cs" company="(none)">
// Copyright © 2013 John Gietzen. All Rights Reserved.
// This source is subject to the MIT license.
// Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Pegasus.Tests
{
using System.Linq;
using NUnit.Framework;
using Pegasus.Compiler;
using Pegasus.Parser;
[TestFixture]
public class RegressionTests
{
[Test(Description = "GitHub bug #20")]
public void Compile_WhenGivenAGrammarWithARuleWithAnImmediateTypedExpression_DoesNotThrowAnExceptionOrReturnErrors()
{
var grammar = new PegParser().Parse("top = item:(<string> 'a' 'b') {item}");
var result = PegCompiler.Compile(grammar);
Assert.That(result.Errors, Is.Empty);
}
[Test(Description = "GitHub bug #21")]
[TestCase("accessibility", "foo-public-foo")]
[TestCase("accessibility", "foo-internal-foo")]
public void Compile_WhenGivenAGrammarWithAnInvalidAccessibilitySetting_YieldsError(string settingName, string value)
{
var grammar = new PegParser().Parse("@" + settingName + " {" + value + "}; a = 'OK';");
var result = PegCompiler.Compile(grammar);
var error = result.Errors.Single();
Assert.That(error.ErrorNumber, Is.EqualTo("PEG0012"));
}
}
}
|
namespace Pegasus.Tests
{
using System.Linq;
using NUnit.Framework;
using Pegasus.Compiler;
using Pegasus.Parser;
[TestFixture]
public class RegressionTests
{
[Test(Description = "GitHub bug #20")]
public void Compile_WhenGivenAGrammarWithARuleWithAnImmediateTypedExpression_DoesNotThrowAnExceptionOrReturnErrors()
{
var grammar = new PegParser().Parse("top = item:(<string> 'a' 'b') {item}");
var result = PegCompiler.Compile(grammar);
Assert.That(result.Errors, Is.Empty);
}
[Test(Description = "GitHub bug #21")]
[TestCase("accessibility", "foo-public-foo")]
[TestCase("accessibility", "foo-internal-foo")]
public void Compile_WhenGivenAGrammarWithAnInvalidAccessibilitySetting_YieldsError(string settingName, string value)
{
var grammar = new PegParser().Parse("@" + settingName + " {" + value + "}; a = 'OK';");
var result = PegCompiler.Compile(grammar);
var error = result.Errors.Single();
Assert.That(error.ErrorNumber, Is.EqualTo("PEG0012"));
}
}
}
|
mit
|
C#
|
76af7fec0e93377a95074bdd107f8344b1e31240
|
add modification tests
|
ceee/PocketSharp
|
PocketSharp.Tests/ModifyTests.cs
|
PocketSharp.Tests/ModifyTests.cs
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
namespace PocketSharp.Tests
{
public class ModifyTests : TestsBase
{
public ModifyTests() : base() { }
[Fact]
public async Task IsAnItemArchivedAndUnarchived()
{
PocketItem item = await Setup();
Assert.True(await client.Archive(item));
item = await GetItemById(item.ID, true);
Assert.True(item.IsArchive);
Assert.True(await client.Unarchive(item));
item = await GetItemById(item.ID);
Assert.False(item.IsArchive);
}
[Fact]
public async Task IsAnItemFavoritedAndUnfavorited()
{
PocketItem item = await Setup();
Assert.True(await client.Favorite(item));
item = await GetItemById(item.ID);
Assert.True(item.IsFavorite);
Assert.True(await client.Unfavorite(item));
item = await GetItemById(item.ID);
Assert.False(item.IsFavorite);
}
[Fact]
public async Task IsAnItemDeleted()
{
PocketItem item = await Setup();
Assert.True(await client.Delete(item));
item = await GetItemById(item.ID);
Assert.Null(item);
}
private async Task<PocketItem> Setup()
{
PocketItem item = await client.Add(
uri: new Uri("https://github.com"),
tags: new string[] { "github", "code", "social" }
);
itemsToDelete.Add(item.ID);
return await GetItemById(item.ID);
}
private async Task<PocketItem> GetItemById(int id, bool archive = false)
{
List<PocketItem> items = await client.Retrieve(state: archive ? State.archive : State.unread);
PocketItem itemDesired = null;
items.ForEach(itm =>
{
if (itm.ID == id)
{
itemDesired = itm;
}
});
return itemDesired;
}
}
}
|
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using Xunit;
using PocketSharp.Models;
namespace PocketSharp.Tests
{
class ModifyTests : TestsBase
{
public ModifyTests() : base() { }
}
}
|
mit
|
C#
|
f7645637a84ffe9ebc4a9825918cfa47d5b38cf4
|
Remove unused using;
|
KonH/UDBase
|
Scripts/Controllers/Save/Save.cs
|
Scripts/Controllers/Save/Save.cs
|
using System;
using System.Collections.Generic;
using UnityEngine;
using UDBase.Utils;
using Rotorz.Games.Reflection;
namespace UDBase.Controllers.SaveSystem {
public interface ISaveSource { }
public class Save {
[Serializable]
public class SaveItem {
[ClassImplements(typeof(ISaveSource))]
public ClassTypeReference Type;
public string Name;
}
[Serializable]
public class Settings {
public List<SaveItem> Items;
}
[Serializable]
public class JsonSettings : Settings {
public string FileName;
public bool PrettyJson;
public bool Versioning;
}
public static void OpenDirectory() {
IOTool.Open(Application.persistentDataPath);
}
}
}
|
using System;
using System.Collections.Generic;
using UnityEngine;
using UDBase.Utils;
using UDBase.Common;
using Rotorz.Games.Reflection;
namespace UDBase.Controllers.SaveSystem {
public interface ISaveSource { }
public class Save {
[Serializable]
public class SaveItem {
[ClassImplements(typeof(ISaveSource))]
public ClassTypeReference Type;
public string Name;
}
[Serializable]
public class Settings {
public List<SaveItem> Items;
}
[Serializable]
public class JsonSettings : Settings {
public string FileName;
public bool PrettyJson;
public bool Versioning;
}
public static void OpenDirectory() {
IOTool.Open(Application.persistentDataPath);
}
}
}
|
mit
|
C#
|
7d6eefa821f5297c6c214fa5030c9cb883b6a0b2
|
Fix XML documentation of ITreeWalker.TryGetParent
|
jasonmcboyd/Treenumerable
|
Source/Treenumerable/ITreeWalker.cs
|
Source/Treenumerable/ITreeWalker.cs
|
using System.Collections.Generic;
namespace Treenumerable
{
/// <summary>
/// Represents an object that is capable of getting the parent and child nodes of a node in a
/// tree.
/// </summary>
/// <typeparam name="T">The type of elements in the tree.</typeparam>
public interface ITreeWalker<T>
{
/// <summary>
/// Returns a <see cref="System.Boolean"/> that indicates if a parent node exists.
/// </summary>
/// <param name="node">The node whose parent is to be returned.</param>
/// <param name="parent">The parent node, if one exists.</param>
/// <returns>
/// When this method returns true this parameter will contain the <see cref="ParentNode"/>
/// that represents the parent of the <paramref name="node"/> parameter. When this method
/// returns false the behavior of this parameter is undefined.
/// </returns>
bool TryGetParent(T node, out T parent);
/// <summary>
/// Returns the children of a node.
/// </summary>
/// <param name="node">The node whose children are to be returned.</param>
/// <returns>
/// The node's children. This should never return null. If a node has no children then
/// an empty IEnumerable should be returned.
/// </returns>
IEnumerable<T> GetChildren(T node);
}
}
|
using System.Collections.Generic;
namespace Treenumerable
{
/// <summary>
/// Represents an object that is capable of getting the parent and child nodes of a node in a
/// tree.
/// </summary>
/// <typeparam name="T">The type of elements in the tree.</typeparam>
public interface ITreeWalker<T>
{
/// <summary>
/// Returns the parent of a node.
/// </summary>
/// <param name="node">The node whose parent is to be returned.</param>
/// <returns>
/// The <see cref="ParentNode"/> that represents node's parent (or lack of parent).
/// </returns>
bool TryGetParent(T node, out T parent);
/// <summary>
/// Returns the children of a node.
/// </summary>
/// <param name="node">The node whose children are to be returned.</param>
/// <returns>
/// The node's children. This should never return null. If a node has no children then
/// an empty IEnumerable should be returned.
/// </returns>
IEnumerable<T> GetChildren(T node);
}
}
|
mit
|
C#
|
2b54b75156e64e46ce79b28ae23c762a866ff47d
|
Bump v1.0.19
|
karronoli/tiny-sato
|
TinySato/Properties/AssemblyInfo.cs
|
TinySato/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.19.*")]
[assembly: AssemblyFileVersion("1.0.19")]
|
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("TinySato")]
[assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TinySato")]
[assembly: AssemblyCopyright("Copyright 2016 karronoli")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
// 既定値にすることができます:
[assembly: AssemblyVersion("1.0.18.*")]
[assembly: AssemblyFileVersion("1.0.18")]
|
apache-2.0
|
C#
|
5cc575ed4ba84184a3ef28d0fd55a8896a026f90
|
Update version number to 0.3.2.0.
|
beppler/trayleds
|
TrayLeds/Properties/AssemblyInfo.cs
|
TrayLeds/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("TrayLeds")]
[assembly: AssemblyDescription("Tray Notification Leds")]
[assembly: AssemblyProduct("TrayLeds")]
[assembly: AssemblyCopyright("Copyright © 2017 Carlos Alberto Costa Beppler")]
// 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("eecfb156-872b-498d-9a01-42d37066d3d4")]
// 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.3.2.0")]
[assembly: AssemblyFileVersion("0.3.2.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("TrayLeds")]
[assembly: AssemblyDescription("Tray Notification Leds")]
[assembly: AssemblyProduct("TrayLeds")]
[assembly: AssemblyCopyright("Copyright © 2017 Carlos Alberto Costa Beppler")]
// 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("eecfb156-872b-498d-9a01-42d37066d3d4")]
// 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.3.1.0")]
[assembly: AssemblyFileVersion("0.3.1.0")]
|
mit
|
C#
|
e077d1793eb559245557559b18878c81d62c36a9
|
use environment instead of args
|
3ventic/BotVenticCore
|
BotVentic2/Program.cs
|
BotVentic2/Program.cs
|
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
string token = Environment.GetEnvironmentVariable("TOKEN");
string clientid = Environment.GetEnvironmentVariable("CLIENT_ID");
if (string.IsNullOrEmpty(token))
{
Console.WriteLine("Required environment variable TOKEN missing.");
}
else
{
Console.WriteLine($"Starting... Ctrl+C to stop");
var bot = new BotVentic2.Bot(token, clientid);
Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) =>
{
Console.WriteLine("Quitting...");
e.Cancel = true;
bot.QuitAsync().Wait();
Environment.Exit(0);
};
bot.RunAsync().GetAwaiter().GetResult();
}
}
internal static async Task<string> RequestAsync(string uri, bool includeClientId = false)
{
string result = "";
try
{
using (var client = new HttpClient())
{
if (includeClientId)
{
client.DefaultRequestHeaders.Add("Client-ID", "4wck2d3bifbikv779pnez14jujeyash");
client.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.twitchtv.v4+json");
}
client.Timeout = TimeSpan.FromSeconds(60);
result = await client.GetStringAsync(uri);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error with request to {uri}: {ex.ToString()}");
}
return result;
}
}
|
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
if (args.Length < 2)
{
Console.WriteLine("Required arguments: [bot token] [client id]");
}
else
{
Console.WriteLine($"Starting... Ctrl+C to stop");
var bot = new BotVentic2.Bot(args[0], args[1]);
Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) =>
{
Console.WriteLine("Quitting...");
e.Cancel = true;
bot.QuitAsync().Wait();
Environment.Exit(0);
};
bot.RunAsync().GetAwaiter().GetResult();
}
}
internal static async Task<string> RequestAsync(string uri, bool includeClientId = false)
{
string result = "";
try
{
using (var client = new HttpClient())
{
if (includeClientId)
{
client.DefaultRequestHeaders.Add("Client-ID", "4wck2d3bifbikv779pnez14jujeyash");
client.DefaultRequestHeaders.Accept.ParseAdd("application/vnd.twitchtv.v4+json");
}
client.Timeout = TimeSpan.FromSeconds(60);
result = await client.GetStringAsync(uri);
}
}
catch (Exception ex)
{
Console.WriteLine($"Error with request to {uri}: {ex.ToString()}");
}
return result;
}
}
|
mit
|
C#
|
52a7dbb1231f126f99c521c3ec01864364b05b01
|
test change
|
ilse-macias/SeleniumSetup
|
CSSPath/EntryPoint.cs
|
CSSPath/EntryPoint.cs
|
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Threading;
using System;
class EntryPoint
{
static void Main()
{
string url = "http://testing.todvachev.com/selectors/css-path/";
string cssPath = "#post-108 > div > figure > img";
string xPath = ".//*[@id='post-108']/div/figure/img";
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl(url);
/** Copy selector: Copy CSS path **/
/** Copy xpath: It's the same that "Copy CSS" but is uglier **/
IWebElement cssPathElement = driver.FindElement(By.CssSelector(cssPath));
IWebElement xPathElement = driver.FindElement(By.XPath(xPath)); //IE has a poor support for xPath
//CSS Path
if (cssPathElement.Displayed)
{
GreenMessage("I can see CSS Path Element");
}
else
{
RedMessage("I can't see CSS Path Element");
}
//xPath
if (xPathElement.Displayed)
{
GreenMessage("I can see xPath Element");
}
else
{
RedMessage("I can't see xPath Element");
}
//test
Thread.Sleep(3000);
driver.Close();
}
private static void GreenMessage(string message)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.White;
}
private static void RedMessage(string message)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.White;
}
}
|
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System.Threading;
using System;
class EntryPoint
{
static void Main()
{
string url = "http://testing.todvachev.com/selectors/css-path/";
string cssPath = "#post-108 > div > figure > img";
string xPath = ".//*[@id='post-108']/div/figure/img";
IWebDriver driver = new ChromeDriver();
driver.Navigate().GoToUrl(url);
/** Copy selector: Copy CSS path **/
/** Copy xpath: It's the same that "Copy CSS" but is uglier **/
IWebElement cssPathElement = driver.FindElement(By.CssSelector(cssPath));
IWebElement xPathElement = driver.FindElement(By.XPath(xPath)); //IE has a poor support for xPath
//CSS Path
if (cssPathElement.Displayed)
{
GreenMessage("I can see CSS Path Element");
}
else
{
RedMessage("I can't see CSS Path Element");
}
//xPath
if (xPathElement.Displayed)
{
GreenMessage("I can see xPath Element");
}
else
{
RedMessage("I can't see xPath Element");
}
Thread.Sleep(3000);
driver.Close();
}
private static void GreenMessage(string message)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.White;
}
private static void RedMessage(string message)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(message);
Console.ForegroundColor = ConsoleColor.White;
}
}
|
mit
|
C#
|
5b63748cda335490fdacc9d9855b993a2d1f1861
|
Update ValuesOut.cs
|
EricZimmerman/RegistryPlugins
|
RegistryPlugin.LastVisitedPidlMRU/ValuesOut.cs
|
RegistryPlugin.LastVisitedPidlMRU/ValuesOut.cs
|
using System;
using System.IO;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.LastVisitedPidlMRU
{
public class ValuesOut:IValueOut
{
public ValuesOut(string ext, string absolutePath, string details, string valueName, int mruPosition,
DateTimeOffset? openedOn)
{
Executable = ext;
AbsolutePath = absolutePath;
Details = details;
ValueName = valueName;
MruPosition = mruPosition;
OpenedOn = openedOn?.UtcDateTime;
}
public string ValueName { get; }
public int MruPosition { get; }
public string Executable { get; }
public string AbsolutePath { get; }
public DateTime? OpenedOn { get; }
public string Details { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Exe: {Executable} Folder: {Executable} Absolute path: {AbsolutePath}";
public string BatchValueData2 => $"Opened: {OpenedOn?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff}";
public string BatchValueData3 => $"MRU: {MruPosition} Details: {Details}";
}
}
|
using System;
using System.IO;
using RegistryPluginBase.Interfaces;
namespace RegistryPlugin.LastVisitedPidlMRU
{
public class ValuesOut:IValueOut
{
public ValuesOut(string ext, string absolutePath, string details, string valueName, int mruPosition,
DateTimeOffset? openedOn)
{
Executable = ext;
AbsolutePath = absolutePath;
Details = details;
ValueName = valueName;
MruPosition = mruPosition;
OpenedOn = openedOn?.UtcDateTime;
}
public string ValueName { get; }
public int MruPosition { get; }
public string Executable { get; }
public string AbsolutePath { get; }
public DateTime? OpenedOn { get; }
public string Details { get; }
public string BatchKeyPath { get; set; }
public string BatchValueName { get; set; }
public string BatchValueData1 => $"Exe: {Executable} Folder: {Executable} Absolute path: {AbsolutePath}";
public string BatchValueData2 => $"Opened: {OpenedOn?.ToUniversalTime():yyyy-MM-dd HH:mm:ss.fffffff})";
public string BatchValueData3 => $"MRU: {MruPosition} Details: {Details}";
}
}
|
mit
|
C#
|
00dbdf544e80ffe97f3f81bfda3ea1ac1963bdc9
|
update version
|
Fody/PropertyChanged
|
CommonAssemblyInfo.cs
|
CommonAssemblyInfo.cs
|
using System.Reflection;
[assembly: AssemblyTitle("PropertyChanged")]
[assembly: AssemblyProduct("PropertyChanged")]
[assembly: AssemblyCompany("Simon Cropp and Contributors")]
[assembly: AssemblyDescription("Fody add-in for injecting INotifyPropertyChanged code into properties.")]
[assembly: AssemblyVersion("2.0.1")]
[assembly: AssemblyFileVersion("2.0.1")]
|
using System.Reflection;
[assembly: AssemblyTitle("PropertyChanged")]
[assembly: AssemblyProduct("PropertyChanged")]
[assembly: AssemblyCompany("Simon Cropp and Contributors")]
[assembly: AssemblyDescription("Fody add-in for injecting INotifyPropertyChanged code into properties.")]
[assembly: AssemblyVersion("2.0.0")]
[assembly: AssemblyFileVersion("2.0.0")]
|
mit
|
C#
|
41fca91bc9442dcef437530026c468aab8a3b105
|
Update IMongoRepository.cs
|
tiksn/TIKSN-Framework
|
TIKSN.Core/Data/Mongo/IMongoRepository.cs
|
TIKSN.Core/Data/Mongo/IMongoRepository.cs
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.Mongo
{
public interface IMongoRepository<TDocument, TIdentity> : IRepository<TDocument>, IQueryRepository<TDocument, TIdentity>, IStreamRepository<TDocument> where TDocument : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity>
{
Task AddOrUpdateAsync(TDocument entity, CancellationToken cancellationToken);
}
}
|
using System;
using System.Threading;
using System.Threading.Tasks;
namespace TIKSN.Data.Mongo
{
public interface IMongoRepository<TDocument, TIdentity> : IRepository<TDocument>, IQueryRepository<TDocument, TIdentity> where TDocument : IEntity<TIdentity> where TIdentity : IEquatable<TIdentity>
{
Task AddOrUpdateAsync(TDocument entity, CancellationToken cancellationToken);
}
}
|
mit
|
C#
|
04c19a3b3c3dc7a0351581330deef8c4c648c728
|
Fix SavedCameras being null
|
SteamDatabase/ValveResourceFormat
|
GUI/Utils/Settings.cs
|
GUI/Utils/Settings.cs
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using ValveKeyValue;
namespace GUI.Utils
{
internal static class Settings
{
public class AppConfig
{
public List<string> GameSearchPaths { get; set; } = new List<string>();
public string BackgroundColor { get; set; } = string.Empty;
public string OpenDirectory { get; set; } = string.Empty;
public string SaveDirectory { get; set; } = string.Empty;
public Dictionary<string, float[]> SavedCameras { get; set; } = new Dictionary<string, float[]>();
}
private static string SettingsFilePath;
public static AppConfig Config { get; set; } = new AppConfig();
public static Color BackgroundColor { get; set; } = Color.FromArgb(60, 60, 60);
public static void Load()
{
SettingsFilePath = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "settings.txt");
if (!File.Exists(SettingsFilePath))
{
Save();
return;
}
using (var stream = new FileStream(SettingsFilePath, FileMode.Open, FileAccess.Read))
{
Config = KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Deserialize<AppConfig>(stream, KVSerializerOptions.DefaultOptions);
}
BackgroundColor = ColorTranslator.FromHtml(Config.BackgroundColor);
if (Config.SavedCameras == null)
{
Config.SavedCameras = new Dictionary<string, float[]>();
}
}
public static void Save()
{
Config.BackgroundColor = ColorTranslator.ToHtml(BackgroundColor);
using (var stream = new FileStream(SettingsFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
{
KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Serialize(stream, Config, nameof(ValveResourceFormat));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using ValveKeyValue;
namespace GUI.Utils
{
internal static class Settings
{
public class AppConfig
{
public List<string> GameSearchPaths { get; set; } = new List<string>();
public string BackgroundColor { get; set; } = string.Empty;
public string OpenDirectory { get; set; } = string.Empty;
public string SaveDirectory { get; set; } = string.Empty;
public Dictionary<string, float[]> SavedCameras { get; set; } = new Dictionary<string, float[]>();
}
private static string SettingsFilePath;
public static AppConfig Config { get; set; } = new AppConfig();
public static Color BackgroundColor { get; set; } = Color.FromArgb(60, 60, 60);
public static void Load()
{
SettingsFilePath = Path.Combine(Path.GetDirectoryName(typeof(Program).Assembly.Location), "settings.txt");
if (!File.Exists(SettingsFilePath))
{
Save();
return;
}
using (var stream = new FileStream(SettingsFilePath, FileMode.Open, FileAccess.Read))
{
Config = KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Deserialize<AppConfig>(stream, KVSerializerOptions.DefaultOptions);
}
BackgroundColor = ColorTranslator.FromHtml(Config.BackgroundColor);
}
public static void Save()
{
Config.BackgroundColor = ColorTranslator.ToHtml(BackgroundColor);
using (var stream = new FileStream(SettingsFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
{
KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Serialize(stream, Config, nameof(ValveResourceFormat));
}
}
}
}
|
mit
|
C#
|
8d0017fd031473ab7df1b883d1b08a9e471bcc2a
|
Fix navigator.getUserMedia webkit(TypeError: Illegal invocation) + moz(typo)
|
n9/SaltarelleWeb,n9/SaltarelleWeb,Saltarelle/SaltarelleWeb,n9/SaltarelleWeb,n9/SaltarelleWeb,Saltarelle/SaltarelleWeb
|
Web/Html/Navigator.cs
|
Web/Html/Navigator.cs
|
using System.Html.Media;
using System.Runtime.CompilerServices;
namespace System.Html {
public partial class Navigator {
[InlineCode("(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia).call(navigator, {params}, {onsuccess})")]
public static void GetUserMedia(MediaStreamOptions @params, Action<LocalMediaStream> onsuccess) {}
[InlineCode("(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia).call(navigator, {params}, {onsuccess}, {onerror})")]
public static void GetUserMedia(MediaStreamOptions @params, Action<LocalMediaStream> onsuccess, Action<string> onerror) {}
}
}
|
using System.Html.Media;
using System.Runtime.CompilerServices;
namespace System.Html {
public partial class Navigator {
[InlineCode("(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozUserMedia || navigator.msGetUserMedia)({params}, {onsuccess})")]
public static void GetUserMedia(MediaStreamOptions @params, Action<LocalMediaStream> onsuccess) {}
[InlineCode("(navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozUserMedia || navigator.msGetUserMedia)({params}, {onsuccess}, {onerror})")]
public static void GetUserMedia(MediaStreamOptions @params, Action<LocalMediaStream> onsuccess, Action<string> onerror) {}
}
}
|
apache-2.0
|
C#
|
458f663f16cf4c8978f3740f6c0759f47670e60e
|
Make SafeAreaTargetContainer.SafeAreaPadding entirely internal
|
peppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ZLima12/osu-framework
|
osu.Framework/Graphics/Containers/SafeAreaTargetContainer.cs
|
osu.Framework/Graphics/Containers/SafeAreaTargetContainer.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.Platform;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A <see cref="SnapTargetContainer"/> that is automatically cached and provides a bindable <see cref="SafeAreaPadding"/> representing
/// the desired safe area margins. Should be used in conjunction with child <see cref="SafeAreaContainer"/>s.
/// The root of the scenegraph contains an instance of this container, with <see cref="SafeAreaPadding"/> automatically bound
/// to the host <see cref="GameWindow"/>'s <see cref="GameWindow.SafeAreaPadding"/>.
/// Developers may set a custom bindable for testing various safe area insets.
/// </summary>
[Cached(typeof(SafeAreaTargetContainer))]
public class SafeAreaTargetContainer : SnapTargetContainer
{
private readonly BindableSafeArea safeAreaPadding = new BindableSafeArea();
private BindableSafeArea boundSafeAreaPadding;
/// <summary>
/// Setting this property will bind a new <see cref="BindableSafeArea"/> and unbind any previously bound bindables.
/// Automatically bound to <see cref="GameWindow.SafeAreaPadding"/> if not assigned before injecting dependencies.
/// </summary>
internal BindableSafeArea SafeAreaPadding
{
get => safeAreaPadding;
set
{
if (value == null)
throw new ArgumentNullException(nameof(value));
if (boundSafeAreaPadding != null)
safeAreaPadding.UnbindFrom(boundSafeAreaPadding);
safeAreaPadding.BindTo(boundSafeAreaPadding = value);
}
}
[BackgroundDependencyLoader]
private void load(GameHost host)
{
if (boundSafeAreaPadding == null && host.Window != null)
SafeAreaPadding = host.Window.SafeAreaPadding;
}
}
}
|
// 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.Platform;
namespace osu.Framework.Graphics.Containers
{
/// <summary>
/// A <see cref="SnapTargetContainer"/> that is automatically cached and provides a bindable <see cref="SafeAreaPadding"/> representing
/// the desired safe area margins. Should be used in conjunction with child <see cref="SafeAreaContainer"/>s.
/// The root of the scenegraph contains an instance of this container, with <see cref="SafeAreaPadding"/> automatically bound
/// to the host <see cref="GameWindow"/>'s <see cref="GameWindow.SafeAreaPadding"/>.
/// Developers may set a custom bindable for testing various safe area insets.
/// </summary>
[Cached(typeof(SafeAreaTargetContainer))]
public class SafeAreaTargetContainer : SnapTargetContainer
{
private readonly BindableSafeArea safeAreaPadding = new BindableSafeArea();
private BindableSafeArea boundSafeAreaPadding;
/// <summary>
/// Setting this property will bind a new <see cref="BindableSafeArea"/> and unbind any previously bound bindables.
/// Automatically bound to <see cref="GameWindow.SafeAreaPadding"/> if not assigned before injecting dependencies.
/// </summary>
public BindableSafeArea SafeAreaPadding
{
get => safeAreaPadding;
internal set
{
if (value == null)
throw new ArgumentNullException(nameof(value));
if (boundSafeAreaPadding != null)
safeAreaPadding.UnbindFrom(boundSafeAreaPadding);
safeAreaPadding.BindTo(boundSafeAreaPadding = value);
}
}
[BackgroundDependencyLoader]
private void load(GameHost host)
{
if (boundSafeAreaPadding == null && host.Window != null)
SafeAreaPadding = host.Window.SafeAreaPadding;
}
}
}
|
mit
|
C#
|
bd590fe33983292d9b16bdd9e33b75d4cf70a54a
|
Bump version number
|
svroonland/TwinRx
|
TwinRx/Properties/AssemblyInfo.cs
|
TwinRx/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("TwinRx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TwinRx")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("63cfc459-80eb-4f20-a3ca-c75a63331986")]
// 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("TwinRx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TwinRx")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("63cfc459-80eb-4f20-a3ca-c75a63331986")]
// 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#
|
042623c69bc4669823189a65bb39a22a728e074e
|
Fix shadowing property.
|
ctl-global/ctl-data
|
Ctl.Data.Excel/ExcelObjectOptions.cs
|
Ctl.Data.Excel/ExcelObjectOptions.cs
|
/*
Copyright (c) 2015, CTL Global, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ctl.Data.Excel
{
/// <summary>
/// A set of options for reading objects from Excel files.
/// </summary>
public class ExcelObjectOptions : ExcelOptions
{
/// <summary>
/// A format provider used to deserialize objects.
/// </summary>
public IFormatProvider FormatProvider { get; set; }
/// <summary>
/// If true, read a header. Otherwise, use column indexes.
/// </summary>
public bool ReadHeader { get; set; }
/// <summary>
/// A comparer used to match header values to property names.
/// </summary>
public IEqualityComparer<string> HeaderComparer { get; set; }
/// <summary>
/// If true, validate objects to conform to their data annotations.
/// </summary>
public bool Validate { get; set; }
public ExcelObjectOptions()
{
FormatProvider = null;
ReadHeader = true;
}
}
}
|
/*
Copyright (c) 2015, CTL Global, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted
provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions
and the following disclaimer. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ctl.Data.Excel
{
/// <summary>
/// A set of options for reading objects from Excel files.
/// </summary>
public class ExcelObjectOptions : ExcelOptions
{
/// <summary>
/// A format provider used to deserialize objects.
/// </summary>
public IFormatProvider FormatProvider { get; set; }
/// <summary>
/// If true, read a header. Otherwise, use column indexes.
/// </summary>
public bool ReadHeader { get; set; }
/// <summary>
/// A comparer used to match header values to property names.
/// </summary>
public IEqualityComparer<string> HeaderComparer { get; set; }
/// <summary>
/// If true, validate objects to conform to their data annotations.
/// </summary>
public bool Validate { get; set; }
/// <summary>
/// If true, leading and trailing whitespace will be trimmed from column values.
/// Values consisting of only whitespace will be returned as null.
/// </summary>
public bool TrimWhitespace { get; set; }
public ExcelObjectOptions()
{
FormatProvider = null;
ReadHeader = true;
}
}
}
|
bsd-2-clause
|
C#
|
c9fd13950a468d8e6b6f82343217b74d2d0ea8e1
|
Use glob-recurse and fix the program when you pass it file names
|
sensics/DeviceMetadataTools
|
DeviceMetadataInstallTool/Program.cs
|
DeviceMetadataInstallTool/Program.cs
|
using System;
using System.IO;
using System.Collections;
namespace DeviceMetadataInstallTool
{
class Program
{
static void Main(string[] args)
{
var files = new System.Collections.Generic.List<String>();
//Console.WriteLine("Args size is {0}", args.Length);
if (args.Length == 0)
{
var assemblyDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
files = Sensics.DeviceMetadataInstaller.Util.GetMetadataFilesRecursive(assemblyDir);
}
else
{
files.AddRange(args);
}
var store = new Sensics.DeviceMetadataInstaller.MetadataStore();
foreach (var fn in files)
{
var pkg = new Sensics.DeviceMetadataInstaller.MetadataPackage(fn);
Console.WriteLine("{0} - {1} - Default locale: {2}", pkg.ExperienceGUID, pkg.ModelName, pkg.DefaultLocale);
store.InstallPackage(pkg);
}
}
}
}
|
using System;
using System.IO;
using System.Collections;
namespace DeviceMetadataInstallTool
{
/// <summary>
/// see https://support.microsoft.com/en-us/kb/303974
/// </summary>
class MetadataFinder
{
public System.Collections.Generic.List<String> Files = new System.Collections.Generic.List<String>();
public void SearchDirectory(string dir)
{
try
{
foreach (var d in Directory.GetDirectories(dir))
{
foreach (var f in Directory.GetFiles(d, "*.devicemetadata-ms"))
{
Files.Add(f);
}
SearchDirectory(d);
}
}
catch (System.Exception excpt)
{
Console.WriteLine(excpt.Message);
}
}
}
class Program
{
static void Main(string[] args)
{
var files = new System.Collections.Generic.List<String>();
//Console.WriteLine("Args size is {0}", args.Length);
if (args.Length == 0)
{
var assemblyDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var finder = new MetadataFinder();
finder.SearchDirectory(assemblyDir);
files = finder.Files;
} else
{
files.AddRange(files);
}
var store = new Sensics.DeviceMetadataInstaller.MetadataStore();
foreach (var fn in files)
{
var pkg = new Sensics.DeviceMetadataInstaller.MetadataPackage(fn);
Console.WriteLine("{0} - {1} - Default locale: {2}", pkg.ExperienceGUID, pkg.ModelName, pkg.DefaultLocale);
store.InstallPackage(pkg);
}
}
}
}
|
apache-2.0
|
C#
|
7e55fea81cf45795037f20d99f69c87250ec975d
|
add License to list details API endpoint
|
collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists,collinbarrett/FilterLists
|
src/FilterLists.Services/FilterListService/ListDetailsDto.cs
|
src/FilterLists.Services/FilterListService/ListDetailsDto.cs
|
using System;
using System.Collections.Generic;
namespace FilterLists.Services.FilterListService
{
public class ListDetailsDto
{
public int Id { get; set; }
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
public DateTime? DiscontinuedDate { get; set; }
public string DonateUrl { get; set; }
public string EmailAddress { get; set; }
public string ForumUrl { get; set; }
public string HomeUrl { get; set; }
public string IssuesUrl { get; set; }
public IEnumerable<string> Languages { get; set; }
public ListLicenseDto License { get; set; }
public IEnumerable<ListMaintainerDto> Maintainers { get; set; }
public string Name { get; set; }
public string PolicyUrl { get; set; }
public DateTime? PublishedDate { get; set; }
public string SubmissionUrl { get; set; }
public string ViewUrl { get; set; }
}
public class ListMaintainerDto
{
public int Id { get; set; }
public string EmailAddress { get; set; }
public string HomeUrl { get; set; }
public string Name { get; set; }
public string TwitterHandle { get; set; }
public IEnumerable<MaintainerAdditionalListsDto> AdditionalLists { get; set; }
}
public class MaintainerAdditionalListsDto
{
public int Id { get; set; }
public string Name { get; set; }
}
public class ListLicenseDto
{
public string DescriptionUrl { get; set; }
public string Name { get; set; }
}
}
|
using System;
using System.Collections.Generic;
namespace FilterLists.Services.FilterListService
{
public class ListDetailsDto
{
public int Id { get; set; }
public string Description { get; set; }
public string DescriptionSourceUrl { get; set; }
public DateTime? DiscontinuedDate { get; set; }
public string DonateUrl { get; set; }
public string EmailAddress { get; set; }
public string ForumUrl { get; set; }
public string HomeUrl { get; set; }
public string IssuesUrl { get; set; }
public IEnumerable<string> Languages { get; set; }
public IEnumerable<ListMaintainerDto> Maintainers { get; set; }
public string Name { get; set; }
public string PolicyUrl { get; set; }
public DateTime? PublishedDate { get; set; }
public string SubmissionUrl { get; set; }
public string ViewUrl { get; set; }
}
public class ListMaintainerDto
{
public int Id { get; set; }
public string EmailAddress { get; set; }
public string HomeUrl { get; set; }
public string Name { get; set; }
public string TwitterHandle { get; set; }
public IEnumerable<MaintainerAdditionalListsDto> AdditionalLists { get; set; }
}
public class MaintainerAdditionalListsDto
{
public int Id { get; set; }
public string Name { get; set; }
}
}
|
mit
|
C#
|
d6e1c8053214027001d0572f60f6d89c306f3cde
|
revert the assemblyversion only updated assemblyfileversion
|
DheerendraRathor/azure-sdk-for-net,jamestao/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,jamestao/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,yaakoviyun/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,stankovski/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,markcowl/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,pilor/azure-sdk-for-net,jamestao/azure-sdk-for-net,jamestao/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,stankovski/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,hyonholee/azure-sdk-for-net,yugangw-msft/azure-sdk-for-net,brjohnstmsft/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,AsrOneSdk/azure-sdk-for-net,pilor/azure-sdk-for-net,shahabhijeet/azure-sdk-for-net,DheerendraRathor/azure-sdk-for-net,jackmagic313/azure-sdk-for-net,pilor/azure-sdk-for-net,ayeletshpigelman/azure-sdk-for-net,hyonholee/azure-sdk-for-net,hyonholee/azure-sdk-for-net
|
src/SDKs/IotHub/Management.IotHub/Properties/AssemblyInfo.cs
|
src/SDKs/IotHub/Management.IotHub/Properties/AssemblyInfo.cs
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Microsoft Azure IotHub Management Library")]
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure IotHub Resources.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("2.0.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
|
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Microsoft Azure IotHub Management Library")]
[assembly: AssemblyDescription("Provides management functionality for Microsoft Azure IotHub Resources.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("2.1.0.0")]
[assembly: AssemblyFileVersion("2.1.0.0")]
|
mit
|
C#
|
ca27fef1ca8f3872332c7d03ad8977ae2f32a99f
|
Fix leak in EN for iOS (#1075)
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
iOS/ExposureNotification/source/Extensions.cs
|
iOS/ExposureNotification/source/Extensions.cs
|
using System;
using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace ExposureNotifications {
public static class ENAttenuationRange {
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = byte.MaxValue;
}
public static class ENRiskLevelRange {
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = 7;
}
public static class ENRiskLevelValueRange {
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = 8;
}
public static class ENRiskWeightRange {
public static byte Default { get; } = 1;
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = 100;
}
[Flags]
public enum ENActivityFlags : uint {
PeriodicRun = 1U << 2
}
public delegate void ENActivityHandler (ENActivityFlags activityFlags);
partial class ENManager {
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
private extern static void void_objc_msgSend_IntPtr_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1, IntPtr arg2);
private delegate void ENActivityHandlerCallbackDelegate (IntPtr block, ENActivityFlags activityFlags);
[MonoPInvokeCallback (typeof (ENActivityHandlerCallbackDelegate))]
private static unsafe void ENActivityHandlerCallback (IntPtr block, ENActivityFlags activityFlags)
{
var descriptor = (BlockLiteral*) block;
var del = (ENActivityHandler) (descriptor->Target);
del?.Invoke (activityFlags);
}
private static ENActivityHandlerCallbackDelegate ENActivityHandlerCallbackReference = ENActivityHandlerCallback;
public unsafe void SetLaunchActivityHandler (ENActivityHandler activityHandler)
{
var key = new NSString ("activityHandler");
var sel = Selector.GetHandle ("setValue:forKey:");
// get old value
var oldValue = ValueForKey (key);
// dispose block
if (oldValue != null) {
void_objc_msgSend_IntPtr_IntPtr (Handle, sel, IntPtr.Zero, key.Handle);
var descriptor = (BlockLiteral*) oldValue.Handle;
descriptor->CleanupBlock ();
}
if (activityHandler == null)
return;
// create new block
var block = new BlockLiteral ();
block.SetupBlock (ENActivityHandlerCallbackReference, activityHandler);
// assign
var ptr = █
void_objc_msgSend_IntPtr_IntPtr (Handle, sel, (IntPtr)ptr, key.Handle);
}
}
}
|
using System;
using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;
namespace ExposureNotifications {
public static class ENAttenuationRange {
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = byte.MaxValue;
}
public static class ENRiskLevelRange {
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = 7;
}
public static class ENRiskLevelValueRange {
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = 8;
}
public static class ENRiskWeightRange {
public static byte Default { get; } = 1;
public static byte Min { get; } = byte.MinValue;
public static byte Max { get; } = 100;
}
[Flags]
public enum ENActivityFlags : uint {
PeriodicRun = 1U << 2
}
public delegate void ENActivityHandler (ENActivityFlags activityFlags);
partial class ENManager {
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "_Block_copy")]
private static extern IntPtr _Block_copy (ref BlockLiteral block);
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
private extern static void void_objc_msgSend_IntPtr_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1, IntPtr arg2);
private delegate void ENActivityHandlerCallbackDelegate (IntPtr block, ENActivityFlags activityFlags);
[MonoPInvokeCallback (typeof (ENActivityHandlerCallbackDelegate))]
private static unsafe void ENActivityHandlerCallback (IntPtr block, ENActivityFlags activityFlags)
{
var descriptor = (BlockLiteral*) block;
var del = (ENActivityHandler) (descriptor->Target);
del?.Invoke (activityFlags);
}
private static ENActivityHandlerCallbackDelegate ENActivityHandlerCallbackReference = ENActivityHandlerCallback;
public unsafe void SetLaunchActivityHandler (ENActivityHandler activityHandler)
{
var key = new NSString ("activityHandler");
var sel = Selector.GetHandle ("setValue:forKey:");
// get old value
var oldValue = ValueForKey (key);
// dispose block
if (oldValue != null) {
void_objc_msgSend_IntPtr_IntPtr (Handle, sel, IntPtr.Zero, key.Handle);
var descriptor = (BlockLiteral*) oldValue.Handle;
descriptor->CleanupBlock ();
}
if (activityHandler == null)
return;
// create new block
var block = new BlockLiteral ();
block.SetupBlock (ENActivityHandlerCallbackReference, activityHandler);
var ptr = _Block_copy (ref block);
// assign
void_objc_msgSend_IntPtr_IntPtr (Handle, sel, ptr, key.Handle);
}
}
}
|
mit
|
C#
|
6bf42f87af6bbb9d45321a884c2b4af3b6da69db
|
increment minor version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.20.0")]
[assembly: AssemblyInformationalVersion("0.20.0")]
/*
* Version 0.20.0
*
* - [FIX] Removes the direct reference 'Jwc.Experiment' from
* 'Jwc.Experiment.Xunit'. (BREAKING-CHANGE)
*
* - [NEW] Improts some customize attributes from the AutoFixture project
* (https://github.com/AutoFixture/AutoFixture) to customize a test fixture
* through test parameters, and removes the reference 'AutoFixture.Xuit' from
* 'Jwc.Experiment.Xunit'. (BREAKING-CHANGE)
*
* - [NEW] Updates AutoFixture and AutoFixture.Idioms to v3.18.7 to support null
* gurad clauses for generic and to use debugging symbols and its source
* codes.
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.19.1")]
[assembly: AssemblyInformationalVersion("0.19.1")]
/*
* Version 0.20.0
*
* - [FIX] Removes the direct reference 'Jwc.Experiment' from
* 'Jwc.Experiment.Xunit'. (BREAKING-CHANGE)
*
* - [NEW] Improts some customize attributes from the AutoFixture project
* (https://github.com/AutoFixture/AutoFixture) to customize a test fixture
* through test parameters, and removes the reference 'AutoFixture.Xuit' from
* 'Jwc.Experiment.Xunit'. (BREAKING-CHANGE)
*
* - [NEW] Updates AutoFixture and AutoFixture.Idioms to v3.18.7 to support null
* gurad clauses for generic and to use debugging symbols and its source
* codes.
*/
|
mit
|
C#
|
c5af0ff23356413f096d265be561855ebfb5473d
|
increment pre-release version,
|
jwChung/Experimentalism,jwChung/Experimentalism
|
build/CommonAssemblyInfo.cs
|
build/CommonAssemblyInfo.cs
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.18")]
[assembly: AssemblyInformationalVersion("0.8.18-pre01")]
/*
* Version 0.8.18-pre01
*
* To test publishing.
*/
|
using System.Reflection;
using System.Resources;
using System.Runtime.InteropServices;
[assembly: AssemblyCompany("Jin-Wook Chung")]
[assembly: AssemblyCopyright("Copyright (c) 2014, Jin-Wook Chung")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyVersion("0.8.17")]
[assembly: AssemblyInformationalVersion("0.8.17")]
/*
* Version 0.8.17
*
* Experiment.AutoFixture nuget package includes Excperiment.dll
* but does not depend on the Experiment nuget package.
*
* This version does not publish the Experiment nuget package.
*/
|
mit
|
C#
|
3b324b7a039af0924937f907313ae7966b8a6daa
|
remove unused usings
|
psyun/HDO2O-RestfulAPI
|
HDO2O.Models/ApplicationDbContext.cs
|
HDO2O.Models/ApplicationDbContext.cs
|
using Microsoft.AspNet.Identity.EntityFramework;
using System.Data.Entity;
namespace HDO2O.Models
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
//public DbSet<Test> Tests { get; set; }
}
}
|
using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HDO2O.Models
{
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
{
public ApplicationDbContext()
: base("DefaultConnection", throwIfV1Schema: false)
{
}
public static ApplicationDbContext Create()
{
return new ApplicationDbContext();
}
}
}
|
apache-2.0
|
C#
|
c8d158e7535e3e7d563cb65f2e838bc17f3da261
|
Add FixedTimeIsAllZeros function
|
ektrah/nsec
|
src/Experimental/CryptographicUtilities.cs
|
src/Experimental/CryptographicUtilities.cs
|
using System;
using System.Runtime.CompilerServices;
namespace NSec.Experimental
{
public static class CryptographicUtilities
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] Base64Decode(string base64)
{
return NSec.Experimental.Text.Base64.Decode(base64);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Base64Encode(ReadOnlySpan<byte> bytes)
{
return NSec.Experimental.Text.Base64.Encode(bytes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void FillRandomBytes(Span<byte> data)
{
System.Security.Cryptography.RandomNumberGenerator.Fill(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
return System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(left, right);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static bool FixedTimeIsAllZeros(ReadOnlySpan<byte> data)
{
// NoOptimization because we want this method to be exactly as non-short-circuiting
// as written.
//
// NoInlining because the NoOptimization would get lost if the method got inlined.
int length = data.Length;
int accum = 0;
for (int i = 0; i < length; i++)
{
accum |= data[i];
}
return accum == 0;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] HexDecode(string base16)
{
return NSec.Experimental.Text.Base16.Decode(base16);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string HexEncode(ReadOnlySpan<byte> bytes)
{
return NSec.Experimental.Text.Base16.Encode(bytes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ZeroMemory(Span<byte> buffer)
{
System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer);
}
}
}
|
using System;
using System.Runtime.CompilerServices;
namespace NSec.Experimental
{
public static class CryptographicUtilities
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] Base64Decode(string base64)
{
return NSec.Experimental.Text.Base64.Decode(base64);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string Base64Encode(ReadOnlySpan<byte> bytes)
{
return NSec.Experimental.Text.Base64.Encode(bytes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void FillRandomBytes(Span<byte> data)
{
System.Security.Cryptography.RandomNumberGenerator.Fill(data);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
{
return System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(left, right);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte[] HexDecode(string base16)
{
return NSec.Experimental.Text.Base16.Decode(base16);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static string HexEncode(ReadOnlySpan<byte> bytes)
{
return NSec.Experimental.Text.Base16.Encode(bytes);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ZeroMemory(Span<byte> buffer)
{
System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer);
}
}
}
|
mit
|
C#
|
f0bc5cf2b1b63e1eb1458d5a97e360bb97157ee4
|
debug logger in release configuration enabled
|
OPEXGroup/ITCC.Library
|
src/ITCC.Logging.Core/Loggers/DebugLogger.cs
|
src/ITCC.Logging.Core/Loggers/DebugLogger.cs
|
#define DEBUG
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
using System.Diagnostics;
using ITCC.Logging.Core.Interfaces;
namespace ITCC.Logging.Core.Loggers
{
/// <summary>
/// Simple logger for debug logging (via System.Diagnostics.Debug)
/// </summary>
public class DebugLogger : ILogReceiver
{
#region ILogReceiver
public LogLevel Level { get; set; }
public virtual void WriteEntry(object sender, LogEntryEventArgs args)
{
if (args.Level > Level)
return;
Debug.WriteLine(args);
}
#endregion
#region public
public DebugLogger()
{
Level = Logger.Level;
}
public DebugLogger(LogLevel level)
{
Level = level;
}
#endregion
}
}
|
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
using System.Diagnostics;
using ITCC.Logging.Core.Interfaces;
namespace ITCC.Logging.Core.Loggers
{
/// <summary>
/// Simple logger for debug logging (via System.Diagnostics.Debug)
/// </summary>
public class DebugLogger : ILogReceiver
{
#region ILogReceiver
public LogLevel Level { get; set; }
public virtual void WriteEntry(object sender, LogEntryEventArgs args)
{
if (args.Level > Level)
return;
Debug.WriteLine(args);
}
#endregion
#region public
public DebugLogger()
{
Level = Logger.Level;
}
public DebugLogger(LogLevel level)
{
Level = level;
}
#endregion
}
}
|
bsd-2-clause
|
C#
|
52aea35a4ef6cc81ee1d7075c45fad0c19accd44
|
Add inline methodimpl option to Require's class methods.
|
ar3cka/Journalist
|
src/Journalist.LanguageExtensions/Require.cs
|
src/Journalist.LanguageExtensions/Require.cs
|
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace Journalist
{
public static class Require
{
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void True(bool value, string param, string message)
{
if (value == false)
{
throw new ArgumentException(message, param);
}
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void False(bool value, string param, string message)
{
if (value)
{
throw new ArgumentException(message, param);
}
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ZeroOrGreater(long value, string param)
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(param, value, "Value must be zero or greater.");
}
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void Positive(long value, string param)
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException(param, value, "Value must be greater than zero.");
}
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotNull(object value, string param)
{
if (value == null)
{
throw new ArgumentNullException(param);
}
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotEmpty(string value, string param)
{
False(string.IsNullOrEmpty(value), param, "Value must be not empty.");
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void NotEmpty(Guid value, string param)
{
False(value == Guid.Empty, param, "Value must be not empty.");
}
}
}
|
using System;
using System.Diagnostics;
namespace Journalist
{
public static class Require
{
[DebuggerNonUserCode]
public static void True(bool value, string param, string message)
{
if (value == false)
{
throw new ArgumentException(message, param);
}
}
[DebuggerNonUserCode]
public static void False(bool value, string param, string message)
{
if (value)
{
throw new ArgumentException(message, param);
}
}
[DebuggerNonUserCode]
public static void ZeroOrGreater(long value, string param)
{
if (value < 0)
{
throw new ArgumentOutOfRangeException(param, value, "Value must be zero or greater.");
}
}
[DebuggerNonUserCode]
public static void Positive(long value, string param)
{
if (value <= 0)
{
throw new ArgumentOutOfRangeException(param, value, "Value must be greater than zero.");
}
}
[DebuggerNonUserCode]
public static void NotNull(object value, string param)
{
if (value == null)
{
throw new ArgumentNullException(param);
}
}
[DebuggerNonUserCode]
public static void NotEmpty(string value, string param)
{
False(string.IsNullOrEmpty(value), param, "Value must be not empty.");
}
[DebuggerNonUserCode]
public static void NotEmpty(Guid value, string param)
{
False(value == Guid.Empty, param, "Value must be not empty.");
}
}
}
|
apache-2.0
|
C#
|
ea9c1028ad2d553a8bb165a6e3617f0e2571fa4d
|
Allow external translations
|
KirillOsenkov/XmlParser
|
src/Microsoft.Language.Xml/DiagnosticInfo.cs
|
src/Microsoft.Language.Xml/DiagnosticInfo.cs
|
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.Resources;
namespace Microsoft.Language.Xml
{
/// <summary>
/// Describes how severe a diagnostic is.
/// </summary>
public enum DiagnosticSeverity
{
/// <summary>
/// Something that is an issue, as determined by some authority,
/// but is not surfaced through normal means.
/// There may be different mechanisms that act on these issues.
/// </summary>
Hidden = 0,
/// <summary>
/// Information that does not indicate a problem (i.e. not prescriptive).
/// </summary>
Info = 1,
/// <summary>
/// Something suspicious but allowed.
/// </summary>
Warning = 2,
/// <summary>
/// Something not allowed by the rules of the language or other authority.
/// </summary>
Error = 3,
}
public class DiagnosticInfo
{
object[] parameters;
public ERRID ErrorID { get; }
public DiagnosticSeverity Severity => DiagnosticSeverity.Error;
public DiagnosticInfo(ERRID errID)
{
ErrorID = errID;
}
public DiagnosticInfo(ERRID errID, object[] parameters)
: this(errID)
{
this.parameters = parameters;
}
public string GetDescription() => GetDescription(XmlResources.ResourceManager);
public string GetDescription(ResourceManager resourceManager)
{
var name = ErrorID.ToString();
var description = resourceManager.GetString(name);
if (parameters != null)
description = string.Format(description, parameters);
return description;
}
}
}
|
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
namespace Microsoft.Language.Xml
{
/// <summary>
/// Describes how severe a diagnostic is.
/// </summary>
public enum DiagnosticSeverity
{
/// <summary>
/// Something that is an issue, as determined by some authority,
/// but is not surfaced through normal means.
/// There may be different mechanisms that act on these issues.
/// </summary>
Hidden = 0,
/// <summary>
/// Information that does not indicate a problem (i.e. not prescriptive).
/// </summary>
Info = 1,
/// <summary>
/// Something suspicious but allowed.
/// </summary>
Warning = 2,
/// <summary>
/// Something not allowed by the rules of the language or other authority.
/// </summary>
Error = 3,
}
public class DiagnosticInfo
{
object[] parameters;
public ERRID ErrorID { get; }
public DiagnosticSeverity Severity => DiagnosticSeverity.Error;
public DiagnosticInfo (ERRID errID)
{
ErrorID = errID;
}
public DiagnosticInfo(ERRID errID, object[] parameters)
: this (errID)
{
this.parameters = parameters;
}
public string GetDescription()
{
var name = ErrorID.ToString();
var description = XmlResources.ResourceManager.GetString(name);
if (parameters != null)
description = string.Format(description, parameters);
return description;
}
}
}
|
apache-2.0
|
C#
|
e04625bf4063226089df673415f7c39b7c41abd5
|
Fix inverted arugments of argumentnullexception
|
qqbuby/Alyio.AspNetCore.ApiMessages
|
src/Alyio.AspNetCore.ApiMessages/Messages/ApiMessage.cs
|
src/Alyio.AspNetCore.ApiMessages/Messages/ApiMessage.cs
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Alyio.AspNetCore.ApiMessages
{
/// <summary>
/// Represents a api message.
/// </summary>
public class ApiMessage
{
private string _message;
/// <summary>
/// Gets or sets the api message.
/// </summary>
[JsonProperty("message", Required = Required.Always)]
public string Message
{
get { return _message; }
set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException("The specified string is null, empty, or consists only of white-space characters.", nameof(value));
}
_message = value;
}
}
/// <summary>
/// Gets or sets a unique identifier to represent this request in trace logs.
/// </summary>
/// <seealso cref="Microsoft.AspNetCore.Http.HttpContext.TraceIdentifier"/>
[JsonProperty("trace_identifier", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public string TraceIdentifier { get; set; }
/// <summary>
/// Gets or sets the model state errors.
/// </summary>
[JsonProperty("errors", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public IList<string> Errors { get; set; }
/// <summary>
/// Gets or sets the exception type.
/// </summary>
[JsonProperty("exception_type", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public string ExceptionType { get; set; }
/// <summary>
/// Gets or sets the exception detail information.
/// </summary>
[JsonProperty("detail", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public string Detail { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Alyio.AspNetCore.ApiMessages
{
/// <summary>
/// Represents a api message.
/// </summary>
public class ApiMessage
{
private string _message;
/// <summary>
/// Gets or sets the api message.
/// </summary>
[JsonProperty("message", Required = Required.Always)]
public string Message
{
get { return _message; }
set
{
if (string.IsNullOrWhiteSpace(value))
{
throw new ArgumentException(nameof(value), "The specified string is null, empty, or consists only of white-space characters.");
}
_message = value;
}
}
/// <summary>
/// Gets or sets a unique identifier to represent this request in trace logs.
/// </summary>
/// <seealso cref="Microsoft.AspNetCore.Http.HttpContext.TraceIdentifier"/>
[JsonProperty("trace_identifier", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public string TraceIdentifier { get; set; }
/// <summary>
/// Gets or sets the model state errors.
/// </summary>
[JsonProperty("errors", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public IList<string> Errors { get; set; }
/// <summary>
/// Gets or sets the exception type.
/// </summary>
[JsonProperty("exception_type", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public string ExceptionType { get; set; }
/// <summary>
/// Gets or sets the exception detail information.
/// </summary>
[JsonProperty("detail", DefaultValueHandling = DefaultValueHandling.Ignore, NullValueHandling = NullValueHandling.Ignore)]
public string Detail { get; set; }
}
}
|
mit
|
C#
|
1c2973c967d579ee60478049cf331140d60f3438
|
Fix tests related to WeakReference and upcoming .NET Core changes.
|
nkreipke/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,lnu/nhibernate-core
|
src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs
|
src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs
|
using System;
using System.Collections;
using System.Runtime.CompilerServices;
using NHibernate.Util;
using NUnit.Framework;
namespace NHibernate.Test.UtilityTest
{
[TestFixture]
public class WeakHashtableFixture
{
private static WeakHashtable Create()
{
return new WeakHashtable();
}
// NoInlining to keep temporary variables' lifetime from being extended.
[MethodImpl(MethodImplOptions.NoInlining)]
private static WeakHashtable CreateWithTwoObjects()
{
var table = Create();
table[new object()] = new object();
table[new object()] = new object();
return table;
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static WeakRefWrapper CreateWeakRefWrapper()
{
object obj = new object();
return new WeakRefWrapper(obj);
}
[Test]
public void Basic()
{
// Keep references to the key and the value
object key = new object();
object value = new object();
WeakHashtable table = Create();
table[key] = value;
Assert.AreSame(value, table[key]);
}
[Test]
public void WeakReferenceGetsFreedButHashCodeRemainsConstant()
{
WeakRefWrapper wr = CreateWeakRefWrapper();
int hashCode = wr.GetHashCode();
GC.Collect();
Assert.IsFalse(wr.IsAlive);
Assert.IsNull(wr.Target);
Assert.AreEqual(hashCode, wr.GetHashCode());
}
[Test]
public void Scavenging()
{
WeakHashtable table = CreateWithTwoObjects();
GC.Collect();
table.Scavenge();
Assert.AreEqual(0, table.Count);
}
[Test]
public void IterationAfterGC()
{
WeakHashtable table = CreateWithTwoObjects();
GC.Collect();
Assert.AreEqual(2, table.Count, "should not have been scavenged yet");
Assert.IsFalse(table.GetEnumerator().MoveNext(), "should not have live elements");
}
[Test]
public void Iteration()
{
object key = new object();
object value = new object();
WeakHashtable table = Create();
table[key] = value;
foreach (DictionaryEntry de in table)
{
Assert.AreSame(key, de.Key);
Assert.AreSame(value, de.Value);
}
}
[Test]
public void RetrieveNonExistentItem()
{
WeakHashtable table = Create();
object obj = table[new object()];
Assert.IsNull(obj);
}
[Test]
public void WeakRefWrapperEquals()
{
object obj = new object();
Assert.AreEqual(new WeakRefWrapper(obj), new WeakRefWrapper(obj));
Assert.IsFalse(new WeakRefWrapper(obj).Equals(null));
Assert.IsFalse(new WeakRefWrapper(obj).Equals(10));
}
[Test]
public void IsSerializable()
{
WeakHashtable weakHashtable = new WeakHashtable();
weakHashtable.Add("key", new object());
NHAssert.IsSerializable(weakHashtable);
}
}
}
|
using System;
using System.Collections;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Util;
using NUnit.Framework;
namespace NHibernate.Test.UtilityTest
{
[TestFixture]
public class WeakHashtableFixture
{
protected WeakHashtable Create()
{
return new WeakHashtable();
}
[Test]
public void Basic()
{
// Keep references to the key and the value
object key = new object();
object value = new object();
WeakHashtable table = Create();
table[key] = value;
Assert.AreSame(value, table[key]);
}
[Test]
public void WeakReferenceGetsFreedButHashCodeRemainsConstant()
{
object obj = new object();
WeakRefWrapper wr = new WeakRefWrapper(obj);
int hashCode = wr.GetHashCode();
obj = null;
GC.Collect();
Assert.IsFalse(wr.IsAlive);
Assert.IsNull(wr.Target);
Assert.AreEqual(hashCode, wr.GetHashCode());
}
[Test]
public void Scavenging()
{
WeakHashtable table = Create();
table[new object()] = new object();
table[new object()] = new object();
GC.Collect();
table.Scavenge();
Assert.AreEqual(0, table.Count);
}
[Test]
public void IterationAfterGC()
{
WeakHashtable table = Create();
table[new object()] = new object();
table[new object()] = new object();
GC.Collect();
Assert.AreEqual(2, table.Count, "should not have been scavenged yet");
Assert.IsFalse(table.GetEnumerator().MoveNext(), "should not have live elements");
}
[Test]
public void Iteration()
{
object key = new object();
object value = new object();
WeakHashtable table = Create();
table[key] = value;
foreach (DictionaryEntry de in table)
{
Assert.AreSame(key, de.Key);
Assert.AreSame(value, de.Value);
}
}
[Test]
public void RetrieveNonExistentItem()
{
WeakHashtable table = Create();
object obj = table[new object()];
Assert.IsNull(obj);
}
[Test]
public void WeakRefWrapperEquals()
{
object obj = new object();
Assert.AreEqual(new WeakRefWrapper(obj), new WeakRefWrapper(obj));
Assert.IsFalse(new WeakRefWrapper(obj).Equals(null));
Assert.IsFalse(new WeakRefWrapper(obj).Equals(10));
}
[Test]
public void IsSerializable()
{
WeakHashtable weakHashtable = new WeakHashtable();
weakHashtable.Add("key", new object());
NHAssert.IsSerializable(weakHashtable);
}
}
}
|
lgpl-2.1
|
C#
|
b0a7cefecc1a5834251b15e5125677a924708a62
|
Fix permission issue (#2979)
|
petedavis/Orchard2,stevetayloruk/Orchard2,petedavis/Orchard2,xkproject/Orchard2,OrchardCMS/Brochard,xkproject/Orchard2,petedavis/Orchard2,OrchardCMS/Brochard,stevetayloruk/Orchard2,xkproject/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,stevetayloruk/Orchard2,xkproject/Orchard2,stevetayloruk/Orchard2,OrchardCMS/Brochard,petedavis/Orchard2
|
src/OrchardCore.Modules/OrchardCore.Lucene/AdminMenu.cs
|
src/OrchardCore.Modules/OrchardCore.Lucene/AdminMenu.cs
|
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;
using System;
using System.Threading.Tasks;
namespace OrchardCore.Lucene
{
public class AdminMenu : INavigationProvider
{
public AdminMenu(IStringLocalizer<AdminMenu> localizer)
{
T = localizer;
}
public IStringLocalizer T { get; set; }
public Task BuildNavigationAsync(string name, NavigationBuilder builder)
{
if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
{
return Task.CompletedTask;
}
builder
.Add(T["Configuration"], "10", configuration => configuration
.AddClass("menu-configuration").Id("configuration")
.Add(T["Site"], "10", import => import
.Add(T["Lucene Indices"], "7", indexes => indexes
.Action("Index", "Admin", new { area = "OrchardCore.Lucene" })
.Permission(Permissions.ManageIndexes)
.LocalNav())
.Add(T["Lucene Queries"], "8", queries => queries
.Action("Query", "Admin", new { area = "OrchardCore.Lucene" })
.Permission(Permissions.ManageIndexes)
.LocalNav())))
.Add(T["Configuration"], configuration => configuration
.Add(T["Settings"], settings => settings
.Add(T["Search"], T["Search"], entry => entry
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = "search" })
.Permission(Permissions.ManageIndexes)
.LocalNav()
)));
return Task.CompletedTask;
}
}
}
|
using Microsoft.Extensions.Localization;
using OrchardCore.Navigation;
using System;
using System.Threading.Tasks;
namespace OrchardCore.Lucene
{
public class AdminMenu : INavigationProvider
{
public AdminMenu(IStringLocalizer<AdminMenu> localizer)
{
T = localizer;
}
public IStringLocalizer T { get; set; }
public Task BuildNavigationAsync(string name, NavigationBuilder builder)
{
if (!String.Equals(name, "admin", StringComparison.OrdinalIgnoreCase))
{
return Task.CompletedTask;
}
builder
.Add(T["Configuration"], "10", configuration => configuration
.AddClass("menu-configuration").Id("configuration")
.Add(T["Site"], "10", import => import
.Add(T["Lucene Indices"], "7", indexes => indexes
.Action("Index", "Admin", new { area = "OrchardCore.Lucene" })
.Permission(Permissions.ManageIndexes)
.LocalNav())
.Add(T["Lucene Queries"], "8", queries => queries
.Action("Query", "Admin", new { area = "OrchardCore.Lucene" })
.Permission(Permissions.ManageIndexes)
.LocalNav())))
.Add(T["Configuration"], configuration => configuration
.Add(T["Settings"], settings => settings
.Add(T["Search"], T["Search"], entry => entry
.Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = "search" })
.LocalNav()
)));
return Task.CompletedTask;
}
}
}
|
bsd-3-clause
|
C#
|
a77730f8712dc0c16daaa0cdeeb059e8b887138e
|
Patch from Wouter Bolsterlee fixing mnemonic support (BGO #557880)
|
GNOME/hyena,arfbtwn/hyena,arfbtwn/hyena,GNOME/hyena,dufoli/hyena,petejohanson/hyena,dufoli/hyena,petejohanson/hyena
|
Hyena.Gui/Hyena.Widgets/ImageButton.cs
|
Hyena.Gui/Hyena.Widgets/ImageButton.cs
|
//
// ImageButton.cs
//
// Authors:
// Gabriel Burt <gburt@novell.com>
//
// Copyright (C) 2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Hyena.Widgets
{
public class ImageButton : Button
{
public ImageButton (string text, string iconName) : this (text, iconName, Gtk.IconSize.Button)
{
}
public ImageButton (string text, string iconName, Gtk.IconSize iconSize) : base ()
{
Image image = new Image ();
image.IconName = iconName;
image.IconSize = (int) iconSize;
Label label = new Label ();
label.MarkupWithMnemonic = text;
HBox hbox = new HBox ();
hbox.Spacing = 2;
hbox.PackStart (image, false, false, 0);
hbox.PackStart (label, true, true, 0);
Child = hbox;
CanDefault = true;
ShowAll ();
}
}
}
|
//
// ImageButton.cs
//
// Authors:
// Gabriel Burt <gburt@novell.com>
//
// Copyright (C) 2008 Novell, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using Gtk;
namespace Hyena.Widgets
{
public class ImageButton : Button
{
public ImageButton (string text, string iconName) : this (text, iconName, Gtk.IconSize.Button)
{
}
public ImageButton (string text, string iconName, Gtk.IconSize iconSize) : base ()
{
Image image = new Image ();
image.IconName = iconName;
image.IconSize = (int) iconSize;
Label label = new Label ();
label.Markup = text;
HBox hbox = new HBox ();
hbox.Spacing = 2;
hbox.PackStart (image, false, false, 0);
hbox.PackStart (label, true, true, 0);
Child = hbox;
CanDefault = true;
ShowAll ();
}
}
}
|
mit
|
C#
|
f247d2aa216e1cf3a50aa7519eb80b3b6fbb3044
|
Use more standard namespace formatting
|
smoogipooo/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,Tom94/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,DrabWeb/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,peppy/osu-framework,ppy/osu-framework
|
osu.Framework/Platform/Linux/LinuxGameHost.cs
|
osu.Framework/Platform/Linux/LinuxGameHost.cs
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using osu.Framework.Platform.Linux.Native;
namespace osu.Framework.Platform.Linux
{
public class LinuxGameHost : DesktopGameHost
{
internal LinuxGameHost(string gameName, bool bindIPC = false)
: base(gameName, bindIPC)
{
Window = new LinuxGameWindow();
Window.WindowStateChanged += (sender, e) =>
{
if (Window.WindowState != OpenTK.WindowState.Minimized)
OnActivated();
else
OnDeactivated();
};
Library.Load("libbass.so", Library.LoadFlags.RTLD_LAZY | Library.LoadFlags.RTLD_GLOBAL);
}
protected override Storage GetStorage(string baseName) => new LinuxStorage(baseName, this);
public override Clipboard GetClipboard() => new LinuxClipboard();
}
}
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
namespace osu.Framework.Platform.Linux
{
using Native;
public class LinuxGameHost : DesktopGameHost
{
internal LinuxGameHost(string gameName, bool bindIPC = false)
: base(gameName, bindIPC)
{
Window = new LinuxGameWindow();
Window.WindowStateChanged += (sender, e) =>
{
if (Window.WindowState != OpenTK.WindowState.Minimized)
OnActivated();
else
OnDeactivated();
};
Library.Load("libbass.so", Library.LoadFlags.RTLD_LAZY | Library.LoadFlags.RTLD_GLOBAL);
}
protected override Storage GetStorage(string baseName) => new LinuxStorage(baseName, this);
public override Clipboard GetClipboard() => new LinuxClipboard();
}
}
|
mit
|
C#
|
28143278d2d59ed6c69f57441b6e062e8539beb5
|
Make COlDef ctor public
|
seguemark/mvc.jquery.datatables,mcintyre321/mvc.jquery.datatables,Sohra/mvc.jquery.datatables,mcintyre321/mvc.jquery.datatables,mcintyre321/mvc.jquery.datatables,seguemark/mvc.jquery.datatables,Sohra/mvc.jquery.datatables
|
Mvc.JQuery.Datatables/Models/ColDef.cs
|
Mvc.JQuery.Datatables/Models/ColDef.cs
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace Mvc.JQuery.Datatables.Models
{
public class ColDef
{
public ColDef(string name, Type type)
{
Name = name;
Type = type;
Filter = new FilterDef(Type);
DisplayName = name;
Visible = true;
Sortable = true;
SortDirection = SortDirection.None;
MRenderFunction = (string) null;
CssClass = "";
CssClassHeader = "";
this.Searchable = true;
}
public string Name { get; set; }
public string DisplayName { get; set; }
public bool Visible { get; set; }
public bool Sortable { get; set; }
public Type Type { get; set; }
public bool Searchable { get; set; }
public String CssClass { get; set; }
public String CssClassHeader { get; set; }
public SortDirection SortDirection { get; set; }
public string MRenderFunction { get; set; }
public FilterDef Filter { get; set; }
public JObject SearchCols { get; set; }
public Attribute[] CustomAttributes { get; set; }
public string Width { get; set; }
}
}
|
using System;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
namespace Mvc.JQuery.Datatables.Models
{
public class ColDef
{
protected internal ColDef(string name, Type type)
{
Name = name;
Type = type;
Filter = new FilterDef(Type);
DisplayName = name;
Visible = true;
Sortable = true;
SortDirection = SortDirection.None;
MRenderFunction = (string) null;
CssClass = "";
CssClassHeader = "";
this.Searchable = true;
}
public string Name { get; set; }
public string DisplayName { get; set; }
public bool Visible { get; set; }
public bool Sortable { get; set; }
public Type Type { get; set; }
public bool Searchable { get; set; }
public String CssClass { get; set; }
public String CssClassHeader { get; set; }
public SortDirection SortDirection { get; set; }
public string MRenderFunction { get; set; }
public FilterDef Filter { get; set; }
public JObject SearchCols { get; set; }
public Attribute[] CustomAttributes { get; set; }
public string Width { get; set; }
}
}
|
mit
|
C#
|
219dbf203ee5afe99161013093f6053ef402668b
|
add new AudioRenderer component and comment out the first gui
|
TUD-INF-IAI-MCI/BrailleIO,TUD-INF-IAI-MCI/BrailleIO,TUD-INF-IAI-MCI/BrailleIO,TUD-INF-IAI-MCI/BrailleIO
|
BrailleIO/Structs/BoxModel.cs
|
BrailleIO/Structs/BoxModel.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BrailleIO.Structs
{
public struct BoxModel
{
public uint Top;
public uint Bottom;
public uint Left;
public uint Right;
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return "Box: " + Top + "," + Right + "," + Bottom + "," + Left;
}
/// <summary>
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
return (obj is BoxModel) && (Top == ((BoxModel)obj).Top) && (Right == ((BoxModel)obj).Right) && (Bottom == ((BoxModel)obj).Bottom) && (Left == ((BoxModel)obj).Left);
}
public override int GetHashCode() { return base.GetHashCode(); }
public BoxModel(uint top, uint right, uint bottom, uint left)
{
Top = top; Right = right; Bottom = bottom; Left = left;
}
public BoxModel(uint top, uint horizontal, uint bottom) : this(top, horizontal, bottom, horizontal) { }
public BoxModel(uint vertical, uint horizontal) : this(vertical, horizontal, vertical) { }
public BoxModel(uint width) : this(width, width) { }
public void Clear() { Top = Right = Bottom = Left = 0; }
public bool HasBox() { return (Top > 0) || (Right > 0) || (Bottom > 0) || (Left > 0); }
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BrailleIO.Structs
{
public struct BoxModel
{
public uint Top;
public uint Bottom;
public uint Left;
public uint Right;
/// <summary>
/// Returns a <see cref="System.String"/> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String"/> that represents this instance.
/// </returns>
public override string ToString()
{
return "Box: " + Top + "," + Right + "," + Bottom + "," + Left;
}
/// <summary>
/// Determines whether the specified <see cref="System.Object"/> is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="System.Object"/> to compare with this instance.</param>
/// <returns>
/// <c>true</c> if the specified <see cref="System.Object"/> is equal to this instance; otherwise, <c>false</c>.
/// </returns>
public override bool Equals(object obj)
{
return (obj is BoxModel) && (Top == ((BoxModel)obj).Top) && (Right == ((BoxModel)obj).Right) && (Bottom == ((BoxModel)obj).Bottom) && (Left == ((BoxModel)obj).Left);
}
public BoxModel(uint top, uint right, uint bottom, uint left)
{
Top = top; Right = right; Bottom = bottom; Left = left;
}
public BoxModel(uint top, uint horizontal, uint bottom) : this(top, horizontal, bottom, horizontal){}
public BoxModel(uint vertical, uint horizontal) : this(vertical, horizontal, vertical){}
public BoxModel(uint width): this(width, width){}
public void Clear() { Top = Right = Bottom = Left = 0; }
public bool HasBox() { return (Top > 0) || (Right > 0) || (Bottom > 0) || (Left > 0); }
}
}
|
bsd-2-clause
|
C#
|
c18e097953926ffec5a007467f06333d69fb9d44
|
Enable CORS again for Account controller.
|
enarod/enarod-web-api,enarod/enarod-web-api,enarod/enarod-web-api
|
Infopulse.EDemocracy.Web/Controllers/API/AccountController.cs
|
Infopulse.EDemocracy.Web/Controllers/API/AccountController.cs
|
using Infopulse.EDemocracy.Data.Repositories;
using Infopulse.EDemocracy.Web.Models;
using Microsoft.AspNet.Identity;
using System.Threading.Tasks;
using System.Web.Http;
using Infopulse.EDemocracy.Common.Operations;
using Infopulse.EDemocracy.Web.CORS;
namespace Infopulse.EDemocracy.Web.Controllers.API
{
[CorsPolicyProvider]
[RoutePrefix("api/Account")]
public class AccountController : ApiController
{
private AuthRepository authRepository = null;
public AccountController()
{
authRepository = new AuthRepository();
}
// POST api/Account/Register
[AllowAnonymous]
[Route("Register")]
public async Task<IHttpActionResult> Register(UserModel userModel)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
IdentityResult result = await authRepository.RegisterUser(userModel);
IHttpActionResult errorResult = GetErrorResult(result);
if (errorResult != null)
{
return errorResult;
}
return Ok(OperationResult.Success(1, "Ви зареєстровані"));
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
authRepository.Dispose();
}
base.Dispose(disposing);
}
private IHttpActionResult GetErrorResult(IdentityResult result)
{
if (result == null)
{
return InternalServerError();
}
if (!result.Succeeded)
{
if (result.Errors != null)
{
foreach (string error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
if (ModelState.IsValid)
{
// No ModelState errors are available to send, so just return an empty BadRequest.
return BadRequest();
}
return BadRequest(ModelState);
}
return null;
}
}
}
|
using Infopulse.EDemocracy.Data.Repositories;
using Infopulse.EDemocracy.Web.Models;
using Microsoft.AspNet.Identity;
using System.Threading.Tasks;
using System.Web.Http;
using Infopulse.EDemocracy.Common.Operations;
namespace Infopulse.EDemocracy.Web.Controllers.API
{
[RoutePrefix("api/Account")]
public class AccountController : ApiController
{
private AuthRepository authRepository = null;
public AccountController()
{
authRepository = new AuthRepository();
}
// POST api/Account/Register
[AllowAnonymous]
[Route("Register")]
public async Task<IHttpActionResult> Register(UserModel userModel)
{
if (!ModelState.IsValid)
{
return BadRequest(ModelState);
}
IdentityResult result = await authRepository.RegisterUser(userModel);
IHttpActionResult errorResult = GetErrorResult(result);
if (errorResult != null)
{
return errorResult;
}
return Ok(OperationResult.Success(1, "Ви зареєстровані"));
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
authRepository.Dispose();
}
base.Dispose(disposing);
}
private IHttpActionResult GetErrorResult(IdentityResult result)
{
if (result == null)
{
return InternalServerError();
}
if (!result.Succeeded)
{
if (result.Errors != null)
{
foreach (string error in result.Errors)
{
ModelState.AddModelError("", error);
}
}
if (ModelState.IsValid)
{
// No ModelState errors are available to send, so just return an empty BadRequest.
return BadRequest();
}
return BadRequest(ModelState);
}
return null;
}
}
}
|
cc0-1.0
|
C#
|
5cd4208ac8cfc577ad5e2cfb0c0b306e4cf9210c
|
fix a problem with null values
|
marinoscar/MySql2MSSQL
|
Code/MySql2MSSQL/SqlHelper.cs
|
Code/MySql2MSSQL/SqlHelper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MySql2MSSQL
{
public class SqlHelper
{
private Dictionary<int, bool> _numberIndex;
public SqlHelper(Arguments args)
{
Args = args;
}
public Arguments Args { get; private set; }
public string GetCommand(string line)
{
var items = line.Split(",".ToCharArray()).Select(i => i.Remove(0, 1)).Select(i => i.Remove(i.Length - 1, 1)).ToList();
var sb = new StringBuilder();
sb.AppendFormat("INSERT INTO {0} VALUES ({1});", Args.TableName, GetValues(items));
return sb.ToString();
}
private string GetValues(List<string> values)
{
var items = new List<string>();
if (_numberIndex == null)
InitNumberIndex(values);
for (var i = 0; i < values.Count; i++)
{
if (_numberIndex[i])
items.Add(values[i]);
else
{
var val = values[i];
if (val == null || val == string.Empty)
items.Add("NULL");
else
items.Add(string.Format("'{0}'", val.Replace("'", "''")));
}
}
return string.Join(",", items);
}
private void InitNumberIndex(List<string> values)
{
_numberIndex = new Dictionary<int, bool>();
double d;
long l;
for (int i = 0; i < values.Count; i++)
{
_numberIndex[i] = (double.TryParse(values[i], out d) || long.TryParse(values[i], out l));
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MySql2MSSQL
{
public class SqlHelper
{
private Dictionary<int, bool> _numberIndex;
public SqlHelper(Arguments args)
{
Args = args;
}
public Arguments Args { get; private set; }
public string GetCommand(string line)
{
var items = line.Split(",".ToCharArray()).Select(i => i.Remove(0, 1)).Select(i => i.Remove(i.Length - 1, 1)).ToList();
var sb = new StringBuilder();
sb.AppendFormat("INSERT INTO {0} VALUES ({1});", Args.TableName, GetValues(items));
return sb.ToString();
}
private string GetValues(List<string> values)
{
var items = new List<string>();
if (_numberIndex == null)
InitNumberIndex(values);
for (var i = 0; i < values.Count; i++)
{
if (_numberIndex[i])
items.Add(values[i]);
else
{
items.Add(string.Format("'{0}'", values[i].Replace("'", "''")));
}
}
return string.Join(",", items);
}
private void InitNumberIndex(List<string> values)
{
_numberIndex = new Dictionary<int, bool>();
double d;
long l;
for (int i = 0; i < values.Count; i++)
{
_numberIndex[i] = (double.TryParse(values[i], out d) || long.TryParse(values[i], out l));
}
}
}
}
|
mit
|
C#
|
8d904049937aeb994b9e13673bcb5fb507833209
|
Update Demo
|
sunkaixuan/SqlSugar
|
Src/Asp.Net/PerformanceTest/Program.cs
|
Src/Asp.Net/PerformanceTest/Program.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PerformanceTest.TestItems;
namespace PerformanceTest
{
class Program
{
/// <summary>
/// 注意注意注意注意注意:分开测试比较公平,并且请在Realse模式下启动程序(SqlSugar直接引用的是项目)
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
var type = DemoType.GetAll;
var ormType = OrmType.Dapper;
switch (type)
{
case DemoType.GetAll:
new TestGetAll().Init(ormType);
break;
case DemoType.GetById:
new TestGetAll().Init(ormType);
break;
case DemoType.TestSql:
new TestGetAll().Init(ormType);
break;
default:
break;
}
Console.ReadKey();
}
enum DemoType
{
GetAll,
GetById,
TestSql
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PerformanceTest.TestItems;
namespace PerformanceTest
{
class Program
{
/// <summary>
/// 注意注意注意注意注意:分开测试比较公平,并且请在Realse模式下启动程序(SqlSugar直接引用的是项目)
/// </summary>
/// <param name="args"></param>
static void Main(string[] args)
{
//new TestGetAll().Init(OrmType.Dapper);
//new TestGetById().Init(OrmType.EF);
new TestSql().Init(OrmType.SqlSugar);
Console.ReadKey();
}
}
}
|
apache-2.0
|
C#
|
76d47794411af70ae0eb1cd5faf485e46b586835
|
Document HwiCommands.cs
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Hwi/Models/HwiCommands.cs
|
WalletWasabi/Hwi/Models/HwiCommands.cs
|
using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Hwi.Models
{
/// <summary>
/// List of commands that HWI project supports for various <see href="https://en.wikipedia.org/wiki/Human_interface_device">HID devices</see>.
/// </summary>
/// <remarks>HWI may partially support a hardware device.</remarks>
/// <seealso href="https://github.com/bitcoin-core/HWI/blob/master/hwilib/hwwclient.py"/>
/// <seealso href="https://github.com/bitcoin-core/HWI/blob/master/docs/trezor.md"/>
/// <seealso href="https://github.com/bitcoin-core/HWI/blob/master/docs/ledger.md"/>
public enum HwiCommands
{
/// <summary>Get a list of all available hardware wallets.</summary>
Enumerate,
/// <summary>
/// Return the master BIP44 public key.
///
/// <para>Retrieve the public key at the "m/44h/0h/0h" derivation path.</para>
/// </summary>
/// <remarks>
/// Return <code>{"xpub": <xpub string>"}</code>.
/// </remarks>
GetMasterXpub,
/// <summary>
/// Sign a partially signed bitcoin transaction (PSBT).
/// </summary>
/// <remarks>
/// Return <code>{"psbt": <base64 psbt string></code>.
/// </remarks>
SignTx,
/// <summary>
/// ???
/// </summary>
GetXpub,
/// <summary>
/// Sign a message (bitcoin message signing).
///
/// <para>Sign the message according to the bitcoin message signing standard.</para>
/// <para>Retrieve the signing key at the specified BIP32 derivation path.</para>
/// </summary>
/// <remarks>
/// Return <code>{"signature": <base64 signature string>}</code>.
/// </remarks>
SignMessage,
/// <summary>
/// ??? (unused at the moment?)
/// </summary>
GetKeypool,
/// <summary>
/// Display and return the address of specified type.
/// <para>redeem_script is a hex-string.</para>
/// <para>Retrieve the public key at the specified BIP32 derivation path.</para>
/// </summary>
/// <remarks>
/// Return <code>{"address": <base58 or bech32 address string>}</code>.
/// </remarks>
DisplayAddress,
/// <summary>
/// Setup the HID device.
///
/// <para>Must return a dictionary with the "success" key, possibly including also "error" and "code".</para>
/// </summary>
/// <remarks>
/// Return <code>{"success": bool, "error": str, "code": int}</code>.
/// </remarks>
Setup,
/// <summary>
/// Wipe the HID device.
///
/// <para>Must return a dictionary with the "success" key, possibly including also "error" and "code".</para>
/// </summary>
/// <remarks>
/// Return <code>{"success": bool, "error": srt, "code": int}</code>.
/// </remarks>
Wipe,
/// <summary>
/// Restore the HID device from mnemonic.
///
/// <para>Must return a dictionary with the "success" key, possibly including also "error" and "code".</para>
/// </summary>
/// <remarks>
/// Return <code>{"success": bool, "error": srt, "code": int}</code>.
/// </remarks>
Restore,
/// <summary>
/// Backup the HID device.
///
/// <para>Must return a dictionary with the "success" key, possibly including also "error" and "code".</para>
/// </summary>
/// <remarks>
/// Return <code>{"success": bool, "error": srt, "code": int}</code>.
/// </remarks>
Backup,
/// <summary>
/// Prompt for PIN.
///
/// <para>Must return a dictionary with the "success" key, possibly including also "error" and "code".</para>
/// </summary>
/// <remarks>
/// Return <code>{"success": bool, "error": srt, "code": int}</code>.
/// </remarks>
PromptPin,
/// <summary>
/// Send PIN.
///
/// <para>Must return a dictionary with the "success" key, possibly including also "error" and "code".</para>
/// </summary>
/// <remarks>
/// Return <code>{"success": bool, "error": srt, "code": int}</code>.
/// </remarks>
SendPin
}
}
|
using System;
using System.Collections.Generic;
using System.Text;
namespace WalletWasabi.Hwi.Models
{
public enum HwiCommands
{
Enumerate,
GetMasterXpub,
SignTx,
GetXpub,
SignMessage,
GetKeypool,
DisplayAddress,
Setup,
Wipe,
Restore,
Backup,
PromptPin,
SendPin
}
}
|
mit
|
C#
|
f8f93d87866634a5e14c4c038001b1b112b470e5
|
Fix map path for single player maps
|
feliwir/openSage,feliwir/openSage
|
src/OpenSage.Game/Data/Sav/GameStateMap.cs
|
src/OpenSage.Game/Data/Sav/GameStateMap.cs
|
using System.IO;
using OpenSage.Network;
namespace OpenSage.Data.Sav
{
internal static class GameStateMap
{
internal static void Load(SaveFileReader reader, Game game)
{
reader.ReadVersion(2);
var mapPath1 = reader.ReadAsciiString();
var mapPath2 = reader.ReadAsciiString();
var gameType = reader.ReadEnum<GameType>();
var mapSize = reader.BeginSegment();
// TODO: Delete this temporary map when ending the game.
var mapPathInSaveFolder = Path.Combine(
game.ContentManager.UserMapsFileSystem.RootDirectory,
mapPath1);
using (var mapOutputStream = File.OpenWrite(mapPathInSaveFolder))
{
reader.ReadBytesIntoStream(mapOutputStream, (int)mapSize);
}
reader.EndSegment();
var unknown2 = reader.ReadUInt32(); // 586
var unknown3 = reader.ReadUInt32(); // 3220
if (gameType == GameType.Skirmish)
{
game.SkirmishManager = new LocalSkirmishManager(game);
game.SkirmishManager.Settings.Load(reader);
game.SkirmishManager.Settings.MapName = mapPath1;
game.SkirmishManager.StartGame();
}
else
{
game.StartSinglePlayerGame(mapPath1);
}
}
}
}
|
using System.IO;
using OpenSage.Network;
namespace OpenSage.Data.Sav
{
internal static class GameStateMap
{
internal static void Load(SaveFileReader reader, Game game)
{
reader.ReadVersion(2);
var mapPath1 = reader.ReadAsciiString();
var mapPath2 = reader.ReadAsciiString();
var gameType = reader.ReadEnum<GameType>();
var mapSize = reader.BeginSegment();
// TODO: Delete this temporary map when ending the game.
var mapPathInSaveFolder = Path.Combine(
game.ContentManager.UserMapsFileSystem.RootDirectory,
mapPath1);
using (var mapOutputStream = File.OpenWrite(mapPathInSaveFolder))
{
reader.ReadBytesIntoStream(mapOutputStream, (int)mapSize);
}
reader.EndSegment();
var unknown2 = reader.ReadUInt32(); // 586
var unknown3 = reader.ReadUInt32(); // 3220
if (gameType == GameType.Skirmish)
{
game.SkirmishManager = new LocalSkirmishManager(game);
game.SkirmishManager.Settings.Load(reader);
game.SkirmishManager.Settings.MapName = mapPath1;
game.SkirmishManager.StartGame();
}
else
{
game.StartSinglePlayerGame(mapPathInSaveFolder);
}
}
}
}
|
mit
|
C#
|
3bd3e41661eea6e3649dca30bb7a6e3dadeafb89
|
Add extension to verify mimetype.
|
TastesLikeTurkey/Papyrus
|
Papyrus/Papyrus/Extensions/EbookExtensions.cs
|
Papyrus/Papyrus/Extensions/EbookExtensions.cs
|
using System;
using System.Threading.Tasks;
using Windows.Storage;
namespace Papyrus
{
public static class EBookExtensions
{
public static async Task<bool> VerifyMimetypeAsync(this EBook ebook)
{
var mimetypeFile = await ebook._rootFolder.GetItemAsync("mimetype");
if (mimetypeFile == null) // Make sure file exists.
return false;
var fileContents = await FileIO.ReadTextAsync(mimetypeFile as StorageFile);
if (fileContents != "application/epub+zip") // Make sure file contents are correct.
return false;
return true;
}
}
}
|
namespace Papyrus
{
public static class EBookExtensions
{
}
}
|
mit
|
C#
|
56dc98c537f465c8abec1b21e9b54b4f16aa62d3
|
Revert "Allow diffs to be run from the root"
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
.ci/nuget-diff.cake
|
.ci/nuget-diff.cake
|
// SECTION: Arguments and Settings
var ROOT_DIR = MakeAbsolute((DirectoryPath)Argument("root", "."));
var ARTIFACTS_DIR = MakeAbsolute((DirectoryPath)Argument("artifacts", ROOT_DIR.Combine("output").FullPath));
var CACHE_DIR = MakeAbsolute((DirectoryPath)Argument("cache", ROOT_DIR.Combine("externals/api-diff").FullPath));
var OUTPUT_DIR = MakeAbsolute((DirectoryPath)Argument("output", ROOT_DIR.Combine("output/api-diff").FullPath));
// SECTION: Main Script
Information("");
Information("Script Arguments:");
Information(" Root directory: {0}", ROOT_DIR);
Information(" Artifacts directory: {0}", ARTIFACTS_DIR);
Information(" Cache directory: {0}", CACHE_DIR);
Information(" Output directory: {0}", OUTPUT_DIR);
Information("");
// SECTION: Diff NuGets
if (!GetFiles($"{ARTIFACTS_DIR}/**/*.nupkg").Any()) {
Warning($"##vso[task.logissue type=warning]No NuGet packages were found.");
} else {
var exitCode = StartProcess("api-tools", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append("nuget-diff")
.AppendQuoted(ARTIFACTS_DIR.FullPath)
.Append("--latest")
.Append("--prerelease")
.Append("--group-ids")
.Append("--ignore-unchanged")
.AppendSwitchQuoted("--output", OUTPUT_DIR.FullPath)
.AppendSwitchQuoted("--cache", CACHE_DIR.Combine("package-cache").FullPath)
});
if (exitCode != 0)
throw new Exception ($"api-tools exited with error code {exitCode}.");
}
// SECTION: Upload Diffs
var diffs = GetFiles($"{OUTPUT_DIR}/**/*.md");
if (!diffs.Any()) {
Warning($"##vso[task.logissue type=warning]No NuGet diffs were found.");
} else {
var temp = CACHE_DIR.Combine("md-files");
EnsureDirectoryExists(temp);
foreach (var diff in diffs) {
var segments = diff.Segments.Reverse().ToArray();
var nugetId = segments[2];
var platform = segments[1];
var assembly = ((FilePath)segments[0]).GetFilenameWithoutExtension().GetFilenameWithoutExtension();
var breaking = segments[0].EndsWith(".breaking.md");
// using non-breaking spaces
var newName = breaking ? "[BREAKING] " : "";
newName += $"{nugetId} {assembly} ({platform}).md";
var newPath = temp.CombineWithFilePath(newName);
CopyFile(diff, newPath);
}
var temps = GetFiles($"{temp}/**/*.md");
foreach (var t in temps.OrderBy(x => x.FullPath)) {
Information($"##vso[task.uploadsummary]{t}");
}
}
|
// SECTION: Arguments and Settings
var ROOT_DIR = MakeAbsolute((DirectoryPath)Argument("root", "."));
var ARTIFACTS_DIR = MakeAbsolute(ROOT_DIR.Combine(Argument("artifacts", "output")));
var CACHE_DIR = MakeAbsolute(ROOT_DIR.Combine(Argument("cache", "externals/api-diff")));
var OUTPUT_DIR = MakeAbsolute(ROOT_DIR.Combine(Argument("output", "output/api-diff")));
// SECTION: Main Script
Information("");
Information("Script Arguments:");
Information(" Root directory: {0}", ROOT_DIR);
Information(" Artifacts directory: {0}", ARTIFACTS_DIR);
Information(" Cache directory: {0}", CACHE_DIR);
Information(" Output directory: {0}", OUTPUT_DIR);
Information("");
// SECTION: Diff NuGets
if (!GetFiles($"{ARTIFACTS_DIR}/**/*.nupkg").Any()) {
Warning($"##vso[task.logissue type=warning]No NuGet packages were found.");
} else {
var exitCode = StartProcess("api-tools", new ProcessSettings {
Arguments = new ProcessArgumentBuilder()
.Append("nuget-diff")
.AppendQuoted(ARTIFACTS_DIR.FullPath)
.Append("--latest")
.Append("--prerelease")
.Append("--group-ids")
.Append("--ignore-unchanged")
.AppendSwitchQuoted("--output", OUTPUT_DIR.FullPath)
.AppendSwitchQuoted("--cache", CACHE_DIR.Combine("package-cache").FullPath)
});
if (exitCode != 0)
throw new Exception ($"api-tools exited with error code {exitCode}.");
}
// SECTION: Upload Diffs
var diffs = GetFiles($"{OUTPUT_DIR}/**/*.md");
if (!diffs.Any()) {
Warning($"##vso[task.logissue type=warning]No NuGet diffs were found.");
} else {
var temp = CACHE_DIR.Combine("md-files");
EnsureDirectoryExists(temp);
foreach (var diff in diffs) {
var segments = diff.Segments.Reverse().ToArray();
var nugetId = segments[2];
var platform = segments[1];
var assembly = ((FilePath)segments[0]).GetFilenameWithoutExtension().GetFilenameWithoutExtension();
var breaking = segments[0].EndsWith(".breaking.md");
// using non-breaking spaces
var newName = breaking ? "[BREAKING] " : "";
newName += $"{nugetId} {assembly} ({platform}).md";
var newPath = temp.CombineWithFilePath(newName);
CopyFile(diff, newPath);
}
var temps = GetFiles($"{temp}/**/*.md");
foreach (var t in temps.OrderBy(x => x.FullPath)) {
Information($"##vso[task.uploadsummary]{t}");
}
}
|
mit
|
C#
|
9c24882a3a179ebbe760957a1fa3b110a8c30200
|
Remove plural form
|
aloisdg/SharpResume
|
SharpResume/Resume.cs
|
SharpResume/Resume.cs
|
using System.Linq.Expressions;
using Newtonsoft.Json;
using SharpResume.Model;
namespace SharpResume
{
public class Resume
{
public Basics Basics { get; set; }
public Work[] Work { get; set; }
public Volunteer[] Volunteer { get; set; }
public Education[] Education { get; set; }
public Award[] Awards { get; set; }
public Publication[] Publications { get; set; }
public Skill[] Skills { get; set; }
public Language[] Languages { get; set; }
public Interest[] Interests { get; set; }
public Reference[] References { get; set; }
public static Resume Create(string json)
{
return JsonConvert.DeserializeObject<Resume>(json);
}
}
}
|
using System.Linq.Expressions;
using Newtonsoft.Json;
using SharpResume.Model;
namespace SharpResume
{
public class Resume
{
public Basics Basics { get; set; }
public Work[] Works { get; set; }
public Volunteer[] Volunteers { get; set; }
public Education[] Educations { get; set; }
public Award[] Awards { get; set; }
public Publication[] Publications { get; set; }
public Skill[] Skills { get; set; }
public Language[] Languages { get; set; }
public Interest[] Interests { get; set; }
public Reference[] References { get; set; }
public static Resume Create(string json)
{
return JsonConvert.DeserializeObject<Resume>(json);
}
}
}
|
mit
|
C#
|
66c96fe5001ba98bb7f47baad383a35c5bf0ff0f
|
Use azure hosted server for now
|
AppGet/AppGet
|
src/AppGet/PackageRepository/AppGetServerClient.cs
|
src/AppGet/PackageRepository/AppGetServerClient.cs
|
using System.Collections.Generic;
using System.Net;
using AppGet.Http;
using NLog;
namespace AppGet.PackageRepository
{
public class AppGetServerClient : IPackageRepository
{
private readonly IHttpClient _httpClient;
private readonly Logger _logger;
private readonly HttpRequestBuilder _requestBuilder;
private const string API_ROOT = "https://appget.azurewebsites.net/v1/";
public AppGetServerClient(IHttpClient httpClient, Logger logger)
{
_httpClient = httpClient;
_logger = logger;
_requestBuilder = new HttpRequestBuilder(API_ROOT);
}
public PackageInfo GetLatest(string name)
{
_logger.Info("Getting package " + name);
var request = _requestBuilder.Build("packages/{package}/latest");
request.AddSegment("package", name);
try
{
var package = _httpClient.Get<PackageInfo>(request);
return package.Resource;
}
catch (HttpException ex)
{
if (ex.Response.StatusCode == HttpStatusCode.NotFound)
{
return null;
}
throw;
}
}
public List<PackageInfo> Search(string term)
{
_logger.Info("Searching for " + term);
var request = _requestBuilder.Build("packages");
request.UriBuilder.SetQueryParam("q", term.Trim());
var package = _httpClient.Get<List<PackageInfo>>(request);
return package.Resource;
}
}
}
|
using System.Collections.Generic;
using System.Net;
using AppGet.Http;
using NLog;
namespace AppGet.PackageRepository
{
public class AppGetServerClient : IPackageRepository
{
private readonly IHttpClient _httpClient;
private readonly Logger _logger;
private readonly HttpRequestBuilder _requestBuilder;
private const string API_ROOT = "https://appget.net/api/v1/";
public AppGetServerClient(IHttpClient httpClient, Logger logger)
{
_httpClient = httpClient;
_logger = logger;
_requestBuilder = new HttpRequestBuilder(API_ROOT);
}
public PackageInfo GetLatest(string name)
{
_logger.Info("Getting package " + name);
var request = _requestBuilder.Build("packages/{package}/latest");
request.AddSegment("package", name);
try
{
var package = _httpClient.Get<PackageInfo>(request);
return package.Resource;
}
catch (HttpException ex)
{
if (ex.Response.StatusCode == HttpStatusCode.NotFound)
{
return null;
}
throw;
}
}
public List<PackageInfo> Search(string term)
{
_logger.Info("Searching for " + term);
var request = _requestBuilder.Build("packages");
request.UriBuilder.SetQueryParam("q", term.Trim());
var package = _httpClient.Get<List<PackageInfo>>(request);
return package.Resource;
}
}
}
|
apache-2.0
|
C#
|
915e8b23110ae334e1a1805ab48e909780375711
|
Support mocking of Hazelcast.Net.Tests assembly's own interfaces (#701)
|
asimarslan/hazelcast-csharp-client,asimarslan/hazelcast-csharp-client
|
src/Hazelcast.Net.Tests/Properties/AssemblyInfo.cs
|
src/Hazelcast.Net.Tests/Properties/AssemblyInfo.cs
|
// Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Runtime.CompilerServices;
using NUnit.Framework;
// sets a default (large) timeout so tests eventually abort
// 10 min * 60 sec * 1000 ms - no test should last more that 10 mins
[assembly:Timeout( 10 * 60 * 1000)]
#if ASSEMBLY_SIGNING
// see https://github.com/Moq/moq4/wiki/Quickstart and https://stackoverflow.com/questions/30089042
// we need the full public key here in order to be able to use Moq when our assemblies are signed
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2,PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
#else
// moq
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
#endif
|
// Copyright (c) 2008-2022, Hazelcast, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using NUnit.Framework;
// sets a default (large) timeout so tests eventually abort
// 10 min * 60 sec * 1000 ms - no test should last more that 10 mins
[assembly:Timeout( 10 * 60 * 1000)]
|
apache-2.0
|
C#
|
fa73a877b9f1d4fb742a75cefb569912fb06279b
|
Improve code documentation in the IMutationValidator interface
|
openchain/openchain
|
src/Openchain.Infrastructure/IMutationValidator.cs
|
src/Openchain.Infrastructure/IMutationValidator.cs
|
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Openchain.Infrastructure
{
/// <summary>
/// Represents a service capable of verifying a mutation.
/// </summary>
public interface IMutationValidator
{
/// <summary>
/// Validates a mutation.
/// </summary>
/// <param name="mutation">The mutation to validate.</param>
/// <param name="authentication">Authentication data provided along with the mutation.</param>
/// <param name="accounts">Dictionary containing the current version of records being affected.</param>
/// <returns>The task object representing the asynchronous operation.</returns>
Task Validate(ParsedMutation mutation, IReadOnlyList<SignatureEvidence> authentication, IReadOnlyDictionary<AccountKey, AccountStatus> accounts);
}
}
|
// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Openchain.Infrastructure
{
public interface IMutationValidator
{
Task Validate(ParsedMutation mutation, IReadOnlyList<SignatureEvidence> authentication, IReadOnlyDictionary<AccountKey, AccountStatus> accounts);
}
}
|
apache-2.0
|
C#
|
a5c96fe96e4cb4b8bc1539eee24e6f6c37fda2f4
|
Add tests for json lists.
|
jquintus/spikes,jquintus/spikes,jquintus/spikes,jquintus/spikes
|
ConsoleApps/FunWithSpikes/FunWithNewtonsoft/ListTests.cs
|
ConsoleApps/FunWithSpikes/FunWithNewtonsoft/ListTests.cs
|
using Newtonsoft.Json;
using NUnit.Framework;
using System.Collections.Generic;
namespace FunWithNewtonsoft
{
[TestFixture]
public class ListTests
{
[Test]
public void DeserializeObject_JsonList_ReturnsList()
{
// Assemble
string json = @"
[
{'Number':'1','Letter':'A'},
{'Number':'2','Letter':'B'},
{'Number':'3','Letter':'C'}
]";
// Act
List<Data> actual = JsonConvert.DeserializeObject<List<Data>>(json);
// Assert
Assert.AreEqual(1, actual[0].Number);
Assert.AreEqual("A", actual[0].Letter);
Assert.AreEqual(2, actual[1].Number);
Assert.AreEqual("B", actual[1].Letter);
Assert.AreEqual(3, actual[2].Number);
Assert.AreEqual("C", actual[2].Letter);
}
[Test]
public void DeserializeObject_MissingSquareBracesAroundJsonList_Throws()
{
// Assemble
string json = @"
{'Number':'1','Letter':'A'},
{'Number':'2','Letter':'B'},
{'Number':'3','Letter':'C'}";
// Act
Assert.Throws<JsonSerializationException>(() => JsonConvert.DeserializeObject<List<Data>>(json));
}
[Test]
public void DeserializeObject_TrailingCommaAtEndOfJsonList_ReturnsList()
{
// Assemble
string json = @"
[
{'Number':'1','Letter':'A'},
{'Number':'2','Letter':'B'},
{'Number':'3','Letter':'C'},
]";
// Act
List<Data> actual = JsonConvert.DeserializeObject<List<Data>>(json);
// Assert
Assert.AreEqual(1, actual[0].Number);
Assert.AreEqual("A", actual[0].Letter);
Assert.AreEqual(2, actual[1].Number);
Assert.AreEqual("B", actual[1].Letter);
Assert.AreEqual(3, actual[2].Number);
Assert.AreEqual("C", actual[2].Letter);
}
}
}
|
using NUnit.Framework;
using System.Collections.Generic;
namespace FunWithNewtonsoft
{
[TestFixture]
public class ListTests
{
[Test]
public void Deserialize_PartialList_ReturnsList()
{
// Assemble
string json = @"
{'Number':'1','Letter':'A'},
{'Number':'2','Letter':'B'},
{'Number':'3','Letter':'C'},";
// Act
List<Data> actual = null;
// Assert
Assert.AreEqual(1, actual[0].Number);
Assert.AreEqual("A", actual[0].Letter);
Assert.AreEqual(2, actual[1].Number);
Assert.AreEqual("B", actual[1].Letter);
Assert.AreEqual(3, actual[2].Number);
Assert.AreEqual("C", actual[2].Letter);
}
}
}
|
mit
|
C#
|
249b713dc3a5cdeee35cc0460ec2efbe734cad1d
|
Change the Order for Inlining Multi Units
|
CryZe/GekkoAssembler
|
GekkoAssembler.Common/Optimizers/IRMultiUnitOptimizer.cs
|
GekkoAssembler.Common/Optimizers/IRMultiUnitOptimizer.cs
|
using System.Collections.Generic;
using System.Linq;
using GekkoAssembler.IntermediateRepresentation;
namespace GekkoAssembler.Optimizers
{
public class IRMultiUnitOptimizer : IOptimizer
{
public IRCodeBlock Optimize(IRCodeBlock block)
{
var units = block.Units;
var newUnits = units
.SelectMany(x => x is IRMultiUnit ? (x as IRMultiUnit).Inner : (IEnumerable<IIRUnit>)new[] { x })
.Select(x => x is IRCodeBlock ? Optimize(x as IRCodeBlock) : x);
return new IRCodeBlock(newUnits);
}
}
}
|
using System.Collections.Generic;
using System.Linq;
using GekkoAssembler.IntermediateRepresentation;
namespace GekkoAssembler.Optimizers
{
public class IRMultiUnitOptimizer : IOptimizer
{
public IRCodeBlock Optimize(IRCodeBlock block)
{
var units = block.Units;
var newUnits = units
.Select(x => x is IRCodeBlock ? Optimize(x as IRCodeBlock) : x)
.SelectMany(x => x is IRMultiUnit ? (x as IRMultiUnit).Inner : (IEnumerable<IIRUnit>)new[] { x });
return new IRCodeBlock(newUnits);
}
}
}
|
mit
|
C#
|
e71d7cb56bd917ee7595dda32e00838cfc6feed8
|
Update StringExtensionsTests.cs
|
GHPReporter/Ghpr.Core,GHPReporter/Ghpr.Core,GHPReporter/Ghpr.Core
|
Ghpr.Core.Tests/Core/Extensions/StringExtensionsTests.cs
|
Ghpr.Core.Tests/Core/Extensions/StringExtensionsTests.cs
|
using System;
using System.IO;
using Ghpr.Core.Extensions;
using Ghpr.Core.Settings;
using NUnit.Framework;
namespace Ghpr.Core.Tests.Core.Extensions
{
[TestFixture]
public class StringExtensionsTests
{
[TestCase(@"C:\SomePath")]
[TestCase(@"C:\SomePath\1")]
[TestCase(@"C:\SomePath\1\folder")]
[TestCase(@"C:\SomePath\folder\folder")]
public void CreatePathTest(string path)
{
path.Create();
Assert.IsTrue(Directory.Exists(path));
Directory.Delete(path);
}
[TestCase(null, "d98c1dd4-008f-04b2-e980-0998ecf8427e")]
[TestCase("value", "60c16320-6e8d-af0b-8024-9c42e2be5804")]
[TestCase("@#$%^&*", "13f43c69-dfa2-20cc-d646-f6640cc49968")]
[TestCase("value - asdfa - s!", "5148c927-4668-af01-b893-28f44bb86689")]
[TestCase("va1234lue", "777fde87-a8f2-2645-4e74-b51ff7925b8c")]
[TestCase("valu$%^&e", "e6c3ff61-6b8d-c229-c193-f24ac13a1452")]
[TestCase("", "d98c1dd4-008f-04b2-e980-0998ecf8427e")]
[TestCase(" ", "f0318662-2173-2db2-8c17-6c200c855e1b")]
public void Md5HashGuidTest(string value, string guid)
{
Assert.AreEqual(Guid.Parse(guid), value.ToMd5HashGuid());
}
[Test]
public void LoadAsTest()
{
var uri = new Uri(typeof(ReporterSettings).Assembly.CodeBase);
var settingsPath = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? "", "Ghpr.Core.Settings.json");
var s = settingsPath.LoadAs<ReporterSettings>();
Assert.AreEqual("C:\\_GHPReporter_Core_Report", s.OutputPath);
}
}
}
|
using System;
using System.IO;
using Ghpr.Core.Extensions;
using Ghpr.Core.Settings;
using NUnit.Framework;
namespace Ghpr.Core.Tests.Core.Extensions
{
[TestFixture]
public class StringExtensionsTests
{
[TestCase(@"C:\SomePath")]
[TestCase(@"C:\SomePath\1")]
[TestCase(@"C:\SomePath\1\folder")]
[TestCase(@"C:\SomePath\folder\folder")]
public void CreatePathTest(string path)
{
path.Create();
Assert.IsTrue(Directory.Exists(path));
Directory.Delete(path);
}
[TestCase("value", "60c16320-6e8d-af0b-8024-9c42e2be5804")]
[TestCase("@#$%^&*", "13f43c69-dfa2-20cc-d646-f6640cc49968")]
[TestCase("value - asdfa - s!", "5148c927-4668-af01-b893-28f44bb86689")]
[TestCase("va1234lue", "777fde87-a8f2-2645-4e74-b51ff7925b8c")]
[TestCase("valu$%^&e", "e6c3ff61-6b8d-c229-c193-f24ac13a1452")]
[TestCase("", "d98c1dd4-008f-04b2-e980-0998ecf8427e")]
[TestCase(" ", "f0318662-2173-2db2-8c17-6c200c855e1b")]
public void Md5HashGuidTest(string value, string guid)
{
Assert.AreEqual(Guid.Parse(guid), value.ToMd5HashGuid());
}
[Test]
public void LoadAsTest()
{
var uri = new Uri(typeof(ReporterSettings).Assembly.CodeBase);
var settingsPath = Path.Combine(Path.GetDirectoryName(uri.LocalPath) ?? "", "Ghpr.Core.Settings.json");
var s = settingsPath.LoadAs<ReporterSettings>();
Assert.AreEqual("C:\\_GHPReporter_Core_Report", s.OutputPath);
}
}
}
|
mit
|
C#
|
8f525db268642cc95be549bc3949370075dde93f
|
Fix NullReferenceException
|
haefele/UwCore
|
src/UwCore/Services/Navigation/ParametersHelper.cs
|
src/UwCore/Services/Navigation/ParametersHelper.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UwCore.Extensions;
namespace UwCore.Services.Navigation
{
public static class ParametersHelper
{
private static PropertyInfo GetParametersProperty(object instance)
{
var parametersProperty =
instance.GetType().GetPropertyCaseInsensitive("Parameter") ??
instance.GetType().GetPropertyCaseInsensitive("Parameters") ??
instance.GetType().GetPropertyCaseInsensitive("Param");
if (parametersProperty == null)
return null;
if (parametersProperty.CanRead == false || parametersProperty.CanWrite == false)
return null;
return parametersProperty;
}
public static void InjectParameter(object self, IDictionary<string, object> values)
{
if (values == null || values.Any() == false)
return;
var parametersProperty = GetParametersProperty(self);
if (parametersProperty != null)
{
var parameter = Activator.CreateInstance(parametersProperty.PropertyType);
parameter.InjectValues(values);
parametersProperty.SetValue(self, parameter);
}
else
{
self.InjectValues(values);
}
}
public static bool AreParameterInjected(object self, IDictionary<string, object> values)
{
if (values == null || values.Any() == false)
return true;
var parametersProperty = GetParametersProperty(self);
if (parametersProperty != null)
{
var parameter = parametersProperty.GetValue(self);
return parameter.AreValuesInjected(values);
}
else
{
return self.AreValuesInjected(values);
}
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UwCore.Extensions;
namespace UwCore.Services.Navigation
{
public static class ParametersHelper
{
private static PropertyInfo GetParametersProperty(object instance)
{
var parametersProperty =
instance.GetType().GetPropertyCaseInsensitive("Parameter") ??
instance.GetType().GetPropertyCaseInsensitive("Parameters") ??
instance.GetType().GetPropertyCaseInsensitive("Param");
if (parametersProperty == null)
return null;
if (parametersProperty.CanRead == false || parametersProperty.CanWrite == false)
return null;
return parametersProperty;
}
public static void InjectParameter(object self, IDictionary<string, object> values)
{
if (values.Any() == false)
return;
var parametersProperty = GetParametersProperty(self);
if (parametersProperty != null)
{
var parameter = Activator.CreateInstance(parametersProperty.PropertyType);
parameter.InjectValues(values);
parametersProperty.SetValue(self, parameter);
}
else
{
self.InjectValues(values);
}
}
public static bool AreParameterInjected(object self, IDictionary<string, object> values)
{
if (values.Any() == false)
return false;
var parametersProperty = GetParametersProperty(self);
if (parametersProperty != null)
{
var parameter = parametersProperty.GetValue(self);
return parameter.AreValuesInjected(values);
}
else
{
return self.AreValuesInjected(values);
}
}
}
}
|
mit
|
C#
|
fc668d8a74898586c8a774fd1bd50f36032c7746
|
Move autoplay mod to a less overridable location
|
peppy/osu-new,smoogipooo/osu,ppy/osu,ppy/osu,ZLima12/osu,smoogipoo/osu,johnneijzen/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,peppy/osu,peppy/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,ppy/osu,johnneijzen/osu,2yangk23/osu,ZLima12/osu,UselessToucan/osu,EVAST9919/osu,EVAST9919/osu
|
osu.Game/Tests/Visual/PlayerTestScene.cs
|
osu.Game/Tests/Visual/PlayerTestScene.cs
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
public abstract class PlayerTestScene : RateAdjustedBeatmapTestScene
{
private readonly Ruleset ruleset;
protected Player Player;
protected PlayerTestScene(Ruleset ruleset)
{
this.ruleset = ruleset;
}
protected OsuConfigManager LocalConfig;
[BackgroundDependencyLoader]
private void load()
{
Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage));
LocalConfig.GetBindable<double>(OsuSetting.DimLevel).Value = 1.0;
}
[SetUpSteps]
public virtual void SetUpSteps()
{
AddStep(ruleset.RulesetInfo.Name, loadPlayer);
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
}
protected virtual bool AllowFail => false;
protected virtual bool Autoplay => false;
private void loadPlayer()
{
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
Beatmap.Value = CreateWorkingBeatmap(beatmap);
if (!AllowFail)
Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
if (Autoplay)
{
var mod = ruleset.GetAutoplayMod();
if (mod != null)
Mods.Value = Mods.Value.Concat(mod.Yield()).ToArray();
}
Player = CreatePlayer(ruleset);
LoadScreen(Player);
}
protected virtual Player CreatePlayer(Ruleset ruleset) => new TestPlayer(false, false);
}
}
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
public abstract class PlayerTestScene : RateAdjustedBeatmapTestScene
{
private readonly Ruleset ruleset;
protected Player Player;
protected PlayerTestScene(Ruleset ruleset)
{
this.ruleset = ruleset;
}
protected OsuConfigManager LocalConfig;
[BackgroundDependencyLoader]
private void load()
{
Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage));
LocalConfig.GetBindable<double>(OsuSetting.DimLevel).Value = 1.0;
}
[SetUpSteps]
public virtual void SetUpSteps()
{
AddStep(ruleset.RulesetInfo.Name, loadPlayer);
AddUntilStep("player loaded", () => Player.IsLoaded && Player.Alpha == 1);
}
protected virtual bool AllowFail => false;
protected virtual bool Autoplay => false;
private void loadPlayer()
{
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
Beatmap.Value = CreateWorkingBeatmap(beatmap);
if (!AllowFail)
Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
Player = CreatePlayer(ruleset);
LoadScreen(Player);
}
protected virtual Player CreatePlayer(Ruleset ruleset)
{
if (Autoplay)
{
var mod = ruleset.GetAutoplayMod();
if (mod != null)
Mods.Value = Mods.Value.Concat(mod.Yield()).ToArray();
}
return new TestPlayer(false, false);
}
}
}
|
mit
|
C#
|
c777086195462991d44fe8d50be48ce93f4da004
|
change URL binding
|
MCeddy/IoT-core
|
IoT-Core/Program.cs
|
IoT-Core/Program.cs
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace IoT_Core
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("http://*:3002/")
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
namespace IoT_Core
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseUrls("http://localhost:3002/")
.UseApplicationInsights()
.Build();
host.Run();
}
}
}
|
mit
|
C#
|
240681b206f604cd84db74120c9e03100d5a0feb
|
update meta tags
|
tburnett80/blender-buddy,tburnett80/blender-buddy,tburnett80/blender-buddy,tburnett80/blender-buddy
|
blender-buddy-web/Views/Shared/_Layout.cshtml
|
blender-buddy-web/Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-106758103-1"></script>
<script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments)};gtag('js', new Date());gtag('config', 'UA-106758103-1');</script>
<meta charset="utf-8"/>
<meta name="description" content="BlenderBuddy Web is a mobile friendly online Gas Blending and Mixing tool for Scuba Divers and Gas Blenders"/>
<meta name="keywords" content="blender buddy,blender buddy web,scuba diving,nitrox,gas blending,nitrox calculator,gas blending calculator,trimix,trimix calculator,trimix blending,trimix blending calculator" />
<meta name="robots" content="index,follow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>@ViewData["Title"]</title>
<base href="~/"/>
<link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true"/>
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-106758103-1', 'auto');ga('send', 'pageview');</script>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-106758103-1"></script>
<script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments)};gtag('js', new Date());gtag('config', 'UA-106758103-1');</script>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>@ViewData["Title"]</title>
<base href="~/"/>
<link rel="stylesheet" href="~/dist/vendor.css" asp-append-version="true"/>
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');ga('create', 'UA-106758103-1', 'auto');ga('send', 'pageview');</script>
</body>
</html>
|
apache-2.0
|
C#
|
da763d20e4423080db9b0cf749d6e40d02b6fc09
|
Update version
|
segrived/WTManager
|
WTManager/Properties/AssemblyInfo.cs
|
WTManager/Properties/AssemblyInfo.cs
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WTManager")]
[assembly: AssemblyDescription("Control your Windows services with tray")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Babaev Evgeniy")]
[assembly: AssemblyProduct("WTManager")]
[assembly: AssemblyCopyright("Copyright © 2015-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("9fad443f-f504-47fa-802c-6470413097d0")]
[assembly: AssemblyVersion("0.2.*")]
[assembly: AssemblyFileVersion("0.2.0.0")]
|
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("WTManager")]
[assembly: AssemblyDescription("Control your Windows services with tray")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Babaev Evgeniy")]
[assembly: AssemblyProduct("WTManager")]
[assembly: AssemblyCopyright("Copyright © 2015-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("9fad443f-f504-47fa-802c-6470413097d0")]
[assembly: AssemblyVersion("0.1.224.5899")]
[assembly: AssemblyFileVersion("0.1.224.5899")]
|
mit
|
C#
|
8aa3ed12c604169f23c168d1b3411847d11fe8e3
|
Move ctor
|
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
|
WalletWasabi/Hwi/Models/HwiOption.cs
|
WalletWasabi/Hwi/Models/HwiOption.cs
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Helpers;
using WalletWasabi.Hwi.Parsers;
namespace WalletWasabi.Hwi.Models
{
public class HwiOption : IEquatable<HwiOption>
{
private HwiOption(HwiOptions type, string argument = null)
{
Type = type;
Arguments = argument;
}
public static HwiOption Debug => new HwiOption(HwiOptions.Debug);
public static HwiOption Help => new HwiOption(HwiOptions.Help);
public static HwiOption Interactive => new HwiOption(HwiOptions.Interactive);
public static HwiOption TestNet => new HwiOption(HwiOptions.TestNet);
public static HwiOption Version => new HwiOption(HwiOptions.Version);
public HwiOptions Type { get; }
public string Arguments { get; }
public static HwiOption DevicePath(string devicePath)
{
devicePath = Guard.NotNullOrEmptyOrWhitespace(nameof(devicePath), devicePath, trim: true);
return new HwiOption(HwiOptions.DevicePath, devicePath);
}
public static HwiOption DeviceType(HardwareWalletModels deviceType) => new HwiOption(HwiOptions.DeviceType, deviceType.ToHwiFriendlyString());
public static HwiOption Fingerprint(HDFingerprint fingerprint) => new HwiOption(HwiOptions.Fingerprint, fingerprint.ToString());
public static HwiOption Password(string password) => new HwiOption(HwiOptions.Password, password);
#region Equality
public override bool Equals(object obj) => Equals(obj as HwiOption);
public bool Equals(HwiOption other) => this == other;
public override int GetHashCode() => (Type, Arguments).GetHashCode();
public static bool operator ==(HwiOption x, HwiOption y) => x?.Type == y?.Type && x?.Arguments == y?.Arguments;
public static bool operator !=(HwiOption x, HwiOption y) => !(x == y);
#endregion Equality
}
}
|
using NBitcoin;
using System;
using System.Collections.Generic;
using System.Text;
using WalletWasabi.Helpers;
using WalletWasabi.Hwi.Parsers;
namespace WalletWasabi.Hwi.Models
{
public class HwiOption : IEquatable<HwiOption>
{
public static HwiOption Debug => new HwiOption(HwiOptions.Debug);
public static HwiOption Help => new HwiOption(HwiOptions.Help);
public static HwiOption Interactive => new HwiOption(HwiOptions.Interactive);
public static HwiOption TestNet => new HwiOption(HwiOptions.TestNet);
public static HwiOption Version => new HwiOption(HwiOptions.Version);
public HwiOptions Type { get; }
public string Arguments { get; }
private HwiOption(HwiOptions type, string argument = null)
{
Type = type;
Arguments = argument;
}
public static HwiOption DevicePath(string devicePath)
{
devicePath = Guard.NotNullOrEmptyOrWhitespace(nameof(devicePath), devicePath, trim: true);
return new HwiOption(HwiOptions.DevicePath, devicePath);
}
public static HwiOption DeviceType(HardwareWalletModels deviceType) => new HwiOption(HwiOptions.DeviceType, deviceType.ToHwiFriendlyString());
public static HwiOption Fingerprint(HDFingerprint fingerprint) => new HwiOption(HwiOptions.Fingerprint, fingerprint.ToString());
public static HwiOption Password(string password) => new HwiOption(HwiOptions.Password, password);
#region Equality
public override bool Equals(object obj) => Equals(obj as HwiOption);
public bool Equals(HwiOption other) => this == other;
public override int GetHashCode() => (Type, Arguments).GetHashCode();
public static bool operator ==(HwiOption x, HwiOption y) => x?.Type == y?.Type && x?.Arguments == y?.Arguments;
public static bool operator !=(HwiOption x, HwiOption y) => !(x == y);
#endregion Equality
}
}
|
mit
|
C#
|
f8f916fca8b1fc50282376b9aaac9c537caa4410
|
Add XML comment to MotorModule
|
bl-nero/miss
|
Miss/MotorModule.cs
|
Miss/MotorModule.cs
|
using System;
using Nancy;
namespace Miss {
/// <summary>
/// A module that is responsible for interacting with motors. It handles URLs
/// of a following structure: <c>/v1/motor/[portSpec]/[action]</c>, where
/// <c>[portSpec]</c> decides which motor (or pair of motors) will be used,
/// and </c>[action]</c> is the name of action to be performed.
/// </summary>
public class MotorModule: NancyModule {
public MotorModule() : base("/v1/motor") {
Get["/{portSpec}/switchOn"] = parameters => {
return "Switching on motor " + parameters.portSpec;
};
}
}
}
|
using System;
using Nancy;
namespace Miss {
public class MotorModule: NancyModule {
public MotorModule() : base("/v1/motor") {
Get["/{portSpec}/switchOn"] = parameters => {
return "Switching on motor " + parameters.portSpec;
};
}
}
}
|
mit
|
C#
|
c3fe35ce72d8033991d9b82968e1e6bcb70dddde
|
fix unit tests
|
dotnetcore/CAP,dotnetcore/CAP,ouraspnet/cap,dotnetcore/CAP
|
test/DotNetCore.CAP.MySql.Test/DatabaseTestHost.cs
|
test/DotNetCore.CAP.MySql.Test/DatabaseTestHost.cs
|
using System.Threading;
using Dapper;
using DotNetCore.CAP.Persistence;
namespace DotNetCore.CAP.MySql.Test
{
public abstract class DatabaseTestHost : TestHost
{
private static bool _sqlObjectInstalled;
public static object _lock = new object();
protected override void PostBuildServices()
{
base.PostBuildServices();
lock (_lock)
{
if (!_sqlObjectInstalled)
{
InitializeDatabase();
}
}
}
public override void Dispose()
{
DeleteAllData();
base.Dispose();
}
private void InitializeDatabase()
{
using (CreateScope())
{
var storage = GetService<IStorageInitializer>();
var token = new CancellationTokenSource().Token;
CreateDatabase();
storage.InitializeAsync(token);
_sqlObjectInstalled = true;
}
}
private void CreateDatabase()
{
var masterConn = ConnectionUtil.GetMasterConnectionString();
var databaseName = ConnectionUtil.GetDatabaseName();
using (var connection = ConnectionUtil.CreateConnection(masterConn))
{
connection.Execute($@"
DROP DATABASE IF EXISTS `{databaseName}`;
CREATE DATABASE `{databaseName}`;");
}
}
private void DeleteAllData()
{
var conn = ConnectionUtil.GetConnectionString();
using (var connection = ConnectionUtil.CreateConnection(conn))
{
connection.Execute($@"
TRUNCATE TABLE `cap.published`;
TRUNCATE TABLE `cap.received`;");
}
}
}
}
|
using System.Threading;
using Dapper;
using DotNetCore.CAP.Persistence;
namespace DotNetCore.CAP.MySql.Test
{
public abstract class DatabaseTestHost : TestHost
{
private static bool _sqlObjectInstalled;
public static object _lock = new object();
protected override void PostBuildServices()
{
base.PostBuildServices();
lock (_lock)
{
if (!_sqlObjectInstalled)
{
InitializeDatabase();
}
}
}
public override void Dispose()
{
DeleteAllData();
base.Dispose();
}
private void InitializeDatabase()
{
using (CreateScope())
{
var storage = GetService<IStorageInitializer>();
var token = new CancellationTokenSource().Token;
CreateDatabase();
storage.InitializeAsync(token).GetAwaiter().GetResult();
_sqlObjectInstalled = true;
}
}
private void CreateDatabase()
{
var masterConn = ConnectionUtil.GetMasterConnectionString();
var databaseName = ConnectionUtil.GetDatabaseName();
using (var connection = ConnectionUtil.CreateConnection(masterConn))
{
connection.Execute($@"
DROP DATABASE IF EXISTS `{databaseName}`;
CREATE DATABASE `{databaseName}`;");
}
}
private void DeleteAllData()
{
var conn = ConnectionUtil.GetConnectionString();
using (var connection = ConnectionUtil.CreateConnection(conn))
{
connection.Execute($@"
TRUNCATE TABLE `cap.published`;
TRUNCATE TABLE `cap.received`;");
}
}
}
}
|
mit
|
C#
|
d52edee05775d9dd142f9e277d4eb459d0af07bc
|
fix #1454 add Query(IQueryContainer) to CountDescriptor
|
junlapong/elasticsearch-net,robrich/elasticsearch-net,LeoYao/elasticsearch-net,robrich/elasticsearch-net,mac2000/elasticsearch-net,joehmchan/elasticsearch-net,robertlyson/elasticsearch-net,starckgates/elasticsearch-net,joehmchan/elasticsearch-net,SeanKilleen/elasticsearch-net,faisal00813/elasticsearch-net,abibell/elasticsearch-net,SeanKilleen/elasticsearch-net,mac2000/elasticsearch-net,junlapong/elasticsearch-net,starckgates/elasticsearch-net,gayancc/elasticsearch-net,LeoYao/elasticsearch-net,faisal00813/elasticsearch-net,gayancc/elasticsearch-net,starckgates/elasticsearch-net,mac2000/elasticsearch-net,gayancc/elasticsearch-net,SeanKilleen/elasticsearch-net,joehmchan/elasticsearch-net,robertlyson/elasticsearch-net,junlapong/elasticsearch-net,abibell/elasticsearch-net,wawrzyn/elasticsearch-net,wawrzyn/elasticsearch-net,robertlyson/elasticsearch-net,faisal00813/elasticsearch-net,LeoYao/elasticsearch-net,DavidSSL/elasticsearch-net,robrich/elasticsearch-net,DavidSSL/elasticsearch-net,DavidSSL/elasticsearch-net,abibell/elasticsearch-net,wawrzyn/elasticsearch-net
|
src/Nest/DSL/CountDescriptor.cs
|
src/Nest/DSL/CountDescriptor.cs
|
using System;
using System.Collections.Generic;
using Elasticsearch.Net;
using Newtonsoft.Json;
namespace Nest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public interface ICountRequest : IQueryPath<CountRequestParameters>
{
[JsonProperty("query")]
IQueryContainer Query { get; set; }
}
public interface ICountRequest<T> : ICountRequest
where T : class {}
internal static class CountPathInfo
{
public static void Update(ElasticsearchPathInfo<CountRequestParameters> pathInfo, ICountRequest request)
{
var source = request.RequestParameters.GetQueryStringValue<string>("source");
pathInfo.HttpMethod = source.IsNullOrEmpty()
&& (request.Query == null || request.Query.IsConditionless)
? PathInfoHttpMethod.GET
: PathInfoHttpMethod.POST;
}
}
public partial class CountRequest : QueryPathBase<CountRequestParameters>, ICountRequest
{
public CountRequest() {}
public CountRequest(IndexNameMarker index, TypeNameMarker type = null) : base(index, type) { }
public CountRequest(IEnumerable<IndexNameMarker> indices, IEnumerable<TypeNameMarker> types = null) : base(indices, types) { }
public IQueryContainer Query { get; set; }
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<CountRequestParameters> pathInfo)
{
CountPathInfo.Update(pathInfo, this);
}
}
public partial class CountRequest<T> : QueryPathBase<CountRequestParameters, T>, ICountRequest
where T : class
{
public CountRequest() {}
public CountRequest(IndexNameMarker index, TypeNameMarker type = null) : base(index, type) { }
public CountRequest(IEnumerable<IndexNameMarker> indices, IEnumerable<TypeNameMarker> types = null) : base(indices, types) { }
public IQueryContainer Query { get; set; }
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<CountRequestParameters> pathInfo)
{
CountPathInfo.Update(pathInfo, this);
}
}
[DescriptorFor("Count")]
public partial class CountDescriptor<T> : QueryPathDescriptorBase<CountDescriptor<T>, CountRequestParameters, T>, ICountRequest
where T : class
{
private ICountRequest Self { get { return this; } }
IQueryContainer ICountRequest.Query { get; set; }
public CountDescriptor<T> Query(Func<QueryDescriptor<T>, QueryContainer> querySelector)
{
Self.Query = querySelector(new QueryDescriptor<T>());
return this;
}
public CountDescriptor<T> Query(IQueryContainer queryContainer)
{
Self.Query = queryContainer;
return this;
}
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<CountRequestParameters> pathInfo)
{
CountPathInfo.Update(pathInfo, this);
}
}
}
|
using System;
using System.Collections.Generic;
using Elasticsearch.Net;
using Newtonsoft.Json;
namespace Nest
{
[JsonObject(MemberSerialization = MemberSerialization.OptIn)]
public interface ICountRequest : IQueryPath<CountRequestParameters>
{
[JsonProperty("query")]
IQueryContainer Query { get; set; }
}
public interface ICountRequest<T> : ICountRequest
where T : class {}
internal static class CountPathInfo
{
public static void Update(ElasticsearchPathInfo<CountRequestParameters> pathInfo, ICountRequest request)
{
var source = request.RequestParameters.GetQueryStringValue<string>("source");
pathInfo.HttpMethod = source.IsNullOrEmpty()
&& (request.Query == null || request.Query.IsConditionless)
? PathInfoHttpMethod.GET
: PathInfoHttpMethod.POST;
}
}
public partial class CountRequest : QueryPathBase<CountRequestParameters>, ICountRequest
{
public CountRequest() {}
public CountRequest(IndexNameMarker index, TypeNameMarker type = null) : base(index, type) { }
public CountRequest(IEnumerable<IndexNameMarker> indices, IEnumerable<TypeNameMarker> types = null) : base(indices, types) { }
public IQueryContainer Query { get; set; }
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<CountRequestParameters> pathInfo)
{
CountPathInfo.Update(pathInfo, this);
}
}
public partial class CountRequest<T> : QueryPathBase<CountRequestParameters, T>, ICountRequest
where T : class
{
public CountRequest() {}
public CountRequest(IndexNameMarker index, TypeNameMarker type = null) : base(index, type) { }
public CountRequest(IEnumerable<IndexNameMarker> indices, IEnumerable<TypeNameMarker> types = null) : base(indices, types) { }
public IQueryContainer Query { get; set; }
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<CountRequestParameters> pathInfo)
{
CountPathInfo.Update(pathInfo, this);
}
}
[DescriptorFor("Count")]
public partial class CountDescriptor<T> : QueryPathDescriptorBase<CountDescriptor<T>, CountRequestParameters, T>, ICountRequest
where T : class
{
private ICountRequest Self { get { return this; } }
IQueryContainer ICountRequest.Query { get; set; }
public CountDescriptor<T> Query(Func<QueryDescriptor<T>, QueryContainer> querySelector)
{
Self.Query = querySelector(new QueryDescriptor<T>());
return this;
}
protected override void UpdatePathInfo(IConnectionSettingsValues settings, ElasticsearchPathInfo<CountRequestParameters> pathInfo)
{
CountPathInfo.Update(pathInfo, this);
}
}
}
|
apache-2.0
|
C#
|
f12596a10f91847923f3cc062dc712223be4726a
|
Add snippets for "Period" type showing basic construction using factory methods (#1008)
|
BenJenkinson/nodatime,malcolmr/nodatime,malcolmr/nodatime,jskeet/nodatime,nodatime/nodatime,malcolmr/nodatime,BenJenkinson/nodatime,malcolmr/nodatime,jskeet/nodatime,nodatime/nodatime
|
src/NodaTime.Demo/PeriodDemo.cs
|
src/NodaTime.Demo/PeriodDemo.cs
|
// Copyright 2010 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NUnit.Framework;
namespace NodaTime.Demo
{
public class PeriodDemo
{
[Test]
public void ConstructionFromYears()
{
Period period = Snippet.For(Period.FromYears(27));
Assert.AreEqual(27, period.Years);
Assert.AreEqual("P27Y", period.ToString());
}
[Test]
public void ConstructionFromMonths()
{
Period period = Snippet.For(Period.FromMonths(10));
Assert.AreEqual(10, period.Months);
Assert.AreEqual("P10M", period.ToString());
}
[Test]
public void ConstructionFromWeeks()
{
Period period = Snippet.For(Period.FromWeeks(1));
Assert.AreEqual(1, period.Weeks);
Assert.AreEqual("P1W", period.ToString());
}
[Test]
public void ConstructionFromDays()
{
Period period = Snippet.For(Period.FromDays(3));
Assert.AreEqual(3, period.Days);
Assert.AreEqual("P3D", period.ToString());
}
[Test]
public void ConstructionFromHours()
{
Period period = Snippet.For(Period.FromHours(5));
Assert.AreEqual(5, period.Hours);
Assert.AreEqual("PT5H", period.ToString());
}
[Test]
public void ConstructionFromMinutes()
{
Period period = Snippet.For(Period.FromMinutes(15));
Assert.AreEqual(15, period.Minutes);
Assert.AreEqual("PT15M", period.ToString());
}
[Test]
public void ConstructionFromSeconds()
{
Period period = Snippet.For(Period.FromSeconds(70));
Assert.AreEqual(70, period.Seconds);
Assert.AreEqual("PT70S", period.ToString());
}
[Test]
public void ConstructionFromMilliseconds()
{
Period period = Snippet.For(Period.FromMilliseconds(1500));
Assert.AreEqual(1500, period.Milliseconds);
Assert.AreEqual("PT1500s", period.ToString());
}
[Test]
public void ConstructionFromTicks()
{
Period period = Snippet.For(Period.FromTicks(42));
Assert.AreEqual(42, period.Ticks);
Assert.AreEqual("PT42t", period.ToString());
}
[Test]
public void ConstructionFromNanoseconds()
{
Period period = Snippet.For(Period.FromNanoseconds(42));
Assert.AreEqual(42, period.Nanoseconds);
Assert.AreEqual("PT42n", period.ToString());
}
}
}
|
// Copyright 2010 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.
using NUnit.Framework;
namespace NodaTime.Demo
{
public class PeriodDemo
{
[Test]
public void ConstructionFromDays()
{
Period period = Snippet.For(Period.FromDays(3));
Assert.AreEqual(3, period.Days);
}
}
}
|
apache-2.0
|
C#
|
1eca747afe1f3fe48b94b68582e57b73b8b6d985
|
Add missing XML comments
|
markashleybell/MAB.DotIgnore,markashleybell/MAB.DotIgnore
|
MAB.DotIgnore/IgnoreLog.cs
|
MAB.DotIgnore/IgnoreLog.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace MAB.DotIgnore
{
/// <summary>
/// Keeps track of which rules matched which path (including overrides etc).
/// </summary>
public class IgnoreLog : Dictionary<string, List<string>>
{
/// <summary>
/// Returns a "pretty printed" string representation of the rule match log.
/// </summary>
/// <returns>String representation of the match log.</returns>
public override string ToString()
{
var nl = Environment.NewLine;
var prefix = nl + " ";
return string.Join(nl + nl, base.Keys.Select(k => k + prefix + string.Join(prefix, base[k].ToArray())).ToArray());
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
namespace MAB.DotIgnore
{
public class IgnoreLog : Dictionary<string, List<string>>
{
public override string ToString()
{
var nl = Environment.NewLine;
var prefix = nl + " ";
return string.Join(nl + nl, base.Keys.Select(k => k + prefix + string.Join(prefix, base[k].ToArray())).ToArray());
}
}
}
|
mit
|
C#
|
f2c8ad51e9ed055ad13d8a7b8e9fb350ca37f6c3
|
Bump version to 0.1.3
|
exira/ges-runner
|
src/Properties/AssemblyInfo.cs
|
src/Properties/AssemblyInfo.cs
|
// <auto-generated/>
using System.Reflection;
[assembly: AssemblyTitleAttribute("ges-runner")]
[assembly: AssemblyProductAttribute("Exira.EventStore.Runner")]
[assembly: AssemblyDescriptionAttribute("Exira.EventStore.Runner is a wrapper that uses Topshelf to run EventStore as a Windows Service")]
[assembly: AssemblyVersionAttribute("0.1.3")]
[assembly: AssemblyFileVersionAttribute("0.1.3")]
[assembly: AssemblyMetadataAttribute("githash","47e38dd78e4164b7c6d7feeaa38933b46a4b24be")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.1.3";
}
}
|
// <auto-generated/>
using System.Reflection;
[assembly: AssemblyTitleAttribute("ges-runner")]
[assembly: AssemblyProductAttribute("Exira.EventStore.Runner")]
[assembly: AssemblyDescriptionAttribute("Exira.EventStore.Runner is a wrapper that uses Topshelf to run EventStore as a Windows Service")]
[assembly: AssemblyVersionAttribute("0.1.1")]
[assembly: AssemblyFileVersionAttribute("0.1.1")]
[assembly: AssemblyMetadataAttribute("githash","d38ad61ff673ca34d69cb9e63b23de502372e70c")]
namespace System {
internal static class AssemblyVersionInformation {
internal const string Version = "0.1.1";
}
}
|
mit
|
C#
|
7e43a94ac470507ba74ffa56b501a4903d07c5ba
|
Add capacity and time window data to route events.
|
nfleet/.net-sdk
|
NFleetSDK/Data/RouteEventData.cs
|
NFleetSDK/Data/RouteEventData.cs
|
using System;
using System.Collections.Generic;
namespace NFleet.Data
{
public class RouteEventData : IResponseData, IVersioned
{
public static string MIMEType = "application/vnd.jyu.nfleet.routeevent";
public static string MIMEVersion = "2.0";
int IVersioned.VersionNumber { get; set; }
public string State { get; set; }
public double WaitingTimeBefore { get; set; }
public DateTime? ArrivalTime { get; set; }
public DateTime? DepartureTime { get; set; }
public List<Link> Meta { get; set; }
public string DataState { get; set; }
public string FeasibilityState { get; set; }
public int TaskEventId { get; set; }
public KPIData KPIs { get; set; }
public string Type { get; set; }
public LocationData Location { get; set; }
public List<CapacityData> Capacities { get; set; }
public List<TimeWindowData> TimeWindows { get; set; }
}
}
|
using System;
using System.Collections.Generic;
namespace NFleet.Data
{
public class RouteEventData : IResponseData, IVersioned
{
public static string MIMEType = "application/vnd.jyu.nfleet.routeevent";
public static string MIMEVersion = "2.0";
int IVersioned.VersionNumber { get; set; }
public string State { get; set; }
public double WaitingTimeBefore { get; set; }
public DateTime? ArrivalTime { get; set; }
public DateTime? DepartureTime { get; set; }
public List<Link> Meta { get; set; }
public string DataState { get; set; }
public string FeasibilityState { get; set; }
public int TaskEventId { get; set; }
public KPIData KPIs { get; set; }
public string Type { get; set; }
public LocationData Location { get; set; }
}
}
|
mit
|
C#
|
9cab2b68fbcfd505f996da2982c792f9d39b7ee6
|
remove destroyed bullets
|
pako1337/raim,pako1337/raim,pako1337/raim
|
PaCode.Raim/Home/RaimHub.cs
|
PaCode.Raim/Home/RaimHub.cs
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Nancy.Helpers;
using PaCode.Raim.Model;
namespace PaCode.Raim.Home
{
public class RaimHub : Hub
{
private static Dictionary<string, Player> players = new Dictionary<string, Player>();
private static List<IGameObject> gameObjects = new List<IGameObject>();
public void Register(string name)
{
name = HttpUtility.HtmlEncode(name);
var player = Player.Create(name, 250, 250);
players.Add(Context.ConnectionId, player);
gameObjects.Add(player);
Clients.Caller.SignedIn(player.Id);
Clients.All.Registered(player);
Clients.Caller.OtherPlayers(players.Values.Where(p => p.Name != name));
UpdateGameState();
Clients.All.PlayerMoved(gameObjects);
}
public void SignOff()
{
var player = players[Context.ConnectionId];
players.Remove(Context.ConnectionId);
gameObjects.RemoveAll(g => player.Bullets.Any(b => b.Id == g.Id));
gameObjects.RemoveAll(g => g.Id == player.Id);
Clients.All.SignedOff(player.Name);
UpdateGameState();
Clients.All.PlayerMoved(gameObjects);
}
public override Task OnDisconnected(bool stopCalled)
{
SignOff();
return base.OnDisconnected(stopCalled);
}
public void PlayerMoving(PlayerInput input)
{
var updateTime = DateTime.Now;
UpdateGameState(updateTime);
var player = players[Context.ConnectionId];
var createdObjects = player.ProcessInput(input, updateTime);
gameObjects.AddRange(createdObjects);
Clients.All.PlayerMoved(gameObjects);
}
private void UpdateGameState(DateTime? updateTimestamp = null)
{
var updateTime = updateTimestamp ?? DateTime.Now;
foreach (var gameObject in gameObjects)
gameObject.Update(updateTime);
var destroyedObjects = gameObjects.OfType<IDestroyable>().Where(g => g.IsDestroyed).Select(g => ((IGameObject)g).Id).ToList();
gameObjects.RemoveAll(g => destroyedObjects.Contains(g.Id));
}
}
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Nancy.Helpers;
using PaCode.Raim.Model;
namespace PaCode.Raim.Home
{
public class RaimHub : Hub
{
private static Dictionary<string, Player> players = new Dictionary<string, Player>();
private static List<IGameObject> gameObjects = new List<IGameObject>();
public void Register(string name)
{
name = HttpUtility.HtmlEncode(name);
var player = Player.Create(name, 250, 250);
players.Add(Context.ConnectionId, player);
gameObjects.Add(player);
Clients.Caller.SignedIn(player.Id);
Clients.All.Registered(player);
Clients.Caller.OtherPlayers(players.Values.Where(p => p.Name != name));
UpdateGameState();
Clients.All.PlayerMoved(gameObjects);
}
public void SignOff()
{
var player = players[Context.ConnectionId];
players.Remove(Context.ConnectionId);
gameObjects.RemoveAll(g => player.Bullets.Any(b => b.Id == g.Id));
gameObjects.RemoveAll(g => g.Id == player.Id);
Clients.All.SignedOff(player.Name);
UpdateGameState();
Clients.All.PlayerMoved(gameObjects);
}
public override Task OnDisconnected(bool stopCalled)
{
SignOff();
return base.OnDisconnected(stopCalled);
}
public void PlayerMoving(PlayerInput input)
{
var updateTime = DateTime.Now;
UpdateGameState(updateTime);
var player = players[Context.ConnectionId];
var createdObjects = player.ProcessInput(input, updateTime);
gameObjects.AddRange(createdObjects);
Clients.All.PlayerMoved(gameObjects);
}
private void UpdateGameState(DateTime? updateTimestamp = null)
{
var updateTime = updateTimestamp ?? DateTime.Now;
foreach (var gameObject in gameObjects)
gameObject.Update(updateTime);
}
}
}
|
mit
|
C#
|
0cde03d0f2db87d01dbde0289906cc923728b85a
|
Optimize line/col tracking in Stringes
|
TheBerkin/Rant
|
Rant/Core/Stringes/Chare.cs
|
Rant/Core/Stringes/Chare.cs
|
using System.Globalization;
namespace Rant.Core.Stringes
{
/// <summary>
/// Represents a charactere, which provides location information on a character taken from a stringe.
/// </summary>
internal sealed class Chare
{
private int _column;
private int _line;
internal Chare(Stringe source, char c, int offset)
{
Source = source;
Character = c;
Offset = offset;
_line = _column = 0;
}
internal Chare(Stringe source, char c, int offset, int line, int col)
{
Source = source;
Character = c;
Offset = offset;
_line = line;
_column = col;
}
/// <summary>
/// The stringe from which the charactere was taken.
/// </summary>
public Stringe Source { get; }
/// <summary>
/// The underlying character.
/// </summary>
public char Character { get; }
/// <summary>
/// The index of the character in the main string.
/// </summary>
public int Offset { get; }
/// <summary>
/// The line on which the charactere appears.
/// </summary>
public int Line
{
get
{
if (_line == 0) SetLineCol();
return _line;
}
}
/// <summary>
/// The column on which the charactere appears.
/// </summary>
public int Column
{
get
{
if (_column == 0) SetLineCol();
return _column;
}
}
private bool Equals(Chare other)
{
return Character == other.Character;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj is Chare && Equals((Chare)obj);
}
public override int GetHashCode()
{
return Character.GetHashCode();
}
private void SetLineCol()
{
_line = Source.Line;
_column = Source.Column;
if (Offset <= 0) return; // We are at the first character, nothing to do here
int start = Offset - 1; // We have to start at least at the previous character
// Find the last character before this one that has line/col assigned
for (; start >= 0; start--)
{
if (Source[start]._line > 0) break;
}
// Fill all lines/cols on previous chars and current one
for (int i = start; i < Offset; i++)
{
if (Source.ParentString[Offset] == '\n')
{
Source[i]._line = _line++;
Source[i]._column = _column = 1;
}
else
{
Source[i]._column = _column++;
}
}
}
/// <summary>
/// Returns the string representation of the current charactere.
/// </summary>
/// <returns></returns>
public override string ToString() => Character.ToString(CultureInfo.InvariantCulture);
public static bool operator ==(Chare chare, char c)
{
return chare?.Character == c;
}
public static bool operator !=(Chare chare, char c)
{
return !(chare == c);
}
}
}
|
using System.Globalization;
namespace Rant.Core.Stringes
{
/// <summary>
/// Represents a charactere, which provides location information on a character taken from a stringe.
/// </summary>
internal sealed class Chare
{
private int _column;
private int _line;
internal Chare(Stringe source, char c, int offset)
{
Source = source;
Character = c;
Offset = offset;
_line = _column = 0;
}
internal Chare(Stringe source, char c, int offset, int line, int col)
{
Source = source;
Character = c;
Offset = offset;
_line = line;
_column = col;
}
/// <summary>
/// The stringe from which the charactere was taken.
/// </summary>
public Stringe Source { get; }
/// <summary>
/// The underlying character.
/// </summary>
public char Character { get; }
/// <summary>
/// The position of the charactere in the stringe.
/// </summary>
public int Offset { get; }
/// <summary>
/// The line on which the charactere appears.
/// </summary>
public int Line
{
get
{
if (_line == 0) SetLineCol();
return _line;
}
}
/// <summary>
/// The column on which the charactere appears.
/// </summary>
public int Column
{
get
{
if (_column == 0) SetLineCol();
return _column;
}
}
private bool Equals(Chare other)
{
return Character == other.Character;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
return obj is Chare && Equals((Chare)obj);
}
public override int GetHashCode()
{
return Character.GetHashCode();
}
private void SetLineCol()
{
_line = Source.Line;
_column = Source.Column;
if (Offset <= 0) return;
for (int i = 0; i < Offset; i++)
{
if (Source.ParentString[Offset] == '\n')
{
_line++;
_column = 1;
}
else
{
_column++;
}
}
}
/// <summary>
/// Returns the string representation of the current charactere.
/// </summary>
/// <returns></returns>
public override string ToString() => Character.ToString(CultureInfo.InvariantCulture);
public static bool operator ==(Chare chare, char c)
{
return chare?.Character == c;
}
public static bool operator !=(Chare chare, char c)
{
return !(chare == c);
}
}
}
|
mit
|
C#
|
f71843ee2e34506e9d43343a8e22c54a9a560136
|
Fix 2
|
waldemarzubik/TechTalkWroclaw
|
Base/NavigationBase.cs
|
Base/NavigationBase.cs
|
using System;
using System.Collections.Generic;
using TechTalk.Interfaces;
using TechTalk.ViewModels;
namespace TechTalk
{
public abstract class NavigationBase : INavigation
{
public virtual void GoBack()
{
throw new NotImplementedException();
}
public virtual void NavigateTo<T>() where T : IBaseViewModel
{
InternalNavigation<T, object>(null);
}
public virtual void NavigateTo<T, G>(G parameter) where T : IBaseViewModel
{
InternalNavigation<T, G>(parameter);
}
protected Dictionary<Type, Type> NavigationPages;
protected abstract void InitPagesMappings();
protected abstract void InternalNavigation<T, G>(G parameter) where T : IBaseViewModel;
}
}
|
using System;
using System.Collections.Generic;
using TechTalk.Interfaces;
using TechTalk.ViewModels;
namespace TechTalk
{
<<<<<<< HEAD
public abstract class NavigationBase : INavigation
{
public virtual void GoBack()
{
throw new NotImplementedException();
}
public virtual void NavigateTo<T>() where T : IBaseViewModel
{
InternalNavigation<T, object>(null);
}
public virtual void NavigateTo<T, G>(G parameter) where T : IBaseViewModel
{
InternalNavigation<T, G>(parameter);
}
=======
public abstract class NavigationBase : INavigation
{
public abstract void GoBack();
public abstract void NavigateTo<T>() where T : IBaseViewModel;
public abstract void NavigateTo<T, G>(G parameter) where T : IBaseViewModel;
>>>>>>> origin/master
protected Dictionary<Type, Type> NavigationPages = new Dictionary<Type, Type>();
protected abstract void InitPagesMappings();
<<<<<<< HEAD
protected abstract void InternalNavigation<T, G>(G parameter) where T : IBaseViewModel;
}
=======
}
>>>>>>> origin/master
}
|
mit
|
C#
|
255dcf891e4605897e08113e4055bb6961fabac3
|
Add a patch number.
|
xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents,xamarin/XamarinComponents
|
Android/GoogleDagger/build.cake
|
Android/GoogleDagger/build.cake
|
var TARGET = Argument ("t", Argument ("target", "ci"));
var DAGGERS_VERSION = "2.25.2";
var DAGGERS_NUGET_VERSION = DAGGERS_VERSION + ".1";
var DAGGERS_URL = $"http://central.maven.org/maven2/com/google/dagger/dagger/{DAGGERS_VERSION}/dagger-{DAGGERS_VERSION}.jar";
Task ("externals")
.WithCriteria (!FileExists ("./externals/dagger.jar"))
.Does (() =>
{
EnsureDirectoryExists ("./externals");
// Download Dependencies
DownloadFile (DAGGERS_URL, "./externals/dagger.jar");
// Update .csproj nuget versions
XmlPoke("./source/dagger/dagger.csproj", "/Project/PropertyGroup/PackageVersion", DAGGERS_NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task("ci")
.IsDependentOn("samples");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", new DeleteDirectorySettings {
Recursive = true,
Force = true
});
});
RunTarget (TARGET);
|
var TARGET = Argument ("t", Argument ("target", "ci"));
var DAGGERS_VERSION = "2.25.2";
var DAGGERS_NUGET_VERSION = DAGGERS_VERSION;
var DAGGERS_URL = $"http://central.maven.org/maven2/com/google/dagger/dagger/{DAGGERS_VERSION}/dagger-{DAGGERS_VERSION}.jar";
Task ("externals")
.WithCriteria (!FileExists ("./externals/dagger.jar"))
.Does (() =>
{
EnsureDirectoryExists ("./externals");
// Download Dependencies
DownloadFile (DAGGERS_URL, "./externals/dagger.jar");
// Update .csproj nuget versions
XmlPoke("./source/dagger/dagger.csproj", "/Project/PropertyGroup/PackageVersion", DAGGERS_NUGET_VERSION);
});
Task("libs")
.IsDependentOn("externals")
.Does(() =>
{
MSBuild("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.Restore = true;
c.MaxCpuCount = 0;
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("nuget")
.IsDependentOn("libs")
.Does(() =>
{
MSBuild ("./GoogleDagger.sln", c => {
c.Configuration = "Release";
c.MaxCpuCount = 0;
c.Targets.Clear();
c.Targets.Add("Pack");
c.Properties.Add("PackageOutputPath", new [] { MakeAbsolute(new FilePath("./output")).FullPath });
c.Properties.Add("PackageRequireLicenseAcceptance", new [] { "true" });
c.Properties.Add("DesignTimeBuild", new [] { "false" });
});
});
Task("samples")
.IsDependentOn("nuget");
Task("ci")
.IsDependentOn("samples");
Task ("clean")
.Does (() =>
{
if (DirectoryExists ("./externals/"))
DeleteDirectory ("./externals", new DeleteDirectorySettings {
Recursive = true,
Force = true
});
});
RunTarget (TARGET);
|
mit
|
C#
|
087ed52a33b06c83927ee12bf7f07d73fc703518
|
Bump version
|
OrleansContrib/Orleankka,pkese/Orleankka,yevhen/Orleankka,mhertis/Orleankka,llytvynenko/Orleankka,AntyaDev/Orleankka,llytvynenko/Orleankka,OrleansContrib/Orleankka,yevhen/Orleankka,AntyaDev/Orleankka,pkese/Orleankka,mhertis/Orleankka
|
Source/Orleankka.Version.cs
|
Source/Orleankka.Version.cs
|
using System.Reflection;
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]
|
using System.Reflection;
[assembly: AssemblyVersion("0.8.8.0")]
[assembly: AssemblyFileVersion("0.8.8.0")]
|
apache-2.0
|
C#
|
f359ad963a6014e37d5f6d38b37942e81ed177c5
|
Add ToString for ServiceDefinitionError.
|
FacilityApi/Facility
|
src/Facility.Definition/ServiceDefinitionError.cs
|
src/Facility.Definition/ServiceDefinitionError.cs
|
using System;
namespace Facility.Definition
{
/// <summary>
/// An error while processing a service definition.
/// </summary>
public sealed class ServiceDefinitionError
{
/// <summary>
/// Creates an error.
/// </summary>
public ServiceDefinitionError(string message, NamedTextPosition position, Exception exception = null)
{
Message = message ?? throw new ArgumentNullException(nameof(message));
Position = position;
Exception = exception;
}
/// <summary>
/// The error message.
/// </summary>
public string Message { get; }
/// <summary>
/// The position where the error took place, if any.
/// </summary>
public NamedTextPosition Position { get; }
/// <summary>
/// The exception that caused the error, if any.
/// </summary>
public Exception Exception { get; }
/// <summary>
/// Returns a string that represents the current object.
/// </summary>
public override string ToString() => Position != null ? $"{Position}: {Message}" : Message;
internal ServiceDefinitionException CreateException()
{
return new ServiceDefinitionException(Message, Position, Exception);
}
}
}
|
using System;
namespace Facility.Definition
{
/// <summary>
/// An error while processing a service definition.
/// </summary>
public sealed class ServiceDefinitionError
{
/// <summary>
/// Creates an error.
/// </summary>
public ServiceDefinitionError(string message, NamedTextPosition position, Exception exception = null)
{
Message = message ?? throw new ArgumentNullException(nameof(message));
Position = position;
Exception = exception;
}
/// <summary>
/// The error message.
/// </summary>
public string Message { get; }
/// <summary>
/// The position where the error took place, if any.
/// </summary>
public NamedTextPosition Position { get; }
/// <summary>
/// The exception that caused the error, if any.
/// </summary>
public Exception Exception { get; }
internal ServiceDefinitionException CreateException()
{
return new ServiceDefinitionException(Message, Position, Exception);
}
}
}
|
mit
|
C#
|
5616ce0bfafc19f34a7a13cb7ef0628c48285043
|
Fix for #36 - IBuilder extension methods should take IRouter
|
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
|
src/Microsoft.AspNet.Routing/BuilderExtensions.cs
|
src/Microsoft.AspNet.Routing/BuilderExtensions.cs
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet.Routing;
namespace Microsoft.AspNet.Builder
{
public static class BuilderExtensions
{
public static IBuilder UseRouter([NotNull] this IBuilder builder, [NotNull] IRouter router)
{
builder.Use((next) => new RouterMiddleware(next, router).Invoke);
return builder;
}
}
}
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNet;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Routing;
namespace Microsoft.AspNet.Builder
{
public static class BuilderExtensions
{
public static IBuilder UseRouter(this IBuilder builder, IRouteCollection routes)
{
builder.Use((next) => new RouterMiddleware(next, routes).Invoke);
return builder;
}
}
}
|
apache-2.0
|
C#
|
0527afe97fbb4f5b817917cacfb4c5bf5d86a74a
|
Update assembly version.
|
maraf/Money,maraf/Money,maraf/Money
|
src/Money.UI.Universal/Properties/AssemblyInfo.cs
|
src/Money.UI.Universal/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("Money.UI.Universal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Money.UI.Universal")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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")]
[assembly: ComVisible(false)]
|
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("Money.UI.Universal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Money.UI.Universal")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 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")]
[assembly: ComVisible(false)]
|
apache-2.0
|
C#
|
31e2248d59926b0bbd93335ab4e741557339d434
|
Change the method to expression body definition
|
tparviainen/oscilloscope
|
SCPI/IDN.cs
|
SCPI/IDN.cs
|
using System.Linq;
using System.Text;
namespace SCPI
{
public class IDN : ICommand
{
public string Description => "Query the ID string of the instrument";
public string Manufacturer { get; private set; }
public string Model { get; private set; }
public string SerialNumber { get; private set; }
public string SoftwareVersion { get; private set; }
public string HelpMessage() => nameof(IDN);
public string Command(params string[] parameters) => "*IDN?";
public bool Parse(byte[] data)
{
// RIGOL TECHNOLOGIES,<model>,<serial number>,<software version>
var id = Encoding.ASCII.GetString(data).Split(',').Select(f => f.Trim());
// According to IEEE 488.2 there are four fields in the response
if (id.Count() == 4)
{
Manufacturer = id.ElementAt(0);
Model = id.ElementAt(1);
SerialNumber = id.ElementAt(2);
SoftwareVersion = id.ElementAt(3);
return true;
}
return false;
}
}
}
|
using System;
using System.Linq;
using System.Text;
namespace SCPI
{
public class IDN : ICommand
{
public string Description => "Query the ID string of the instrument";
public string Manufacturer { get; private set; }
public string Model { get; private set; }
public string SerialNumber { get; private set; }
public string SoftwareVersion { get; private set; }
public string HelpMessage()
{
return nameof(IDN);
}
public string Command(params string[] parameters)
{
return "*IDN?";
}
public bool Parse(byte[] data)
{
// RIGOL TECHNOLOGIES,<model>,<serial number>,<software version>
var id = Encoding.ASCII.GetString(data).Split(',').Select(f => f.Trim());
// According to IEEE 488.2 there are four fields in the response
if (id.Count() == 4)
{
Manufacturer = id.ElementAt(0);
Model = id.ElementAt(1);
SerialNumber = id.ElementAt(2);
SoftwareVersion = id.ElementAt(3);
return true;
}
return false;
}
}
}
|
mit
|
C#
|
b3882008d6b79fa836ae4b5524c9a670bc2de8cf
|
Update GameEventCharacterTitle.cs
|
ACEmulator/ACE,ACEmulator/ACE,LtRipley36706/ACE,LtRipley36706/ACE,Lidefeath/ACE,ACEmulator/ACE,LtRipley36706/ACE
|
Source/ACE.Server/Network/GameEvent/Events/GameEventCharacterTitle.cs
|
Source/ACE.Server/Network/GameEvent/Events/GameEventCharacterTitle.cs
|
namespace ACE.Server.Network.GameEvent.Events
{
public class GameEventCharacterTitle : GameEventMessage
{
public GameEventCharacterTitle(Session session)
: base(GameEventType.CharacterTitle, GameMessageGroup.UIQueue, session)
{
Writer.Write(1u);
Writer.Write(session.Player.CharacterTitleId ?? 0);
session.Player.NumCharacterTitles = session.Player.Biota.BiotaPropertiesTitleBook.Count;
Writer.Write(session.Player.NumCharacterTitles ?? 0);
foreach (var title in session.Player.Biota.BiotaPropertiesTitleBook)
Writer.Write(title.TitleId);
}
}
}
|
namespace ACE.Server.Network.GameEvent.Events
{
public class GameEventCharacterTitle : GameEventMessage
{
public GameEventCharacterTitle(Session session)
: base(GameEventType.CharacterTitle, GameMessageGroup.UIQueue, session)
{
Writer.Write(1u);
Writer.Write(session.Player.CharacterTitleId ?? 0);
Writer.Write(session.Player.Biota.BiotaPropertiesTitleBook.Count);
foreach (var title in session.Player.Biota.BiotaPropertiesTitleBook)
Writer.Write(title.TitleId);
}
}
}
|
agpl-3.0
|
C#
|
60791f12afad74e563c771e330267d241a2757fa
|
fix thrift common datetime2 get DateTime range bug.
|
yuanrui/Examples,yuanrui/Examples,yuanrui/Examples,yuanrui/Examples,yuanrui/Examples
|
Thrift.Common/DateTime2.cs
|
Thrift.Common/DateTime2.cs
|
using System;
public partial class DateTime2
{
private static readonly DateTime _startTime = new DateTime(1, 1, 1);
public static implicit operator Int64(DateTime2 time)
{
if (time == null)
{
return default(Int64);
}
return time.Value;
}
public static implicit operator DateTime2(Int64 value)
{
return new DateTime2() { Value = value };
}
public static implicit operator DateTime(DateTime2 time)
{
const Int64 MIN_VALUE = 0L;
const Int64 MAX_VALUE = 315537897599999L;
if (time == null || time.Value < MIN_VALUE || time.Value > MAX_VALUE)
{
return _startTime;
}
return _startTime.AddMilliseconds(time.Value);
}
public static implicit operator DateTime2(DateTime time)
{
var value = (time.Ticks - _startTime.Ticks) / 10000;
return new DateTime2() { Value = value };
}
public string ToString(string format)
{
var time = (DateTime)this;
return time.ToString(format);
}
}
|
using System;
public partial class DateTime2
{
private static readonly DateTime _startTime = new DateTime(1, 1, 1);
public static implicit operator Int64(DateTime2 time)
{
if (time == null)
{
return default(Int64);
}
return time.Value;
}
public static implicit operator DateTime2(Int64 value)
{
return new DateTime2() { Value = value };
}
public static implicit operator DateTime(DateTime2 time)
{
if (time == null)
{
return default(DateTime);
}
return _startTime.AddMilliseconds(time.Value);
}
public static implicit operator DateTime2(DateTime time)
{
var value = (time.Ticks - _startTime.Ticks) / 10000;
return new DateTime2() { Value = value };
}
public string ToString(string format)
{
var time = (DateTime)this;
return time.ToString(format);
}
}
|
apache-2.0
|
C#
|
e779033ef054956fe033c032cb04aa53bf323050
|
add link to footer
|
codingteam/codingteam.org.ru,codingteam/codingteam.org.ru
|
Views/Shared/_Layout.cshtml
|
Views/Shared/_Layout.cshtml
|
<!DOCTYPE html>
<html>
<head>
<title>@ViewData["Title"]</title>
<link rel="icon" type="image/png" href="favicon.png">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="~/style.css"/>
</head>
<body>
<div class="container">
<header>
<nav class="navbar navbar-default">
<a class="navbar-brand" href="~/">codingteam</a>
<ul class="nav navbar-nav">
<li><a href="~/">Logs</a></li>
<li><a href="~/resources">Resources</a>
</ul>
</nav>
</header>
<div id="main" role="main">
@RenderBody()
</div>
<footer>© 2016 <a href="https://github.com/codingteam/codingteam.org.ru">codingteam</a></footer>
</div>
</body>
</html>
|
<!DOCTYPE html>
<html>
<head>
<title>@ViewData["Title"]</title>
<link rel="icon" type="image/png" href="favicon.png">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="~/style.css"/>
</head>
<body>
<div class="container">
<header>
<nav class="navbar navbar-default">
<a class="navbar-brand" href="~/">codingteam</a>
<ul class="nav navbar-nav">
<li><a href="~/">Logs</a></li>
<li><a href="~/resources">Resources</a>
</ul>
</nav>
</header>
<div id="main" role="main">
@RenderBody()
</div>
<footer>© 2016 codingteam</footer>
</div>
</body>
</html>
|
mit
|
C#
|
c62893056f25f909787537a39a560d955bb8cf49
|
Add note about reusing of tooltips and the new behaviour
|
ZLima12/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,ppy/osu-framework,ppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework
|
osu.Framework/Graphics/Cursor/IHasCustomTooltip.cs
|
osu.Framework/Graphics/Cursor/IHasCustomTooltip.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.
namespace osu.Framework.Graphics.Cursor
{
/// <summary>
/// Implementing this interface allows the implementing <see cref="Drawable"/> to display a custom tooltip if it is the child of a <see cref="TooltipContainer"/>.
/// Keep in mind that tooltips can only be displayed by a <see cref="TooltipContainer"/> if the <see cref="Drawable"/> implementing <see cref="IHasCustomTooltip"/> has <see cref="Drawable.HandlePositionalInput"/> set to true.
/// </summary>
public interface IHasCustomTooltip : ITooltipContentProvider
{
/// <summary>
/// The custom tooltip that should be displayed.
/// </summary>
/// <remarks>
/// A tooltip may be reused between different drawables with different content if they share the same tooltip type.
/// Therefore it is recommended for all displayed content in the tooltip to be provided by <see cref="TooltipContent"/> instead.
/// </remarks>
/// <returns>The custom tooltip that should be displayed.</returns>
ITooltip GetCustomTooltip();
/// <summary>
/// Tooltip text that shows when hovering the drawable.
/// </summary>
object TooltipContent { get; }
}
/// <inheritdoc />
public interface IHasCustomTooltip<TContent> : IHasCustomTooltip
{
ITooltip IHasCustomTooltip.GetCustomTooltip() => GetCustomTooltip();
/// <inheritdoc cref="IHasCustomTooltip.GetCustomTooltip"/>
new ITooltip<TContent> GetCustomTooltip();
object IHasCustomTooltip.TooltipContent => TooltipContent;
/// <inheritdoc cref="IHasCustomTooltip.TooltipContent"/>
new TContent TooltipContent { get; }
}
}
|
// 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.
namespace osu.Framework.Graphics.Cursor
{
/// <summary>
/// Implementing this interface allows the implementing <see cref="Drawable"/> to display a custom tooltip if it is the child of a <see cref="TooltipContainer"/>.
/// Keep in mind that tooltips can only be displayed by a <see cref="TooltipContainer"/> if the <see cref="Drawable"/> implementing <see cref="IHasCustomTooltip"/> has <see cref="Drawable.HandlePositionalInput"/> set to true.
/// </summary>
public interface IHasCustomTooltip : ITooltipContentProvider
{
/// <summary>
/// The custom tooltip that should be displayed.
/// </summary>
/// <returns>The custom tooltip that should be displayed.</returns>
ITooltip GetCustomTooltip();
/// <summary>
/// Tooltip text that shows when hovering the drawable.
/// </summary>
object TooltipContent { get; }
}
/// <inheritdoc />
public interface IHasCustomTooltip<TContent> : IHasCustomTooltip
{
ITooltip IHasCustomTooltip.GetCustomTooltip() => GetCustomTooltip();
/// <inheritdoc cref="IHasCustomTooltip.GetCustomTooltip"/>
new ITooltip<TContent> GetCustomTooltip();
object IHasCustomTooltip.TooltipContent => TooltipContent;
/// <inheritdoc cref="IHasCustomTooltip.TooltipContent"/>
new TContent TooltipContent { get; }
}
}
|
mit
|
C#
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.