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 |
|---|---|---|---|---|---|---|---|---|
536a8559f62e411e44437fcaae74d76c1804b757 | Update MjpegWriter.cs | secile/MotionJPEGWriter | source/MjpegWriter.cs | source/MjpegWriter.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace GitHub.secile.Avi
{
class MjpegWriter
{
private AviWriter aviWriter;
public MjpegWriter(System.IO.Stream outputAvi, int width, int height, int fps)
{
aviWriter = new AviWriter(outputAvi, "MJPG", width, height, fps);
}
public void AddImage(Bitmap bmp)
{
using (var ms = new System.IO.MemoryStream())
{
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
aviWriter.AddImage(ms.GetBuffer());
}
}
public void Close()
{
aviWriter.Close();
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
namespace GitHub.secile.Avi
{
class MjpegWriter
{
private AviWriter aviWriter;
public MjpegWriter(System.IO.Stream outputAvi, int width, int height, int fps)
{
aviWriter = new AviWriter(outputAvi, "MJPG", width, height, fps);
}
public void AddImage(Bitmap bmp)
{
using (var ms = new System.IO.MemoryStream())
{
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
aviWriter.AddImage(ms.GetBuffer());
}
}
public void Close()
{
aviWriter.Close();
}
}
}
| mit | C# |
bca175b70b70dcd45147b49cb7d35cd356047df1 | Update KeyManager.cs | sentrid/OpenCKMS | OpenCKMS/KeyManager.cs | OpenCKMS/KeyManager.cs | // Copyright 2016 Edward Curren
//
// 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.
namespace OpenCKMS
{
/// <summary>
/// Class KeyManager.
/// </summary>
public class KeyManager
{
}
}
| // Copyright 2016 Edward Curren
//
// 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.
namespace OpenCKMS
{
/// <summary>
/// Class KeyManager.
/// </summary>
public class KeyManager
{
}
} | apache-2.0 | C# |
ef8d6c0b2924036cd5998403d4108f900958bf40 | correct ArrowManager | ice-blaze/msr,ice-blaze/msr | Assets/Scripts/ArrowManager.cs | Assets/Scripts/ArrowManager.cs | using UnityEngine;
using System.Collections.Generic;
public class ArrowManager : MonoBehaviour
{
List<Transform> checkpoints = new List<Transform>();
GameObject arrow;
float baseZscale;
void Start()
{
this.arrow = GameObject.Find("Arrow");
baseZscale = arrow.transform.localScale.x;
GameObject checkpoint = GameObject.Find("CheckPoints");
if (checkpoint != null)
{
foreach (Transform g in checkpoint.transform)
checkpoints.Add(g);
}
}
void Update()
{
if (checkpoints.Count > 0)
{
Vector3 v = checkpoints [0].transform.position;
v.y = transform.position.y;
float distance = Vector3.Distance (v, arrow.transform.position);
arrow.transform.localScale = new Vector3 (arrow.transform.localScale.x, arrow.transform.localScale.y, Mathf.Min (baseZscale * (1 + distance / 100.0f), baseZscale * 3));
arrow.transform.LookAt (v);
}
}
public void RemoveCheckPoint(Collider other)
{
if (checkpoints.Count > 0 && other.transform.Equals (checkpoints [0]))
{
Debug.Log (string.Format("checkpoints.size: {0}", this.checkpoints.Count));
checkpoints.RemoveAt (0);
Debug.Log (string.Format("checkpoints.size: {0}", this.checkpoints.Count));
}
}
public bool PassTroughAllCheckPoints()
{
return checkpoints.Count == 0;
}
}
| using UnityEngine;
using System.Collections.Generic;
public class ArrowManager : MonoBehaviour
{
List<Transform> checkpoints = new List<Transform>();
GameObject arrow;
float baseZscale;
void Start()
{
this.arrow = GameObject.Find("Arrow");
baseZscale = arrow.transform.localScale.x;
<<<<<<< HEAD
// Use this for initialization
void Start () {
arrow = GameObject.Find("Arrow");
baseZscale = arrow.transform.localScale.x;
GameObject checkpoint = GameObject.Find("CheckPoints");
if (checkpoint != null) {
foreach (Transform g in checkpoint.transform) {
checkpoints.Add (g);
}
}
}
// Update is called once per frame
void Update () {
if (checkpoints.Count != 1)
{
Vector3 v = checkpoints [0].transform.position;
v.y = transform.position.y;
float distance = Vector3.Distance (v, arrow.transform.position);
arrow.transform.localScale = new Vector3 (arrow.transform.localScale.x, arrow.transform.localScale.y, Mathf.Min (baseZscale * (1 + distance / 100), baseZscale * 3));
arrow.transform.LookAt (v);
}
}
=======
GameObject checkpoint = GameObject.Find("CheckPoints");
if (checkpoint != null)
{
foreach (Transform g in checkpoint.transform)
checkpoints.Add(g);
}
}
void Update()
{
Vector3 v = checkpoints[0].transform.position;
v.y = transform.position.y;
float distance = Vector3.Distance(v, arrow.transform.position);
arrow.transform.localScale = new Vector3(arrow.transform.localScale.x, arrow.transform.localScale.y, Mathf.Min(baseZscale * (1 + distance / 100.0), baseZscale * 3));
arrow.transform.LookAt(v);
}
>>>>>>> 24819267c28a35767b56007e09c5c112c8df313b
public void RemoveCheckPoint(Collider other)
{
if (checkpoints.Count > 0 && other.transform.Equals (checkpoints [0]))
{
Debug.Log (string.Format("checkpoints.size: {0}", this.checkpoints.Count));
checkpoints.RemoveAt (0);
Debug.Log (string.Format("checkpoints.size: {0}", this.checkpoints.Count));
}
}
public bool PassTroughAllCheckPoints()
{
return checkpoints.Count == 0;
}
}
| mit | C# |
b4369ea97cb410519bc6cc651d711e91a5403279 | Make base ack message not abstract | insthync/LiteNetLibManager,insthync/LiteNetLibManager | Scripts/Messages/BaseAckMessage.cs | Scripts/Messages/BaseAckMessage.cs | using System.Collections;
using System.Collections.Generic;
using LiteNetLib.Utils;
namespace LiteNetLibManager
{
public class BaseAckMessage : ILiteNetLibMessage
{
public uint ackId;
public AckResponseCode responseCode;
public void Deserialize(NetDataReader reader)
{
ackId = reader.GetUInt();
responseCode = (AckResponseCode)reader.GetByte();
DeserializeData(reader);
}
public void Serialize(NetDataWriter writer)
{
writer.Put(ackId);
writer.Put((byte)responseCode);
SerializeData(writer);
}
public virtual void DeserializeData(NetDataReader reader) { }
public virtual void SerializeData(NetDataWriter writer) { }
}
}
| using System.Collections;
using System.Collections.Generic;
using LiteNetLib.Utils;
namespace LiteNetLibManager
{
public abstract class BaseAckMessage : ILiteNetLibMessage
{
public uint ackId;
public AckResponseCode responseCode;
public void Deserialize(NetDataReader reader)
{
ackId = reader.GetUInt();
responseCode = (AckResponseCode)reader.GetByte();
DeserializeData(reader);
}
public void Serialize(NetDataWriter writer)
{
writer.Put(ackId);
writer.Put((byte)responseCode);
SerializeData(writer);
}
public abstract void DeserializeData(NetDataReader reader);
public abstract void SerializeData(NetDataWriter writer);
}
}
| mit | C# |
05d77c16ce93aa1ad492681ef9930b2026c95fd2 | Update test console | refactorsaurusrex/FluentConsole | TestConsole/Program.cs | TestConsole/Program.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentConsole.Library;
namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
var key = "Press any key to continue...".WriteLineWait();
$"You pressed the '{key.Key}' key!".WriteLine(1);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Manual;
FluentConsoleSettings.LineWrapWidth = 25;
"This is a really long string, longer than the default width of the Console window buffer, followed by two line breaks. With any luck, this will be displayed as expected!".WriteLine(2);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Auto;
"This is a really long string, longer than the default width of the Console window buffer, followed by two line breaks. With any luck, this will be displayed as expected!".WriteLine(2);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Off;
"This is a really long string, longer than the default width of the Console window buffer, followed by two line breaks. With any luck, this will be displayed as expected!".WriteLine(2);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Auto;
"This is a much shorter string, with zero line breaks.".WriteLine();
"This is a green string with one line break.".WriteLine(ConsoleColor.Green, 1);
"A red string, with zero breaks, and waits after printing".WriteLineWait(ConsoleColor.Red);
"This is a much shorter string, with zero line breaks.".WriteLineWait();
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentConsole.Library;
namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
FluentConsoleSettings.LineWrapOption = LineWrapOption.Manual;
FluentConsoleSettings.LineWrapWidth = 25;
"This is a really long string, longer than the default width of the Console window buffer, followed by two line breaks. With any luck, this will be displayed as expected!".WriteLine(2);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Auto;
"This is a really long string, longer than the default width of the Console window buffer, followed by two line breaks. With any luck, this will be displayed as expected!".WriteLine(2);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Off;
"This is a really long string, longer than the default width of the Console window buffer, followed by two line breaks. With any luck, this will be displayed as expected!".WriteLine(2);
FluentConsoleSettings.LineWrapOption = LineWrapOption.Auto;
"This is a much shorter string, with zero line breaks.".WriteLine();
"This is a green string with one line break.".WriteLine(ConsoleColor.Green, 1);
"A red string, with zero breaks, and waits after printing".WriteLineWait(ConsoleColor.Red);
"This is a much shorter string, with zero line breaks.".WriteLineWait();
}
}
}
| mit | C# |
073f81566d8fe12995f9a94a03a9178c7a3f1383 | Bump version number | pinting/SharpCrop | SharpCrop/Constants.cs | SharpCrop/Constants.cs | using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
namespace SharpCrop
{
public static class Constants
{
// Version
public const int Version = 2100;
// List of the registered providers
public static readonly IReadOnlyList<Type> Providers = new List<Type>()
{
typeof(Dropbox.Provider),
typeof(GoogleDrive.Provider),
typeof(OneDrive.Provider),
typeof(FTP.Provider),
typeof(LocalFile.Provider)
};
// List of avaiable image formats (first if default)
public static readonly IReadOnlyDictionary<string, ImageFormat> ImageFormats = new Dictionary<string, ImageFormat>()
{
{"png", ImageFormat.Png},
{"jpg", ImageFormat.Jpeg},
{"bmp", ImageFormat.Bmp}
};
// List of available FPS values (the first must be the greatest)
public static readonly IReadOnlyList<string> FpsList = new List<string>()
{
"30",
"25",
"20",
"15",
"10",
"5"
};
// General constants
public const string LatestVersion = "http://api.github.com/repos/pinting/SharpCrop/releases/latest";
public static readonly Brush RightColor = Brushes.PaleVioletRed;
public static readonly Brush LeftColor = Brushes.RoyalBlue;
public const string SettingsPath = "Settings.json";
public const int VersionLength = 4;
public const int PenWidth = 2;
// For .NET (Bumpkit) GifEncoder
public const int GifMaxColorDiff = 10;
public const int GifCheckStep = 2;
// For Mono (NGif) GifEncoder
public const int GifQuality = 20;
}
}
| using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
namespace SharpCrop
{
public static class Constants
{
// Version
public const int Version = 2000;
// List of the registered providers
public static readonly IReadOnlyList<Type> Providers = new List<Type>()
{
typeof(Dropbox.Provider),
typeof(GoogleDrive.Provider),
typeof(OneDrive.Provider),
typeof(FTP.Provider),
typeof(LocalFile.Provider)
};
// List of avaiable image formats (first if default)
public static readonly IReadOnlyDictionary<string, ImageFormat> ImageFormats = new Dictionary<string, ImageFormat>()
{
{"png", ImageFormat.Png},
{"jpg", ImageFormat.Jpeg},
{"bmp", ImageFormat.Bmp}
};
// List of available FPS values (the first must be the greatest)
public static readonly IReadOnlyList<string> FpsList = new List<string>()
{
"30",
"25",
"20",
"15",
"10",
"5"
};
// General constants
public const string LatestVersion = "http://api.github.com/repos/pinting/SharpCrop/releases/latest";
public static readonly Brush RightColor = Brushes.PaleVioletRed;
public static readonly Brush LeftColor = Brushes.RoyalBlue;
public const string SettingsPath = "Settings.json";
public const int VersionLength = 4;
public const int PenWidth = 2;
// For .NET (Bumpkit) GifEncoder
public const int GifMaxColorDiff = 10;
public const int GifCheckStep = 2;
// For Mono (NGif) GifEncoder
public const int GifQuality = 20;
}
}
| mit | C# |
7e0d71ed32c629fbcd563b80fcf806b5ac4467ad | Drop useless TagOption entry | red-gate/libgit2sharp,AMSadek/libgit2sharp,psawey/libgit2sharp,dlsteuer/libgit2sharp,ethomson/libgit2sharp,vorou/libgit2sharp,shana/libgit2sharp,GeertvanHorrik/libgit2sharp,Skybladev2/libgit2sharp,psawey/libgit2sharp,Zoxive/libgit2sharp,oliver-feng/libgit2sharp,jeffhostetler/public_libgit2sharp,red-gate/libgit2sharp,sushihangover/libgit2sharp,vivekpradhanC/libgit2sharp,dlsteuer/libgit2sharp,xoofx/libgit2sharp,mono/libgit2sharp,nulltoken/libgit2sharp,whoisj/libgit2sharp,xoofx/libgit2sharp,AArnott/libgit2sharp,oliver-feng/libgit2sharp,vorou/libgit2sharp,github/libgit2sharp,rcorre/libgit2sharp,jorgeamado/libgit2sharp,sushihangover/libgit2sharp,Skybladev2/libgit2sharp,ethomson/libgit2sharp,mono/libgit2sharp,yishaigalatzer/LibGit2SharpCheckOutTests,PKRoma/libgit2sharp,vivekpradhanC/libgit2sharp,AMSadek/libgit2sharp,Zoxive/libgit2sharp,jorgeamado/libgit2sharp,GeertvanHorrik/libgit2sharp,shana/libgit2sharp,yishaigalatzer/LibGit2SharpCheckOutTests,OidaTiftla/libgit2sharp,libgit2/libgit2sharp,OidaTiftla/libgit2sharp,AArnott/libgit2sharp,rcorre/libgit2sharp,github/libgit2sharp,jeffhostetler/public_libgit2sharp,jamill/libgit2sharp,jamill/libgit2sharp,nulltoken/libgit2sharp,whoisj/libgit2sharp | LibGit2Sharp/TagOptions.cs | LibGit2Sharp/TagOptions.cs | using System;
namespace LibGit2Sharp
{
/// <summary>
/// Enum for TagOptions
/// </summary>
public enum TagOption
{
/// <summary>
/// None.
/// </summary>
None = 1, // GIT_REMOTE_DOWNLOAD_TAGS_NONE
/// <summary>
/// Auto.
/// </summary>
Auto, // GIT_REMOTE_DOWNLOAD_TAGS_AUTO
/// <summary>
/// All.
/// </summary>
All, // GIT_REMOTE_DOWNLOAD_TAGS_ALL
}
}
| using System;
namespace LibGit2Sharp
{
/// <summary>
/// Enum for TagOptions
/// </summary>
public enum TagOption
{
/// <summary>
/// Unset.
/// </summary>
Unset = 0, // GIT_REMOTE_DOWNLOAD_TAGS_UNSET
/// <summary>
/// None.
/// </summary>
None, // GIT_REMOTE_DOWNLOAD_TAGS_NONE
/// <summary>
/// Auto.
/// </summary>
Auto, // GIT_REMOTE_DOWNLOAD_TAGS_AUTO
/// <summary>
/// All.
/// </summary>
All, // GIT_REMOTE_DOWNLOAD_TAGS_ALL
}
}
| mit | C# |
5e76acc089754d5b2eb56de42cf11edd690807be | Remove old comments | mono/dbus-sharp-glib,mono/dbus-sharp-glib | glib/GLib.cs | glib/GLib.cs | // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
using NDesk.DBus;
using NDesk.GLib;
using org.freedesktop.DBus;
namespace NDesk.DBus
{
//FIXME: this API needs review and de-unixification. It is horrid, but gets the job done.
public static class BusG
{
static bool initialized = false;
public static void Init ()
{
if (initialized)
return;
Init (Bus.System);
Init (Bus.Session);
//TODO: consider starter bus?
initialized = true;
}
public static void Init (Connection conn)
{
IOFunc dispatchHandler = delegate (IOChannel source, IOCondition condition, IntPtr data) {
if ((condition & IOCondition.Hup) == IOCondition.Hup) {
if (Protocol.Verbose)
Console.Error.WriteLine ("Warning: Connection was probably hung up (" + condition + ")");
//TODO: handle disconnection properly, consider memory management
return false;
}
//this may not provide expected behaviour all the time, but works for now
conn.Iterate ();
return true;
};
Init (conn, dispatchHandler);
}
static void Init (Connection conn, IOFunc dispatchHandler)
{
IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle);
IO.AddWatch (channel, IOCondition.In | IOCondition.Hup, dispatchHandler);
}
}
}
| // Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details
using System;
//using GLib;
//using Gtk;
using NDesk.DBus;
using NDesk.GLib;
using org.freedesktop.DBus;
namespace NDesk.DBus
{
//FIXME: this API needs review and de-unixification. It is horrid, but gets the job done.
public static class BusG
{
static bool initialized = false;
public static void Init ()
{
if (initialized)
return;
Init (Bus.System);
Init (Bus.Session);
//TODO: consider starter bus?
initialized = true;
}
public static void Init (Connection conn)
{
IOFunc dispatchHandler = delegate (IOChannel source, IOCondition condition, IntPtr data) {
if ((condition & IOCondition.Hup) == IOCondition.Hup) {
if (Protocol.Verbose)
Console.Error.WriteLine ("Warning: Connection was probably hung up (" + condition + ")");
//TODO: handle disconnection properly, consider memory management
return false;
}
//this may not provide expected behaviour all the time, but works for now
conn.Iterate ();
return true;
};
Init (conn, dispatchHandler);
}
static void Init (Connection conn, IOFunc dispatchHandler)
{
IOChannel channel = new IOChannel ((int)conn.Transport.SocketHandle);
IO.AddWatch (channel, IOCondition.In | IOCondition.Hup, dispatchHandler);
}
}
}
| mit | C# |
b0d2859e744ea437af3b04613f8599fb66e7a219 | Fix phrasing | reznet/MusicXml.Net,gerryaobrien/MusicXml.Net,vdaron/MusicXml.Net | MusicXml/Domain/Measure.cs | MusicXml/Domain/Measure.cs | using System.Collections.Generic;
namespace MusicXml.Domain
{
public class Measure
{
internal Measure()
{
Width = -1;
Notes = new List<Note>();
Attributes = new MeasureAttributes();
UpperStaffNotesInOrderOfTime = new Dictionary<int, List<Note>>();
}
public int Width { get; internal set; }
public List<Note> Notes { get; internal set; }
public MeasureAttributes Attributes { get; internal set; }
/*
* This structure contains the notes in the order they will appear in the rendered staff from highest to lowest in pitch.
*
* Each key is the absolute postion of the note in the measure. The absolute position is calculated by summing the durations of notes as they are
* parsed. If a backup or forward tag is encountered, the current position is moved and the next insertion checks to see if there is
* already a note at that position and performs an ordered insert.
*/
public Dictionary <int, List<Note>> UpperStaffNotesInOrderOfTime { get; internal set; }
}
}
| using System.Collections.Generic;
namespace MusicXml.Domain
{
public class Measure
{
internal Measure()
{
Width = -1;
Notes = new List<Note>();
Attributes = new MeasureAttributes();
UpperStaffNotesInOrderOfTime = new Dictionary<int, List<Note>>();
}
public int Width { get; internal set; }
public List<Note> Notes { get; internal set; }
public MeasureAttributes Attributes { get; internal set; }
/*
* This structure contains the notes in the order they will appear in the rendered staff from highest to lowest in pitch.
*
* Each key is the absolute postion of the note in the measure. The absolute position is caculated by summing the durations of notes as they are
* parsed. If a backup or forward tag is encountered the current position is moved and the next insertion checks to see if there is
* already a note at that position and performs and ordered insert.
*/
public Dictionary <int, List<Note>> UpperStaffNotesInOrderOfTime { get; internal set; }
}
}
| bsd-3-clause | C# |
e60a79fbedc32e185983f6f4ee3076147a55639f | add benchmarks | runceel/ReactiveProperty,runceel/ReactiveProperty,runceel/ReactiveProperty | Benchmark/Benchmark.V6/BasicUsages.cs | Benchmark/Benchmark.V6/BasicUsages.cs | using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text;
using BenchmarkDotNet.Attributes;
using Reactive.Bindings;
using Reactive.Bindings.Extensions;
namespace ReactivePropertyBenchmark
{
public class BasicUsages
{
[Benchmark]
public ReactiveProperty<string> CreateReactivePropertyInstance() => new ReactiveProperty<string>();
[Benchmark]
public ReactivePropertySlim<string> CreateReactivePropertySlimInstance() => new ReactivePropertySlim<string>();
[Benchmark]
public void BasicForReactiveProperty()
{
var rp = new ReactiveProperty<string>();
var rrp = rp.ToReadOnlyReactiveProperty();
rp.Value = "xxxx";
rp.Dispose();
}
[Benchmark]
public void BasicForReactivePropertySlim()
{
var rp = new ReactivePropertySlim<string>();
var rrp = rp.ToReadOnlyReactivePropertySlim();
rp.Value = "xxxx";
rp.Dispose();
}
[Benchmark]
public IObservable<string> ObserveProperty()
{
var p = new Person();
return p.ObserveProperty(x => x.Name);
}
[Benchmark]
public ReactiveProperty<string> ToReactivePropertyAsSynchronized()
{
var p = new Person();
return p.ToReactivePropertyAsSynchronized(x => x.Name);
}
}
class Person : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private void SetProperty<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value))
{
return;
}
field = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
private string _name;
public string Name
{
get { return _name; }
set { SetProperty(ref _name, value); }
}
}
}
| using System;
using System.Collections.Generic;
using System.Text;
using BenchmarkDotNet.Attributes;
using Reactive.Bindings;
namespace ReactivePropertyBenchmark
{
public class BasicUsages
{
[Benchmark]
public ReactiveProperty<string> CreateReactivePropertyInstance() => new ReactiveProperty<string>();
[Benchmark]
public ReactivePropertySlim<string> CreateReactivePropertySlimInstance() => new ReactivePropertySlim<string>();
[Benchmark]
public void BasicForReactiveProperty()
{
var rp = new ReactiveProperty<string>();
var rrp = rp.ToReadOnlyReactiveProperty();
rp.Value = "xxxx";
rp.Dispose();
}
[Benchmark]
public void BasicForReactivePropertySlim()
{
var rp = new ReactivePropertySlim<string>();
var rrp = rp.ToReadOnlyReactivePropertySlim();
rp.Value = "xxxx";
rp.Dispose();
}
}
}
| mit | C# |
457ce2ddd2ed615748680bfee42c24b7067b9824 | Bump version | Yuisbean/WebMConverter,o11c/WebMConverter,nixxquality/WebMConverter | Properties/AssemblyInfo.cs | 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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.4.0")]
| mit | C# |
38dbe63a7a5cf0469addce3008c39f6ac3e24693 | Update version numbers | mnitchie/EdmundsApiSDK | Properties/AssemblyInfo.cs | 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( "EdmundsApiSDK" )]
[assembly: AssemblyDescription( "Library for consuming the Edmunds.com API" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Mike Nitchie" )]
[assembly: AssemblyProduct( "EdmundsApiSDK" )]
[assembly: AssemblyCopyright( "Copyright © 2015" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "c11cfa75-4b95-44fe-a3c6-010b99a41fbc" )]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion( "0.1.*" )]
[assembly: AssemblyFileVersion( "0.0.1.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( "EdmundsApiSDK" )]
[assembly: AssemblyDescription( "Library for consuming the Edmunds.com API" )]
[assembly: AssemblyConfiguration( "" )]
[assembly: AssemblyCompany( "Mike Nitchie" )]
[assembly: AssemblyProduct( "EdmundsApiSDK" )]
[assembly: AssemblyCopyright( "Copyright © 2015" )]
[assembly: AssemblyTrademark( "" )]
[assembly: AssemblyCulture( "" )]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible( false )]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid( "c11cfa75-4b95-44fe-a3c6-010b99a41fbc" )]
// 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.0.1.0" )]
[assembly: AssemblyFileVersion( "0.0.1.0" )]
| mit | C# |
f406b42fb1c0fbb807cd1cdcd328268f3ba1069e | Bump version | nixxquality/WebMConverter,Yuisbean/WebMConverter,o11c/WebMConverter | Properties/AssemblyInfo.cs | 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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.6.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("WebM for Retards")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WebM for Retards")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("88d1c5f0-e3e0-445a-8e11-a02441ab6ca8")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.5.1")]
| mit | C# |
94f1374c02031833a90be9da7b005885c464f08b | Fix data attribute in ReconnectTeamResult | duracellko/planningpoker4azure,duracellko/planningpoker4azure,duracellko/planningpoker4azure | Duracellko.PlanningPoker/Service/ReconnectTeamResult.cs | Duracellko.PlanningPoker/Service/ReconnectTeamResult.cs | // <copyright>
// Copyright (c) 2012 Rasto Novotny
// </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Duracellko.PlanningPoker.Service
{
/// <summary>
/// Result data of reconnect operation.
/// </summary>
[Serializable]
[DataContract(Name = "reconnectTeamResult", Namespace = Namespaces.PlanningPokerData)]
public class ReconnectTeamResult
{
/// <summary>
/// Gets or sets the Scrum team.
/// </summary>
/// <value>
/// The Scrum team.
/// </value>
[DataMember(Name = "scrumTeam")]
public ScrumTeam ScrumTeam { get; set; }
/// <summary>
/// Gets or sets the last message ID for the member.
/// </summary>
/// <value>
/// The last message ID.
/// </value>
[DataMember(Name = "lastMessageId")]
public long LastMessageId { get; set; }
/// <summary>
/// Gets or sets the last selected estimation by member.
/// </summary>
/// <value>
/// The selected estimation.
/// </value>
[DataMember(Name = "selectedEstimation")]
public Estimation SelectedEstimation { get; set; }
}
}
| // <copyright>
// Copyright (c) 2012 Rasto Novotny
// </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Duracellko.PlanningPoker.Service
{
/// <summary>
/// Result data of reconnect operation.
/// </summary>
[Serializable]
[DataContract(Name = "reconnectTeamResult", Namespace = Namespaces.PlanningPokerData)]
public class ReconnectTeamResult
{
/// <summary>
/// Gets or sets the Scrum team.
/// </summary>
/// <value>
/// The Scrum team.
/// </value>
[DataMember(Name = "scrumTeam")]
public ScrumTeam ScrumTeam { get; set; }
/// <summary>
/// Gets or sets the last message ID for the member.
/// </summary>
/// <value>
/// The last message ID.
/// </value>
[DataMember(Name = "lastMessageId")]
public long LastMessageId { get; set; }
/// <summary>
/// Gets or sets the last selected estimation by member.
/// </summary>
/// <value>
/// The selected estimation.
/// </value>
[DataMember(Name = "lastMessageId")]
public Estimation SelectedEstimation { get; set; }
}
}
| mit | C# |
5873ea633fc0d5eaeeacb9a44c2b626ef990a01f | fix a small typo | toontown-archive/Krypton.LibProtocol | Krypton.LibProtocol/Src/Member/Statement/IfStatement.cs | Krypton.LibProtocol/Src/Member/Statement/IfStatement.cs | using System.Collections.Generic;
using System.Collections.ObjectModel;
using Krypton.LibProtocol.Member.Expression;
using Krypton.LibProtocol.Target;
namespace Krypton.LibProtocol.Member.Statement
{
public class IfStatement : IExpressiveStatementContainer, IStatement, ITemplateType
{
public string TemplateName => "if_statement";
public IStatementContainer Parent { get; }
public IEnumerable<IStatement> Statements { get; }
private IList<IStatement> _statements = new List<IStatement>();
public IList<IExpression> Expressions { get; }
private IList<IExpression> _expressions = new List<IExpression>();
public IfStatement(IStatementContainer parent)
{
Parent = parent;
Statements = new ReadOnlyCollection<IStatement>(_statements);
Expressions = new ReadOnlyCollection<IExpression>(_expressions);
}
public void AddStatement(IStatement statement)
{
_statements.Add(statement);
}
public void AddExpresion(IExpression expression)
{
_expressions.Add(expression);
}
}
}
| using System.Collections.Generic;
using System.Collections.ObjectModel;
using Krypton.LibProtocol.Member.Expression;
using Krypton.LibProtocol.Target;
namespace Krypton.LibProtocol.Member.Statement
{
public class IfStatement : IExpressiveStatementContainer, IStatement, ITemplateType
{
public string TemplateName => "if_statement";
public IStatementContainer Parent { get; }
public IEnumerable<IStatement> Statements { get; }
private IList<IStatement> _statements = new List<IStatement>();
public IList<IExpression> Expressions { get; }
private IList<IExpression> _expressions = new List<IExpression>();
public IfStatement(IStatementContainer parent)
{
Parent = parent;
Statements = new ReadOnlyCollection<IStatement>(_statements);
Expression = new ReadOnlyCollection<IExpression>(_expressions);
}
public void AddStatement(IStatement statement)
{
_statements.Add(statement);
}
public void AddExpresion(IExpression expression)
{
_expressions.Add(expression);
}
}
}
| mit | C# |
a537c1d0f95aa6836933e563bdf201dfe861373a | Add Async suffix to async methods | andyfmiller/LtiLibrary | LtiLibrary.AspNet.Tests/LineItemsControllerUnitTests.cs | LtiLibrary.AspNet.Tests/LineItemsControllerUnitTests.cs | using System;
using System.Net;
using LtiLibrary.Core.Outcomes.v2;
using Newtonsoft.Json;
using Xunit;
namespace LtiLibrary.AspNet.Tests
{
public class LineItemsControllerUnitTests
{
[Fact]
public void GetLineItemBeforePostReturnsNotFound()
{
var controller = new LineItemsController();
ControllerSetup.RegisterContext(controller, "LineItems");
var result = controller.GetAsync(LineItemsController.LineItemId);
Assert.Equal(HttpStatusCode.NotFound, result.Result.StatusCode);
}
[Fact]
public void PostLineItemReturnsValidLineItem()
{
var controller = new LineItemsController();
ControllerSetup.RegisterContext(controller, "LineItems");
var lineitem = new LineItem
{
LineItemOf = new Context { ContextId = LineItemsController.ContextId },
ReportingMethod = "res:Result"
};
var result = controller.PostAsync(LineItemsController.ContextId, lineitem);
Assert.Equal(HttpStatusCode.Created, result.Result.StatusCode);
var lineItem = JsonConvert.DeserializeObject<LineItem>(result.Result.Content.ReadAsStringAsync().Result);
Assert.NotNull(lineItem);
Assert.Equal(LineItemsController.LineItemId, lineItem.Id.ToString());
}
[Fact]
public void GetLineItemsBeforePostReturnsNotFound()
{
var controller = new LineItemsController();
ControllerSetup.RegisterContext(controller, "LineItems");
var result = controller.GetAsync();
Assert.Equal(HttpStatusCode.NotFound, result.Result.StatusCode);
}
}
}
| using System;
using System.Net;
using LtiLibrary.Core.Outcomes.v2;
using Newtonsoft.Json;
using Xunit;
namespace LtiLibrary.AspNet.Tests
{
public class LineItemsControllerUnitTests
{
[Fact]
public void GetLineItemBeforePostReturnsNotFound()
{
var controller = new LineItemsController();
ControllerSetup.RegisterContext(controller, "LineItems");
var result = controller.Get(LineItemsController.LineItemId);
Assert.Equal(HttpStatusCode.NotFound, result.Result.StatusCode);
}
[Fact]
public void PostLineItemReturnsValidLineItem()
{
var controller = new LineItemsController();
ControllerSetup.RegisterContext(controller, "LineItems");
var lineitem = new LineItem
{
LineItemOf = new Context { ContextId = LineItemsController.ContextId },
ReportingMethod = "res:Result"
};
var result = controller.Post(LineItemsController.ContextId, lineitem);
Assert.Equal(HttpStatusCode.Created, result.Result.StatusCode);
var lineItem = JsonConvert.DeserializeObject<LineItem>(result.Result.Content.ReadAsStringAsync().Result);
Assert.NotNull(lineItem);
Assert.Equal(LineItemsController.LineItemId, lineItem.Id.ToString());
}
[Fact]
public void GetLineItemsBeforePostReturnsNotFound()
{
var controller = new LineItemsController();
ControllerSetup.RegisterContext(controller, "LineItems");
var result = controller.Get();
Assert.Equal(HttpStatusCode.NotFound, result.Result.StatusCode);
}
}
}
| apache-2.0 | C# |
f860c5585f431857d5b851ffe4a907ae9d13408b | make NetworkSettings implement common interface. again | olinyavod/Melomans,olinyavod/MessageRouter | Module.MessageRouter.Mobile/Network/NetworkSettings.cs | Module.MessageRouter.Mobile/Network/NetworkSettings.cs | using Sockets.Plugin;
using Sockets.Plugin.Abstractions;
using Module.MessageRouter.Abstractions.Network;
namespace Module.MessageRouter.Mobile.Network
{
public class NetworkSettings: INetworkSettings
{
public int TTL {get;set;}
public int ListenPort { get; set;}
public string MulticastAddress { get; set;}
public ICommsInterface Adapters { get; set; }
public int MulticastPort { get; set;}
public NetworkSettings ()
{
TTL = 10;
MulticastPort = 30307;
ListenPort = 30303;
MulticastAddress = "239.0.0.222";
Adapters = null;
var interfaces = Sockets.Plugin.CommsInterface.GetAllInterfacesAsync ().Result;
foreach (var i in interfaces) {
if (i.IsUsable && !i.IsLoopback) {
//Adapters = i;
break;
}
}
}
}
} | using Sockets.Plugin;
using Sockets.Plugin.Abstractions;
namespace Module.MessageRouter.Mobile.Network
{
public class NetworkSettings
{
public int TTL {get;set;}
public int ListenPort { get; set;}
public string MulticastAddress { get; set;}
public ICommsInterface Adapters { get; set; }
public int MulticastPort { get; set;}
public NetworkSettings ()
{
TTL = 10;
MulticastPort = 30307;
ListenPort = 30303;
MulticastAddress = "239.0.0.222";
Adapters = null;
var interfaces = Sockets.Plugin.CommsInterface.GetAllInterfacesAsync ().Result;
foreach (var i in interfaces) {
if (i.IsUsable && !i.IsLoopback) {
//Adapters = i;
break;
}
}
}
}
} | mit | C# |
e4062ea57cd5dd6f76c5b1146f6d9cd7855fc74e | Use the current working directory if we don't have Unity | wibbe/DreamboundFramework | Dreambound/Scripts/IO/DataSystem.cs | Dreambound/Scripts/IO/DataSystem.cs | using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
#if UNITY_STANDALONE || UNITY_IOS || UNITY_ANDROID
using UnityEngine;
#define HAS_UNITY
#endif
namespace Dreambound.IO
{
public static class DataSystem
{
public static bool Save(Data data, string name)
{
BinaryFormatter serializer = new BinaryFormatter();
using (FileStream stream = new FileStream(GetSavePath(name), FileMode.Create))
{
try
{
serializer.Serialize(stream, data);
}
catch (Exception exception)
{
Log.Warning("Could not save '", GetSavePath(name), "' - ", exception.ToString());
return false;
}
}
return true;
}
public static Data Load(string name)
{
if (!HasData(name))
return null;
BinaryFormatter serializer = new BinaryFormatter();
using (FileStream stream = new FileStream(GetSavePath(name), FileMode.Open))
{
try
{
return serializer.Deserialize(stream) as Data;
}
catch (Exception exception)
{
Log.Warning("Could not load '", GetSavePath(name), "' - ", exception.ToString());
return null;
}
}
}
public static bool DeleteSave(string name)
{
try
{
File.Delete(GetSavePath(name));
}
catch (Exception exception)
{
Log.Warning("Could not delete '", GetSavePath(name), "' - ", exception.ToString());
return false;
}
return true;
}
public static bool HasData(string name)
{
return File.Exists(GetSavePath(name));
}
private static string GetSavePath(string name)
{
#if HAS_UNITY
return Path.Combine(Application.persistentDataPath, name + ".data");
#else
return Path.Combine(Directory.GetCurrentDirectory(), name + ".data");
#endif
}
}
}
| using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
#if UNITY_STANDALONE || UNITY_IOS || UNITY_ANDROID
using UnityEngine;
#define HAS_UNITY
#endif
namespace Dreambound.IO
{
public static class DataSystem
{
public static bool Save(Data data, string name)
{
BinaryFormatter serializer = new BinaryFormatter();
using (FileStream stream = new FileStream(GetSavePath(name), FileMode.Create))
{
try
{
serializer.Serialize(stream, data);
}
catch (Exception exception)
{
Log.Warning("Could not save '", GetSavePath(name), "' - ", exception.ToString());
return false;
}
}
return true;
}
public static Data Load(string name)
{
if (!HasData(name))
return null;
BinaryFormatter serializer = new BinaryFormatter();
using (FileStream stream = new FileStream(GetSavePath(name), FileMode.Open))
{
try
{
return serializer.Deserialize(stream) as Data;
}
catch (Exception exception)
{
Log.Warning("Could not load '", GetSavePath(name), "' - ", exception.ToString());
return null;
}
}
}
public static bool DeleteSave(string name)
{
try
{
File.Delete(GetSavePath(name));
}
catch (Exception exception)
{
Log.Warning("Could not delete '", GetSavePath(name), "' - ", exception.ToString());
return false;
}
return true;
}
public static bool HasData(string name)
{
return File.Exists(GetSavePath(name));
}
private static string GetSavePath(string name)
{
#if HAS_UNITY
return Path.Combine(Application.persistentDataPath, name + ".data");
#else
return name + ".data";
#endif
}
}
}
| mit | C# |
b7fb5548c74898980545bc4ca09731f011953f6c | make IGeneration public | jobeland/GeneticAlgorithm | NeuralNetwork.GeneticAlgorithm/Evolution/IGeneration.cs | NeuralNetwork.GeneticAlgorithm/Evolution/IGeneration.cs | using System;
using System.Collections.Generic;
namespace NeuralNetwork.GeneticAlgorithm.Evolution
{
public interface IGeneration
{
ITrainingSession GetBestPerformer();
IList<ITrainingSession> GetBestPerformers(int numPerformers);
double[] GetEvalsForGeneration();
void Run();
}
}
| using System;
using System.Collections.Generic;
namespace NeuralNetwork.GeneticAlgorithm.Evolution
{
interface IGeneration
{
ITrainingSession GetBestPerformer();
IList<ITrainingSession> GetBestPerformers(int numPerformers);
double[] GetEvalsForGeneration();
void Run();
}
}
| mit | C# |
716fcac216fc9e099ad74659ac39ad0dc0b9e95b | Tidy up RemoteSqlClient correctly when an exception is returned from the host | ProductiveRage/SqlProxyAndReplay | DataProviderClient/RemoteSqlClient.cs | DataProviderClient/RemoteSqlClient.cs | using System;
using System.ServiceModel;
using ProductiveRage.SqlProxyAndReplay.DataProviderInterface.Interfaces;
namespace ProductiveRage.SqlProxyAndReplay.DataProviderClient
{
public sealed class RemoteSqlClient : IDisposable
{
private ChannelFactory<ISqlProxy> _proxyChannelFactory;
private ISqlProxy _proxy;
private bool _faulted, _disposed;
public RemoteSqlClient(Uri endPoint)
{
if (endPoint == null)
throw new ArgumentNullException(nameof(endPoint));
try
{
_proxyChannelFactory = new ChannelFactory<ISqlProxy>(new NetTcpBinding(), new EndpointAddress(endPoint));
_proxy = _proxyChannelFactory.CreateChannel();
((ICommunicationObject)_proxy).Faulted += SetFaulted;
}
catch
{
Dispose(true);
throw;
}
_faulted = false;
_disposed = false;
}
~RemoteSqlClient()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (_disposed)
return;
// Note should only tidy up managed objects if disposing is true - but the proxy object and the channel factory wrap unmanaged resources
// (so we're only tidying up unmanaged resources and so we don't need to check whether disposing is true or not)
// There is an oddity to be aware of when communicating over a channel - if it enters a "faulted state" (meaning that an exception was thrown)
// then an subsequent method calls will fail, including any attempt to Close or Dispose the channel factory. The way to avoid this is to call
// Abort on the proxy when disposing, if a fault occurred (see https://msdn.microsoft.com/en-us/library/aa355056.aspx for more information).
var proxyCommunicationObject = _proxy as ICommunicationObject;
if (proxyCommunicationObject != null)
proxyCommunicationObject.Faulted -= SetFaulted;
if (_faulted)
{
if (proxyCommunicationObject != null)
proxyCommunicationObject.Abort();
}
else
proxyCommunicationObject.Close();
if (!_faulted && (_proxyChannelFactory != null))
((IDisposable)_proxyChannelFactory).Dispose();
_disposed = true;
}
private void SetFaulted(object sender, EventArgs e)
{
_faulted = true;
}
public RemoteSqlConnectionClient GetConnection()
{
ThrowIfDisposed();
return new RemoteSqlConnectionClient(
connection: _proxy,
command: _proxy,
transaction: _proxy,
parameters: _proxy,
parameter: _proxy,
reader: _proxy,
connectionId: _proxy.GetNewConnectionId()
);
}
public RemoteSqlConnectionClient GetConnection(string connectionString)
{
ThrowIfDisposed();
var connection = GetConnection();
connection.ConnectionString = connectionString;
return connection;
}
private void ThrowIfDisposed()
{
if (_disposed)
throw new ObjectDisposedException("client");
}
}
}
| using System;
using System.Data;
using System.ServiceModel;
using ProductiveRage.SqlProxyAndReplay.DataProviderInterface.Interfaces;
namespace ProductiveRage.SqlProxyAndReplay.DataProviderClient
{
public sealed class RemoteSqlClient : IDisposable
{
private ChannelFactory<ISqlProxy> _proxyChannelFactory;
private ISqlProxy _proxy;
private bool _disposed;
public RemoteSqlClient(Uri endPoint)
{
if (endPoint == null)
throw new ArgumentNullException(nameof(endPoint));
try
{
_proxyChannelFactory = new ChannelFactory<ISqlProxy>(new NetTcpBinding(), new EndpointAddress(endPoint));
_proxy = _proxyChannelFactory.CreateChannel();
}
catch
{
Dispose(true);
throw;
}
_disposed = false;
}
~RemoteSqlClient()
{
Dispose(false);
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
private void Dispose(bool disposing)
{
if (_disposed)
return;
if (disposing)
{
if (_proxyChannelFactory != null)
((IDisposable)_proxyChannelFactory).Dispose();
}
_disposed = true;
}
public RemoteSqlConnectionClient GetConnection()
{
ThrowIfDisposed();
return new RemoteSqlConnectionClient(
connection: _proxy,
command: _proxy,
transaction: _proxy,
parameters: _proxy,
parameter: _proxy,
reader: _proxy,
connectionId: _proxy.GetNewConnectionId()
);
}
public RemoteSqlConnectionClient GetConnection(string connectionString)
{
ThrowIfDisposed();
var connection = GetConnection();
connection.ConnectionString = connectionString;
return connection;
}
private void ThrowIfDisposed()
{
if (_disposed)
throw new ObjectDisposedException("client");
}
}
}
| mit | C# |
3397b03120c9290b061b173bee29ed7f32276742 | Use jobs info command for ExecuteTask wait. | YuvalItzchakov/aerospike-client-csharp | AerospikeClient/Task/ExecuteTask.cs | AerospikeClient/Task/ExecuteTask.cs | /*
* Copyright 2012-2015 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements.
*
* 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.
*/
namespace Aerospike.Client
{
/// <summary>
/// Task used to poll for long running execute job completion.
/// </summary>
public sealed class ExecuteTask : BaseTask
{
private readonly long taskId;
private readonly bool scan;
/// <summary>
/// Initialize task with fields needed to query server nodes.
/// </summary>
public ExecuteTask(Cluster cluster, Policy policy, Statement statement)
: base(cluster, policy)
{
this.taskId = statement.taskId;
this.scan = statement.filters == null;
}
/// <summary>
/// Query all nodes for task completion status.
/// </summary>
public override bool QueryIfDone()
{
string module = (scan) ? "scan" : "query";
string command = "jobs:module=" + module + ";cmd=get-job;trid=" + taskId;
Node[] nodes = cluster.Nodes;
bool done = false;
foreach (Node node in nodes)
{
string response = Info.Request(policy, node, command);
if (response.StartsWith("ERROR:"))
{
done = true;
continue;
}
string find = "status=";
int index = response.IndexOf(find);
if (index < 0)
{
continue;
}
int begin = index + find.Length;
int end = response.IndexOf(':', begin);
string status = response.Substring(begin, end - begin);
if (status.Equals("active"))
{
return false;
}
else if (status.StartsWith("done"))
{
done = true;
}
}
return done;
}
}
}
| /*
* Copyright 2012-2015 Aerospike, Inc.
*
* Portions may be licensed to Aerospike, Inc. under one or more contributor
* license agreements.
*
* 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.
*/
namespace Aerospike.Client
{
/// <summary>
/// Task used to poll for long running execute job completion.
/// </summary>
public sealed class ExecuteTask : BaseTask
{
private readonly long taskId;
private readonly bool scan;
/// <summary>
/// Initialize task with fields needed to query server nodes.
/// </summary>
public ExecuteTask(Cluster cluster, Policy policy, Statement statement)
: base(cluster, policy)
{
this.taskId = statement.taskId;
this.scan = statement.filters == null;
}
/// <summary>
/// Query all nodes for task completion status.
/// </summary>
public override bool QueryIfDone()
{
string command = (scan) ? "scan-list" : "query-list";
Node[] nodes = cluster.Nodes;
bool done = false;
foreach (Node node in nodes)
{
string response = Info.Request(policy, node, command);
string find = "job_id=" + taskId + ':';
int index = response.IndexOf(find);
if (index < 0)
{
done = true;
continue;
}
int begin = index + find.Length;
find = "job_status=";
index = response.IndexOf(find, begin);
if (index < 0)
{
continue;
}
begin = index + find.Length;
int end = response.IndexOf(':', begin);
string status = response.Substring(begin, end - begin);
if (status.Equals("ABORTED"))
{
throw new AerospikeException.QueryTerminated();
}
else if (status.Equals("IN PROGRESS"))
{
return false;
}
else if (status.Equals("DONE"))
{
done = true;
}
}
return done;
}
}
}
| apache-2.0 | C# |
cfddaa90e19898a6dade61e59b6440f20f8585da | Bump version | ragnard/Graphite.NET | Graphite/Properties/AssemblyInfo.cs | Graphite/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("Graphite.NET")]
[assembly: AssemblyDescription(".NET client library for Graphite")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ragnar Dahlén")]
[assembly: AssemblyProduct("Graphite.NET")]
[assembly: AssemblyCopyright("Copyright © Ragnar Dahlén")]
[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("675c24c5-d0b9-436a-8eac-aa48394b5ab7")]
// 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("Graphite.NET")]
[assembly: AssemblyDescription(".NET client library for Graphite")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Ragnar Dahlén")]
[assembly: AssemblyProduct("Graphite.NET")]
[assembly: AssemblyCopyright("Copyright © Ragnar Dahlén")]
[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("675c24c5-d0b9-436a-8eac-aa48394b5ab7")]
// 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")]
| bsd-2-clause | C# |
e20a15aadbf4cc07b235223cc66c0dfef7265ae6 | Update Pluton.cs | Notulp/Pluton,Notulp/Pluton | Pluton/Pluton.cs | Pluton/Pluton.cs | using System;
namespace Pluton {
[ConsoleSystem.Factory("pluton")]
public class pluton : ConsoleSystem {
[ConsoleSystem.Admin]
[ConsoleSystem.Help("Helps to break basic functionality", "")]
public static bool enabled;
static pluton() {
pluton.enabled = true;
}
public pluton() : base() {
}
[ConsoleSystem.Admin]
public static void ban(ConsoleSystem.Arg arg) {
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Ban("Banned by: " + nameFrom);
Server.GetServer().Broadcast(arg.ArgsStr + " is banned from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is banned!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
[ConsoleSystem.Admin]
public static void kick(ConsoleSystem.Arg arg) {
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Kick("Kicked by: " + nameFrom);
Server.GetServer().Broadcast(arg.ArgsStr + " is kicked from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is kicked!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
[ConsoleSystem.User]
[ConsoleSystem.Help("pluton.login <rcon.password>", "")]
public static void login(ConsoleSystem.Arg arg) {
if (arg.connection != null && arg.ArgsStr == rcon.password) {
ServerUsers.Set(arg.connection.userid, ServerUsers.UserGroup.Moderator, arg.connection.username, "Console login!");
ServerUsers.Save();
arg.ReplyWith("You are a moderator now!");
}
}
[ConsoleSystem.Admin]
[ConsoleSystem.Help("pluton.reload <optional = plugin name>", "")]
public static void reload(ConsoleSystem.Arg arg) {
if (PluginLoader.Plugins.ContainsKey (arg.ArgsStr)) {
PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr);
arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr));
} else if (arg.ArgsStr == "") {
PluginLoader.GetInstance().ReloadPlugins();
arg.ReplyWith("Pluton reloaded!");
} else {
arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr));
}
}
[ConsoleSystem.Admin]
[ConsoleSystem.Help("Manually saves stats, server", "")]
public static void saveall(ConsoleSystem.Arg arg) {
Bootstrap.SaveAll();
arg.ReplyWith("Everything saved!");
}
}
}
| using System;
namespace Pluton {
[ConsoleSystem.Factory("pluton")]
public class pluton : ConsoleSystem {
[ConsoleSystem.Admin]
[ConsoleSystem.Help("Helps to break basic functionality", "")]
public static bool enabled;
static pluton() {
pluton.enabled = true;
}
public pluton() {
base.\u002Ector();
}
[ConsoleSystem.Admin]
public static void ban(ConsoleSystem.Arg arg) {
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Ban("Banned by: " + nameFrom);
Server.GetServer().Broadcast(arg.ArgsStr + " is banned from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is banned!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
[ConsoleSystem.Admin]
public static void kick(ConsoleSystem.Arg arg) {
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Kick("Kicked by: " + nameFrom);
Server.GetServer().Broadcast(arg.ArgsStr + " is kicked from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is kicked!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
[ConsoleSystem.User]
[ConsoleSystem.Help("pluton.login <rcon.password>", "")]
public static void login(ConsoleSystem.Arg arg) {
if (arg.connection != null && arg.ArgsStr == rcon.password) {
ServerUsers.Set(arg.connection.userid, ServerUsers.UserGroup.Moderator, arg.connection.username, "Console login!");
ServerUsers.Save();
arg.ReplyWith("You are a moderator now!");
}
}
[ConsoleSystem.Admin]
[ConsoleSystem.Help("pluton.reload <optional = plugin name>", "")]
public static void reload(ConsoleSystem.Arg arg) {
if (PluginLoader.Plugins.ContainsKey (arg.ArgsStr)) {
PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr);
arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr));
} else if (arg.ArgsStr == "") {
PluginLoader.GetInstance().ReloadPlugins();
arg.ReplyWith("Pluton reloaded!");
} else {
arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr));
}
}
[ConsoleSystem.Admin]
[ConsoleSystem.Help("Manually saves stats, server", "")]
public static void saveall(ConsoleSystem.Arg arg) {
Bootstrap.SaveAll();
arg.ReplyWith("Everything saved!");
}
}
}
| mit | C# |
a06574d666a0f382054cb681f1f10ef8bb0b6e4c | add a 'connect' button :) | heftig/avahi-1,catta-x/catta,sunilghai/avahi-clone,lathiat/avahi,gloryleague/avahi,Distrotech/avahi,Distrotech/avahi,lathiat/avahi,sunilghai/avahi-clone,heftig/avahi-1,Kisensum/xmDNS-avahi,Distrotech/avahi,sunilghai/avahi-clone,Kisensum/xmDNS-avahi,heftig/avahi,sunilghai/avahi-clone,lathiat/avahi,Kisensum/xmDNS-avahi,heftig/avahi-1,heftig/avahi,heftig/avahi,gloryleague/avahi,Distrotech/avahi,gloryleague/avahi,catta-x/catta,lathiat/avahi,Distrotech/avahi,gloryleague/avahi,gloryleague/avahi,catta-x/catta,Distrotech/avahi,Kisensum/xmDNS-avahi,everbase/catta,heftig/avahi-1,sunilghai/avahi-clone,gloryleague/avahi,lathiat/avahi,lathiat/avahi,heftig/avahi-1,sunilghai/avahi-clone,heftig/avahi-1,everbase/catta,everbase/catta,Kisensum/xmDNS-avahi,heftig/avahi,Kisensum/xmDNS-avahi,heftig/avahi,heftig/avahi | avahi-ui-sharp/zssh.cs | avahi-ui-sharp/zssh.cs | using System;
using System.Diagnostics;
using Gtk;
using Avahi.UI;
public class EntryPoint {
public static void Main () {
Application.Init ();
ServiceDialog dialog = new ServiceDialog ("Choose SSH Server", null,
Stock.Cancel, ResponseType.Cancel,
Stock.Connect, ResponseType.Accept);
dialog.BrowseServiceTypes = new string[] { "_ssh._tcp" };
dialog.ResolveServiceEnabled = true;
if (dialog.Run () == (int) ResponseType.Accept) {
Console.WriteLine ("Connecting to {0}:{1}", dialog.Address, dialog.Port);
string user = Environment.UserName;
foreach (byte[] txtBytes in dialog.TxtData) {
string txt = System.Text.Encoding.UTF8.GetString (txtBytes);
string[] splitTxt = txt.Split(new char[] { '=' }, 2);
if (splitTxt.Length != 2)
continue;
if (splitTxt[0] == "u") {
user = splitTxt[1];
}
string args = String.Format ("gnome-terminal -t {0} -x ssh -p {1} -l {2} {3}",
dialog.HostName, dialog.Port, user, dialog.Address.ToString ());
Console.WriteLine ("Launching: " + args);
Process.Start (args);
}
}
}
}
| using System;
using System.Diagnostics;
using Gtk;
using Avahi.UI;
public class EntryPoint {
public static void Main () {
Application.Init ();
ServiceDialog dialog = new ServiceDialog ("Choose SSH Server", null, Stock.Close, ResponseType.Cancel);
dialog.BrowseServiceTypes = new string[] { "_ssh._tcp" };
dialog.ResolveServiceEnabled = true;
if (dialog.Run () == (int) ResponseType.Accept) {
Console.WriteLine ("Connecting to {0}:{1}", dialog.Address, dialog.Port);
string user = Environment.UserName;
foreach (byte[] txtBytes in dialog.TxtData) {
string txt = System.Text.Encoding.UTF8.GetString (txtBytes);
string[] splitTxt = txt.Split(new char[] { '=' }, 2);
if (splitTxt.Length != 2)
continue;
if (splitTxt[0] == "u") {
user = splitTxt[1];
}
string args = String.Format ("gnome-terminal -t {0} -x ssh -p {1} -l {2} {3}",
dialog.HostName, dialog.Port, user, dialog.Address.ToString ());
Console.WriteLine ("Launching: " + args);
Process.Start (args);
}
}
}
}
| lgpl-2.1 | C# |
4dd65b5b9f949d548ce8a9140eee2bb9819a0b83 | Update AssmeblyInformation | miniter/SSH.NET,GenericHero/SSH.NET,Bloomcredit/SSH.NET,sshnet/SSH.NET | Renci.SshClient/Renci.SshNet/Properties/AssemblyInfo.cs | Renci.SshClient/Renci.SshNet/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System;
// 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("SshNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Renci")]
[assembly: AssemblyProduct("SSH.NET")]
[assembly: AssemblyCopyright("Copyright © Renci 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ad816c5e-6f13-4589-9f3e-59523f8b77a4")]
// 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("2013.1.8")]
[assembly: AssemblyFileVersion("2013.1.8")]
[assembly: AssemblyInformationalVersion("2013.1.8")]
[assembly: CLSCompliant(false)]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System;
// 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("SshNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Renci")]
[assembly: AssemblyProduct("SSH.NET")]
[assembly: AssemblyCopyright("Copyright © Renci 2011")]
[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("ad816c5e-6f13-4589-9f3e-59523f8b77a4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: CLSCompliant(false)]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests")]
| mit | C# |
29f641ba613f005fc1e68d0b6287be6e00b0280f | Update Assmbly information to version 2013.1.27 | Bloomcredit/SSH.NET,sshnet/SSH.NET,GenericHero/SSH.NET,miniter/SSH.NET | Renci.SshClient/Renci.SshNet/Properties/AssemblyInfo.cs | Renci.SshClient/Renci.SshNet/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System;
// 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("SshNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Renci")]
[assembly: AssemblyProduct("SSH.NET")]
[assembly: AssemblyCopyright("Copyright © Renci 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ad816c5e-6f13-4589-9f3e-59523f8b77a4")]
// 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("2013.1.27")]
[assembly: AssemblyFileVersion("2013.1.27")]
[assembly: AssemblyInformationalVersion("2013.1.27")]
[assembly: CLSCompliant(false)]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System;
// 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("SshNet")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("Renci")]
[assembly: AssemblyProduct("SSH.NET")]
[assembly: AssemblyCopyright("Copyright © Renci 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ad816c5e-6f13-4589-9f3e-59523f8b77a4")]
// 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("2013.1.8")]
[assembly: AssemblyFileVersion("2013.1.8")]
[assembly: AssemblyInformationalVersion("2013.1.8")]
[assembly: CLSCompliant(false)]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif | mit | C# |
4a0613672488e4bdcc5d931f7a1b4eebbe0edcf0 | Fix bug in polling logic. | rakutensf-malex/slinqy,rakutensf-malex/slinqy | Source/Slinqy.Test.Functional/Utilities/Polling/Poll.cs | Source/Slinqy.Test.Functional/Utilities/Polling/Poll.cs | namespace Slinqy.Test.Functional.Utilities.Polling
{
using System;
using System.Diagnostics;
using System.Threading;
/// <summary>
/// Provides common polling functionality.
/// </summary>
internal static class Poll
{
/// <summary>
/// Polls the specified function until a certain criteria is met.
/// </summary>
/// <typeparam name="T">Specifies the return type of the from function.</typeparam>
/// <param name="from">Specifies the function to use to retrieve the value.</param>
/// <param name="until">Specifies the function to use to test the value.</param>
/// <param name="interval">Specifies how often to get the latest value via the from function.</param>
/// <param name="maxPollDuration">Specifies the max amount of time to wait for the right value before giving up.</param>
public
static
void
Value<T>(
Func<T> from,
Func<T, bool> until,
TimeSpan interval,
TimeSpan maxPollDuration)
{
var stopwatch = Stopwatch.StartNew();
while (until(from()) == false)
{
if (stopwatch.Elapsed > maxPollDuration)
throw new PollTimeoutException(maxPollDuration);
Thread.Sleep(interval);
}
}
}
}
| namespace Slinqy.Test.Functional.Utilities.Polling
{
using System;
using System.Diagnostics;
using System.Threading;
/// <summary>
/// Provides common polling functionality.
/// </summary>
internal static class Poll
{
/// <summary>
/// Polls the specified function until a certain criteria is met.
/// </summary>
/// <typeparam name="T">Specifies the return type of the from function.</typeparam>
/// <param name="from">Specifies the function to use to retrieve the value.</param>
/// <param name="until">Specifies the function to use to test the value.</param>
/// <param name="interval">Specifies how often to get the latest value via the from function.</param>
/// <param name="maxPollDuration">Specifies the max amount of time to wait for the right value before giving up.</param>
public
static
void
Value<T>(
Func<T> from,
Func<T, bool> until,
TimeSpan interval,
TimeSpan maxPollDuration)
{
var stopwatch = Stopwatch.StartNew();
while (until(from()))
{
if (stopwatch.Elapsed > maxPollDuration)
throw new PollTimeoutException(maxPollDuration);
Thread.Sleep(interval);
}
}
}
}
| mit | C# |
c113020161bd83b540888fd3237e5e382d75edfd | 修正 Bug | wukaixian/DbUtility,wukaixian/DbUtility,Ivony/DbUtility,Ivony/DbUtility | Sources/Ivony.Data.MySql/MySqlClient/MySqlDbExecutor.cs | Sources/Ivony.Data.MySql/MySqlClient/MySqlDbExecutor.cs | using Ivony.Data.Common;
using Ivony.Data.Queries;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ivony.Data.MySqlClient
{
public class MySqlDbExecutor : DbExecutorBase, IDbExecutor<ParameterizedQuery>, IDbTransactionProvider<MySqlDbExecutor>
{
public MySqlDbExecutor( string connectionString, MySqlDbConfiguration configuration )
: base( configuration )
{
if ( connectionString == null )
throw new ArgumentNullException( "connectionString" );
if ( configuration == null )
throw new ArgumentNullException( "configuration" );
ConnectionString = connectionString;
Configuration = configuration;
}
protected string ConnectionString
{
get;
private set;
}
protected MySqlDbConfiguration Configuration
{
get;
private set;
}
public IDbExecuteContext Execute( ParameterizedQuery query )
{
return Execute( CreateCommand( query ), TryCreateTracing( this, query ) );
}
protected virtual IDbExecuteContext Execute( MySqlCommand command, IDbTracing tracing )
{
TryExecuteTracing( tracing, t => t.OnExecuting( command ) );
var connection = new MySqlConnection( ConnectionString );
connection.Open();
command.Connection = connection;
var context = new MySqlExecuteContext( connection, command.ExecuteReader(), tracing );
TryExecuteTracing( tracing, t => t.OnLoadingData( context ) );
return context;
}
private MySqlCommand CreateCommand( ParameterizedQuery query )
{
return new MySqlParameterizedQueryParser().Parse( query );
}
IDbTransactionContext<MySqlDbExecutor> IDbTransactionProvider<MySqlDbExecutor>.CreateTransaction()
{
return new MySqlDbTransactionContext( ConnectionString, Configuration );
}
}
}
| using Ivony.Data.Common;
using Ivony.Data.Queries;
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Ivony.Data.MySqlClient
{
public class MySqlDbExecutor : DbExecutorBase, IDbExecutor<ParameterizedQuery>, IDbTransactionProvider<MySqlDbExecutor>
{
public MySqlDbExecutor( string connectionString, MySqlDbConfiguration configuration )
: base( configuration )
{
if ( connectionString == null )
throw new ArgumentNullException( "connectionString" );
if ( configuration == null )
throw new ArgumentNullException( "configuration" );
ConnectionString = connectionString;
Configuration = configuration;
TraceService = configuration.TraceService ?? BlankTraceService.Instance;
}
protected string ConnectionString
{
get;
private set;
}
protected MySqlDbConfiguration Configuration
{
get;
private set;
}
protected IDbTraceService TraceService
{
get;
private set;
}
public IDbExecuteContext Execute( ParameterizedQuery query )
{
return Execute( CreateCommand( query ), TryCreateTracing( this, query ) );
}
protected virtual IDbExecuteContext Execute( MySqlCommand command, IDbTracing tracing )
{
TryExecuteTracing( tracing, t => t.OnExecuting( command ) );
var connection = new MySqlConnection( ConnectionString );
connection.Open();
command.Connection = connection;
var context = new MySqlExecuteContext( connection, command.ExecuteReader(), tracing );
TryExecuteTracing( tracing, t => t.OnLoadingData( context ) );
return context;
}
private MySqlCommand CreateCommand( ParameterizedQuery query )
{
return new MySqlParameterizedQueryParser().Parse( query );
}
IDbTransactionContext<MySqlDbExecutor> IDbTransactionProvider<MySqlDbExecutor>.CreateTransaction()
{
return new MySqlDbTransactionContext( ConnectionString, Configuration );
}
}
}
| apache-2.0 | C# |
8865392d1808b983daf996bdb05d0ed3715c33fd | update version | prodot/ReCommended-Extension | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | Sources/ReCommendedExtension/Properties/AssemblyInfo.cs | using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2021 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.5.9.0")]
[assembly: AssemblyFileVersion("5.5.9")] | using System.Reflection;
using ReCommendedExtension;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle(ZoneMarker.ExtensionName)]
[assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("prodot GmbH")]
[assembly: AssemblyProduct(ZoneMarker.ExtensionId)]
[assembly: AssemblyCopyright("© 2012-2021 prodot GmbH")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("5.5.8.0")]
[assembly: AssemblyFileVersion("5.5.8")] | apache-2.0 | C# |
9ff3f21a9102ad652a54fba96664b4c8be9f35d8 | fix build on net4.0 | DeonHeyns/Metrics.NET,MetaG8/Metrics.NET,Liwoj/Metrics.NET,MetaG8/Metrics.NET,Recognos/Metrics.NET,ntent-ad/Metrics.NET,MetaG8/Metrics.NET,Liwoj/Metrics.NET,cvent/Metrics.NET,cvent/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,etishor/Metrics.NET,Recognos/Metrics.NET,etishor/Metrics.NET,DeonHeyns/Metrics.NET,ntent-ad/Metrics.NET,huoxudong125/Metrics.NET,huoxudong125/Metrics.NET | Src/Metrics/Utils/Clock.cs | Src/Metrics/Utils/Clock.cs |
using System;
namespace Metrics.Utils
{
public abstract class Clock
{
private sealed class StopwatchClock : Clock
{
private static readonly long factor = (1000L * 1000L * 1000L) / System.Diagnostics.Stopwatch.Frequency;
public override long Nanoseconds { get { return System.Diagnostics.Stopwatch.GetTimestamp() * factor; } }
}
private sealed class SystemClock : Clock
{
public override long Nanoseconds { get { return DateTime.UtcNow.Ticks * 100L; } }
}
public sealed class TestClock : Clock
{
private long nanoseconds = 0;
public override long Nanoseconds { get { return this.nanoseconds; } }
public void Advance(TimeUnit unit, long value)
{
this.nanoseconds += unit.ToNanoseconds(value);
if (Advanced != null)
{
Advanced(this, EventArgs.Empty);
}
}
public event EventHandler Advanced;
}
public static readonly Clock SystemDateTime = new SystemClock();
public static readonly Clock Default = new StopwatchClock();
public abstract long Nanoseconds { get; }
public long Seconds { get { return TimeUnit.Nanoseconds.ToSeconds(Nanoseconds); } }
}
}
|
using System;
namespace Metrics.Utils
{
public abstract class Clock
{
private sealed class StopwatchClock : Clock
{
private static readonly long factor = (1000L * 1000L * 1000L) / System.Diagnostics.Stopwatch.Frequency;
public override long Nanoseconds { get { return System.Diagnostics.Stopwatch.GetTimestamp() * factor; } }
}
private sealed class SystemClock : Clock
{
public override long Nanoseconds { get { return DateTime.UtcNow.Ticks * 100L; } }
}
public sealed class TestClock : Clock
{
private long nanoseconds = 0;
public override long Nanoseconds { get { return this.nanoseconds; } }
public void Advance(TimeUnit unit, long value)
{
this.nanoseconds += unit.ToNanoseconds(value);
if (Advanced != null)
{
Advanced(this, this.nanoseconds);
}
}
public event EventHandler<long> Advanced;
}
public static readonly Clock SystemDateTime = new SystemClock();
public static readonly Clock Default = new StopwatchClock();
public abstract long Nanoseconds { get; }
public long Seconds { get { return TimeUnit.Nanoseconds.ToSeconds(Nanoseconds); } }
}
}
| apache-2.0 | C# |
40f7858e5fa1a1c84be32ae002daeb837a086eb2 | Support config from alternative source | Lethrir/NLogger | NLogger/NLogger/CustomLogFactory.cs | NLogger/NLogger/CustomLogFactory.cs | using System.Collections.Generic;
using System.Configuration;
using System.Linq;
namespace NLogger
{
public class CustomLogFactory<T> where T : NLoggerSection
{
private readonly List<ILogWriterRegistration<T>> _logWriterTypes;
public CustomLogFactory()
{
_logWriterTypes= new List<ILogWriterRegistration<T>>();
}
public void RegisterLogWriterType(ILogWriterRegistration<T> registration)
{
_logWriterTypes.Add(registration);
}
public ILogger CreateLogger(string sectionName, Configuration configFile)
{
var config = (T)configFile.GetSection(sectionName);
return CreateLogger(config);
}
/// <summary>
/// Create a logger using App.config or Web.config settings
/// </summary>
/// <returns></returns>
public ILogger CreateLogger(string sectionName)
{
var config = (T) ConfigurationManager.GetSection(sectionName);
return CreateLogger(config);
}
private ILogger CreateLogger(T config)
{
if (config != null)
{
var writer = GetLogWriter(config);
if (writer != null)
{
return new Logger(writer, config.LogLevel);
}
}
return LoggerFactory.CreateLogger(config);
}
private ILogWriter GetLogWriter(T config)
{
var type = _logWriterTypes.FirstOrDefault(t => t.HasSection(config));
return type != null
? type.GetWriter(config)
: null;
}
}
}
| using System.Collections.Generic;
using System.Configuration;
using System.Linq;
namespace NLogger
{
public class CustomLogFactory<T> where T : NLoggerSection
{
private readonly List<ILogWriterRegistration<T>> _logWriterTypes;
public CustomLogFactory()
{
_logWriterTypes= new List<ILogWriterRegistration<T>>();
}
public void RegisterLogWriterType(ILogWriterRegistration<T> registration)
{
_logWriterTypes.Add(registration);
}
/// <summary>
/// Create a logger using App.config or Web.config settings
/// </summary>
/// <returns></returns>
public ILogger CreateLogger(string sectionName)
{
var config = (T) ConfigurationManager.GetSection(sectionName);
if (config != null)
{
var writer = GetLogWriter(config);
if (writer != null)
{
return new Logger(writer, config.LogLevel);
}
}
return LoggerFactory.CreateLogger(config);
}
private ILogWriter GetLogWriter(T config)
{
var type = _logWriterTypes.FirstOrDefault(t => t.HasSection(config));
return type != null
? type.GetWriter(config)
: null;
}
}
}
| mit | C# |
1ab2381b7afc3d1f532628bdb2f773786b7af1c3 | Remove some unused usings | ccoton/MFlow,ccoton/MFlow,ccoton/MFlow | MFlow.Samples.Mvc/Global.asax.cs | MFlow.Samples.Mvc/Global.asax.cs | using System;
using System.Linq;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace MFlow.Samples.Mvc
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
} | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace MFlow.Samples.Mvc
{
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
AuthConfig.RegisterAuth();
}
}
} | mit | C# |
b5aed429724d2735b0e3a0c699da23a2b24e3bd6 | Add Png,Tiff,Gif,Wmp encoders | tomba/Toolkit,sharpdx/Toolkit,sharpdx/Toolkit | Samples/WIC/EncodeDecode/Program.cs | Samples/WIC/EncodeDecode/Program.cs | // Copyright (c) 2010-2011 SharpDX - Alexandre Mutel
//
// 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.IO;
using SharpDX.WIC;
namespace EncodeDecode
{
static class Program
{
/// <summary>
/// SharpDX WIC sample. Encode to JPG and decode.
/// </summary>
static void Main()
{
var factory = new ImagingFactory();
var stream = new WICStream(factory, "output.jpg", FileAccess.Write);
var encoder = new JpegBitmapEncoder(factory);
encoder.Initialize(stream);
var bitmapFrameEncode = new BitmapFrameEncode(encoder);
bitmapFrameEncode.Options.ImageQuality = 0.8f;
bitmapFrameEncode.Initialize();
bitmapFrameEncode.SetSize(512, 512);
bitmapFrameEncode.PixelFormat = PixelFormat.Format24bppBGR;
//bitmapFrameEncode.WritePixels()
bitmapFrameEncode.Commit();
encoder.Commit();
}
}
}
| // Copyright (c) 2010-2011 SharpDX - Alexandre Mutel
//
// 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.IO;
using SharpDX.WIC;
namespace EncodeDecode
{
static class Program
{
/// <summary>
/// SharpDX WIC sample. Encode to JPG and decode.
/// </summary>
static void Main()
{
var factory = new ImagingFactory();
var stream = new WICStream(factory, "output.jpg", FileAccess.Write);
var encoder = new BitmapEncoder(factory, ContainerFormatGuids.Jpeg);
encoder.Initialize(stream);
var bitmapFrameEncode = new BitmapFrameEncode(encoder);
bitmapFrameEncode.Options.ImageQuality = 0.8f;
bitmapFrameEncode.Initialize();
bitmapFrameEncode.SetSize(512, 512);
bitmapFrameEncode.PixelFormat = PixelFormat.Format24bppBGR;
//bitmapFrameEncode.WritePixels()
bitmapFrameEncode.Commit();
encoder.Commit();
}
}
}
| mit | C# |
ec2723c10ac280cef1178ac9a4a642424088260f | Update AssemblyInfo.cs | demigor/nreact | NReact.Csx/Properties/AssemblyInfo.cs | NReact.Csx/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("NReact.Csx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NReact.Csx")]
[assembly: AssemblyCopyright("Copyright © Lex Lavnikov 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e0f73318-a23b-4926-8cb6-8146f1cca23d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("NReact.Csx")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NReact.Csx")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e0f73318-a23b-4926-8cb6-8146f1cca23d")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
a93b21a07db8add30741717db75df907271781e7 | fix ConsoleWriter QR output | tsongknows/WeChatBot.Net | WeChatBot.Net/Util/ConsoleWriter.cs | WeChatBot.Net/Util/ConsoleWriter.cs | using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace WeChatBot.Net.Util
{
public class ConsoleWriter
{
private const string Black = "";
private const string White = "";
/// <summary>
///
/// </summary>
/// <param name="bitMatrix"></param>
/// <param name="withBorder"></param>
/// <returns></returns>
public async Task WriteToConsoleAsync(List<BitArray> bitMatrix, bool withBorder = true)
{
await Task.Run(() =>
{
foreach (var line in bitMatrix)
{
foreach (bool set in line)
{
var block = withBorder ? set ? White : Black
: set ? Black : White;
Console.Write(block);
}
Console.Write(Environment.NewLine);
}
});
}
}
} | using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace WeChatBot.Net.Util
{
public class ConsoleWriter
{
private const string Black = "";
private const string White = " ";
/// <summary>
///
/// </summary>
/// <param name="bitMatrix"></param>
/// <param name="withBorder"></param>
/// <returns></returns>
public async Task WriteToConsoleAsync(List<BitArray> bitMatrix, bool withBorder = true)
{
await Task.Run(() =>
{
foreach (var line in bitMatrix)
{
foreach (bool set in line)
{
var block = withBorder ? set ? White : Black
: set ? Black : White;
Console.Write(block);
}
Console.Write(Environment.NewLine);
}
});
}
}
} | mit | C# |
20da5d94a26aac8e8323fce409970c2d8a18c167 | update version | gaochundong/Cowboy.WebSockets | Cowboy.WebSockets/SolutionVersion.cs | Cowboy.WebSockets/SolutionVersion.cs | using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Cowboy.WebSockets is a library for building WebSocket based services.")]
[assembly: AssemblyCompany("Dennis Gao")]
[assembly: AssemblyProduct("Cowboy.WebSockets")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.3.1.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: ComVisible(false)]
| using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyDescription("Cowboy.WebSockets is a library for building WebSocket based services.")]
[assembly: AssemblyCompany("Dennis Gao")]
[assembly: AssemblyProduct("Cowboy.WebSockets")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyVersion("1.2.20.0")]
[assembly: AssemblyFileVersion("1.2.20.0")]
[assembly: ComVisible(false)]
| mit | C# |
a7c0dabf2dd181d45e0706526a12f92be434dc7f | Change Namespace | muhammedikinci/FuzzyCore | FuzzyCore/CommandClasses/GetFile.cs | FuzzyCore/CommandClasses/GetFile.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace FuzzyCore.Server.Commands
{
class GetFile
{
ConsoleMessage Message = new ConsoleMessage();
public void GetFileBytes(Data.JsonCommand Command)
{
try
{
byte[] file = File.ReadAllBytes(Command.FilePath + "\\" + Command.Text);
if (file.Length > 0)
{
SendDataArray(file, Command.Client_Socket);
Message.Write(Command.CommandType,ConsoleMessage.MessageType.SUCCESS);
}
}
catch (Exception ex)
{
Message.Write(ex.Message, ConsoleMessage.MessageType.ERROR);
}
}
public void SendDataArray(byte[] Data, Socket Client)
{
try
{
Thread.Sleep(100);
Client.Send(Data);
}
catch (Exception ex)
{
Message.Write(ex.Message, ConsoleMessage.MessageType.ERROR);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace fuzzyControl.Server.Commands
{
class GetFile
{
ConsoleMessage Message = new ConsoleMessage();
public void GetFileBytes(Data.JsonCommand Command)
{
try
{
byte[] file = File.ReadAllBytes(Command.FilePath + "\\" + Command.Text);
if (file.Length > 0)
{
SendDataArray(file, Command.Client_Socket);
Message.Write(Command.CommandType,ConsoleMessage.MessageType.SUCCESS);
}
}
catch (Exception ex)
{
Message.Write(ex.Message, ConsoleMessage.MessageType.ERROR);
}
}
public void SendDataArray(byte[] Data, Socket Client)
{
try
{
Thread.Sleep(100);
Client.Send(Data);
}
catch (Exception ex)
{
Message.Write(ex.Message, ConsoleMessage.MessageType.ERROR);
}
}
}
}
| mit | C# |
80e1d55909210da8fc1a748289805ac5dda76c51 | Handle overflows in line selection | fadookie/monodevelop-justenoughvi,hifi/monodevelop-justenoughvi | JustEnoughVi/ViMode.cs | JustEnoughVi/ViMode.cs | using System;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Extension;
namespace JustEnoughVi
{
public abstract class ViMode
{
protected TextEditor Editor { get; set; }
public Mode RequestedMode { get; internal set; }
protected ViMode(TextEditor editor)
{
Editor = editor;
RequestedMode = Mode.None;
}
public abstract void Activate();
public abstract void Deactivate();
public abstract bool KeyPress (KeyDescriptor descriptor);
protected void SetSelectLines(int start, int end)
{
start = Math.Min(start, Editor.LineCount);
end = Math.Min(end, Editor.LineCount);
var startLine = start > end ? Editor.GetLine(end) : Editor.GetLine(start);
var endLine = start > end ? Editor.GetLine(start) : Editor.GetLine(end);
Editor.SetSelection(startLine.Offset, endLine.EndOffsetIncludingDelimiter);
}
}
}
| using System;
using MonoDevelop.Ide.Editor;
using MonoDevelop.Ide.Editor.Extension;
namespace JustEnoughVi
{
public abstract class ViMode
{
protected TextEditor Editor { get; set; }
public Mode RequestedMode { get; internal set; }
protected ViMode(TextEditor editor)
{
Editor = editor;
RequestedMode = Mode.None;
}
public abstract void Activate();
public abstract void Deactivate();
public abstract bool KeyPress (KeyDescriptor descriptor);
protected void SetSelectLines(int start, int end)
{
var startLine = start > end ? Editor.GetLine(end) : Editor.GetLine(start);
var endLine = start > end ? Editor.GetLine(start) : Editor.GetLine(end);
Editor.SetSelection(startLine.Offset, endLine.EndOffsetIncludingDelimiter);
}
}
}
| mit | C# |
f77d332dbeef8a18e195b256b5a259afbf18752a | Fix possible null-reference error | roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon,roman-yagodin/R7.Epsilon | R7.Epsilon/Skins/Controls/PageInfo.cs | R7.Epsilon/Skins/Controls/PageInfo.cs | //
// PageInfo.ascx.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015
//
// 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 System.Web;
using System.Web.UI;
using DotNetNuke.Entities.Portals;
using System.Web.UI.WebControls;
using System.Web.Security;
using DotNetNuke.UI.WebControls;
using DotNetNuke.Entities.Users;
namespace R7.Epsilon
{
public class PageInfo : EpsilonSkinObjectBase
{
public bool ShowPageInfo { get; set; }
protected PageInfo ()
{
// set default values
ShowPageInfo = true;
}
/// <summary>
/// Gets page published info message.
/// </summary>
/// <value>The published message.</value>
protected string PublishedMessage
{
get
{
var activeTab = PortalSettings.ActiveTab;
var user = activeTab.CreatedByUser (PortalSettings.PortalId);
return string.Format (Localizer.GetString ("PagePublishedMessage.Format"),
activeTab.CreatedOnDate, (user != null)? user.DisplayName : Localizer.GetString ("SystemUser.Text"));
}
}
}
}
| //
// PageInfo.ascx.cs
//
// Author:
// Roman M. Yagodin <roman.yagodin@gmail.com>
//
// Copyright (c) 2015
//
// 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 System.Web;
using System.Web.UI;
using DotNetNuke.Entities.Portals;
using System.Web.UI.WebControls;
using System.Web.Security;
using DotNetNuke.UI.WebControls;
using DotNetNuke.Entities.Users;
namespace R7.Epsilon
{
public class PageInfo : EpsilonSkinObjectBase
{
public bool ShowPageInfo { get; set; }
protected PageInfo ()
{
// set default values
ShowPageInfo = true;
}
/// <summary>
/// Gets page published info message.
/// </summary>
/// <value>The published message.</value>
protected string PublishedMessage
{
get
{
var activeTab = PortalSettings.ActiveTab;
var user = activeTab.CreatedByUser (PortalSettings.PortalId);
return string.Format (Localizer.GetString ("PagePublishedMessage.Format"),
activeTab.CreatedOnDate, Utils.GetUserDisplayName (user.UserID, Localizer.GetString ("SystemUser.Text")));
}
}
}
}
| agpl-3.0 | C# |
6e513a738890d7fe74f433dc1b0712731028fffd | Build Fix - Include missing | amaneureka/AtomOS,amaneureka/AtomOS,amaneureka/AtomOS | src/Compiler/Atomixilc/IL/CodeType/OpToken.cs | src/Compiler/Atomixilc/IL/CodeType/OpToken.cs | /*
* PROJECT: Atomix Development
* LICENSE: Copyright (C) Atomix Development, Inc - All Rights Reserved
* Unauthorized copying of this file, via any medium is
* strictly prohibited Proprietary and confidential.
* PURPOSE: Token Value MSIL
* PROGRAMMERS: Aman Priyadarshi (aman.eureka@gmail.com)
*/
using System;
using System.Reflection;
namespace Atomixilc.IL.CodeType
{
internal class OpToken : OpCodeType
{
internal readonly int Value;
internal readonly Type ValueType;
internal readonly FieldInfo ValueField;
internal bool IsType
{
get
{
if (((Value & 0x02000000) != 0)
|| ((Value & 0x01000000) != 0)
|| ((Value & 0x1B000000) != 0))
return true;
return false;
}
}
internal bool IsField
{
get
{
return ((Value & 0x04000000) != 0);
}
}
internal OpToken(ILCode aCode, int aPosition, int aNextPosition, int aValue, Module aModule, Type[] aTypeGenericArgs, Type[] aMethodGenericArgs, ExceptionHandlingClause aEhc)
:base(aCode, aPosition, aNextPosition, aEhc)
{
Value = aValue;
if (IsField)
ValueField = aModule.ResolveField(Value, aTypeGenericArgs, aMethodGenericArgs);
if (IsType)
ValueType = aModule.ResolveType(Value, aTypeGenericArgs, aMethodGenericArgs);
}
public override string ToString()
{
return string.Format("{0} [0x{1}-0x{2}] {3}", GetType().Name, Position.ToString("X4"), NextPosition.ToString("X4"), IsField ? ValueField.ToString() : ValueType.ToString());
}
}
}
| /*
* PROJECT: Atomix Development
* LICENSE: Copyright (C) Atomix Development, Inc - All Rights Reserved
* Unauthorized copying of this file, via any medium is
* strictly prohibited Proprietary and confidential.
* PURPOSE: Token Value MSIL
* PROGRAMMERS: Aman Priyadarshi (aman.eureka@gmail.com)
*/
using System.Reflection;
namespace Atomixilc.IL.CodeType
{
internal class OpToken : OpCodeType
{
internal readonly int Value;
internal readonly Type ValueType;
internal readonly FieldInfo ValueField;
internal bool IsType
{
get
{
if (((Value & 0x02000000) != 0)
|| ((Value & 0x01000000) != 0)
|| ((Value & 0x1B000000) != 0))
return true;
return false;
}
}
internal bool IsField
{
get
{
return ((Value & 0x04000000) != 0);
}
}
internal OpToken(ILCode aCode, int aPosition, int aNextPosition, int aValue, Module aModule, Type[] aTypeGenericArgs, Type[] aMethodGenericArgs, ExceptionHandlingClause aEhc)
:base(aCode, aPosition, aNextPosition, aEhc)
{
Value = aValue;
if (IsField)
ValueField = aModule.ResolveField(Value, aTypeGenericArgs, aMethodGenericArgs);
if (IsType)
ValueType = aModule.ResolveType(Value, aTypeGenericArgs, aMethodGenericArgs);
}
public override string ToString()
{
return string.Format("{0} [0x{1}-0x{2}] {3}", GetType().Name, Position.ToString("X4"), NextPosition.ToString("X4"), IsField ? ValueField.ToString() : ValueType.ToString());
}
}
}
| bsd-3-clause | C# |
f58e5cfec6ad26883e4bc8801f91b13ab82f817a | Bump assembly version number | nerdfury/Slack.Webhooks,asizikov/Slack.Webhooks,nerdfury/Slack.Webhooks,mteper/Slack.Webhooks,circuitrider/Slack.Webhooks | src/Slack.Webhooks/Properties/AssemblyInfo.cs | src/Slack.Webhooks/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("Slack.Webhooks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Slack.Webhooks")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98c19dcd-28da-4ebf-8e81-c9e051d65625")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.4.*")]
[assembly: AssemblyFileVersion("0.1.4.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("Slack.Webhooks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Slack.Webhooks")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98c19dcd-28da-4ebf-8e81-c9e051d65625")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.3.28")]
[assembly: AssemblyFileVersion("0.1.3.28")]
| mit | C# |
646e035b0a0c490d4922a8c147bd2d2d7b25db6c | update assemblyinfo | yanghongjie/DotNetDev | src/Dev/Properties/AssemblyInfo.cs | src/Dev/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Dev")]
[assembly: AssemblyDescription("C# 常用类库及拓展方法")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("逗豆豆")]
[assembly: AssemblyProduct("Dev")]
[assembly: AssemblyCopyright("逗豆豆")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("56f86cff-c3c9-4216-8bff-fece1d9669f3")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")] | using System.Reflection;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Dev")]
[assembly: AssemblyDescription("DotNet 开发组件")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Dev")]
[assembly: AssemblyCopyright("Copyright © 逗豆豆 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("56f86cff-c3c9-4216-8bff-fece1d9669f3")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")] | apache-2.0 | C# |
4b47b407f18f1a64d5fc1e4a1ae2c24c0b9e6d4a | Edit library version | Vtek/Ninject.WebContext | src/Ninject.WebContext/Properties/AssemblyInfo.cs | src/Ninject.WebContext/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Ninject.WebContext")]
[assembly: AssemblyDescription("Smart IoC library for your WebApp")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Ninject.WebContext")]
[assembly: AssemblyCopyright("Copyright © PONTOREAU Sylvain 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.0.0")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Ninject.WebContext")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("pontoreau")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]
| mit | C# |
6889d63bfae6312cd7585ca3ec2263dd0f820619 | Update BuildWebsite.cs | dotnetsheff/dotnetsheff-api,dotnetsheff/dotnetsheff-api | src/dotnetsheff.Api/BuildWebsite/BuildWebsite.cs | src/dotnetsheff.Api/BuildWebsite/BuildWebsite.cs | using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace dotnetsheff.Api.BuildWebsite
{
public static class BuildWebsite
{
private static readonly HttpClient HttpClient = new HttpClient()
{
BaseAddress = new Uri("https://ci.appveyor.com/"),
DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AppVeyorApiKey")) }
};
[FunctionName("BuildWebsite")]
public static async Task Run([TimerTrigger("0 0 5 * * ?")]TimerInfo myTimer, TraceWriter log)
{
var value = new
{
accountName = "kevbite",
projectSlug = "dotnetsheff",
branch = "master"
};
var responseMessage = await HttpClient.PostAsJsonAsync("api/builds", value);
responseMessage.EnsureSuccessStatusCode();
log.Info($"AppVeyor {value.accountName}/{value.projectSlug} {value.branch} build triggered");
}
}
}
| using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
namespace dotnetsheff.Api.BuildWebsite
{
public static class BuildWebsite
{
private static readonly HttpClient HttpClient = new HttpClient()
{
BaseAddress = new Uri("https://ci.appveyor.com/"),
DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("AppVeyorApiKey")) }
};
[FunctionName("BuildWebsite")]
public static async Task Run([TimerTrigger("0 5 * * *")]TimerInfo myTimer, TraceWriter log)
{
var value = new
{
accountName = "kevbite",
projectSlug = "dotnetsheff",
branch = "master"
};
var responseMessage = await HttpClient.PostAsJsonAsync("api/builds", value);
responseMessage.EnsureSuccessStatusCode();
log.Info($"AppVeyor {value.accountName}/{value.projectSlug} {value.branch} build triggered");
}
}
}
| mit | C# |
380fa199d098875f10c012746685ae3eb02dd629 | copy file listing and file download method | j2ghz/IntranetGJAK,j2ghz/IntranetGJAK | IntranetGJAK/Controllers/FileController.cs | IntranetGJAK/Controllers/FileController.cs | using IntranetGJAK.Models;
using Microsoft.AspNet.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace IntranetGJAK.Controllers
{
using System.IO;
using Serilog;
[Route("api/[controller]")]
public class FileController : Controller
{
[FromServices]
public IFileRepository Files { get; set; }
// GET: api/values
[HttpGet]
public JsonResult Get()
{
Log.Information("Get triggerd");
return Json(Files.GetAll());//TODO return the right format
}
// GET api/values/5
[HttpGet("{id}", Name = "GetTodo")]
public IActionResult GetById(string id)
{
if (!User.Identity.IsAuthenticated)
return HttpUnauthorized();
var item = Files.Find(id);
if (item == null)
{
return HttpNotFound();
}
var file = new FileInfo(item.Path);
return PhysicalFile(file.FullName, "application/octet-stream"); //copypasted from old controller, refactor
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
} | using IntranetGJAK.Models;
using Microsoft.AspNet.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
namespace IntranetGJAK.Controllers
{
[Route("api/[controller]")]
public class FileController : Controller
{
[FromServices]
public IFileRepository Files { get; set; }
// GET: api/values
[HttpGet]
public IEnumerable<File> Get()
{
return Files.GetAll();
}
// GET api/values/5
[HttpGet("{id}", Name = "GetTodo")]
public IActionResult GetById(string id)
{
var item = Files.Find(id);
if (item == null)
{
return HttpNotFound();
}
return new ObjectResult(item);
}
// POST api/values
[HttpPost]
public void Post([FromBody]string value)
{
}
// PUT api/values/5
[HttpPut("{id}")]
public void Put(int id, [FromBody]string value)
{
}
// DELETE api/values/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
} | agpl-3.0 | C# |
345b38a6f6879ae1d9e78d289f0e3845b603e9ac | Update version number. | ronnymgm/csla-light,rockfordlhotka/csla,ronnymgm/csla-light,rockfordlhotka/csla,MarimerLLC/csla,MarimerLLC/csla,BrettJaner/csla,MarimerLLC/csla,JasonBock/csla,jonnybee/csla,JasonBock/csla,jonnybee/csla,BrettJaner/csla,ronnymgm/csla-light,jonnybee/csla,rockfordlhotka/csla,JasonBock/csla,BrettJaner/csla | cslacs/Csla/Properties/AssemblyInfo.cs | cslacs/Csla/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("CSLA .NET")]
[assembly: AssemblyDescription("CSLA .NET Framework")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rockford Lhotka")]
[assembly: AssemblyProduct("CSLA .NET")]
[assembly: AssemblyCopyright("Copyright © 2007 Rockford Lhotka")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Mark the assembly as CLS compliant
[assembly: System.CLSCompliant(true)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("43110d9d-9176-498d-95e0-2be52fcd11d2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.2.0")]
[assembly: AssemblyFileVersion("3.0.2.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("CSLA .NET")]
[assembly: AssemblyDescription("CSLA .NET Framework")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Rockford Lhotka")]
[assembly: AssemblyProduct("CSLA .NET")]
[assembly: AssemblyCopyright("Copyright © 2007 Rockford Lhotka")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Mark the assembly as CLS compliant
[assembly: System.CLSCompliant(true)]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("43110d9d-9176-498d-95e0-2be52fcd11d2")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("3.0.1.0")]
[assembly: AssemblyFileVersion("3.0.1.0")]
| mit | C# |
db4c1b5b5e4cb47155a390ebd382e249ad9b274e | Remove Readline() | SeanDuffy42/SudokuSolver | SudokuSolver/Program.cs | SudokuSolver/Program.cs | using Microsoft.Practices.Unity;
using SudukoSolverLib;
using SudukoSolverLib.Interfaces;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
namespace SudokuSolverConsole
{
class Program
{
static void Main(string[] args)
{
var container = Bootstrap.start();
ISudokuSolver solver = (ISudokuSolver)container.Resolve(typeof(ISudokuSolver));
var fileName = ConfigurationManager.AppSettings["defaultFileName"];
var filesToSolve = new List<string>();
if (args.Length > 0)
{
for (var i = 0; i < args.Length; i++)
{
filesToSolve.Add(args[i]);
}
}
else
{
filesToSolve.Add(fileName);
}
foreach(var fileToSolve in filesToSolve)
{
var grid = solver.SolvePuzzle(fileToSolve);
foreach (var row in grid)
{
foreach (var col in row)
{
if (col.Count == 1)
{
Console.Write(col.Single());
}
else
{
Console.Write('X');
}
}
Console.WriteLine();
}
Console.WriteLine();
}
}
}
}
| using Microsoft.Practices.Unity;
using SudukoSolverLib;
using SudukoSolverLib.Interfaces;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration;
namespace SudokuSolverConsole
{
class Program
{
static void Main(string[] args)
{
var container = Bootstrap.start();
ISudokuSolver solver = (ISudokuSolver)container.Resolve(typeof(ISudokuSolver));
var fileName = ConfigurationManager.AppSettings["defaultFileName"];
var filesToSolve = new List<string>();
if (args.Length > 0)
{
for (var i = 0; i < args.Length; i++)
{
filesToSolve.Add(args[i]);
}
}
else
{
filesToSolve.Add(fileName);
}
foreach(var fileToSolve in filesToSolve)
{
var grid = solver.SolvePuzzle(fileToSolve);
foreach (var row in grid)
{
foreach (var col in row)
{
if (col.Count == 1)
{
Console.Write(col.Single());
}
else
{
Console.Write('X');
}
}
Console.WriteLine();
}
Console.WriteLine();
}
Console.ReadLine();
}
}
}
| mit | C# |
2c1523097f62182c2749747fb437064efb2a7e93 | refactor user agent to more leaner and cleaner | wangkanai/Detection | src/Detection.Core/src/Models/UserAgent.cs | src/Detection.Core/src/Models/UserAgent.cs | // Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
namespace Wangkanai.Detection
{
public class UserAgent
{
private readonly string _useragent;
public UserAgent()
=> _useragent = string.Empty;
public UserAgent(string useragent) : this()
=> _useragent = useragent ?? string.Empty;
public override string ToString()
=> _useragent;
}
}
| // Copyright (c) 2014-2020 Sarin Na Wangkanai, All Rights Reserved.
// The Apache v2. See License.txt in the project root for license information.
namespace Wangkanai.Detection
{
public class UserAgent //: IUserAgent
{
private readonly string useragent;
public UserAgent() => useragent = string.Empty;
public UserAgent(string useragent) : this()
{
if (useragent != null)
this.useragent = useragent;
else
this.useragent = string.Empty;
}
public override string ToString() => useragent;
}
}
| apache-2.0 | C# |
eedf0955b63450fbe528123c62be2ecba417fc32 | Update ProblemDetails.cs | paulcbetts/refit,paulcbetts/refit,PKRoma/refit | Refit/ProblemDetails.cs | Refit/ProblemDetails.cs | using System.Collections.Generic;
namespace Refit
{
/// <summary>
/// The object representing the details about a ValidationException caught by a service implementing RFC 7807.
/// </summary>
public class ProblemDetails
{
/// <summary>
/// Collection of resulting errors for the request.
/// </summary>
public Dictionary<string, string[]> Errors { get; set; } = new Dictionary<string, string[]>();
/// <summary>
/// A URI reference that identifies the problem type.
/// </summary>
public string Type { get; set; } = "about:blank";
/// <summary>
/// A short, human-readable summary of the problem type.
/// </summary>
public string Title { get; set; }
/// <summary>
/// The HTTP status code generated by the origin server for this occurrence of the problem.
/// </summary>
public int Status { get; set; }
/// <summary>
/// A human-readable explanation specific to this occurrence of the problem.
/// </summary>
public string Detail { get; set; }
/// <summary>
/// A URI reference that identifies the specific occurrence of the problem.
/// </summary>
public string Instance { get; set; }
}
}
| using System.Collections.Generic;
namespace Refit
{
public class ProblemDetails
{
/// <summary>
/// Collection of resulting errors for the request.
/// </summary>
public Dictionary<string, string[]> Errors { get; set; } = new Dictionary<string, string[]>();
/// <summary>
/// A URI reference that identifies the problem type.
/// </summary>
public string Type { get; set; } = "about:blank";
/// <summary>
/// A short, human-readable summary of the problem type.
/// </summary>
public string Title { get; set; }
/// <summary>
/// The HTTP status code generated by the origin server for this occurrence of the problem.
/// </summary>
public int Status { get; set; }
/// <summary>
/// A human-readable explanation specific to this occurrence of the problem.
/// </summary>
public string Detail { get; set; }
/// <summary>
/// A URI reference that identifies the specific occurrence of the problem.
/// </summary>
public string Instance { get; set; }
}
}
| mit | C# |
4e473923112e9a5cd291533dbdaf9634fe062ae0 | Test in wrong place | tommarien/zenini | src/Zenini.Tests/Model/An_IniSettings_instance.cs | src/Zenini.Tests/Model/An_IniSettings_instance.cs | using System.Linq;
using NUnit.Framework;
using Shouldly;
using Zenini.Model;
namespace Zenini.Tests.Model
{
[TestFixture]
public class An_IniSettings_instance
{
[SetUp]
public void Setup()
{
sectionOne = new Section("SectionOne");
sectionTwo = new Section("SectionTwo");
settings = new IniSettings(new[] {sectionOne, sectionTwo});
}
private ISection sectionOne;
private ISection sectionTwo;
private IIniSettings settings;
[Test]
public void has_an_indexer_that_returns_an_empty_section_if_none_match()
{
settings["sectionthree"].ShouldBeSameAs(Section.Empty);
}
[Test]
public void has_an_indexer_to_return_a_section()
{
settings["SectionOne"].ShouldBeSameAs(sectionOne);
}
[Test]
public void is_a_container_of_settings()
{
settings.Count().ShouldBe(2);
}
}
} | using System.Linq;
using NUnit.Framework;
using Shouldly;
using Zenini.Model;
namespace Zenini.Tests.Model
{
[TestFixture]
public class An_IniSettings_instance
{
[SetUp]
public void Setup()
{
sectionOne = new Section("SectionOne");
sectionTwo = new Section("SectionTwo");
settings = new IniSettings(new[] {sectionOne, sectionTwo});
}
private ISection sectionOne;
private ISection sectionTwo;
private IIniSettings settings;
[Test]
public void has_an_indexer_that_ignores_string_casing()
{
settings["Sectionone"].ShouldBeSameAs(sectionOne);
}
[Test]
public void has_an_indexer_that_returns_an_empty_section_if_none_match()
{
settings["sectionthree"].ShouldBeSameAs(Section.Empty);
}
[Test]
public void has_an_indexer_to_return_a_section()
{
settings["SectionOne"].ShouldBeSameAs(sectionOne);
}
[Test]
public void is_a_container_of_settings()
{
settings.Count().ShouldBe(2);
}
}
} | mit | C# |
b9a1fbfd1b4d37f0a815c5b3d3cb38a9c224a37c | Fix d71b852 | sergeyshushlyapin/Sitecore-Instance-Manager,Sitecore/Sitecore-Instance-Manager,Brad-Christie/Sitecore-Instance-Manager | src/SIM.Pipelines/Export/ExportSettings.cs | src/SIM.Pipelines/Export/ExportSettings.cs | namespace SIM.Pipelines.Export
{
using System.Diagnostics;
using System.IO;
using SIM.Adapters.WebServer;
internal class ExportSettings : ExportProcessor
{
#region Protected methods
protected override void Process(ExportArgs args)
{
var websiteName = args.Instance.Name;
using (var context = new WebServerManager.WebServerContext())
{
var appPoolName = new Website(args.Instance.ID).GetPool(context).Name;
var websiteSettingsCommand = string.Format(@"%windir%\system32\inetsrv\appcmd list site {0}{1}{0} /config /xml > {2}", '"', websiteName, Path.Combine(args.Folder, "WebsiteSettings.xml"));
var appPoolSettingsCommand = string.Format(@"%windir%\system32\inetsrv\appcmd list apppool {0}{1}{0} /config /xml > {2}", '"', appPoolName, Path.Combine(args.Folder, "AppPoolSettings.xml"));
ExecuteCommand(websiteSettingsCommand);
ExecuteCommand(appPoolSettingsCommand);
}
}
#endregion
#region Private methods
private static void ExecuteCommand(string command)
{
var procStartInfo = new ProcessStartInfo("cmd", $"/c {command}")
{
UseShellExecute = false,
CreateNoWindow = true
};
var proc = new Process
{
StartInfo = procStartInfo
};
proc.Start();
proc.WaitForExit();
}
#endregion
}
} | namespace SIM.Pipelines.Export
{
using System.Diagnostics;
using System.IO;
using SIM.Adapters.WebServer;
internal class ExportSettings : ExportProcessor
{
#region Protected methods
protected override void Process(ExportArgs args)
{
var websiteName = args.Instance.Name;
var appPoolName = new Website(args.Instance.ID).GetPool(new WebServerManager.WebServerContext(string.Empty)).Name;
var websiteSettingsCommand = string.Format(@"%windir%\system32\inetsrv\appcmd list site {0}{1}{0} /config /xml > {2}", '"', websiteName, Path.Combine(args.Folder, "WebsiteSettings.xml"));
var appPoolSettingsCommand = string.Format(@"%windir%\system32\inetsrv\appcmd list apppool {0}{1}{0} /config /xml > {2}", '"', appPoolName, Path.Combine(args.Folder, "AppPoolSettings.xml"));
ExecuteCommand(websiteSettingsCommand);
ExecuteCommand(appPoolSettingsCommand);
}
#endregion
#region Private methods
private static void ExecuteCommand(string command)
{
var procStartInfo = new ProcessStartInfo("cmd", $"/c {command}")
{
UseShellExecute = false,
CreateNoWindow = true
};
var proc = new Process
{
StartInfo = procStartInfo
};
proc.Start();
proc.WaitForExit();
}
#endregion
}
} | mit | C# |
7dcd986def5bd2bdba99acdd79dfb810e02cba3c | Update version number. | Damnae/storybrew | editor/Properties/AssemblyInfo.cs | editor/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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.43.*")]
| 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("storybrew editor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("storybrew editor")]
[assembly: AssemblyCopyright("Copyright © Damnae 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("ff59aeea-c133-4bf8-8a0b-620a3c99022b")]
// 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.42.*")]
| mit | C# |
b2ba1d701922d2312d59099c56cdc31cd3df6975 | Fix issue with getting content. | TastesLikeTurkey/Papyrus | Papyrus/Papyrus.Demo/MainPage.xaml.cs | Papyrus/Papyrus.Demo/MainPage.xaml.cs | using Newtonsoft.Json;
using System;
using System.Diagnostics;
using System.IO;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Papyrus.Demo
{
public sealed partial class MainPage : Page
{
#region EBook
public EBook EBook
{
get => (EBook)GetValue(EBookProperty); set => SetValue(EBookProperty, value);
}
public static readonly DependencyProperty EBookProperty = DependencyProperty.Register("EBook", typeof(EBook), typeof(MainPage), new PropertyMetadata(null));
#endregion EBook
public MainPage()
{
InitializeComponent();
}
private async void OpenFolderButton_Click(object sender, RoutedEventArgs e)
{
var picker = new FolderPicker
{
SettingsIdentifier = "TastesLikeTurkey.Papyrus.OpenFolderPicker",
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
};
picker.FileTypeFilter.Add(".epub"); // This line is very important. The FolderPicker crashes if this line is deleted. See https://stackoverflow.com/questions/40456200/universal-app-folderpicker-system-runtime-interopservices-comexception for more information.
var folder = await picker.PickSingleFolderAsync();
if (folder == null)
return;
EBook = new EBook(folder);
await EBook.InitializeAsync();
Debug.WriteLine($"Content file location (relative): {EBook.ContentLocation}");
Debug.WriteLine($"Content file location (absolute): {Path.Combine(EBook.RootPath, EBook.ContentLocation)}");
Debug.WriteLine($"Metadata: {JsonConvert.SerializeObject(EBook.Metadata, Formatting.Indented)}");
}
private async void NavPointsListView_ItemClick(object sender, ItemClickEventArgs e)
{
var navPoint = e.ClickedItem as NavPoint;
var contents = await EBook.GetContentsAsync(navPoint);
ContentWebView.NavigateToString(contents);
}
}
}
| using Newtonsoft.Json;
using System;
using System.Diagnostics;
using System.IO;
using Windows.Storage.Pickers;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Papyrus.Demo
{
public sealed partial class MainPage : Page
{
#region EBook
public EBook EBook
{
get => (EBook)GetValue(EBookProperty); set => SetValue(EBookProperty, value);
}
public static readonly DependencyProperty EBookProperty = DependencyProperty.Register("EBook", typeof(EBook), typeof(MainPage), new PropertyMetadata(null));
#endregion EBook
public MainPage()
{
InitializeComponent();
}
private async void OpenFolderButton_Click(object sender, RoutedEventArgs e)
{
var picker = new FolderPicker
{
SettingsIdentifier = "TastesLikeTurkey.Papyrus.OpenFolderPicker",
SuggestedStartLocation = PickerLocationId.DocumentsLibrary
};
picker.FileTypeFilter.Add(".epub"); // This line is very important. The FolderPicker crashes if this line is deleted. See https://stackoverflow.com/questions/40456200/universal-app-folderpicker-system-runtime-interopservices-comexception for more information.
var folder = await picker.PickSingleFolderAsync();
if (folder == null)
return;
EBook = new EBook(folder);
await EBook.InitializeAsync();
Debug.WriteLine($"Content file location (relative): {EBook.ContentLocation}");
Debug.WriteLine($"Content file location (absolute): {Path.Combine(EBook.RootPath, EBook.ContentLocation)}");
Debug.WriteLine($"Metadata: {JsonConvert.SerializeObject(EBook.Metadata, Formatting.Indented)}");
}
private async void NavPointsListView_ItemClick(object sender, ItemClickEventArgs e)
{
var navPoint = e.ClickedItem as NavPoint;
var contents = await navPoint.GetContentsAsync();
ContentWebView.NavigateToString(contents);
}
}
}
| mit | C# |
6ef3f23eb5e253b93c7c8b161e445f87c396ccc4 | Update AvailableTranslations.cs | Utdanningsdirektoratet/IdentityServer3.Contrib.Localization,totpero/IdentityServer3.Contrib.Localization,IdentityServer/IdentityServer3.Contrib.Localization,darkestspirit/IdentityServer3.Contrib.Localization,johnkors/IdentityServer3.Contrib.Localization | source/Unittests/AvailableTranslations.cs | source/Unittests/AvailableTranslations.cs | using System.Linq;
using Thinktecture.IdentityServer.Core.Services.Contrib;
using Xunit;
namespace Unittests
{
public class AvailableTranslations
{
[Theory]
[InlineData("Default")]
[InlineData("pirate")]
[InlineData("de-DE")]
[InlineData("es-AR")]
[InlineData("fr-FR")]
[InlineData("nb-NO")]
[InlineData("sv-SE")]
[InlineData("tr-TR")]
[InlineData("ro-RO")]
[InlineData("nl-NL")]
[InlineData("zh-CN")]
public void ContainsLocales(string locale)
{
Assert.Contains(GlobalizedLocalizationService.GetAvailableLocales(), s => s.Equals(locale));
}
[Fact]
public void HasCorrectCount()
{
Assert.Equal(11, GlobalizedLocalizationService.GetAvailableLocales().Count());
}
}
}
| using System.Linq;
using Thinktecture.IdentityServer.Core.Services.Contrib;
using Xunit;
namespace Unittests
{
public class AvailableTranslations
{
[Theory]
[InlineData("Default")]
[InlineData("pirate")]
[InlineData("de-DE")]
[InlineData("es-AR")]
[InlineData("fr-FR")]
[InlineData("nb-NO")]
[InlineData("sv-SE")]
[InlineData("tr-TR")]
[InlineData("ro-RO")]
[InlineData("nl-NL")]
public void ContainsLocales(string locale)
{
Assert.Contains(GlobalizedLocalizationService.GetAvailableLocales(), s => s.Equals(locale));
}
[Fact]
public void HasCorrectCount()
{
Assert.Equal(10, GlobalizedLocalizationService.GetAvailableLocales().Count());
}
}
} | mit | C# |
ce589d7303a2aab1235d933323cc847dc5357cab | Fix for loading mysettings | mrvoorhe/redox-extensions,mrvoorhe/redox-extensions,mrvoorhe/redox-extensions | RedoxExtensions/Settings/ActiveSettings.cs | RedoxExtensions/Settings/ActiveSettings.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using NiceIO;
namespace RedoxExtensions.Settings
{
public static class ActiveSettings
{
private static UserSettings _activeSettings;
public static void Clear()
{
_activeSettings = null;
}
public static void Init(UserSettings userSettings)
{
_activeSettings = userSettings;
}
public static UserSettings Instance
{
get
{
if (_activeSettings == null)
{
var mainSettings = JsonConvert.DeserializeObject<Main>(GetMainSettingsFilePath().ReadAllText());
var expanded = Environment.ExpandEnvironmentVariables(mainSettings.UserSettingsFilePath);
if (!System.IO.Path.IsPathRooted(expanded))
{
expanded = new Uri(typeof(Main).Assembly.CodeBase).LocalPath.ToNPath().Parent.Combine(expanded).ToString();
}
_activeSettings = JsonConvert.DeserializeObject<UserSettings>(System.IO.File.ReadAllText(expanded));
}
return _activeSettings;
}
}
private static NPath GetMainSettingsFilePath()
{
return new Uri(typeof(Main).Assembly.CodeBase).LocalPath.ToNPath().Parent.Combine("settings.json");
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using NiceIO;
namespace RedoxExtensions.Settings
{
public static class ActiveSettings
{
private static UserSettings _activeSettings;
public static void Clear()
{
_activeSettings = null;
}
public static void Init(UserSettings userSettings)
{
_activeSettings = userSettings;
}
public static UserSettings Instance
{
get
{
if (_activeSettings == null)
{
var mainSettings = JsonConvert.DeserializeObject<Main>(GetMainSettingsFilePath().ReadAllText());
var expanded = Environment.ExpandEnvironmentVariables(mainSettings.UserSettingsFilePath);
_activeSettings = JsonConvert.DeserializeObject<UserSettings>(System.IO.File.ReadAllText(expanded));
}
return _activeSettings;
}
}
private static NPath GetMainSettingsFilePath()
{
return new Uri(typeof(Main).Assembly.CodeBase).LocalPath.ToNPath().Parent.Combine("settings.json");
}
}
}
| mit | C# |
3e12204c60ada8164561a841bb8dcb4c96078c99 | Fix sample: encoder must be disposed | weltkante/managed-lzma,weltkante/managed-lzma,weltkante/managed-lzma | sandbox-7z/Program.cs | sandbox-7z/Program.cs | using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using ManagedLzma.LZMA.Master.SevenZip;
namespace sandbox_7z
{
static class Program
{
class Password: master._7zip.Legacy.IPasswordProvider
{
string _pw;
public Password(string pw)
{
_pw = pw;
}
string master._7zip.Legacy.IPasswordProvider.CryptoGetTextPassword()
{
return _pw;
}
}
[STAThread]
static void Main()
{
Directory.CreateDirectory("_test");
using(var stream = new FileStream(@"_test\test.7z", FileMode.Create, FileAccess.ReadWrite, FileShare.Delete))
using(var encoder = new ArchiveWriter.Lzma2Encoder(null))
{
var writer = new ArchiveWriter(stream);
writer.ConnectEncoder(encoder);
string path = Path.GetDirectoryName(typeof(Program).Assembly.Location);
var directory = new DirectoryInfo(path);
foreach(string filename in Directory.EnumerateFiles(path))
writer.WriteFile(directory, new FileInfo(filename));
writer.WriteFinalHeader();
}
{
var db = new master._7zip.Legacy.CArchiveDatabaseEx();
var x = new master._7zip.Legacy.ArchiveReader();
x.Open(new FileStream(@"_test\test.7z", FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete));
x.ReadDatabase(db, null);
db.Fill();
x.Extract(db, null, null);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using ManagedLzma.LZMA.Master.SevenZip;
namespace sandbox_7z
{
static class Program
{
class Password: master._7zip.Legacy.IPasswordProvider
{
string _pw;
public Password(string pw)
{
_pw = pw;
}
string master._7zip.Legacy.IPasswordProvider.CryptoGetTextPassword()
{
return _pw;
}
}
[STAThread]
static void Main()
{
Directory.CreateDirectory("_test");
using(var stream = new FileStream(@"_test\test.7z", FileMode.Create, FileAccess.ReadWrite, FileShare.Delete))
{
var writer = new ArchiveWriter(stream);
writer.ConnectEncoder(new ArchiveWriter.Lzma2Encoder(null));
string path = Path.GetDirectoryName(typeof(Program).Assembly.Location);
var directory = new DirectoryInfo(path);
foreach(string filename in Directory.EnumerateFiles(path))
writer.WriteFile(directory, new FileInfo(filename));
writer.WriteFinalHeader();
}
{
var db = new master._7zip.Legacy.CArchiveDatabaseEx();
var x = new master._7zip.Legacy.ArchiveReader();
x.Open(new FileStream(@"_test\test.7z", FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete));
x.ReadDatabase(db, null);
db.Fill();
x.Extract(db, null, null);
}
}
}
}
| mit | C# |
9f12c3a4e4645b21a4a4a9dba8d81ac859bf2733 | Add safe ctor overload for UnmanagedDataSource. | Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver | src/AsmResolver/IO/UnmanagedDataSource.cs | src/AsmResolver/IO/UnmanagedDataSource.cs | using System;
using System.Runtime.InteropServices;
namespace AsmResolver.IO
{
/// <summary>
/// Represents a data source that obtains its data from a block of unmanaged memory.
/// </summary>
public sealed unsafe class UnmanagedDataSource : IDataSource
{
private readonly void* _basePointer;
/// <summary>
/// Creates a new instance of the <see cref="UnmanagedDataSource"/> class.
/// </summary>
/// <param name="basePointer">The base pointer to start reading from.</param>
/// <param name="length">The total length of the data source.</param>
public UnmanagedDataSource(IntPtr basePointer, ulong length)
: this(basePointer.ToPointer(), length)
{
}
/// <summary>
/// Creates a new instance of the <see cref="UnmanagedDataSource"/> class.
/// </summary>
/// <param name="basePointer">The base pointer to start reading from.</param>
/// <param name="length">The total length of the data source.</param>
public UnmanagedDataSource(void* basePointer, ulong length)
{
_basePointer = basePointer;
Length = length;
}
/// <inheritdoc />
public ulong BaseAddress => (ulong) _basePointer;
/// <inheritdoc />
public byte this[ulong address]
{
get
{
if (!IsValidAddress(address))
throw new ArgumentOutOfRangeException(nameof(address));
return *(byte*) address;
}
}
/// <inheritdoc />
public ulong Length
{
get;
}
/// <inheritdoc />
public bool IsValidAddress(ulong address) => address >= (ulong) _basePointer
&& address - (ulong) _basePointer < Length;
/// <inheritdoc />
public int ReadBytes(ulong address, byte[] buffer, int index, int count)
{
if (!IsValidAddress(address))
return 0;
ulong relativeIndex = address - (ulong) _basePointer;
int actualLength = (int) Math.Min((ulong) count, Length - relativeIndex);
Marshal.Copy((IntPtr) address, buffer, index, actualLength);
return actualLength;
}
}
}
| using System;
using System.Runtime.InteropServices;
namespace AsmResolver.IO
{
/// <summary>
/// Represents a data source that obtains its data from a block of unmanaged memory.
/// </summary>
public sealed unsafe class UnmanagedDataSource : IDataSource
{
private readonly void* _basePointer;
public UnmanagedDataSource(void* basePointer, ulong length)
{
_basePointer = basePointer;
Length = length;
}
/// <inheritdoc />
public ulong BaseAddress => (ulong) _basePointer;
/// <inheritdoc />
public byte this[ulong address]
{
get
{
if (!IsValidAddress(address))
throw new ArgumentOutOfRangeException(nameof(address));
return *(byte*) address;
}
}
/// <inheritdoc />
public ulong Length
{
get;
}
/// <inheritdoc />
public bool IsValidAddress(ulong address) => address >= (ulong) _basePointer
&& address - (ulong) _basePointer < Length;
/// <inheritdoc />
public int ReadBytes(ulong address, byte[] buffer, int index, int count)
{
if (!IsValidAddress(address))
return 0;
ulong relativeIndex = address - (ulong) _basePointer;
int actualLength = (int) Math.Min((ulong) count, Length - relativeIndex);
Marshal.Copy((IntPtr) address, buffer, index, actualLength);
return actualLength;
}
}
}
| mit | C# |
9116df615f7a2eb11f88c0d28d35ccf864462201 | Update GlennStephens.cs | beraybentesen/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,stvansolano/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,MabroukENG/planetxamarin,beraybentesen/planetxamarin | src/Firehose.Web/Authors/GlennStephens.cs | src/Firehose.Web/Authors/GlennStephens.cs | using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web
{
public class GlennStephens : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Glenn";
public string LastName => "Stephens";
public string StateOrRegion => "Sunshine Coast, Australia";
public string EmailAddress => "";
public string Title => "senior trainer at Xamarin University";
public Uri WebSite => new Uri("http://www.glennstephens.com.au/tag/xamarin/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.glennstephens.com.au/tag/xamarin/rss/"); }
}
public string TwitterHandle => "glenntstephens";
public string GravatarHash => "ffc4ec4a7133be87d2587325ac7b1d00";
public DateTime Started => new DateTime(2014, 1, 9);
}
}
| using System;
using System.Collections.Generic;
using Firehose.Web.Infrastructure;
namespace Firehose.Web
{
public class GlennStephens : IWorkAtXamarinOrMicrosoft
{
public string FirstName => "Glenn";
public string LastName => "Stephens";
public string StateOrRegion => "Sunshine Coast, Australia";
public string EmailAddress => "";
public string Title => "Senior Trainer @ Xamarin University";
public Uri WebSite => new Uri("http://www.glennstephens.com.au/tag/xamarin/");
public IEnumerable<Uri> FeedUris
{
get { yield return new Uri("http://www.glennstephens.com.au/tag/xamarin/rss/"); }
}
public string TwitterHandle => "glenntstephens";
public string GravatarHash => "ffc4ec4a7133be87d2587325ac7b1d00";
public DateTime Started => new DateTime(2014, 1, 9);
}
}
| mit | C# |
7393fad3bc9ceb4105c3fef3d28e5b858b7c2735 | Add license to new unit test class file | fredatgithub/UsefulFunctions | UnitTestUsefullFunctions/UnitTest1.cs | UnitTestUsefullFunctions/UnitTest1.cs | /*
The MIT License(MIT)
Copyright(c) 2015 Freddy Juhel
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 Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestUsefullFunctions
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.IsTrue(true);
}
}
} | using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace UnitTestUsefullFunctions
{
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Assert.IsTrue(true);
}
}
} | mit | C# |
733cf350f53e321367e279ad0c1291f56fdcea47 | Change return type from bool to void. | Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW | src/NadekoBot/Resources/CommandStrings.cs | src/NadekoBot/Resources/CommandStrings.cs | using System;
using System.IO;
using System.Linq;
using Mitternacht.Common.Collections;
using Newtonsoft.Json;
using NLog;
namespace Mitternacht.Resources
{
public class CommandStrings
{
private static readonly Logger Log;
private const string CmdStringPath = @"./_strings/commandstrings.json";
private static ConcurrentHashSet<CommandStringsModel> _commandStrings;
static CommandStrings() {
Log = LogManager.GetCurrentClassLogger();
LoadCommandStrings();
}
public static void LoadCommandStrings() {
try {
var json = File.ReadAllText(CmdStringPath);
_commandStrings = JsonConvert.DeserializeObject<ConcurrentHashSet<CommandStringsModel>>(json);
}
catch (Exception e) {
Log.Error(e);
}
}
public static CommandStringsModel GetCommandStringModel(string name)
=> _commandStrings.FirstOrDefault(c => c.Name == name) ?? new CommandStringsModel { Name = name, Command = name + "_cmd" };
}
} | using System;
using System.IO;
using System.Linq;
using Mitternacht.Common.Collections;
using Newtonsoft.Json;
using NLog;
namespace Mitternacht.Resources
{
public class CommandStrings
{
private static readonly Logger Log;
private const string CmdStringPath = @"./_strings/commandstrings.json";
private static ConcurrentHashSet<CommandStringsModel> _commandStrings;
static CommandStrings() {
Log = LogManager.GetCurrentClassLogger();
LoadCommandStrings();
}
public static bool LoadCommandStrings() {
try {
var json = File.ReadAllText(CmdStringPath);
_commandStrings = JsonConvert.DeserializeObject<ConcurrentHashSet<CommandStringsModel>>(json);
}
catch (Exception e) {
Log.Error(e);
return false;
}
return true;
}
public static CommandStringsModel GetCommandStringModel(string name)
=> _commandStrings.FirstOrDefault(c => c.Name == name) ?? new CommandStringsModel { Name = name, Command = name + "_cmd" };
}
} | mit | C# |
44a6a4ca6037f8dd10c04a4e93c9ddf01e0c5da5 | update TerminalLexeme by moving method | bilsaboob/Pliant,patrickhuber/Pliant | libraries/Pliant/Lexemes/TerminalLexeme.cs | libraries/Pliant/Lexemes/TerminalLexeme.cs | using Pliant.Grammars;
using Pliant.Tokens;
namespace Pliant.Lexemes
{
public class TerminalLexeme : ILexeme
{
public ITerminal Terminal { get; private set; }
public string Capture { get; private set; }
public TokenType TokenType { get; private set; }
public TerminalLexeme(ITerminalLexerRule lexerRule)
: this(lexerRule.Terminal, lexerRule.TokenType)
{
}
public TerminalLexeme(ITerminal terminal, TokenType tokenType)
{
Terminal = terminal;
TokenType = tokenType;
Capture = string.Empty;
}
public bool IsAccepted()
{
return Capture.Length > 0;
}
public bool Scan(char c)
{
if (!IsAccepted())
{
if (Terminal.IsMatch(c))
{
Capture = c.ToString();
return true;
}
}
return false;
}
}
}
| using Pliant.Grammars;
using Pliant.Tokens;
namespace Pliant.Lexemes
{
public class TerminalLexeme : ILexeme
{
public ITerminal Terminal { get; private set; }
public string Capture { get; private set; }
public TokenType TokenType { get; private set; }
public TerminalLexeme(ITerminal terminal, TokenType tokenType)
{
Terminal = terminal;
TokenType = tokenType;
Capture = string.Empty;
}
public TerminalLexeme(ITerminalLexerRule terminalRule)
: this(terminalRule.Terminal, terminalRule.TokenType)
{
}
public bool IsAccepted()
{
return Capture.Length > 0;
}
public bool Scan(char c)
{
if (!IsAccepted())
{
if (Terminal.IsMatch(c))
{
Capture = c.ToString();
return true;
}
}
return false;
}
}
}
| mit | C# |
55c5e0eadb60d9d0f5822d6dc91e4cb6e9d6081f | Remove redundant directive | Trulioo/sdk-csharp-v1 | src/Trulioo.Client.V1/Model/RecordRule.cs | src/Trulioo.Client.V1/Model/RecordRule.cs | namespace Trulioo.Client.V1.Model
{
public class RecordRule
{
public string RuleName { get; set; }
public string Note { get; set; }
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Trulioo.Client.V1.Model
{
public class RecordRule
{
public string RuleName { get; set; }
public string Note { get; set; }
}
}
| apache-2.0 | C# |
4a25d87fede3758c384799d121f1ec4be87e6c7e | Fix author name on commits | BeefEX/ships | Ships-Client/Rendering/Renderer.cs | Ships-Client/Rendering/Renderer.cs | using System;
using Ships_Common;
namespace Ships_Client {
public static class Renderer {
public static char[][,] loadingCircle = {
new [,] {
{'\\', '_', '/'}, {' ', ' ', ' '}, {' ', ' ', ' '}
},
new [,] {
{'\\', '_', ' '}, {'|', ' ', ' '}, {' ', ' ', ' '}
},
new [,] {
{'\\', ' ', ' '}, {'|', ' ', ' '}, {'/', ' ', ' '}
},
new [,] {
{' ', ' ', ' '}, {'|', ' ', ' '}, {'/', '=', ' '}
},
new [,] {
{' ', ' ', ' '}, {' ', ' ', ' '}, {'/', '=', '\\'}
},
new [,] {
{' ', ' ', ' '}, {' ', ' ', '|'}, {' ', '=', '\\'}
},
new [,] {
{' ', ' ', '/'}, {' ', ' ', '|'}, {' ', ' ', '\\'}
},
new [,] {
{' ', '_', '/'}, {' ', ' ', '|'}, {' ', ' ', ' '}
}
};
public static void renderShip (Ship ship, Vector2 offset = new Vector2()) {
if (ship == default(Ship))
return;
Vector2 pos = ship.position + offset;
for (int i = 0; i < ship.shape.Length; i++) {
Vector2 vector = pos + ship.shape[i];
if (ship.hits[i])
drawPixel(vector, 'X');//drawPatternAsPixel(vector, Ship.Parts.PART_EXPLODED);
else
drawPixel(vector, '#');
}
}
public static void drawPixel (Vector2 position, char character) {
/*
for (int x = position.x; x <= position.x + 5; x++) {
for (int y = position.y; y <= position.y + 2; y++) {
if (x < 0 || y < 0 || x > Console.WindowWidth || y > Console.WindowHeight)
continue;
Console.SetCursorPosition(x, y);
Console.Write(character);
}
}
*/
Console.SetCursorPosition((int)position.x, (int)position.y);
Console.Write(character);
}
public static void drawPatternAsPixel (Vector2 position, char[,] pattern) {
for (int x = (int)position.x - 1; x <= position.x + 1; x++) {
for (int y = (int)position.y - 1; y <= position.y + 1; y++) {
if (x < 0 || y < 0 || x > Console.WindowWidth || y > Console.WindowHeight)
continue;
Console.SetCursorPosition(x, y);
Console.Write(pattern[1 - (y - (int)position.y), 1 + (x - (int)position.x)]);
}
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Reflection.Emit;
using Ships_Common;
namespace Ships_Client {
public static class Renderer {
public static char[][,] loadingCircle = {
new [,] {
{'\\', '_', '/'}, {' ', ' ', ' '}, {' ', ' ', ' '}
},
new [,] {
{'\\', '_', ' '}, {'|', ' ', ' '}, {' ', ' ', ' '}
},
new [,] {
{'\\', ' ', ' '}, {'|', ' ', ' '}, {'/', ' ', ' '}
},
new [,] {
{' ', ' ', ' '}, {'|', ' ', ' '}, {'/', '=', ' '}
},
new [,] {
{' ', ' ', ' '}, {' ', ' ', ' '}, {'/', '=', '\\'}
},
new [,] {
{' ', ' ', ' '}, {' ', ' ', '|'}, {' ', '=', '\\'}
},
new [,] {
{' ', ' ', '/'}, {' ', ' ', '|'}, {' ', ' ', '\\'}
},
new [,] {
{' ', '_', '/'}, {' ', ' ', '|'}, {' ', ' ', ' '}
}
};
public static void renderShip (Ship ship, Vector2 offset = new Vector2()) {
if (ship == default(Ship))
return;
Vector2 pos = ship.position + offset;
for (int i = 0; i < ship.shape.Length; i++) {
Vector2 vector = pos + ship.shape[i];
if (ship.hits[i])
drawPixel(vector, 'X');//drawPatternAsPixel(vector, Ship.Parts.PART_EXPLODED);
else
drawPixel(vector, '#');
}
}
public static void drawPixel (Vector2 position, char character) {
/*
for (int x = position.x; x <= position.x + 5; x++) {
for (int y = position.y; y <= position.y + 2; y++) {
if (x < 0 || y < 0 || x > Console.WindowWidth || y > Console.WindowHeight)
continue;
Console.SetCursorPosition(x, y);
Console.Write(character);
}
}
*/
Console.SetCursorPosition((int)position.x, (int)position.y);
Console.Write(character);
}
public static void drawPatternAsPixel (Vector2 position, char[,] pattern) {
for (int x = (int)position.x - 1; x <= position.x + 1; x++) {
for (int y = (int)position.y - 1; y <= position.y + 1; y++) {
if (x < 0 || y < 0 || x > Console.WindowWidth || y > Console.WindowHeight)
continue;
Console.SetCursorPosition(x, y);
Console.Write(pattern[1 - (y - (int)position.y), 1 + (x - (int)position.x)]);
}
}
}
}
}
| mit | C# |
d50998e7c6dd74b16896ce9395fd8daf837ab09b | Set property item as localizable only if Localizable attribute value is true | rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,volkanceylan/Serenity,volkanceylan/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity,rolembergfilho/Serenity,rolembergfilho/Serenity,WasimAhmad/Serenity,WasimAhmad/Serenity | Serenity.Services/RequestHandlers/IntegratedFeatures/Localization/LocalizablePropertyProcessor.cs | Serenity.Services/RequestHandlers/IntegratedFeatures/Localization/LocalizablePropertyProcessor.cs | using Serenity.ComponentModel;
using Serenity.Data;
using System;
using System.ComponentModel;
using System.Reflection;
namespace Serenity.PropertyGrid
{
public partial class LocalizablePropertyProcessor : PropertyProcessor
{
private ILocalizationRowHandler localizationRowHandler;
public override void Initialize()
{
if (BasedOnRow == null)
return;
var attr = BasedOnRow.GetType().GetCustomAttribute<LocalizationRowAttribute>(false);
if (attr != null)
localizationRowHandler = Activator.CreateInstance(typeof(LocalizationRowHandler<>)
.MakeGenericType(BasedOnRow.GetType())) as ILocalizationRowHandler;
}
public override void Process(IPropertySource source, PropertyItem item)
{
var attr = source.GetAttribute<LocalizableAttribute>();
if (attr != null)
{
if (item.IsLocalizable)
item.Localizable = true;
return;
}
if (!ReferenceEquals(null, source.BasedOnField) &&
localizationRowHandler != null &&
localizationRowHandler.IsLocalized(source.BasedOnField))
{
item.Localizable = true;
}
}
public override int Priority
{
get { return 15; }
}
}
}
| using Serenity.ComponentModel;
using Serenity.Data;
using System;
using System.ComponentModel;
using System.Reflection;
namespace Serenity.PropertyGrid
{
public partial class LocalizablePropertyProcessor : PropertyProcessor
{
private ILocalizationRowHandler localizationRowHandler;
public override void Initialize()
{
if (BasedOnRow == null)
return;
var attr = BasedOnRow.GetType().GetCustomAttribute<LocalizationRowAttribute>(false);
if (attr != null)
localizationRowHandler = Activator.CreateInstance(typeof(LocalizationRowHandler<>)
.MakeGenericType(BasedOnRow.GetType())) as ILocalizationRowHandler;
}
public override void Process(IPropertySource source, PropertyItem item)
{
var attr = source.GetAttribute<LocalizableAttribute>();
if (attr != null)
{
item.Localizable = true;
return;
}
if (!ReferenceEquals(null, source.BasedOnField) &&
localizationRowHandler != null &&
localizationRowHandler.IsLocalized(source.BasedOnField))
{
item.Localizable = true;
}
}
public override int Priority
{
get { return 15; }
}
}
} | mit | C# |
9c08b633e01e3410a609306399f571870896de35 | Update Program.cs | organizacjaJM/rezerwacjaKawa | 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)
{
Console.WriteLine("asdasd");
}
}
}
| 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)
{
}
}
}
| mit | C# |
95894a3177e0e1dfbc825b24be0f453b6a1efbc4 | Add try catches to SimpleServer Dispose where necessary to prevent throwing in unit tests. | RestSharp-resurrected/RestSharp,mattwalden/RestSharp,lydonchandra/RestSharp,rivy/RestSharp,SaltyDH/RestSharp,wparad/RestSharp,huoxudong125/RestSharp,jiangzm/RestSharp,restsharp/RestSharp,eamonwoortman/RestSharp.Unity,kouweizhong/RestSharp,dyh333/RestSharp,mwereda/RestSharp,cnascimento/RestSharp,who/RestSharp,wparad/RestSharp,mattleibow/RestSharp,KraigM/RestSharp,periface/RestSharp,amccarter/RestSharp,dgreenbean/RestSharp,benfo/RestSharp,chengxiaole/RestSharp,fmmendo/RestSharp,rucila/RestSharp,dmgandini/RestSharp,PKRoma/RestSharp,uQr/RestSharp,felipegtx/RestSharp,haithemaraissia/RestSharp | RestSharp.IntegrationTests/Helpers/SimpleServer.cs | RestSharp.IntegrationTests/Helpers/SimpleServer.cs | namespace RestSharp.IntegrationTests.Helpers
{
using System;
using System.Net;
using System.Security;
using System.Threading;
public class SimpleServer : IDisposable
{
private readonly HttpListener listener;
private readonly Action<HttpListenerContext> handler;
private Thread thread;
private SimpleServer(HttpListener listener, Action<HttpListenerContext> handler)
{
this.listener = listener;
this.handler = handler;
}
public static SimpleServer Create(
string url,
Action<HttpListenerContext> handler,
AuthenticationSchemes authenticationSchemes = AuthenticationSchemes.Anonymous)
{
var listener = new HttpListener { Prefixes = { url }, AuthenticationSchemes = authenticationSchemes };
var server = new SimpleServer(listener, handler);
server.Start();
return server;
}
public void Start()
{
if (this.listener.IsListening)
{
return;
}
this.listener.Start();
this.thread = new Thread(() =>
{
var context = this.listener.GetContext();
this.handler(context);
context.Response.Close();
}) { Name = "WebServer" };
this.thread.Start();
}
public void Dispose()
{
try
{
this.thread.Abort();
}
catch (ThreadStateException threadStateException)
{
Console.WriteLine("Issue aborting thread - {0}.", threadStateException.Message);
}
catch (SecurityException securityException)
{
Console.WriteLine("Issue aborting thread - {0}.", securityException.Message);
}
if (this.listener.IsListening)
{
try
{
this.listener.Stop();
}
catch (ObjectDisposedException objectDisposedException)
{
Console.WriteLine("Issue stopping listener - {0}", objectDisposedException.Message);
}
}
this.listener.Close();
}
}
}
| namespace RestSharp.IntegrationTests.Helpers
{
using System;
using System.Net;
using System.Threading;
public class SimpleServer : IDisposable
{
private readonly HttpListener listener;
private readonly Action<HttpListenerContext> handler;
private Thread processor;
public static SimpleServer Create(
string url,
Action<HttpListenerContext> handler,
AuthenticationSchemes authenticationSchemes = AuthenticationSchemes.Anonymous)
{
var listener = new HttpListener { Prefixes = { url }, AuthenticationSchemes = authenticationSchemes };
var server = new SimpleServer(listener, handler);
server.Start();
return server;
}
private SimpleServer(HttpListener listener, Action<HttpListenerContext> handler)
{
this.listener = listener;
this.handler = handler;
}
public void Start()
{
if (this.listener.IsListening)
{
return;
}
this.listener.Start();
this.processor = new Thread(() =>
{
var context = this.listener.GetContext();
this.handler(context);
context.Response.Close();
}) { Name = "WebServer" };
this.processor.Start();
}
public void Dispose()
{
this.processor.Abort();
this.listener.Stop();
this.listener.Close();
}
}
}
| apache-2.0 | C# |
d2b9d69f9511fec77300cc7f057b1aaeedbead11 | Improve persistent session client test | xobed/RohlikAPI,xobed/RohlikAPI,notdev/RohlikAPI,xobed/RohlikAPI,xobed/RohlikAPI | RohlikAPITests/PersistentSessionHttpClientTests.cs | RohlikAPITests/PersistentSessionHttpClientTests.cs | using Microsoft.VisualStudio.TestTools.UnitTesting;
using RohlikAPI;
namespace RohlikAPITests
{
[TestClass]
public class PersistentSessionHttpClientTests
{
[TestMethod]
public void HTTPGet_PersistsCookies()
{
const string testCookieName = "testCookieName";
const string testCookieValue = "testCookieValue";
var client = new PersistentSessionHttpClient();
client.Get($"http://httpbin.org/cookies/set/{testCookieName}/{testCookieValue}");
var response = client.Get("http://httpbin.org/cookies");
Assert.IsTrue(response.Contains(testCookieName) && response.Contains(testCookieValue), $"Response should contain both {testCookieName} and {testCookieValue}");
}
}
} | using Microsoft.VisualStudio.TestTools.UnitTesting;
using RohlikAPI;
namespace RohlikAPITests
{
[TestClass]
public class PersistentSessionHttpClientTests
{
[TestMethod]
public void GetTest()
{
const string testCookieName = "testCookieName";
const string testCookieValue = "testCookieValue";
var client = new PersistentSessionHttpClient();
client.Get($"http://httpbin.org/cookies/set/{testCookieName}/{testCookieValue}");
var response = client.Get("http://httpbin.org/cookies");
Assert.IsTrue(response.Contains(testCookieName) && response.Contains(testCookieValue), $"Response should contain both {testCookieName} and {testCookieValue}");
}
}
} | mit | C# |
763d9778bb66bf131960d9281d243d9a826219a5 | Check parameters and add friendly exceptions. | chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet | Source/MQTTnet/Extensions/UserPropertyExtension.cs | Source/MQTTnet/Extensions/UserPropertyExtension.cs | using System;
using System.Linq;
namespace MQTTnet.Extensions
{
public static class UserPropertyExtension
{
public static string GetUserProperty(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
{
if (message == null) throw new ArgumentNullException(nameof(message));
if (propertyName == null) throw new ArgumentNullException(nameof(propertyName));
return message.UserProperties?.SingleOrDefault(up => up.Name.Equals(propertyName, comparisonType))?.Value;
}
public static T GetUserProperty<T>(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
{
var value = GetUserProperty(message, propertyName, comparisonType);
try
{
return (T) Convert.ChangeType(value, typeof(T));
}
catch (Exception ex)
{
throw new InvalidOperationException($"Cannot convert value({value}) of UserProperty({propertyName}) to {typeof(T).FullName}.", ex);
}
}
}
}
| using System;
using System.Linq;
namespace MQTTnet.Extensions
{
public static class UserPropertyExtension
{
public static string GetUserProperty(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
{
return message?.UserProperties?.SingleOrDefault(up => up.Name.Equals(propertyName, comparisonType))?.Value;
}
public static T GetUserProperty<T>(this MqttApplicationMessage message, string propertyName, StringComparison comparisonType = StringComparison.OrdinalIgnoreCase)
{
return (T) Convert.ChangeType(GetUserProperty(message, propertyName, comparisonType), typeof(T));
}
}
}
| mit | C# |
d85c48a9d4307046fc34d198562351065e478102 | Increment version to 1.4.2 | evilz/sc2replay-csharp,ascendedguard/sc2replay-csharp | Starcraft2.ReplayParser/Properties/AssemblyInfo.cs | Starcraft2.ReplayParser/Properties/AssemblyInfo.cs | // --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Ascend">
// Copyright © 2011 All Rights Reserved
// </copyright>
// <summary>
// AssemblyInfo.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
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("Starcraft2.ReplayParser")]
[assembly: AssemblyDescription("Library for parsing information from a Starcraft 2 replay file.")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCompany("Ascend")]
[assembly: AssemblyProduct("Starcraft2.ReplayParser")]
[assembly: AssemblyCopyright("Copyright © Ascend 2010")]
[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("ab85402d-b34a-42ed-b74e-02c2656896d8")]
// 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.4.2.*")]
[assembly: AssemblyFileVersion("1.4.2.0")]
| // --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="Ascend">
// Copyright © 2011 All Rights Reserved
// </copyright>
// <summary>
// AssemblyInfo.cs
// </summary>
// --------------------------------------------------------------------------------------------------------------------
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("Starcraft2.ReplayParser")]
[assembly: AssemblyDescription("Library for parsing information from a Starcraft 2 replay file.")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyCompany("Ascend")]
[assembly: AssemblyProduct("Starcraft2.ReplayParser")]
[assembly: AssemblyCopyright("Copyright © Ascend 2010")]
[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("ab85402d-b34a-42ed-b74e-02c2656896d8")]
// 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.4.1.*")]
[assembly: AssemblyFileVersion("1.4.1.0")]
| mit | C# |
1c7cbceffcc274911d1a9cf6d71bd7943835f409 | Make ReflectionTypeGenericInfo failures easier to understand in test runner. | FUSEEProjectTeam/JSIL,acourtney2015/JSIL,Trattpingvin/JSIL,antiufo/JSIL,acourtney2015/JSIL,hach-que/JSIL,antiufo/JSIL,iskiselev/JSIL,dmirmilshteyn/JSIL,volkd/JSIL,sander-git/JSIL,sq/JSIL,dmirmilshteyn/JSIL,antiufo/JSIL,iskiselev/JSIL,mispy/JSIL,acourtney2015/JSIL,iskiselev/JSIL,sander-git/JSIL,FUSEEProjectTeam/JSIL,FUSEEProjectTeam/JSIL,x335/JSIL,FUSEEProjectTeam/JSIL,Trattpingvin/JSIL,TukekeSoft/JSIL,sq/JSIL,dmirmilshteyn/JSIL,TukekeSoft/JSIL,x335/JSIL,sq/JSIL,volkd/JSIL,sander-git/JSIL,mispy/JSIL,x335/JSIL,TukekeSoft/JSIL,iskiselev/JSIL,hach-que/JSIL,volkd/JSIL,FUSEEProjectTeam/JSIL,volkd/JSIL,Trattpingvin/JSIL,acourtney2015/JSIL,x335/JSIL,sander-git/JSIL,hach-que/JSIL,sander-git/JSIL,sq/JSIL,hach-que/JSIL,acourtney2015/JSIL,iskiselev/JSIL,sq/JSIL,hach-que/JSIL,Trattpingvin/JSIL,mispy/JSIL,volkd/JSIL,mispy/JSIL,antiufo/JSIL,TukekeSoft/JSIL,dmirmilshteyn/JSIL | Tests/SimpleTestCases/ReflectionTypeGenericInfo.cs | Tests/SimpleTestCases/ReflectionTypeGenericInfo.cs | using System;
using System.Linq.Expressions;
public static class Program
{
public static void Main()
{
Write(typeof(Base<,>), 1);
Write(typeof(Derived<>), 2);
Write(typeof(Derived<>).BaseType, 3);
Write(typeof(Derived<>).GetField("Field1").FieldType, 4);
Write(typeof(Derived<>).GetField("Field2").FieldType, 5);
Write(typeof(Derived<>).GetField("Field3").FieldType, 6);
Write(typeof(Derived<>.Nested), 7);
Write(typeof(Base<SomeClass, SomeClass>), 8);
Write(typeof(Derived<SomeClass>), 9);
Write(typeof(Derived<SomeClass>).BaseType, 10);
Write(typeof(Derived<SomeClass>).GetField("Field1").FieldType, 11);
Write(typeof(Derived<SomeClass>).GetField("Field2").FieldType, 12);
Write(typeof(Derived<SomeClass>).GetField("Field3").FieldType, 13);
Write(typeof(Derived<SomeClass>.Nested), 14);
Write(typeof(Derived<SomeClass>[]), 15);
}
public static void Write(Type type, int index)
{
Console.WriteLine("{1} IGT: {0}", type.IsGenericType, index);
Console.WriteLine("{1} IGTD: {0}", type.IsGenericTypeDefinition, index);
Console.WriteLine("{1} CGP: {0}", type.ContainsGenericParameters, index);
Console.WriteLine("{1} IGP: {0}", type.IsGenericParameter, index);
}
}
public class Base<T, U>
{
public static T M1Base(U u) { return default(T); }
}
public class Derived<V> : Base<SomeClass, V>
{
public V Field1;
public G<V> Field2;
public G<G<V>> Field3;
public class Nested
{
void M1Nested() { }
}
public static void M1Derived<W>() { }
}
public class G<T> { }
public class SomeClass {} | using System;
using System.Linq.Expressions;
public static class Program
{
public static void Main()
{
Write(typeof(Base<,>), 1);
Write(typeof(Derived<>), 2);
Write(typeof(Derived<>).BaseType, 3);
Write(typeof(Derived<>).GetField("Field1").FieldType, 4);
Write(typeof(Derived<>).GetField("Field2").FieldType, 5);
Write(typeof(Derived<>).GetField("Field3").FieldType, 6);
Write(typeof(Derived<>.Nested), 7);
Write(typeof(Base<SomeClass, SomeClass>), 8);
Write(typeof(Derived<SomeClass>), 9);
Write(typeof(Derived<SomeClass>).BaseType, 10);
Write(typeof(Derived<SomeClass>).GetField("Field1").FieldType, 11);
Write(typeof(Derived<SomeClass>).GetField("Field2").FieldType, 12);
Write(typeof(Derived<SomeClass>).GetField("Field3").FieldType, 13);
Write(typeof(Derived<SomeClass>.Nested), 14);
Write(typeof(Derived<SomeClass>[]), 15);
}
public static void Write(Type type, int index)
{
Console.WriteLine(index);
Console.WriteLine("IsGenericType: {0}", type.IsGenericType);
Console.WriteLine("IsGenericTypeDefinition: {0}", type.IsGenericTypeDefinition);
Console.WriteLine("ContainsGenericParameters: {0}", type.ContainsGenericParameters);
Console.WriteLine("IsGenericParameter: {0}", type.IsGenericParameter);
}
}
public class Base<T, U>
{
public static T M1Base(U u) { return default(T); }
}
public class Derived<V> : Base<SomeClass, V>
{
public V Field1;
public G<V> Field2;
public G<G<V>> Field3;
public class Nested
{
void M1Nested() { }
}
public static void M1Derived<W>() { }
}
public class G<T> { }
public class SomeClass {} | mit | C# |
4a484c3539f111a8570621ef6cdad723c1d28ffa | fix threading bug | ruarai/Trigrad,ruarai/Trigrad | Trigrad/DataTypes/Compression/TrigradCompressed.cs | Trigrad/DataTypes/Compression/TrigradCompressed.cs | using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using ICSharpCode.SharpZipLib.BZip2;
using TriangleNet;
namespace Trigrad.DataTypes.Compression
{
/// <summary> The TrigradCompressed form of a bitmap. </summary>
public partial class TrigradCompressed
{
/// <summary> Constructs a TrigradCompressed without any initial data. </summary>
public TrigradCompressed()
{
}
/// <summary> A dictionary of sampled points to their corresponding colors. </summary>
public Dictionary<Point, Color> SampleTable = new Dictionary<Point, Color>();
public List<SampleTri> Mesh = new List<SampleTri>();
/// <summary> The width of the bitmap. </summary>
public int Width;
/// <summary> The height of the bitmap. </summary>
public int Height;
/// <summary> Provides a visualisation of the SampleTable. </summary>
public PixelMap DebugVisualisation()
{
PixelMap map = new PixelMap(Width, Height);
for (int x = 0; x < Width; x++)
{
for (int y = 0; y < Height; y++)
{
map[x, y] = Color.FromArgb(10, 10, 10);
}
}
foreach (var value in SampleTable)
{
Point p = value.Key;
map[p]= value.Value;
}
return map;
}
public PixelMap MeshOutput(PixelMap original)
{
return Mesh.DrawMesh(Width, Height);
}
}
} | using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using ICSharpCode.SharpZipLib.BZip2;
using TriangleNet;
namespace Trigrad.DataTypes.Compression
{
/// <summary> The TrigradCompressed form of a bitmap. </summary>
public partial class TrigradCompressed
{
/// <summary> Constructs a TrigradCompressed without any initial data. </summary>
public TrigradCompressed()
{
}
/// <summary> A dictionary of sampled points to their corresponding colors. </summary>
public Dictionary<Point, Color> SampleTable = new Dictionary<Point, Color>();
public List<SampleTri> Mesh = new List<SampleTri>();
/// <summary> The width of the bitmap. </summary>
public int Width;
/// <summary> The height of the bitmap. </summary>
public int Height;
/// <summary> Provides a visualisation of the SampleTable. </summary>
public Bitmap DebugVisualisation()
{
Bitmap bitmap = new Bitmap(Width, Height);
using (Graphics g = Graphics.FromImage(bitmap))
{
g.FillRectangle(new SolidBrush(Color.FromArgb(10, 10, 10)), new Rectangle(0, 0, Width, Height));
}
foreach (var value in SampleTable)
{
Point p = value.Key;
bitmap.SetPixel(p.X, p.Y, value.Value);
}
return bitmap;
}
public PixelMap MeshOutput(PixelMap original)
{
return Mesh.DrawMesh(Width, Height);
}
}
} | mit | C# |
8163d63342aca04f9861eb7c680a076e612c3af3 | Set "Last-Modified" for HomeController. | nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet | WalletWasabi.Backend/Controllers/HomeController.cs | WalletWasabi.Backend/Controllers/HomeController.cs | using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WalletWasabi.Backend.Controllers
{
[Route("")]
public class HomeController : Controller
{
[HttpGet("")]
public ActionResult Index()
{
VirtualFileResult response = File("index.html", "text/html");
response.LastModified = DateTimeOffset.UtcNow;
return response;
}
}
}
| using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace WalletWasabi.Backend.Controllers
{
[Route("")]
public class HomeController : Controller
{
[HttpGet("")]
public ActionResult Index()
{
return File("index.html", "text/html");
}
}
}
| mit | C# |
a50c0f7f94720e35dfcc82ead284f1746b211769 | Fix cake again | stormpath/stormpath-dotnet-owin-middleware | build.cake | build.cake | var configuration = Argument("configuration", "Debug");
Task("Clean")
.Does(() =>
{
CleanDirectory("./artifacts/");
});
Task("Restore")
.Does(() =>
{
DotNetCoreRestore();
});
Task("Build")
.Does(() =>
{
var projects = GetFiles("./src/**/*.csproj");
Console.WriteLine("Building {0} projects", projects.Count());
foreach (var project in projects)
{
DotNetCoreBuild(project.FullPath, new DotNetCoreBuildSettings
{
Configuration = configuration
});
}
});
Task("Pack")
.Does(() =>
{
new List<string>
{
"Stormpath.Owin.Abstractions",
"Stormpath.Owin.Middleware",
"Stormpath.Owin.Views.Precompiled"
}.ForEach(name =>
{
DotNetCorePack(string.Format("./src/{0}/{0}.csproj", name), new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = "./artifacts/"
});
});
});
Task("Test")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.Does(() =>
{
new List<string>
{
"Stormpath.Owin.UnitTest"
}.ForEach(name =>
{
DotNetCoreTest(string.Format("./test/{0}/{0}.csproj", name));
});
});
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Pack");
var target = Argument("target", "Default");
RunTarget(target); | var configuration = Argument("configuration", "Debug");
Task("Clean")
.Does(() =>
{
CleanDirectory("./artifacts/");
});
Task("Restore")
.Does(() =>
{
DotNetCoreRestore();
});
Task("Build")
.Does(() =>
{
var projects = GetFiles("./src/**/*.csproj");
Console.WriteLine("Building {0} projects", projects.Count());
foreach (var project in projects)
{
DotNetCoreBuild(project.FullPath, new DotNetCoreBuildSettings
{
Configuration = configuration
});
}
});
Task("Pack")
.Does(() =>
{
new List<string>
{
"Stormpath.Owin.Abstractions",
"Stormpath.Owin.Middleware",
"Stormpath.Owin.Views.Precompiled"
}.ForEach(name =>
{
DotNetCorePack("./src/" + name + ".csproj", new DotNetCorePackSettings
{
Configuration = configuration,
OutputDirectory = "./artifacts/"
});
});
});
Task("Test")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.Does(() =>
{
new List<string>
{
"Stormpath.Owin.UnitTest"
}.ForEach(name =>
{
DotNetCoreTest("./test/" + name + ".csproj");
});
});
Task("Default")
.IsDependentOn("Clean")
.IsDependentOn("Restore")
.IsDependentOn("Build")
.IsDependentOn("Pack");
var target = Argument("target", "Default");
RunTarget(target); | apache-2.0 | C# |
9cd914b36a3ff56251935922393a3ccbf09e38e6 | add apiSessionId to token resp | SnapMD/connectedcare-sdk | SnapMD.VirtualCare.ApiModels/SerializableToken.cs | SnapMD.VirtualCare.ApiModels/SerializableToken.cs | #region Copyright
// Copyright 2016 SnapMD, 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.
#endregion
using System;
// ReSharper disable InconsistentNaming
#pragma warning disable 1591
namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
///
/// </summary>
public class SerializableToken
{
public string access_token { get; set; }
public DateTimeOffset? expires { get; set; }
public Guid? apiSessionId { get; set; }
}
}
| #region Copyright
// Copyright 2016 SnapMD, 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.
#endregion
using System;
// ReSharper disable InconsistentNaming
#pragma warning disable 1591
namespace SnapMD.VirtualCare.ApiModels
{
/// <summary>
///
/// </summary>
public class SerializableToken
{
public string access_token { get; set; }
public DateTimeOffset? expires { get; set; }
}
}
| apache-2.0 | C# |
7fbc1ff26769034d533edbe90da0e06a7cd70c74 | Fix new unit test to fail if it does not throw properly | marianosz/azure-mobile-services,baumatron/azure-mobile-services-baumatron,dcristoloveanu/azure-mobile-services,Azure/azure-mobile-services,soninaren/azure-mobile-services,Reminouche/azure-mobile-services,Reminouche/azure-mobile-services,ysxu/azure-mobile-services,cmatskas/azure-mobile-services,gb92/azure-mobile-services,intellitour/azure-mobile-services,marianosz/azure-mobile-services,intellitour/azure-mobile-services,Redth/azure-mobile-services,dcristoloveanu/azure-mobile-services,shrishrirang/azure-mobile-services,apuyana/azure-mobile-services,baumatron/azure-mobile-services-baumatron,mauricionr/azure-mobile-services,apuyana/azure-mobile-services,soninaren/azure-mobile-services,gb92/azure-mobile-services,soninaren/azure-mobile-services,yuqiqian/azure-mobile-services,soninaren/azure-mobile-services,Redth/azure-mobile-services,apuyana/azure-mobile-services,dhei/azure-mobile-services,paulbatum/azure-mobile-services,phvannor/azure-mobile-services,baumatron/azure-mobile-services-baumatron,Reminouche/azure-mobile-services,gb92/azure-mobile-services,marianosz/azure-mobile-services,soninaren/azure-mobile-services,fabiocav/azure-mobile-services,Azure/azure-mobile-services,YOTOV-LIMITED/azure-mobile-services,erichedstrom/azure-mobile-services,pragnagopa/azure-mobile-services,shrishrirang/azure-mobile-services,cmatskas/azure-mobile-services,Redth/azure-mobile-services,mauricionr/azure-mobile-services,phvannor/azure-mobile-services,dhei/azure-mobile-services,dcristoloveanu/azure-mobile-services,YOTOV-LIMITED/azure-mobile-services,Redth/azure-mobile-services,apuyana/azure-mobile-services,daemun/azure-mobile-services,cmatskas/azure-mobile-services,ysxu/azure-mobile-services,intellitour/azure-mobile-services,cmatskas/azure-mobile-services,ysxu/azure-mobile-services,erichedstrom/azure-mobile-services,baumatron/azure-mobile-services-baumatron,pragnagopa/azure-mobile-services,yuqiqian/azure-mobile-services,shrishrirang/azure-mobile-services,dcristoloveanu/azure-mobile-services,intellitour/azure-mobile-services,apuyana/azure-mobile-services,yuqiqian/azure-mobile-services,ysxu/azure-mobile-services,phvannor/azure-mobile-services,daemun/azure-mobile-services,Azure/azure-mobile-services,paulbatum/azure-mobile-services,Reminouche/azure-mobile-services,Redth/azure-mobile-services,erichedstrom/azure-mobile-services,Redth/azure-mobile-services,marianosz/azure-mobile-services,baumatron/azure-mobile-services-baumatron,baumatron/azure-mobile-services-baumatron,Azure/azure-mobile-services,paulbatum/azure-mobile-services,dcristoloveanu/azure-mobile-services,daemun/azure-mobile-services,YOTOV-LIMITED/azure-mobile-services,daemun/azure-mobile-services,apuyana/azure-mobile-services,mauricionr/azure-mobile-services,dcristoloveanu/azure-mobile-services,YOTOV-LIMITED/azure-mobile-services,jeremy50dj/azure-mobile-services,paulbatum/azure-mobile-services,pragnagopa/azure-mobile-services,cmatskas/azure-mobile-services,gb92/azure-mobile-services,Azure/azure-mobile-services,marianosz/azure-mobile-services,pragnagopa/azure-mobile-services,mauricionr/azure-mobile-services,baumatron/azure-mobile-services-baumatron,phvannor/azure-mobile-services,marianosz/azure-mobile-services,intellitour/azure-mobile-services,gb92/azure-mobile-services,dhei/azure-mobile-services,cmatskas/azure-mobile-services,dhei/azure-mobile-services,fabiocav/azure-mobile-services,ysxu/azure-mobile-services,Reminouche/azure-mobile-services,jeremy50dj/azure-mobile-services,jeremy50dj/azure-mobile-services,fabiocav/azure-mobile-services,mauricionr/azure-mobile-services,cmatskas/azure-mobile-services,erichedstrom/azure-mobile-services,daemun/azure-mobile-services,jeremy50dj/azure-mobile-services,fabiocav/azure-mobile-services,daemun/azure-mobile-services,YOTOV-LIMITED/azure-mobile-services,dhei/azure-mobile-services,shrishrirang/azure-mobile-services,marianosz/azure-mobile-services,paulbatum/azure-mobile-services,jeremy50dj/azure-mobile-services,pragnagopa/azure-mobile-services,gb92/azure-mobile-services,Reminouche/azure-mobile-services,yuqiqian/azure-mobile-services,mauricionr/azure-mobile-services,YOTOV-LIMITED/azure-mobile-services,yuqiqian/azure-mobile-services,erichedstrom/azure-mobile-services,fabiocav/azure-mobile-services,yuqiqian/azure-mobile-services,daemun/azure-mobile-services,ysxu/azure-mobile-services,soninaren/azure-mobile-services,phvannor/azure-mobile-services,intellitour/azure-mobile-services,shrishrirang/azure-mobile-services,jeremy50dj/azure-mobile-services,pragnagopa/azure-mobile-services,shrishrirang/azure-mobile-services,paulbatum/azure-mobile-services,phvannor/azure-mobile-services,fabiocav/azure-mobile-services,Azure/azure-mobile-services,erichedstrom/azure-mobile-services | sdk/Managed/test/Microsoft.WindowsAzure.MobileServices.WindowsStore.Test/UnitTests/PushUnit.Test.cs | sdk/Managed/test/Microsoft.WindowsAzure.MobileServices.WindowsStore.Test/UnitTests/PushUnit.Test.cs | // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
using System;
using System.Linq;
using Microsoft.WindowsAzure.MobileServices.Test.Functional;
using Microsoft.WindowsAzure.MobileServices.TestFramework;
namespace Microsoft.WindowsAzure.MobileServices.Test
{
[Tag("push")]
public class PushUnit : TestBase
{
[TestMethod]
public void InvalidBodyTemplateIfNotXml()
{
try
{
var registration = new TemplateRegistration("uri", "junkBodyTemplate", "testName");
Assert.Fail("Expected templateBody that is not XML to throw ArgumentException");
}
catch (ArgumentException e)
{
// PASSES
}
}
[TestMethod]
public void InvalidBodyTemplateIfImproperXml()
{
try
{
var registration = new TemplateRegistration(
"uri",
"<foo><visual><binding template=\"ToastText01\"><text id=\"1\">$(message)</text></binding></visual></foo>",
"testName");
Assert.Fail("Expected templateBody with unexpected first XML node to throw ArgumentException");
}
catch (ArgumentException e)
{
// PASSES
}
}
}
} | // ----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// ----------------------------------------------------------------------------
using System;
using System.Linq;
using Microsoft.WindowsAzure.MobileServices.Test.Functional;
using Microsoft.WindowsAzure.MobileServices.TestFramework;
namespace Microsoft.WindowsAzure.MobileServices.Test
{
[Tag("push")]
public class PushUnit : TestBase
{
[TestMethod]
public void InvalidBodyTemplateIfNotXml()
{
try
{
var registration = new TemplateRegistration("uri", "junkBodyTemplate", "testName");
}
catch (ArgumentException e)
{
// PASSES
}
}
[TestMethod]
public void InvalidBodyTemplateIfImproperXml()
{
try
{
var registration = new TemplateRegistration(
"uri",
"<foo><visual><binding template=\"ToastText01\"><text id=\"1\">$(message)</text></binding></visual></foo>",
"testName");
}
catch (ArgumentException e)
{
// PASSES
}
}
}
} | apache-2.0 | C# |
e37ff06578e34e9be035d7b230965b8afdf14989 | Set Credits to long to prevent overflow | timeanddate/libtad-net | TimeAndDate.Services/DataTypes/Account/Account.cs | TimeAndDate.Services/DataTypes/Account/Account.cs | using System;
using System.Collections.Generic;
using System.Xml;
using TimeAndDate.Services.DataTypes.Time;
namespace TimeAndDate.Services.DataTypes.Account
{
public class Account
{
/// <summary>
/// Padded 8-digit account ID.
/// </summary>
/// <value>
/// The account ID..
/// </value>
public string Id { get; set; }
/// <summary>
/// Timestamp of the request.
/// </summary>
/// <value>
/// The timestamp.
/// </value>
public TADDateTime Timestamp { get; set; }
/// <summary>
/// Remaining request credits on the request account.
/// </summary>
/// <value>
/// The request credits.
/// </value>
public long Credits { get; set; }
/// <summary>
/// Active packages owned by the request account.
/// </summary>
/// <value>
/// The packages.
/// </value>
public List<Package> Packages { get; set; }
public Account ()
{
Packages = new List<Package> ();
}
public Account (XmlNode node)
{
Packages = new List<Package> ();
var id = node.Attributes ["id"];
var timestamp = node.SelectSingleNode ("timestamp");
var credits = node.SelectSingleNode ("requests");
var packages = node.SelectNodes ("package");
if (id != null)
Id = id.InnerText;
if (timestamp != null)
{
var iso = timestamp.Attributes["iso"];
if (iso != null)
Timestamp = new TADDateTime (iso.InnerText);
}
if (credits != null)
Credits = long.Parse(credits.InnerText);
if (packages != null)
{
foreach (XmlNode package in packages)
Packages.Add ((Package) package);
}
}
}
}
| using System;
using System.Collections.Generic;
using System.Xml;
using TimeAndDate.Services.DataTypes.Time;
namespace TimeAndDate.Services.DataTypes.Account
{
public class Account
{
/// <summary>
/// Padded 8-digit account ID.
/// </summary>
/// <value>
/// The account ID..
/// </value>
public string Id { get; set; }
/// <summary>
/// Timestamp of the request.
/// </summary>
/// <value>
/// The timestamp.
/// </value>
public TADDateTime Timestamp { get; set; }
/// <summary>
/// Remaining request credits on the request account.
/// </summary>
/// <value>
/// The request credits.
/// </value>
public int Credits { get; set; }
/// <summary>
/// Active packages owned by the request account.
/// </summary>
/// <value>
/// The packages.
/// </value>
public List<Package> Packages { get; set; }
public Account ()
{
Packages = new List<Package> ();
}
public Account (XmlNode node)
{
Packages = new List<Package> ();
var id = node.Attributes ["id"];
var timestamp = node.SelectSingleNode ("timestamp");
var credits = node.SelectSingleNode ("requests");
var packages = node.SelectNodes ("package");
if (id != null)
Id = id.InnerText;
if (timestamp != null)
{
var iso = timestamp.Attributes["iso"];
if (iso != null)
Timestamp = new TADDateTime (iso.InnerText);
}
if (credits != null)
Credits = Int32.Parse(credits.InnerText);
if (packages != null)
{
foreach (XmlNode package in packages)
Packages.Add ((Package) package);
}
}
}
}
| mit | C# |
b7c64ecbfbe8a77501cfdaed6ff5bb06f3110316 | Simplify CanClone logic | krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,krille90/unitystation,fomalsd/unitystation | UnityProject/Assets/Scripts/Medical/CloningPod.cs | UnityProject/Assets/Scripts/Medical/CloningPod.cs | using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class CloningPod : NetworkBehaviour
{
[SyncVar(hook = nameof(SyncSprite))] public CloningPodStatus statusSync;
public SpriteRenderer spriteRenderer;
public Sprite cloningSprite;
public Sprite emptySprite;
public string statusString;
public CloningConsole console;
public enum CloningPodStatus
{
Empty,
Cloning
}
public override void OnStartServer()
{
statusString = "Inactive.";
}
public override void OnStartClient()
{
SyncSprite(statusSync, statusSync);
}
public void ServerStartCloning(CloningRecord record)
{
statusSync = CloningPodStatus.Cloning;
statusString = "Cloning cycle in progress.";
StartCoroutine(ServerProcessCloning(record));
}
private IEnumerator ServerProcessCloning(CloningRecord record)
{
yield return WaitFor.Seconds(10f);
statusString = "Cloning process complete.";
if (console)
{
console.UpdateDisplay();
}
if (record.mind.IsOnline(record.mind.GetCurrentMob()))
{
PlayerSpawn.ServerClonePlayer(record.mind, transform.position.CutToInt());
}
statusSync = CloningPodStatus.Empty;
}
public bool CanClone()
{
return statusSync == CloningPodStatus.Empty;
}
public void SyncSprite(CloningPodStatus oldValue, CloningPodStatus value)
{
statusSync = value;
if (value == CloningPodStatus.Empty)
{
spriteRenderer.sprite = emptySprite;
}
else
{
spriteRenderer.sprite = cloningSprite;
}
}
}
| using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Mirror;
public class CloningPod : NetworkBehaviour
{
[SyncVar(hook = nameof(SyncSprite))] public CloningPodStatus statusSync;
public SpriteRenderer spriteRenderer;
public Sprite cloningSprite;
public Sprite emptySprite;
public string statusString;
public CloningConsole console;
public enum CloningPodStatus
{
Empty,
Cloning
}
public override void OnStartServer()
{
statusString = "Inactive.";
}
public override void OnStartClient()
{
SyncSprite(statusSync, statusSync);
}
public void ServerStartCloning(CloningRecord record)
{
statusSync = CloningPodStatus.Cloning;
statusString = "Cloning cycle in progress.";
StartCoroutine(ServerProcessCloning(record));
}
private IEnumerator ServerProcessCloning(CloningRecord record)
{
yield return WaitFor.Seconds(10f);
statusString = "Cloning process complete.";
if (console)
{
console.UpdateDisplay();
}
if(record.mind.IsOnline(record.mind.GetCurrentMob()))
{
PlayerSpawn.ServerClonePlayer(record.mind, transform.position.CutToInt());
}
statusSync = CloningPodStatus.Empty;
}
public bool CanClone()
{
if(statusSync == CloningPodStatus.Cloning)
{
return false;
}
else
{
return true;
}
}
public void SyncSprite(CloningPodStatus oldValue, CloningPodStatus value)
{
statusSync = value;
if (value == CloningPodStatus.Empty)
{
spriteRenderer.sprite = emptySprite;
}
else
{
spriteRenderer.sprite = cloningSprite;
}
}
}
| agpl-3.0 | C# |
31ca4785424b8017b01f8550f588de7a58d5f694 | change localhost ip address | xlui/KinectProject,xlui/KinectProject,xlui/KinectProject,xlui/KinectProject | csharp_client/csharp_client/Config.cs | csharp_client/csharp_client/Config.cs | /* 在该文件中设置:
* 服务器 IP 地址
* 服务器端口号
* 引用:
* Config.SERVER_IP
* Config.SERVER_PORT
*/
using System;
namespace csharp_client
{
class Config
{
// 部署用的服务器 IP 地址
// public const String SERVER_IP = "111.231.1.210";
// 测试用的本机 IP 地址
public const String SERVER_IP = "10.100.67.235";
public const int SERVER_PORT = 21567;
}
}
| /* 在该文件中设置:
* 服务器 IP 地址
* 服务器端口号
* 引用:
* Config.SERVER_IP
* Config.SERVER_PORT
*/
using System;
namespace csharp_client
{
class Config
{
// 部署用的服务器 IP 地址
// public const String SERVER_IP = "111.231.1.210";
// 测试用的本机 IP 地址
public const String SERVER_IP = "192.168.1.165";
public const int SERVER_PORT = 21567;
}
}
| apache-2.0 | C# |
147b8f7cd274cbc05a5571bfba4d497d28aad821 | fix missing using | ArsenShnurkov/BitSharp | BitSharp.Core/Wallet/WalletAddress.cs | BitSharp.Core/Wallet/WalletAddress.cs | using BitSharp.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.Core.Wallet
{
public class WalletAddress
{
// point in the blockchain when monitoring started
private readonly UInt256 startBlockHash;
private readonly int startBlockHeight;
private readonly int startTxIndex;
private readonly int startInputIndex;
private readonly int startOutputIndex;
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BitSharp.Core.Wallet
{
public class WalletAddress
{
// point in the blockchain when monitoring started
private readonly UInt256 startBlockHash;
private readonly int startBlockHeight;
private readonly int startTxIndex;
private readonly int startInputIndex;
private readonly int startOutputIndex;
}
}
| unlicense | C# |
fd99da52e103fdfc8569e931ce2555b61b8555a9 | Fix fault in context menu | mike-ward/tweetz-desktop | tweetz5/tweetz5/Controls/Timeline.xaml.cs | tweetz5/tweetz5/Controls/Timeline.xaml.cs | // Copyright (c) 2013 Blue Onion Software - All rights reserved
using System.Windows;
using System.Windows.Input;
using tweetz5.Model;
namespace tweetz5.Controls
{
public partial class Timeline
{
public TimelineController Controller { get; private set; }
public Timeline()
{
InitializeComponent();
Controller = new TimelineController((Timelines)DataContext);
Controller.StartTimelines();
Unloaded += (sender, args) => Controller.Dispose();
}
private void MoreOnMouseDown(object sender, MouseButtonEventArgs e)
{
var frameworkElement = sender as FrameworkElement;
frameworkElement.ContextMenu.PlacementTarget = this;
frameworkElement.ContextMenu.DataContext = frameworkElement.DataContext;
frameworkElement.ContextMenu.IsOpen = true;
}
}
} | // Copyright (c) 2013 Blue Onion Software - All rights reserved
using System.Windows.Documents;
using System.Windows.Input;
using tweetz5.Model;
namespace tweetz5.Controls
{
public partial class Timeline
{
public TimelineController Controller { get; private set; }
public Timeline()
{
InitializeComponent();
Controller = new TimelineController((Timelines)DataContext);
Controller.StartTimelines();
Unloaded += (sender, args) => Controller.Dispose();
}
private void MoreOnMouseDown(object sender, MouseButtonEventArgs e)
{
var span = sender as Span;
span.ContextMenu.PlacementTarget = this;
span.ContextMenu.DataContext = span.DataContext;
span.ContextMenu.IsOpen = true;
}
}
} | mit | C# |
4125ee612c2109a922e4d1d9837bb486ecba26c2 | Support russian variant in FtpServerStrings.fileSizeNotInASCII | robinrodricks/FluentFTP,robinrodricks/FluentFTP,robinrodricks/FluentFTP | FluentFTP/Servers/FtpServerStrings.cs | FluentFTP/Servers/FtpServerStrings.cs | using System;
using System.Collections.Generic;
using System.Text;
namespace FluentFTP.Servers {
internal static class FtpServerStrings {
#region File Exists
/// <summary>
/// Error messages returned by various servers when a file does not exist.
/// Instead of throwing an error, we use these to detect and handle the file detection properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileNotFound = new[] {
"can't find file",
"can't check for file existence",
"does not exist",
"failed to open file",
"not found",
"no such file",
"cannot find the file",
"cannot find",
"can't get file",
"could not get file",
"could not get file size",
"cannot get file",
"not a regular file",
"file unavailable",
"file is unavailable",
"file not unavailable",
"file is not available",
"no files found",
"no file found",
"datei oder verzeichnis nicht gefunden",
"can't find the path",
"cannot find the path",
"could not find the path",
"file doesnot exist"
};
#endregion
#region File Size
/// <summary>
/// Error messages returned by various servers when a file size is not supported in ASCII mode.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileSizeNotInASCII = new[] {
"not allowed in ascii",
"size not allowed in ascii",
"n'est pas autorisé en mode ascii",
"не разрешено в режиме ascii"
};
#endregion
#region File Transfer
/// <summary>
/// Error messages returned by various servers when a file transfer temporarily failed.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] unexpectedEOF = new[] {
"unexpected eof for remote file",
"received an unexpected eof",
"unexpected eof"
};
#endregion
#region Create Directory
/// <summary>
/// Error messages returned by various servers when a folder already exists.
/// Instead of throwing an error, we use these to detect and handle the folder creation properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] folderExists = new[] {
"exist on server",
"exists on server",
"file exist",
"directory exist",
"folder exist",
"file already exist",
"directory already exist",
"folder already exist",
};
#endregion
}
}
| using System;
using System.Collections.Generic;
using System.Text;
namespace FluentFTP.Servers {
internal static class FtpServerStrings {
#region File Exists
/// <summary>
/// Error messages returned by various servers when a file does not exist.
/// Instead of throwing an error, we use these to detect and handle the file detection properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileNotFound = new[] {
"can't find file",
"can't check for file existence",
"does not exist",
"failed to open file",
"not found",
"no such file",
"cannot find the file",
"cannot find",
"can't get file",
"could not get file",
"could not get file size",
"cannot get file",
"not a regular file",
"file unavailable",
"file is unavailable",
"file not unavailable",
"file is not available",
"no files found",
"no file found",
"datei oder verzeichnis nicht gefunden",
"can't find the path",
"cannot find the path",
"could not find the path",
"file doesnot exist"
};
#endregion
#region File Size
/// <summary>
/// Error messages returned by various servers when a file size is not supported in ASCII mode.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] fileSizeNotInASCII = new[] {
"not allowed in ascii",
"size not allowed in ascii",
"n'est pas autorisé en mode ascii"
};
#endregion
#region File Transfer
/// <summary>
/// Error messages returned by various servers when a file transfer temporarily failed.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] unexpectedEOF = new[] {
"unexpected eof for remote file",
"received an unexpected eof",
"unexpected eof"
};
#endregion
#region Create Directory
/// <summary>
/// Error messages returned by various servers when a folder already exists.
/// Instead of throwing an error, we use these to detect and handle the folder creation properly.
/// MUST BE LOWER CASE!
/// </summary>
public static string[] folderExists = new[] {
"exist on server",
"exists on server",
"file exist",
"directory exist",
"folder exist",
"file already exist",
"directory already exist",
"folder already exist",
};
#endregion
}
}
| mit | C# |
3a17d7b12ea98156a1617f9b7e5f6efff3c2fb97 | Add the col class. (It move the button to the right a little) | ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab | Anlab.Mvc/Views/AdminAnalysis/Delete.cshtml | Anlab.Mvc/Views/AdminAnalysis/Delete.cshtml | @using AnlabMvc.Controllers
@model AnlabMvc.Controllers.AdminAnalysisController.AnalysisDeleteModel
@{
ViewBag.Title = "Delete Analysis Method";
}
<div class="col">
<hr />
<h3>Are you sure you want to delete this?</h3>
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Id)
</dt>
<dd>
@Html.DisplayFor(model => model.AnalysisMethod.Id)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Title)
</dt>
<dd>
@Html.DisplayFor(model => model.AnalysisMethod.Title)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Category)
</dt>
<dd>
@Html.DisplayFor(model => model.AnalysisMethod.Category)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Content)
</dt>
<dd>
@Html.Raw(Model.HtmlContent)
</dd>
</dl>
<form asp-action="Delete">
<div class="form-actions no-color col-md-offset-1">
<input type="submit" value="Delete" class="btn btn-default" />
</div>
<a asp-action="Index">Back to List</a>
</form>
</div>
| @using AnlabMvc.Controllers
@model AnlabMvc.Controllers.AdminAnalysisController.AnalysisDeleteModel
@{
ViewBag.Title = "Delete Analysis Method";
}
<div>
<hr />
<h3>Are you sure you want to delete this?</h3>
<dl class="dl-horizontal">
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Id)
</dt>
<dd>
@Html.DisplayFor(model => model.AnalysisMethod.Id)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Title)
</dt>
<dd>
@Html.DisplayFor(model => model.AnalysisMethod.Title)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Category)
</dt>
<dd>
@Html.DisplayFor(model => model.AnalysisMethod.Category)
</dd>
<dt>
@Html.DisplayNameFor(model => model.AnalysisMethod.Content)
</dt>
<dd>
@Html.Raw(Model.HtmlContent)
</dd>
</dl>
<form asp-action="Delete">
<div class="form-actions no-color col-md-offset-1">
<input type="submit" value="Delete" class="btn btn-default" />
</div>
<a asp-action="Index">Back to List</a>
</form>
</div>
| mit | C# |
53b3bb9a3208844510c01dc78f8f68569148c7f2 | add ex hook | ProRoman/Aura_PhotoViewer | AuraPhotoViewer/AuraPhotoViewer/App.xaml.cs | AuraPhotoViewer/AuraPhotoViewer/App.xaml.cs | using AuraPhotoViewer.Modules.Common.Events;
using Microsoft.Practices.Unity;
using Prism.Events;
using System.Windows;
using log4net;
using System;
using System.Windows.Threading;
namespace AuraPhotoViewer
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
#region Log4net
private static readonly ILog Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
protected override void OnStartup(StartupEventArgs e)
{
Log.Info("App starts");
base.OnStartup(e);
Log.Info("Bootstrapper starts");
// Start Bootstrapper
var bootstrapper = new AuraBootstrapper();
bootstrapper.Run();
Application.Current.Exit += AppExitHandler;
// On start up publish opened image
if (e.Args.Length >= 1)
{
bootstrapper.Container.Resolve<IEventAggregator>().GetEvent<OpenedImageEvent>().Publish(e.Args[0]);
}
// Unhandled by code running on the main UI thread
Current.DispatcherUnhandledException += DispatcherUnhandledExceptionHandler;
// In any thread
AppDomain.CurrentDomain.UnhandledException += DomainUnhandledExceptionHandler;
}
private void AppExitHandler(object sender, ExitEventArgs exitEventArgs)
{
Log.Info("App shuts down");
}
private void DomainUnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
{
var ex = unhandledExceptionEventArgs.ExceptionObject as Exception;
Log.Fatal("Unhandled Thread Exception", ex);
}
private void DispatcherUnhandledExceptionHandler(object sender, DispatcherUnhandledExceptionEventArgs dispatcherUnhandledExceptionEventArgs)
{
Log.Fatal("Dispatcher Unhandled Exception", dispatcherUnhandledExceptionEventArgs.Exception);
dispatcherUnhandledExceptionEventArgs.Handled = true;
}
}
}
| using AuraPhotoViewer.Modules.Common.Events;
using Microsoft.Practices.Unity;
using Prism.Events;
using System.Windows;
using log4net;
namespace AuraPhotoViewer
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
#region Log4net
private static readonly ILog Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
#endregion
protected override void OnStartup(StartupEventArgs e)
{
Log.Info("App starts");
base.OnStartup(e);
Log.Info("Bootstrapper starts");
// Start Bootstrapper
var bootstrapper = new AuraBootstrapper();
bootstrapper.Run();
Application.Current.Exit += AppExitHandler;
// On start up publish opened image
if (e.Args.Length >= 1)
{
bootstrapper.Container.Resolve<IEventAggregator>().GetEvent<OpenedImageEvent>().Publish(e.Args[0]);
}
}
private void AppExitHandler(object sender, ExitEventArgs exitEventArgs)
{
Log.Info("App shuts down");
}
}
}
| mit | C# |
a5936be1385293f868622c9b9179bb6da73b26a8 | Add warning | mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander | Battery-Commander.Web/Views/SUTA/New.cshtml | Battery-Commander.Web/Views/SUTA/New.cshtml | @model BatteryCommander.Web.Commands.AddSUTARequest
<div class="alert alert-default">
Use this form to submit a Substitute Unit Training (SUTA) request to your chain of command.
</div>
<div class="alert alert-warning">
Note: All requests are subject to mission requirements and Commander's discretion!
</div>
@using (Html.BeginForm("Save", "SUTA", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary()
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Soldier)
@Html.DropDownListFor(model => model.Soldier, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --", new { @class = "select2" })
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.StartDate)
@Html.EditorFor(model => model.EndDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.EndDate)
@Html.EditorFor(model => model.EndDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Reasoning)
@Html.TextAreaFor(model => model.Reasoning)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.MitigationPlan)
@Html.TextAreaFor(model => model.MitigationPlan)
</div>
<button type="submit">Submit</button>
}
| @model BatteryCommander.Web.Commands.AddSUTARequest
@using (Html.BeginForm("Save", "SUTA", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@Html.ValidationSummary()
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Soldier)
@Html.DropDownListFor(model => model.Soldier, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --", new { @class = "select2" })
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.StartDate)
@Html.EditorFor(model => model.EndDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.EndDate)
@Html.EditorFor(model => model.EndDate)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.Reasoning)
@Html.TextAreaFor(model => model.Reasoning)
</div>
<div class="form-group form-group-lg">
@Html.DisplayNameFor(model => model.MitigationPlan)
@Html.TextAreaFor(model => model.MitigationPlan)
</div>
<button type="submit">Submit</button>
}
| mit | C# |
394e834e4846908b832085ba1758c60ef6e0e8ac | Remove use of "unaligned. 8" IL instruction | RyanLamansky/dotnet-webassembly | WebAssembly/Instructions/MemoryReadInstruction.cs | WebAssembly/Instructions/MemoryReadInstruction.cs | using System.Reflection.Emit;
using WebAssembly.Runtime;
using WebAssembly.Runtime.Compilation;
namespace WebAssembly.Instructions
{
/// <summary>
/// Provides shared functionality for instructions that read from linear memory.
/// </summary>
public abstract class MemoryReadInstruction : MemoryImmediateInstruction
{
private protected MemoryReadInstruction()
: base()
{
}
private protected MemoryReadInstruction(Reader reader)
: base(reader)
{
}
private protected virtual System.Reflection.Emit.OpCode ConversionOpCode => OpCodes.Nop;
internal sealed override void Compile(CompilationContext context)
{
var stack = context.Stack;
context.PopStackNoReturn(this.OpCode, WebAssemblyValueType.Int32);
if (this.Offset != 0)
{
Int32Constant.Emit(context, (int)this.Offset);
context.Emit(OpCodes.Add_Ovf_Un);
}
this.EmitRangeCheck(context);
context.EmitLoadThis();
context.Emit(OpCodes.Ldfld, context.CheckedMemory);
context.Emit(OpCodes.Call, UnmanagedMemory.StartGetter);
context.Emit(OpCodes.Add);
byte alignment;
switch (this.Flags & Options.Align8)
{
default: //Impossible to hit, but needed to avoid compiler error the about alignment variable.
case Options.Align1: alignment = 1; break;
case Options.Align2: alignment = 2; break;
case Options.Align4: alignment = 4; break;
case Options.Align8: alignment = 8; break;
}
//8-byte alignment is not available in IL.
//See: https://docs.microsoft.com/en-us/dotnet/api/system.reflection.emit.opcodes.unaligned?view=net-5.0
//However, because 8-byte alignment is subset of 4-byte alignment,
//We don't have to consider it.
if (alignment != 4 && alignment != 8)
context.Emit(OpCodes.Unaligned, alignment);
context.Emit(this.EmittedOpCode);
var conversion = this.ConversionOpCode;
if (conversion != OpCodes.Nop)
context.Emit(conversion);
stack.Push(this.Type);
}
}
} | using System.Reflection.Emit;
using WebAssembly.Runtime;
using WebAssembly.Runtime.Compilation;
namespace WebAssembly.Instructions
{
/// <summary>
/// Provides shared functionality for instructions that read from linear memory.
/// </summary>
public abstract class MemoryReadInstruction : MemoryImmediateInstruction
{
private protected MemoryReadInstruction()
: base()
{
}
private protected MemoryReadInstruction(Reader reader)
: base(reader)
{
}
private protected virtual System.Reflection.Emit.OpCode ConversionOpCode => OpCodes.Nop;
internal sealed override void Compile(CompilationContext context)
{
var stack = context.Stack;
context.PopStackNoReturn(this.OpCode, WebAssemblyValueType.Int32);
if (this.Offset != 0)
{
Int32Constant.Emit(context, (int)this.Offset);
context.Emit(OpCodes.Add_Ovf_Un);
}
this.EmitRangeCheck(context);
context.EmitLoadThis();
context.Emit(OpCodes.Ldfld, context.CheckedMemory);
context.Emit(OpCodes.Call, UnmanagedMemory.StartGetter);
context.Emit(OpCodes.Add);
byte alignment;
switch (this.Flags & Options.Align8)
{
default: //Impossible to hit, but needed to avoid compiler error the about alignment variable.
case Options.Align1: alignment = 1; break;
case Options.Align2: alignment = 2; break;
case Options.Align4: alignment = 4; break;
case Options.Align8: alignment = 8; break;
}
if (alignment != 4)
context.Emit(OpCodes.Unaligned, alignment);
context.Emit(this.EmittedOpCode);
var conversion = this.ConversionOpCode;
if (conversion != OpCodes.Nop)
context.Emit(conversion);
stack.Push(this.Type);
}
}
} | apache-2.0 | C# |
d093eb6660c7f04ff27c75dd587e08bb67bd48d0 | Mark sprite read-only | NeoAdonis/osu,peppy/osu,ppy/osu,johnneijzen/osu,smoogipoo/osu,2yangk23/osu,EVAST9919/osu,ppy/osu,ZLima12/osu,peppy/osu,EVAST9919/osu,UselessToucan/osu,smoogipoo/osu,UselessToucan/osu,2yangk23/osu,ppy/osu,UselessToucan/osu,peppy/osu,johnneijzen/osu,smoogipooo/osu,ZLima12/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu | osu.Game/Graphics/Backgrounds/Background.cs | osu.Game/Graphics/Backgrounds/Background.cs | // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transforms;
using osuTK;
namespace osu.Game.Graphics.Backgrounds
{
/// <summary>
/// A background which offers blurring via a <see cref="BufferedContainer"/> on demand.
/// </summary>
public class Background : CompositeDrawable
{
public readonly Sprite Sprite;
private readonly string textureName;
private BufferedContainer bufferedContainer;
public Background(string textureName = @"")
{
this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
AddInternal(Sprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
});
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
}
public Vector2 BlurSigma => bufferedContainer?.BlurSigma ?? Vector2.Zero;
/// <summary>
/// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time.
/// </summary>
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
{
if (bufferedContainer == null)
{
RemoveInternal(Sprite);
AddInternal(bufferedContainer = new BufferedContainer
{
CacheDrawnFrameBuffer = true,
RelativeSizeAxes = Axes.Both,
Child = Sprite
});
}
bufferedContainer.BlurTo(newBlurSigma, duration, easing);
}
}
}
| // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transforms;
using osuTK;
namespace osu.Game.Graphics.Backgrounds
{
/// <summary>
/// A background which offers blurring via a <see cref="BufferedContainer"/> on demand.
/// </summary>
public class Background : CompositeDrawable
{
public Sprite Sprite;
private readonly string textureName;
private BufferedContainer bufferedContainer;
public Background(string textureName = @"")
{
this.textureName = textureName;
RelativeSizeAxes = Axes.Both;
AddInternal(Sprite = new Sprite
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
});
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
}
public Vector2 BlurSigma => bufferedContainer?.BlurSigma ?? Vector2.Zero;
/// <summary>
/// Smoothly adjusts <see cref="IBufferedContainer.BlurSigma"/> over time.
/// </summary>
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
{
if (bufferedContainer == null)
{
RemoveInternal(Sprite);
AddInternal(bufferedContainer = new BufferedContainer
{
CacheDrawnFrameBuffer = true,
RelativeSizeAxes = Axes.Both,
Child = Sprite
});
}
bufferedContainer.BlurTo(newBlurSigma, duration, easing);
}
}
}
| mit | C# |
288a435cecba3de2517d68c67a5d3efb39e5a29e | Remove errant comment on calc type | mattgwagner/CertiPay.Payroll.Common | CertiPay.Payroll.Common/CalculationType.cs | CertiPay.Payroll.Common/CalculationType.cs | using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace CertiPay.Payroll.Common
{
/// <summary>
/// Identifies the method to calculate the result
/// </summary>
public enum CalculationType : byte
{
/// <summary>
/// Deduction is taken as a percentage of the gross pay
/// </summary>
[Display(Name = "Percent of Gross Pay")]
PercentOfGrossPay = 1,
/// <summary>
/// Deduction is taken as a percentage of the net pay
/// </summary>
[Display(Name = "Percent of Net Pay")]
PercentOfNetPay = 2,
/// <summary>
/// Deduction is taken as a flat, fixed amount
/// </summary>
[Display(Name = "Fixed Amount")]
FixedAmount = 3,
/// <summary>
/// Deduction is taken as a fixed amount per hour of work
/// </summary>
[Display(Name = "Fixed Hourly Amount")]
FixedHourlyAmount = 4
}
public static class CalculationTypes
{
public static IEnumerable<CalculationType> Values()
{
yield return CalculationType.PercentOfGrossPay;
yield return CalculationType.PercentOfNetPay;
yield return CalculationType.FixedAmount;
yield return CalculationType.FixedHourlyAmount;
}
}
} | using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace CertiPay.Payroll.Common
{
/// <summary>
/// Identifies the method to calculate the result
/// </summary>
public enum CalculationType : byte
{
// TODO: We might implement some other calculation methods as needed?
// Percent of Special Earnings: Select to calculate the deduction as a percent of a special accumulator, such as 401(k).
/// <summary>
/// Deduction is taken as a percentage of the gross pay
/// </summary>
[Display(Name = "Percent of Gross Pay")]
PercentOfGrossPay = 1,
/// <summary>
/// Deduction is taken as a percentage of the net pay
/// </summary>
[Display(Name = "Percent of Net Pay")]
PercentOfNetPay = 2,
/// <summary>
/// Deduction is taken as a flat, fixed amount
/// </summary>
[Display(Name = "Fixed Amount")]
FixedAmount = 3,
/// <summary>
/// Deduction is taken as a fixed amount per hour of work
/// </summary>
[Display(Name = "Fixed Hourly Amount")]
FixedHourlyAmount = 4
}
public static class CalculationTypes
{
public static IEnumerable<CalculationType> Values()
{
yield return CalculationType.PercentOfGrossPay;
yield return CalculationType.PercentOfNetPay;
yield return CalculationType.FixedAmount;
yield return CalculationType.FixedHourlyAmount;
}
}
} | mit | C# |
c84759968874d903b4319900638ccf13eac19063 | Tweak module for returning PDF request | kylebjones/CertiPay.Services.PDF | CertiPay.Services.PDF/Modules/PdfModule.cs | CertiPay.Services.PDF/Modules/PdfModule.cs | using CertiPay.Common;
using CertiPay.PDF;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Responses;
using System;
using System.Configuration;
using System.IO;
using System.Net.Mime;
namespace CertiPay.Services.PDF.Modules
{
public class PdfModule : NancyModule
{
private static String AppName { get { return ConfigurationManager.AppSettings["ApplicationName"]; } }
public PdfModule(IPDFService pdfSvc)
{
Get["/"] = _ =>
{
return Response.AsJson(new
{
Application = AppName,
Version = Utilities.Version<PdfModule>(),
Environment = EnvUtil.Current.DisplayName(),
Server = Environment.MachineName
});
};
Get["/Pdf/GenerateDocument"] = p =>
{
var useLandscape = (bool?)Request.Query["landscape"] ?? null;
return GetPdf(pdfSvc, new PDFService.Settings
{
UseLandscapeOrientation = useLandscape ?? false,
Uris = new String[] { Request.Query["url"] }
});
};
Post["/Pdf/GenerateDocument"] = p =>
{
return GetPdf(pdfSvc, this.Bind<PDFService.Settings>());
};
}
private StreamResponse GetPdf(IPDFService pdfSvc, PDFService.Settings request)
{
var stream = new MemoryStream(pdfSvc.CreatePdf(request));
return new StreamResponse(() => stream, MediaTypeNames.Application.Pdf);
}
}
} | using CertiPay.Common;
using CertiPay.PDF;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Responses;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
namespace CertiPay.Services.PDF.Modules
{
public class PdfModule : NancyModule
{
private static String AppName { get { return ConfigurationManager.AppSettings["ApplicationName"]; } }
public PdfModule(IPDFService pdfSvc)
{
Get["/"] = _ =>
{
return Response.AsJson(new
{
Application = AppName,
Version = CertiPay.Common.Utilities.Version<PdfModule>(),
Environment = EnvUtil.Current.DisplayName(),
Server = Environment.MachineName
});
};
Get["/Pdf/GenerateDocument"] = p =>
{
var url = this.Request.Query["url"];
var useLandscape = (bool?)this.Request.Query["landscape"] ?? null;
var settings = new PDFService.Settings()
{
UseLandscapeOrientation = useLandscape ?? false,
Uris = new List<string>()
{
url
}
};
var stream = new MemoryStream(pdfSvc.CreatePdf(settings));
//Future change. Add ability for FileName to be passed in from Caller.
var response = new StreamResponse(() => stream, MimeTypes.GetMimeType("Generated-Document.pdf"));
return response;
};
Post["/Pdf/GenerateDocument"] = p =>
{
var settings = this.Bind<PDFService.Settings>();
var stream = new MemoryStream(pdfSvc.CreatePdf(settings));
//Future change. Add ability for FileName to be passed in from Caller.
var response = new StreamResponse(() => stream, MimeTypes.GetMimeType("Generated-Document.pdf"));
return response;
};
}
}
} | mit | C# |
f645d4d25d09fb4b81266fa6e1e5b223e47a2a17 | Remove usage of newer C# feature | GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus,GrognardsFromHell/TemplePlus | Configurator/SaveGameFolder.cs | Configurator/SaveGameFolder.cs | using System;
using System.Runtime.InteropServices;
namespace TemplePlusConfig
{
class SaveGameFolder
{
private static readonly Guid SavedGames = new Guid("4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4");
[DllImport("shell32.dll")]
private static extern int SHGetKnownFolderPath(
[MarshalAs(UnmanagedType.LPStruct)] Guid rfid,
uint dwFlags,
IntPtr hToken,
out IntPtr pszPath
);
static SaveGameFolder()
{
int hresult;
IntPtr pszPath;
if ((hresult = SHGetKnownFolderPath(SavedGames, 0, IntPtr.Zero, out pszPath)) == 0)
{
Path = Marshal.PtrToStringUni(pszPath);
Marshal.FreeCoTaskMem(pszPath);
}
else
{
throw new COMException("Unable to determine location of save game folder.", hresult);
}
}
public static string Path { get; internal set; }
}
}
| using System;
using System.Runtime.InteropServices;
namespace TemplePlusConfig
{
class SaveGameFolder
{
private static readonly Guid SavedGames = new Guid("4C5C32FF-BB9D-43b0-B5B4-2D72E54EAAA4");
[DllImport("shell32.dll")]
private static extern int SHGetKnownFolderPath(
[MarshalAs(UnmanagedType.LPStruct)] Guid rfid,
uint dwFlags,
IntPtr hToken,
out IntPtr pszPath
);
static SaveGameFolder()
{
int hresult;
if ((hresult = SHGetKnownFolderPath(SavedGames, 0, IntPtr.Zero, out IntPtr pszPath)) == 0)
{
Path = Marshal.PtrToStringUni(pszPath);
Marshal.FreeCoTaskMem(pszPath);
} else
{
throw new COMException("Unable to determine location of save game folder.", hresult);
}
}
public static string Path { get; internal set; }
}
}
| mit | C# |
70bac48cd79c42557e0a64fa89adf9bb59cb8e44 | Fix warning. | JohanLarsson/Gu.Wpf.ToolTips | Gu.Wpf.ToolTips.UiTests/MainWindowTests.cs | Gu.Wpf.ToolTips.UiTests/MainWindowTests.cs | namespace Gu.Wpf.ToolTips.UiTests
{
using Gu.Wpf.UiAutomation;
using NUnit.Framework;
public class MainWindowTests
{
[Test]
public void ClickAllTabs()
{
// Just a smoke test so we don't crash.
using (var app = Application.Launch("Gu.Wpf.ToolTips.Demo.exe"))
{
var window = app.MainWindow;
var tab = window.FindTabControl();
foreach (var tabItem in tab.Items)
{
_ = tabItem.Select();
}
}
}
}
}
| namespace Gu.Wpf.ToolTips.UiTests
{
using Gu.Wpf.UiAutomation;
using NUnit.Framework;
public class MainWindowTests
{
[Test]
public void ClickAllTabs()
{
// Just a smoke test so we don't crash.
using (var app = Application.Launch("Gu.Wpf.ToolTips.Demo.exe"))
{
var window = app.MainWindow;
var tab = window.FindTabControl();
foreach (var tabItem in tab.Items)
{
tabItem.Select();
}
}
}
}
}
| mit | C# |
9caac71450b8f4befd72ffba042b668f4582095d | Update assembly information | jozefizso/FogBugz-ExtendedEvents,jozefizso/FogBugz-ExtendedEvents | FBExtendedEvents/Properties/AssemblyInfo.cs | FBExtendedEvents/Properties/AssemblyInfo.cs | using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Extended Events")]
[assembly: AssemblyDescription("Show events from external sources like Subversion, TeamCity and Jenkins.")]
[assembly: AssemblyCompany("Jozef Izso")]
[assembly: AssemblyProduct("FBExtendedEvents")]
[assembly: AssemblyCopyright("Copyright © 2015-2016 Jozef Izso")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("dc011599-24b0-4a15-acc5-bc3fa9a446d8")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Extended Events")]
[assembly: AssemblyDescription("Show events from external sources like Subversion, TeamCity and Jenkins.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Jozef Izso")]
[assembly: AssemblyProduct("FBExtendedEvents")]
[assembly: AssemblyCopyright("Copyright © 2015 Jozef Izso")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("dc011599-24b0-4a15-acc5-bc3fa9a446d8")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
dace33e59c93a40e73341a8b11d78d72e9630bb5 | add year property to Quote | jgraber/MicroORM_examples,jgraber/MicroORM_examples,jgraber/MicroORM_examples | MicroORM_Dapper/Quotations/Models/Quote.cs | MicroORM_Dapper/Quotations/Models/Quote.cs | namespace Quotations.Models
{
public class Quote
{
public int Id { get; set; }
public string Text { get; set; }
public string Context { get; set; }
public Person Author { get; set; }
public string Year { get; set; }
}
} | namespace Quotations.Models
{
public class Quote
{
public int Id { get; set; }
public string Text { get; set; }
public string Context { get; set; }
public Person Author { get; set; }
}
} | apache-2.0 | C# |
d23dd26b31d7ebbced51bc23bc0690434ba90766 | update in performance benchmark | p-org/PSharp | Tests/Performance.Tests/NBody/Test.cs | Tests/Performance.Tests/NBody/Test.cs | using System;
using Microsoft.PSharp;
using Microsoft.PSharp.Utilities;
namespace NBody
{
public class Test
{
static readonly int NumOfBodies = 1000;
static readonly int NumOfSteps = 100;
static void Main(string[] args)
{
Profiler profiler = new Profiler();
profiler.StartMeasuringExecutionTime();
var runtime = PSharpRuntime.Create();
Test.Execute(runtime);
runtime.Wait();
profiler.StopMeasuringExecutionTime();
Console.WriteLine("... P# executed for '" +
profiler.Results() + "' seconds.");
profiler.StartMeasuringExecutionTime();
new TPLTest().Start(Test.NumOfBodies, Test.NumOfSteps);
profiler.StopMeasuringExecutionTime();
Console.WriteLine("... TPL executed for '" +
profiler.Results() + "' seconds.");
}
[Microsoft.PSharp.Test]
public static void Execute(PSharpRuntime runtime)
{
runtime.CreateMachine(typeof(Simulation),
new Simulation.Config(Test.NumOfBodies, Test.NumOfSteps));
}
}
}
| using System;
using Microsoft.PSharp;
using Microsoft.PSharp.Utilities;
namespace NBody
{
public class Test
{
static readonly int NumOfBodies = 100;
static readonly int NumOfSteps = 100;
static void Main(string[] args)
{
Profiler profiler = new Profiler();
profiler.StartMeasuringExecutionTime();
var runtime = PSharpRuntime.Create();
Test.Execute(runtime);
runtime.Wait();
profiler.StopMeasuringExecutionTime();
Console.WriteLine("... P# executed for '" +
profiler.Results() + "' seconds.");
//profiler.StartMeasuringExecutionTime();
//new TPLTest().Start(Test.NumOfBodies, Test.NumOfSteps);
//profiler.StopMeasuringExecutionTime();
//Console.WriteLine("... TPL executed for '" +
// profiler.Results() + "' seconds.");
}
[Microsoft.PSharp.Test]
public static void Execute(PSharpRuntime runtime)
{
runtime.CreateMachine(typeof(Simulation),
new Simulation.Config(Test.NumOfBodies, Test.NumOfSteps));
}
}
}
| mit | C# |
2881d9af4ddaabebb6f0870c12bc80eed5e0f3f3 | Format available channels for Limit attribute | mastorm/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX,mariocatch/MODiX | Modix/Utilities/LimitToChannelsAttribute.cs | Modix/Utilities/LimitToChannelsAttribute.cs | using Discord.Commands;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Modix.Utilities
{
public class LimitToChannelsAttribute : PreconditionAttribute
{
public override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IDependencyMap map)
{
var channelsConfig = Environment.GetEnvironmentVariable($"MODIX_LIMIT_MODULE_CHANNELS_{command.Module.Name.ToUpper()}");
if (channelsConfig == null)
{
return Task.Run(() => PreconditionResult.FromSuccess());
}
var channels = channelsConfig.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
return channels.Any(c => ulong.Parse(c) == context.Channel.Id)
? Task.Run(() => PreconditionResult.FromSuccess())
: Task.Run(() => PreconditionResult.FromError($"This command cannot run in this channel. Valid channels are: {string.Join(", ", channels.Select(c => $"<#{c}>"))}"));
}
}
}
| using Discord.Commands;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace Modix.Utilities
{
public class LimitToChannelsAttribute : PreconditionAttribute
{
public override Task<PreconditionResult> CheckPermissions(ICommandContext context, CommandInfo command, IDependencyMap map)
{
var channelsConfig = Environment.GetEnvironmentVariable($"MODIX_LIMIT_MODULE_CHANNELS_{command.Module.Name.ToUpper()}");
if (channelsConfig == null)
{
return Task.Run(() => PreconditionResult.FromSuccess());
}
var channels = channelsConfig.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();
return channels.Any(c => ulong.Parse(c) == context.Channel.Id)
? Task.Run(() => PreconditionResult.FromSuccess())
: Task.Run(() => PreconditionResult.FromError("This command cannot run in this channel"));
}
}
}
| mit | C# |
9ca4a727514997c70c37f83aebbf1705a530273a | Fix code style and mode initialisation code to Initialize method | peppy/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,ZLima12/osu-framework,smoogipooo/osu-framework,peppy/osu-framework,EVAST9919/osu-framework | osu.Framework.iOS/Input/IOSMouseHandler.cs | osu.Framework.iOS/Input/IOSMouseHandler.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 CoreGraphics;
using Foundation;
using JetBrains.Annotations;
using osu.Framework.Input.Handlers;
using osu.Framework.Input.StateChanges;
using osu.Framework.Platform;
using osuTK;
using UIKit;
namespace osu.Framework.iOS.Input
{
public class IOSMouseHandler : InputHandler
{
private readonly IOSGameView view;
public IOSMouseHandler(IOSGameView view)
{
this.view = view;
}
public override bool IsActive => true;
public override int Priority => 1; // Touches always take priority
[UsedImplicitly]
private IOSMouseDelegate mouseDelegate;
public override bool Initialize(GameHost host)
{
// UIPointerInteraction is only available on iOS 13.4 and up
if (!UIDevice.CurrentDevice.CheckSystemVersion(13, 4))
return false;
view.Window.AddInteraction(new UIPointerInteraction(mouseDelegate = new IOSMouseDelegate()));
mouseDelegate.LocationUpdated += locationUpdated;
return true;
}
private void locationUpdated(CGPoint location)
{
PendingInputs.Enqueue(new MousePositionAbsoluteInput
{
Position = new Vector2(
(float)location.X * view.Scale,
(float)location.Y * view.Scale)
});
}
}
public class IOSMouseDelegate : NSObject, IUIPointerInteractionDelegate
{
public Action<CGPoint> LocationUpdated;
[Export("pointerInteraction:regionForRequest:defaultRegion:")]
public UIPointerRegion GetRegionForRequest(UIPointerInteraction interaction, UIPointerRegionRequest request, UIPointerRegion defaultRegion)
{
LocationUpdated(request.Location);
return defaultRegion;
}
[Export("pointerInteraction:styleForRegion:")]
public UIPointerStyle GetStyleForRegion(UIPointerInteraction interaction, UIPointerRegion region) =>
UIPointerStyle.CreateHiddenPointerStyle();
}
}
| // 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 CoreGraphics;
using Foundation;
using ObjCRuntime;
using osu.Framework.Input.Handlers;
using osu.Framework.Input.StateChanges;
using osu.Framework.Platform;
using osuTK;
using UIKit;
namespace osu.Framework.iOS.Input
{
public class IOSMouseHandler : InputHandler
{
private readonly IOSGameView view;
private readonly UIPointerInteraction pointerInteraction;
private readonly IOSMouseDelegate mouseDelegate;
public IOSMouseHandler(IOSGameView view)
{
// UIPointerInteraction is only available on iOS 13.4 and up
if (!UIDevice.CurrentDevice.CheckSystemVersion(13, 4))
return;
this.view = view;
view.Window.AddInteraction(pointerInteraction = new UIPointerInteraction(mouseDelegate = new IOSMouseDelegate()));
mouseDelegate.LocationUpdated += locationUpdated;
}
public override bool IsActive => (pointerInteraction != null);
public override int Priority => 1; // Touches always take priority
public override bool Initialize(GameHost host) => true;
private void locationUpdated(CGPoint location)
{
PendingInputs.Enqueue(new MousePositionAbsoluteInput { Position = new Vector2((float)location.X * view.Scale,
(float)location.Y * view.Scale) });
}
}
public class IOSMouseDelegate: NSObject, IUIPointerInteractionDelegate
{
public Action<CGPoint> LocationUpdated;
[Export("pointerInteraction:regionForRequest:defaultRegion:")]
public UIPointerRegion GetRegionForRequest(UIPointerInteraction interaction, UIPointerRegionRequest request, UIPointerRegion defaultRegion)
{
LocationUpdated(request.Location);
return defaultRegion;
}
[Export("pointerInteraction:styleForRegion:")]
public UIPointerStyle GetStyleForRegion(UIPointerInteraction interaction, UIPointerRegion region)
{
return UIPointerStyle.CreateHiddenPointerStyle();
}
}
} | mit | C# |
e42d8a73694ed6241f7d5b18c06591e644f05ad8 | edit for style | kaosborn/KaosCollections | Bench/RdExample02/RdExample02.cs | Bench/RdExample02/RdExample02.cs | using System;
using Kaos.Collections;
namespace ExampleApp
{
class RdExample02
{
static void Main()
{
var dary = new RankedDictionary<int,int>()
{ [36] = 360, [12] = 120 };
Console.WriteLine ("Keys:");
foreach (var key in dary.Keys)
Console.WriteLine (key);
Console.WriteLine ("\nValues:");
foreach (var val in dary.Values)
Console.WriteLine (val);
}
/* Output:
Keys:
12
36
Values:
120
360
*/
}
}
| using System;
using Kaos.Collections;
namespace ExampleApp
{
class RdExample02
{
static void Main()
{
var d2 = new RankedDictionary<int,int>()
{ [36] = 360, [12] = 120 };
Console.WriteLine ("Keys:");
foreach (var key in d2.Keys)
Console.WriteLine (key);
Console.WriteLine ("Values:");
foreach (var val in d2.Values)
Console.WriteLine (val);
}
/* Output:
Keys:
12
36
Values:
120
360
*/
}
}
| mit | C# |
b4a050b5b06ae120c0f329dfa713ed3bef26169d | Fix typo that broke the build | JasonBock/csla,rockfordlhotka/csla,rockfordlhotka/csla,JasonBock/csla,JasonBock/csla,rockfordlhotka/csla,MarimerLLC/csla,MarimerLLC/csla,MarimerLLC/csla | Source/Csla.Validation.Test/Properties/AssemblyInfo.cs | Source/Csla.Validation.Test/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("Csla.Validation.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Csla.Validation.Test")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d68c5c90-c345-4c0e-9d6d-837b4419fda7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 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("Csla.Validation.Test")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Csla.Validation.Test")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("d68c5c90-c346.0.0e-9d6d-837b4419fda7")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
| mit | C# |
afbf1e2f722ac224f505426ee9b4f248810f6aca | Update ObsoleteAttribute Text | FormsCommunityToolkit/FormsCommunityToolkit | src/CommunityToolkit/Xamarin.CommunityToolkit/ObjectModel/Extensions/INotifyPropertyChangedExtension.shared.cs | src/CommunityToolkit/Xamarin.CommunityToolkit/ObjectModel/Extensions/INotifyPropertyChangedExtension.shared.cs | using System;
using System.ComponentModel;
namespace Xamarin.CommunityToolkit.ObjectModel.Extensions
{
public static class INotifyPropertyChangedExtension
{
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method is deprecated due to high probability of misuse. Use WeakEventManager instead.")]
public static void WeakSubscribe<T>(this INotifyPropertyChanged target, T subscriber, Action<T, object?, PropertyChangedEventArgs> action)
{
_ = target ?? throw new ArgumentNullException(nameof(target));
if (subscriber == null || action == null)
{
return;
}
var weakSubscriber = new WeakReference(subscriber, false);
target.PropertyChanged += handler;
void handler(object? sender, PropertyChangedEventArgs e)
{
var s = (T?)weakSubscriber.Target;
if (s == null)
{
target.PropertyChanged -= handler;
return;
}
action(s, sender, e);
}
}
}
}
| using System;
using System.ComponentModel;
namespace Xamarin.CommunityToolkit.ObjectModel.Extensions
{
public static class INotifyPropertyChangedExtension
{
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method shouldn't be used week events (like one in ObservableObject). This method is deprecated due to high probability of misuse.")]
public static void WeakSubscribe<T>(this INotifyPropertyChanged target, T subscriber, Action<T, object?, PropertyChangedEventArgs> action)
{
_ = target ?? throw new ArgumentNullException(nameof(target));
if (subscriber == null || action == null)
{
return;
}
var weakSubscriber = new WeakReference(subscriber, false);
target.PropertyChanged += handler;
void handler(object? sender, PropertyChangedEventArgs e)
{
var s = (T?)weakSubscriber.Target;
if (s == null)
{
target.PropertyChanged -= handler;
return;
}
action(s, sender, e);
}
}
}
}
| mit | C# |
8e3212c9d0d2cf0887f4a1e5c0378c8e0d1fcb06 | fix UserConnections regex | signumsoftware/framework,avifatal/framework,avifatal/framework,AlejandroCano/framework,AlejandroCano/framework,signumsoftware/framework | Signum.Engine/Connection/UserConnections.cs | Signum.Engine/Connection/UserConnections.cs | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Signum.Engine;
using System.Data.SqlClient;
using System.Diagnostics;
using Signum.Engine.Maps;
using Signum.Utilities;
using System.Text.RegularExpressions;
namespace Signum.Engine
{
public static class UserConnections
{
public static string FileName = @"C:\UserConnections.txt";
static Dictionary<string, string> replacements = null;
public static Dictionary<string, string> LoadReplacements()
{
if (!File.Exists(FileName))
return new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
return File.ReadAllLines(FileName).Where(s=> !string.IsNullOrWhiteSpace(s) && !s.StartsWith("-") && !s.StartsWith("/")).ToDictionary(a => a.Before('>'), a => a.After('>'));
}
public static string Replace(string connectionString)
{
if (replacements == null)
replacements = LoadReplacements();
Match m = Regex.Match(connectionString, @"(Initial Catalog|Database)\s*=\s*(?<databaseName>[^;]*)\s*;?", RegexOptions.IgnoreCase);
if (!m.Success)
throw new InvalidOperationException("Database name not found");
string databaseName = m.Groups["databaseName"].Value;
return replacements.TryGetC(databaseName) ?? connectionString;
}
}
}
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Signum.Engine;
using System.Data.SqlClient;
using System.Diagnostics;
using Signum.Engine.Maps;
using Signum.Utilities;
using System.Text.RegularExpressions;
namespace Signum.Engine
{
public static class UserConnections
{
public static string FileName = @"C:\UserConnections.txt";
static Dictionary<string, string> replacements = null;
public static Dictionary<string, string> LoadReplacements()
{
if (!File.Exists(FileName))
return new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase);
return File.ReadAllLines(FileName).Where(s=> !string.IsNullOrWhiteSpace(s) && !s.StartsWith("-") && !s.StartsWith("/")).ToDictionary(a => a.Before('>'), a => a.After('>'));
}
public static string Replace(string connectionString)
{
if (replacements == null)
replacements = LoadReplacements();
Match m = Regex.Match(connectionString, "(Initial Catalog|Database)=(?<databaseName>[^;]*);?", RegexOptions.IgnoreCase);
if (!m.Success)
throw new InvalidOperationException("Database name not found");
string databaseName = m.Groups["databaseName"].Value;
return replacements.TryGetC(databaseName) ?? connectionString;
}
}
}
| mit | C# |
6e64d653c5f775c37c951e35452b8fdccc86ccd4 | Hide connect password from logs. | chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet,chkr1011/MQTTnet | Source/MQTTnet/Packets/MqttConnectPacket.cs | Source/MQTTnet/Packets/MqttConnectPacket.cs | namespace MQTTnet.Packets
{
public class MqttConnectPacket : MqttBasePacket
{
public string ProtocolName { get; set; }
public byte? ProtocolLevel { get; set; }
public string ClientId { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public ushort KeepAlivePeriod { get; set; }
// Also called "Clean Start" in MQTTv5.
public bool CleanSession { get; set; }
public MqttApplicationMessage WillMessage { get; set; }
#region Added in MQTTv5.0.0
public MqttConnectPacketProperties Properties { get; set; }
#endregion
public override string ToString()
{
var password = Password;
if (!string.IsNullOrEmpty(password))
{
password = "****";
}
return string.Concat("Connect: [ProtocolLevel=", ProtocolLevel, "] [ClientId=", ClientId, "] [Username=", Username, "] [Password=", password, "] [KeepAlivePeriod=", KeepAlivePeriod, "] [CleanSession=", CleanSession, "]");
}
}
}
| namespace MQTTnet.Packets
{
public class MqttConnectPacket : MqttBasePacket
{
public string ProtocolName { get; set; }
public byte? ProtocolLevel { get; set; }
public string ClientId { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public ushort KeepAlivePeriod { get; set; }
// Also called "Clean Start" in MQTTv5.
public bool CleanSession { get; set; }
public MqttApplicationMessage WillMessage { get; set; }
#region Added in MQTTv5.0.0
public MqttConnectPacketProperties Properties { get; set; }
#endregion
public override string ToString()
{
return string.Concat("Connect: [ProtocolLevel=", ProtocolLevel, "] [ClientId=", ClientId, "] [Username=", Username, "] [Password=", Password, "] [KeepAlivePeriod=", KeepAlivePeriod, "] [CleanSession=", CleanSession, "]");
}
}
}
| mit | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.