content
stringlengths 5
1.04M
| avg_line_length
float64 1.75
12.9k
| max_line_length
int64 2
244k
| alphanum_fraction
float64 0
0.98
| licenses
sequence | repository_name
stringlengths 7
92
| path
stringlengths 3
249
| size
int64 5
1.04M
| lang
stringclasses 2
values |
---|---|---|---|---|---|---|---|---|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "TrapData.asset", menuName = "TowerDefense/Trap Configuration", order = 2)]
public class PlayerTrapData : ScriptableObject
{
public float coolDownMax;
public int damage;
public float duration;
}
| 26.333333 | 103 | 0.768987 | [
"MIT"
] | debruw/Tower-Defence-Egypt-Mobile-Game | Assets/Scripts/In Game Scripts/PlayerTrapData.cs | 318 | C# |
namespace DotNetInterview.Data.Models.Enums
{
public enum Country
{
None = 0,
Bulgaria = 1,
UK = 2,
Germany = 3,
France = 4,
USA = 2,
Other = 999,
}
}
| 15.714286 | 44 | 0.454545 | [
"MIT"
] | TonyDimitrov/SharedDotNetInterview | Data/DotNetInterview.Data.Models/Enums/Country.cs | 222 | C# |
namespace essentialMix.Newtonsoft.Serialization
{
public class SnakeCasePropertyExtensionNoDictionaryNamingStrategy : PropertyExtensionNoDictionaryNamingStrategy
{
/// <inheritdoc />
public SnakeCasePropertyExtensionNoDictionaryNamingStrategy()
: base(NamingStrategyType.SnakeCase)
{
}
}
} | 27.636364 | 112 | 0.819079 | [
"MIT"
] | asm2025/asm | Standard/essentialMix.NewtonSoft/Serialization/SnakeCasePropertyExtensionNoDictionaryNamingStrategy.cs | 306 | C# |
using LuaInterface;
using System;
using System.Collections.Generic;
using UnityEngine;
public class UIToggleWrap
{
public static void Register(LuaState L)
{
L.BeginClass(typeof(UIToggle), typeof(UIWidgetContainer), null);
L.RegFunction("GetActiveToggle", new LuaCSFunction(UIToggleWrap.GetActiveToggle));
L.RegFunction("Set", new LuaCSFunction(UIToggleWrap.Set));
L.RegFunction("__eq", new LuaCSFunction(UIToggleWrap.op_Equality));
L.RegFunction("__tostring", new LuaCSFunction(ToLua.op_ToString));
L.RegVar("list", new LuaCSFunction(UIToggleWrap.get_list), new LuaCSFunction(UIToggleWrap.set_list));
L.RegVar("current", new LuaCSFunction(UIToggleWrap.get_current), new LuaCSFunction(UIToggleWrap.set_current));
L.RegVar("group", new LuaCSFunction(UIToggleWrap.get_group), new LuaCSFunction(UIToggleWrap.set_group));
L.RegVar("activeSprite", new LuaCSFunction(UIToggleWrap.get_activeSprite), new LuaCSFunction(UIToggleWrap.set_activeSprite));
L.RegVar("activeAnimation", new LuaCSFunction(UIToggleWrap.get_activeAnimation), new LuaCSFunction(UIToggleWrap.set_activeAnimation));
L.RegVar("animator", new LuaCSFunction(UIToggleWrap.get_animator), new LuaCSFunction(UIToggleWrap.set_animator));
L.RegVar("startsActive", new LuaCSFunction(UIToggleWrap.get_startsActive), new LuaCSFunction(UIToggleWrap.set_startsActive));
L.RegVar("instantTween", new LuaCSFunction(UIToggleWrap.get_instantTween), new LuaCSFunction(UIToggleWrap.set_instantTween));
L.RegVar("optionCanBeNone", new LuaCSFunction(UIToggleWrap.get_optionCanBeNone), new LuaCSFunction(UIToggleWrap.set_optionCanBeNone));
L.RegVar("onChange", new LuaCSFunction(UIToggleWrap.get_onChange), new LuaCSFunction(UIToggleWrap.set_onChange));
L.RegVar("validator", new LuaCSFunction(UIToggleWrap.get_validator), new LuaCSFunction(UIToggleWrap.set_validator));
L.RegVar("value", new LuaCSFunction(UIToggleWrap.get_value), new LuaCSFunction(UIToggleWrap.set_value));
L.RegFunction("Validate", new LuaCSFunction(UIToggleWrap.UIToggle_Validate));
L.EndClass();
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int GetActiveToggle(IntPtr L)
{
int result;
try
{
ToLua.CheckArgsCount(L, 1);
int group = (int)LuaDLL.luaL_checknumber(L, 1);
UIToggle activeToggle = UIToggle.GetActiveToggle(group);
ToLua.Push(L, activeToggle);
result = 1;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int Set(IntPtr L)
{
int result;
try
{
ToLua.CheckArgsCount(L, 2);
UIToggle uIToggle = (UIToggle)ToLua.CheckObject(L, 1, typeof(UIToggle));
bool state = LuaDLL.luaL_checkboolean(L, 2);
uIToggle.Set(state);
result = 0;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int op_Equality(IntPtr L)
{
int result;
try
{
ToLua.CheckArgsCount(L, 2);
UnityEngine.Object x = (UnityEngine.Object)ToLua.ToObject(L, 1);
UnityEngine.Object y = (UnityEngine.Object)ToLua.ToObject(L, 2);
bool value = x == y;
LuaDLL.lua_pushboolean(L, value);
result = 1;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_list(IntPtr L)
{
int result;
try
{
ToLua.PushObject(L, UIToggle.list);
result = 1;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_current(IntPtr L)
{
int result;
try
{
ToLua.Push(L, UIToggle.current);
result = 1;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_group(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
int group = uIToggle.group;
LuaDLL.lua_pushinteger(L, group);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index group on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_activeSprite(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
UIWidget activeSprite = uIToggle.activeSprite;
ToLua.Push(L, activeSprite);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index activeSprite on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_activeAnimation(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
Animation activeAnimation = uIToggle.activeAnimation;
ToLua.Push(L, activeAnimation);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index activeAnimation on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_animator(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
Animator animator = uIToggle.animator;
ToLua.Push(L, animator);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index animator on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_startsActive(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool startsActive = uIToggle.startsActive;
LuaDLL.lua_pushboolean(L, startsActive);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index startsActive on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_instantTween(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool instantTween = uIToggle.instantTween;
LuaDLL.lua_pushboolean(L, instantTween);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index instantTween on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_optionCanBeNone(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool optionCanBeNone = uIToggle.optionCanBeNone;
LuaDLL.lua_pushboolean(L, optionCanBeNone);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index optionCanBeNone on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_onChange(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
List<EventDelegate> onChange = uIToggle.onChange;
ToLua.PushObject(L, onChange);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index onChange on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_validator(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
UIToggle.Validate validator = uIToggle.validator;
ToLua.Push(L, validator);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index validator on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int get_value(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool value = uIToggle.value;
LuaDLL.lua_pushboolean(L, value);
result = 1;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index value on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_list(IntPtr L)
{
int result;
try
{
BetterList<UIToggle> list = (BetterList<UIToggle>)ToLua.CheckObject(L, 2, typeof(BetterList<UIToggle>));
UIToggle.list = list;
result = 0;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_current(IntPtr L)
{
int result;
try
{
UIToggle current = (UIToggle)ToLua.CheckUnityObject(L, 2, typeof(UIToggle));
UIToggle.current = current;
result = 0;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_group(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
int group = (int)LuaDLL.luaL_checknumber(L, 2);
uIToggle.group = group;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index group on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_activeSprite(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
UIWidget activeSprite = (UIWidget)ToLua.CheckUnityObject(L, 2, typeof(UIWidget));
uIToggle.activeSprite = activeSprite;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index activeSprite on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_activeAnimation(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
Animation activeAnimation = (Animation)ToLua.CheckUnityObject(L, 2, typeof(Animation));
uIToggle.activeAnimation = activeAnimation;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index activeAnimation on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_animator(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
Animator animator = (Animator)ToLua.CheckUnityObject(L, 2, typeof(Animator));
uIToggle.animator = animator;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index animator on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_startsActive(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool startsActive = LuaDLL.luaL_checkboolean(L, 2);
uIToggle.startsActive = startsActive;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index startsActive on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_instantTween(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool instantTween = LuaDLL.luaL_checkboolean(L, 2);
uIToggle.instantTween = instantTween;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index instantTween on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_optionCanBeNone(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool optionCanBeNone = LuaDLL.luaL_checkboolean(L, 2);
uIToggle.optionCanBeNone = optionCanBeNone;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index optionCanBeNone on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_onChange(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
List<EventDelegate> onChange = (List<EventDelegate>)ToLua.CheckObject(L, 2, typeof(List<EventDelegate>));
uIToggle.onChange = onChange;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index onChange on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_validator(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
LuaTypes luaTypes = LuaDLL.lua_type(L, 2);
UIToggle.Validate validator;
if (luaTypes != LuaTypes.LUA_TFUNCTION)
{
validator = (UIToggle.Validate)ToLua.CheckObject(L, 2, typeof(UIToggle.Validate));
}
else
{
LuaFunction func = ToLua.ToLuaFunction(L, 2);
validator = (DelegateFactory.CreateDelegate(typeof(UIToggle.Validate), func) as UIToggle.Validate);
}
uIToggle.validator = validator;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index validator on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int set_value(IntPtr L)
{
object obj = null;
int result;
try
{
obj = ToLua.ToObject(L, 1);
UIToggle uIToggle = (UIToggle)obj;
bool value = LuaDLL.luaL_checkboolean(L, 2);
uIToggle.value = value;
result = 0;
}
catch (Exception ex)
{
result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index value on a nil value");
}
return result;
}
[MonoPInvokeCallback(typeof(LuaCSFunction))]
private static int UIToggle_Validate(IntPtr L)
{
int result;
try
{
int num = LuaDLL.lua_gettop(L);
LuaFunction func = ToLua.CheckLuaFunction(L, 1);
if (num == 1)
{
Delegate ev = DelegateFactory.CreateDelegate(typeof(UIToggle.Validate), func);
ToLua.Push(L, ev);
}
else
{
LuaTable self = ToLua.CheckLuaTable(L, 2);
Delegate ev2 = DelegateFactory.CreateDelegate(typeof(UIToggle.Validate), func, self);
ToLua.Push(L, ev2);
}
result = 1;
}
catch (Exception e)
{
result = LuaDLL.toluaL_exception(L, e, null);
}
return result;
}
}
| 25.983137 | 136 | 0.693731 | [
"MIT"
] | moto2002/jiandangjianghu | src/UIToggleWrap.cs | 15,408 | C# |
using GarageManager.Common.GlobalConstant;
using GarageManager.Common.Notification;
using GarageManager.Services.Contracts;
using GarageManager.Web.Models.BindingModels.RepairService;
using GarageManager.Web.Models.ViewModels.Repair;
using Microsoft.AspNetCore.Mvc;
using System.Security.Claims;
using System.Threading.Tasks;
namespace GarageManager.Web.Areas.Employees.Controllers
{
public class RepairsController : BaseEmployeeController
{
private readonly IRepairService repairsService;
public RepairsController(IRepairService repairsService)
{
this.repairsService = repairsService;
}
public IActionResult AddRepairService()
{
return this.View();
}
[HttpPost]
public async Task<IActionResult> AddRepairService(RepairCreateBindingModel model)
{
if (!ModelState.IsValid)
{
return this.View(model);
}
var employeeId = this.User.FindFirst(ClaimTypes.NameIdentifier)?.Value;
var carId = await this.repairsService
.CreateAsync(
model.CarId,
model.Description,
model.Hours,
model.PricePerHour,
employeeId);
if (carId == default)
{
this.ShowNotification(NotificationMessages.InvalidOperation,
NotificationType.Warning);
return this.Redirect(string.Format(WebConstants.EmployeesCarsServiceDetails, carId));
}
this.ShowNotification(NotificationMessages.RepairServiceCreateSuccessfull,
NotificationType.Success);
return this.Redirect(string.Format(WebConstants.EmployeesCarsServiceDetails, carId));
}
public async Task<IActionResult> Edit(string id, string carId)
{
if (!this.IsValidId(id) || !this.IsValidId(carId))
{
return this.Redirect(WebConstants.HomeIndex);
}
var result = await this.repairsService.GetEditDetailsByIdAsync(id);
if (result == null)
{
this.ShowNotification(NotificationMessages.InvalidOperation,
NotificationType.Error);
return this.Redirect(string.Format(WebConstants.EmployeesCarsServiceDetails, carId));
}
var partModel = AutoMapper.Mapper.Map<RepairEditViewModel>(result);
partModel.CarId = carId;
return this.View(partModel);
}
[HttpPost]
public async Task<IActionResult> Edit(RepairEditBindingModel model,[FromQuery] string carId)
{
if (!ModelState.IsValid)
{
return this.Redirect(WebConstants.HomeIndex);
}
var result = await this.repairsService.UpdateRepairByIdAsync(
model.Id,
model.Description,
model.Hours,
model.PricePerHour,
model.IsFinished);
if (result == default(int))
{
this.ShowNotification(NotificationMessages.InvalidOperation,
NotificationType.Error);
return this.Redirect(WebConstants.HomeIndex);
}
ShowNotification(NotificationMessages.RepairServiceEditSuccessfull,
NotificationType.Success);
return this.Redirect(string.Format(WebConstants.EmployeesCarsServiceDetails, model.CarId));
}
public async Task<IActionResult> Delete(string carId, string repairId)
{
if (!this.IsValidId(carId) || !this.IsValidId(repairId))
{
return this.Redirect(WebConstants.HomeIndex);
}
var result = await this.repairsService.HardDeleteAsync(repairId);
if (result == default(int))
{
this.ShowNotification(NotificationMessages.InvalidOperation,
NotificationType.Error);
return this.Redirect(WebConstants.HomeIndex);
}
this.ShowNotification(NotificationMessages.RepairServiceDeleteSuccessfull,
NotificationType.Warning);
return this.Redirect(string.Format(WebConstants.EmployeesCarsServiceDetails, carId));
}
}
}
| 35 | 103 | 0.606576 | [
"MIT"
] | TodorChapkanov/Garage-Manager | Web/GarageManager.Web/Areas/Employees/Controllers/RepairsController.cs | 4,412 | C# |
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("HotsStats")]
[assembly: AssemblyDescription("An app that shows player stats in Heroes of the Storm")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HotsStats")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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.6.6")]
[assembly: AssemblyFileVersion("0.6.6")]
| 41.017857 | 93 | 0.747932 | [
"MIT"
] | Isopach/HotsStats | StatsDisplay/Properties/AssemblyInfo.cs | 2,300 | C# |
using System;
using AppRopio.Navigation.Menu.Core.Models;
namespace AppRopio.Navigation.Menu.Core.Services
{
public interface IMenuConfigService
{
MenuConfig Config { get; }
}
}
| 18.181818 | 48 | 0.715 | [
"Apache-2.0"
] | cryptobuks/AppRopio.Mobile | src/app-ropio/AppRopio.Navigation/Menu/Core/Services/IMenuConfigService.cs | 202 | C# |
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("Project12_LINQ2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Project12_LINQ2")]
[assembly: AssemblyCopyright("Copyright © 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("170e6192-9f56-4fb2-ba31-a337c02a88be")]
// 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")]
| 37.918919 | 84 | 0.746258 | [
"MIT"
] | KvanTTT/BMSTU-Education | DataBase/Project12_LINQ2/Properties/AssemblyInfo.cs | 1,406 | C# |
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.AzureNative.Web
{
/// <summary>
/// Source control configuration for an app.
/// API Version: 2020-12-01.
/// </summary>
[AzureNativeResourceType("azure-native:web:WebAppSourceControl")]
public partial class WebAppSourceControl : Pulumi.CustomResource
{
/// <summary>
/// Name of branch to use for deployment.
/// </summary>
[Output("branch")]
public Output<string?> Branch { get; private set; } = null!;
/// <summary>
/// <code>true</code> to enable deployment rollback; otherwise, <code>false</code>.
/// </summary>
[Output("deploymentRollbackEnabled")]
public Output<bool?> DeploymentRollbackEnabled { get; private set; } = null!;
/// <summary>
/// If GitHub Action is selected, than the associated configuration.
/// </summary>
[Output("gitHubActionConfiguration")]
public Output<Outputs.GitHubActionConfigurationResponse?> GitHubActionConfiguration { get; private set; } = null!;
/// <summary>
/// <code>true</code> if this is deployed via GitHub action.
/// </summary>
[Output("isGitHubAction")]
public Output<bool?> IsGitHubAction { get; private set; } = null!;
/// <summary>
/// <code>true</code> to limit to manual integration; <code>false</code> to enable continuous integration (which configures webhooks into online repos like GitHub).
/// </summary>
[Output("isManualIntegration")]
public Output<bool?> IsManualIntegration { get; private set; } = null!;
/// <summary>
/// <code>true</code> for a Mercurial repository; <code>false</code> for a Git repository.
/// </summary>
[Output("isMercurial")]
public Output<bool?> IsMercurial { get; private set; } = null!;
/// <summary>
/// Kind of resource.
/// </summary>
[Output("kind")]
public Output<string?> Kind { get; private set; } = null!;
/// <summary>
/// Resource Name.
/// </summary>
[Output("name")]
public Output<string> Name { get; private set; } = null!;
/// <summary>
/// Repository or source control URL.
/// </summary>
[Output("repoUrl")]
public Output<string?> RepoUrl { get; private set; } = null!;
/// <summary>
/// Resource type.
/// </summary>
[Output("type")]
public Output<string> Type { get; private set; } = null!;
/// <summary>
/// Create a WebAppSourceControl resource with the given unique name, arguments, and options.
/// </summary>
///
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public WebAppSourceControl(string name, WebAppSourceControlArgs args, CustomResourceOptions? options = null)
: base("azure-native:web:WebAppSourceControl", name, args ?? new WebAppSourceControlArgs(), MakeResourceOptions(options, ""))
{
}
private WebAppSourceControl(string name, Input<string> id, CustomResourceOptions? options = null)
: base("azure-native:web:WebAppSourceControl", name, null, MakeResourceOptions(options, id))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
Version = Utilities.Version,
Aliases =
{
new Pulumi.Alias { Type = "azure-nextgen:web:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20150801:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20150801:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20160801:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20160801:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20180201:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20180201:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20181101:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20181101:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20190801:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20190801:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20200601:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20200601:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20200901:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20200901:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20201001:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20201001:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20201201:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20201201:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20210101:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20210101:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20210115:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20210115:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-native:web/v20210201:WebAppSourceControl"},
new Pulumi.Alias { Type = "azure-nextgen:web/v20210201:WebAppSourceControl"},
},
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
// Override the ID if one was specified for consistency with other language SDKs.
merged.Id = id ?? merged.Id;
return merged;
}
/// <summary>
/// Get an existing WebAppSourceControl resource's state with the given name, ID, and optional extra
/// properties used to qualify the lookup.
/// </summary>
///
/// <param name="name">The unique name of the resulting resource.</param>
/// <param name="id">The unique provider ID of the resource to lookup.</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public static WebAppSourceControl Get(string name, Input<string> id, CustomResourceOptions? options = null)
{
return new WebAppSourceControl(name, id, options);
}
}
public sealed class WebAppSourceControlArgs : Pulumi.ResourceArgs
{
/// <summary>
/// Name of branch to use for deployment.
/// </summary>
[Input("branch")]
public Input<string>? Branch { get; set; }
/// <summary>
/// <code>true</code> to enable deployment rollback; otherwise, <code>false</code>.
/// </summary>
[Input("deploymentRollbackEnabled")]
public Input<bool>? DeploymentRollbackEnabled { get; set; }
/// <summary>
/// If GitHub Action is selected, than the associated configuration.
/// </summary>
[Input("gitHubActionConfiguration")]
public Input<Inputs.GitHubActionConfigurationArgs>? GitHubActionConfiguration { get; set; }
/// <summary>
/// <code>true</code> if this is deployed via GitHub action.
/// </summary>
[Input("isGitHubAction")]
public Input<bool>? IsGitHubAction { get; set; }
/// <summary>
/// <code>true</code> to limit to manual integration; <code>false</code> to enable continuous integration (which configures webhooks into online repos like GitHub).
/// </summary>
[Input("isManualIntegration")]
public Input<bool>? IsManualIntegration { get; set; }
/// <summary>
/// <code>true</code> for a Mercurial repository; <code>false</code> for a Git repository.
/// </summary>
[Input("isMercurial")]
public Input<bool>? IsMercurial { get; set; }
/// <summary>
/// Kind of resource.
/// </summary>
[Input("kind")]
public Input<string>? Kind { get; set; }
/// <summary>
/// Name of the app.
/// </summary>
[Input("name", required: true)]
public Input<string> Name { get; set; } = null!;
/// <summary>
/// Repository or source control URL.
/// </summary>
[Input("repoUrl")]
public Input<string>? RepoUrl { get; set; }
/// <summary>
/// Name of the resource group to which the resource belongs.
/// </summary>
[Input("resourceGroupName", required: true)]
public Input<string> ResourceGroupName { get; set; } = null!;
public WebAppSourceControlArgs()
{
}
}
}
| 45.926267 | 196 | 0.599237 | [
"Apache-2.0"
] | polivbr/pulumi-azure-native | sdk/dotnet/Web/WebAppSourceControl.cs | 9,966 | C# |
using MaterialSkin.Controls;
using System.Drawing.Text;
using Doomroulette.Properties;
using System.Drawing;
using System.Runtime.InteropServices;
using System;
using System.Linq;
namespace Doomroulette
{
partial class frmMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
//private PrivateFontCollection privateFontCollection = new PrivateFontCollection();
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
this.btnPlay = new System.Windows.Forms.Button();
this.lblStatus = new MaterialSkin.Controls.MaterialLabel();
this.radio_sk_baby = new MaterialSkin.Controls.MaterialRadioButton();
this.radio_sk_hard = new MaterialSkin.Controls.MaterialRadioButton();
this.radio_sk_nightmare = new MaterialSkin.Controls.MaterialRadioButton();
this.radio_sk_medium = new MaterialSkin.Controls.MaterialRadioButton();
this.radio_sk_easy = new MaterialSkin.Controls.MaterialRadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnRunPrevious = new MaterialSkin.Controls.MaterialRaisedButton();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.chkEnableDate = new MaterialSkin.Controls.MaterialCheckBox();
this.createdDate = new System.Windows.Forms.DateTimePicker();
this.btnAdvancedSettings = new MaterialSkin.Controls.MaterialRaisedButton();
this.label1 = new MaterialSkin.Controls.MaterialLabel();
this.numMinrating = new System.Windows.Forms.NumericUpDown();
this.chkIncludeVanilla = new MaterialSkin.Controls.MaterialCheckBox();
this.chkIncludePorts = new MaterialSkin.Controls.MaterialCheckBox();
this.chkIncludeMegawads = new MaterialSkin.Controls.MaterialCheckBox();
this.tabControl1 = new MaterialSkin.Controls.MaterialTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.lstAdditionalWads = new System.Windows.Forms.ListBox();
this.btnRemoveWad = new MaterialSkin.Controls.MaterialRaisedButton();
this.btnAddWad = new MaterialSkin.Controls.MaterialRaisedButton();
this.label2 = new MaterialSkin.Controls.MaterialLabel();
this.grpGames = new System.Windows.Forms.GroupBox();
this.radioDoom2 = new MaterialSkin.Controls.MaterialRadioButton();
this.radioFreedoom2 = new MaterialSkin.Controls.MaterialRadioButton();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.btnRateWad = new MaterialSkin.Controls.MaterialRaisedButton();
this.btnDelete = new MaterialSkin.Controls.MaterialRaisedButton();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.chkFilterUnrated = new MaterialSkin.Controls.MaterialCheckBox();
this.chkFilterDisliked = new MaterialSkin.Controls.MaterialCheckBox();
this.chkFilterLiked = new MaterialSkin.Controls.MaterialCheckBox();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.lblPages = new System.Windows.Forms.Label();
this.listPlayedWads = new System.Windows.Forms.ListBox();
this.btnPlayrandomLiked = new MaterialSkin.Controls.MaterialRaisedButton();
this.btnNextWads = new MaterialSkin.Controls.MaterialRaisedButton();
this.btnPreviousWads = new MaterialSkin.Controls.MaterialRaisedButton();
this.btnShowInfo = new MaterialSkin.Controls.MaterialRaisedButton();
this.btnPlayselected = new MaterialSkin.Controls.MaterialRaisedButton();
this.materialTabSelector1 = new MaterialSkin.Controls.MaterialTabSelector();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numMinrating)).BeginInit();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.grpGames.SuspendLayout();
this.tabPage2.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// btnPlay
//
this.btnPlay.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(50)))), ((int)(((byte)(64)))), ((int)(((byte)(73)))));
this.btnPlay.FlatAppearance.BorderColor = System.Drawing.Color.Silver;
this.btnPlay.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnPlay.Font = new System.Drawing.Font("Microsoft Sans Serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnPlay.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
this.btnPlay.Location = new System.Drawing.Point(327, 177);
this.btnPlay.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPlay.Name = "btnPlay";
this.btnPlay.Size = new System.Drawing.Size(185, 80);
this.btnPlay.TabIndex = 1;
this.btnPlay.Text = "Play";
this.btnPlay.UseVisualStyleBackColor = false;
this.btnPlay.Click += new System.EventHandler(this.btnPlay_Click);
//
// lblStatus
//
this.lblStatus.Depth = 0;
this.lblStatus.Font = new System.Drawing.Font("Roboto", 11F);
this.lblStatus.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.lblStatus.Location = new System.Drawing.Point(300, 332);
this.lblStatus.MouseState = MaterialSkin.MouseState.HOVER;
this.lblStatus.Name = "lblStatus";
this.lblStatus.Size = new System.Drawing.Size(257, 92);
this.lblStatus.TabIndex = 2;
this.lblStatus.Text = "Ready";
//
// radio_sk_baby
//
this.radio_sk_baby.AutoSize = true;
this.radio_sk_baby.Depth = 0;
this.radio_sk_baby.Font = new System.Drawing.Font("Roboto", 10F);
this.radio_sk_baby.Location = new System.Drawing.Point(19, 26);
this.radio_sk_baby.Margin = new System.Windows.Forms.Padding(0);
this.radio_sk_baby.MouseLocation = new System.Drawing.Point(-1, -1);
this.radio_sk_baby.MouseState = MaterialSkin.MouseState.HOVER;
this.radio_sk_baby.Name = "radio_sk_baby";
this.radio_sk_baby.Ripple = true;
this.radio_sk_baby.Size = new System.Drawing.Size(181, 30);
this.radio_sk_baby.TabIndex = 3;
this.radio_sk_baby.Tag = "sk_baby";
this.radio_sk_baby.Text = "I\'m too young to die";
this.radio_sk_baby.UseVisualStyleBackColor = true;
this.radio_sk_baby.CheckedChanged += new System.EventHandler(this.skillChanged);
//
// radio_sk_hard
//
this.radio_sk_hard.AutoSize = true;
this.radio_sk_hard.Depth = 0;
this.radio_sk_hard.Font = new System.Drawing.Font("Roboto", 10F);
this.radio_sk_hard.Location = new System.Drawing.Point(19, 137);
this.radio_sk_hard.Margin = new System.Windows.Forms.Padding(0);
this.radio_sk_hard.MouseLocation = new System.Drawing.Point(-1, -1);
this.radio_sk_hard.MouseState = MaterialSkin.MouseState.HOVER;
this.radio_sk_hard.Name = "radio_sk_hard";
this.radio_sk_hard.Ripple = true;
this.radio_sk_hard.Size = new System.Drawing.Size(139, 30);
this.radio_sk_hard.TabIndex = 4;
this.radio_sk_hard.Tag = "sk_hard";
this.radio_sk_hard.Text = "Ultra-Violence";
this.radio_sk_hard.UseVisualStyleBackColor = true;
this.radio_sk_hard.CheckedChanged += new System.EventHandler(this.skillChanged);
//
// radio_sk_nightmare
//
this.radio_sk_nightmare.AutoSize = true;
this.radio_sk_nightmare.Depth = 0;
this.radio_sk_nightmare.Font = new System.Drawing.Font("Roboto", 10F);
this.radio_sk_nightmare.Location = new System.Drawing.Point(19, 174);
this.radio_sk_nightmare.Margin = new System.Windows.Forms.Padding(0);
this.radio_sk_nightmare.MouseLocation = new System.Drawing.Point(-1, -1);
this.radio_sk_nightmare.MouseState = MaterialSkin.MouseState.HOVER;
this.radio_sk_nightmare.Name = "radio_sk_nightmare";
this.radio_sk_nightmare.Ripple = true;
this.radio_sk_nightmare.Size = new System.Drawing.Size(116, 30);
this.radio_sk_nightmare.TabIndex = 5;
this.radio_sk_nightmare.Tag = "sk_nightmare";
this.radio_sk_nightmare.Text = "Nightmare!";
this.radio_sk_nightmare.UseVisualStyleBackColor = true;
this.radio_sk_nightmare.CheckedChanged += new System.EventHandler(this.skillChanged);
//
// radio_sk_medium
//
this.radio_sk_medium.AutoSize = true;
this.radio_sk_medium.Checked = true;
this.radio_sk_medium.Depth = 0;
this.radio_sk_medium.Font = new System.Drawing.Font("Roboto", 10F);
this.radio_sk_medium.Location = new System.Drawing.Point(19, 100);
this.radio_sk_medium.Margin = new System.Windows.Forms.Padding(0);
this.radio_sk_medium.MouseLocation = new System.Drawing.Point(-1, -1);
this.radio_sk_medium.MouseState = MaterialSkin.MouseState.HOVER;
this.radio_sk_medium.Name = "radio_sk_medium";
this.radio_sk_medium.Ripple = true;
this.radio_sk_medium.Size = new System.Drawing.Size(143, 30);
this.radio_sk_medium.TabIndex = 6;
this.radio_sk_medium.TabStop = true;
this.radio_sk_medium.Tag = "sk_medium";
this.radio_sk_medium.Text = "Hurt me plenty";
this.radio_sk_medium.UseVisualStyleBackColor = true;
this.radio_sk_medium.CheckedChanged += new System.EventHandler(this.skillChanged);
//
// radio_sk_easy
//
this.radio_sk_easy.AutoSize = true;
this.radio_sk_easy.Depth = 0;
this.radio_sk_easy.Font = new System.Drawing.Font("Roboto", 10F);
this.radio_sk_easy.Location = new System.Drawing.Point(19, 63);
this.radio_sk_easy.Margin = new System.Windows.Forms.Padding(0);
this.radio_sk_easy.MouseLocation = new System.Drawing.Point(-1, -1);
this.radio_sk_easy.MouseState = MaterialSkin.MouseState.HOVER;
this.radio_sk_easy.Name = "radio_sk_easy";
this.radio_sk_easy.Ripple = true;
this.radio_sk_easy.Size = new System.Drawing.Size(171, 30);
this.radio_sk_easy.TabIndex = 7;
this.radio_sk_easy.Tag = "sk_easy";
this.radio_sk_easy.Text = "Hey, not too rough";
this.radio_sk_easy.UseVisualStyleBackColor = true;
this.radio_sk_easy.CheckedChanged += new System.EventHandler(this.skillChanged);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radio_sk_baby);
this.groupBox1.Controls.Add(this.radio_sk_nightmare);
this.groupBox1.Controls.Add(this.radio_sk_medium);
this.groupBox1.Controls.Add(this.radio_sk_hard);
this.groupBox1.Controls.Add(this.radio_sk_easy);
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
this.groupBox1.Location = new System.Drawing.Point(608, 37);
this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox1.Size = new System.Drawing.Size(275, 229);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Skill";
//
// btnRunPrevious
//
this.btnRunPrevious.AutoSize = true;
this.btnRunPrevious.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnRunPrevious.Depth = 0;
this.btnRunPrevious.Icon = null;
this.btnRunPrevious.Location = new System.Drawing.Point(327, 261);
this.btnRunPrevious.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnRunPrevious.MouseState = MaterialSkin.MouseState.HOVER;
this.btnRunPrevious.Name = "btnRunPrevious";
this.btnRunPrevious.Primary = true;
this.btnRunPrevious.Size = new System.Drawing.Size(169, 36);
this.btnRunPrevious.TabIndex = 9;
this.btnRunPrevious.Text = "Run last played";
this.btnRunPrevious.UseVisualStyleBackColor = true;
this.btnRunPrevious.Click += new System.EventHandler(this.button1_Click);
//
// groupBox2
//
this.groupBox2.Controls.Add(this.chkEnableDate);
this.groupBox2.Controls.Add(this.createdDate);
this.groupBox2.Controls.Add(this.btnAdvancedSettings);
this.groupBox2.Controls.Add(this.label1);
this.groupBox2.Controls.Add(this.numMinrating);
this.groupBox2.Controls.Add(this.chkIncludeVanilla);
this.groupBox2.Controls.Add(this.chkIncludePorts);
this.groupBox2.Controls.Add(this.chkIncludeMegawads);
this.groupBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox2.Location = new System.Drawing.Point(608, 283);
this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox2.Size = new System.Drawing.Size(275, 363);
this.groupBox2.TabIndex = 10;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Settings";
//
// chkEnableDate
//
this.chkEnableDate.AutoSize = true;
this.chkEnableDate.Depth = 0;
this.chkEnableDate.Font = new System.Drawing.Font("Roboto", 10F);
this.chkEnableDate.Location = new System.Drawing.Point(19, 222);
this.chkEnableDate.Margin = new System.Windows.Forms.Padding(0);
this.chkEnableDate.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkEnableDate.MouseState = MaterialSkin.MouseState.HOVER;
this.chkEnableDate.Name = "chkEnableDate";
this.chkEnableDate.Ripple = true;
this.chkEnableDate.Size = new System.Drawing.Size(130, 30);
this.chkEnableDate.TabIndex = 14;
this.chkEnableDate.Text = "Created date";
this.chkEnableDate.UseVisualStyleBackColor = true;
this.chkEnableDate.CheckedChanged += new System.EventHandler(this.chkDisableDate_CheckedChanged);
//
// createdDate
//
this.createdDate.CustomFormat = "yyyy-MM-dd";
this.createdDate.Enabled = false;
this.createdDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
this.createdDate.Location = new System.Drawing.Point(19, 263);
this.createdDate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.createdDate.Name = "createdDate";
this.createdDate.Size = new System.Drawing.Size(184, 30);
this.createdDate.TabIndex = 12;
//
// btnAdvancedSettings
//
this.btnAdvancedSettings.AutoSize = true;
this.btnAdvancedSettings.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnAdvancedSettings.Depth = 0;
this.btnAdvancedSettings.Icon = null;
this.btnAdvancedSettings.Location = new System.Drawing.Point(20, 306);
this.btnAdvancedSettings.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnAdvancedSettings.MouseState = MaterialSkin.MouseState.HOVER;
this.btnAdvancedSettings.Name = "btnAdvancedSettings";
this.btnAdvancedSettings.Primary = true;
this.btnAdvancedSettings.Size = new System.Drawing.Size(112, 36);
this.btnAdvancedSettings.TabIndex = 11;
this.btnAdvancedSettings.Text = "Advanced";
this.btnAdvancedSettings.UseVisualStyleBackColor = true;
this.btnAdvancedSettings.Click += new System.EventHandler(this.btnAdvancedSettings_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Depth = 0;
this.label1.Font = new System.Drawing.Font("Roboto", 11F);
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.label1.Location = new System.Drawing.Point(23, 146);
this.label1.MouseState = MaterialSkin.MouseState.HOVER;
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(144, 24);
this.label1.TabIndex = 4;
this.label1.Text = "Minimum rating";
//
// numMinrating
//
this.numMinrating.Location = new System.Drawing.Point(27, 180);
this.numMinrating.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.numMinrating.Maximum = new decimal(new int[] {
5,
0,
0,
0});
this.numMinrating.Name = "numMinrating";
this.numMinrating.Size = new System.Drawing.Size(85, 30);
this.numMinrating.TabIndex = 3;
this.numMinrating.ValueChanged += new System.EventHandler(this.numMinrating_ValueChanged);
//
// chkIncludeVanilla
//
this.chkIncludeVanilla.AutoSize = true;
this.chkIncludeVanilla.Depth = 0;
this.chkIncludeVanilla.Font = new System.Drawing.Font("Roboto", 10F);
this.chkIncludeVanilla.Location = new System.Drawing.Point(19, 96);
this.chkIncludeVanilla.Margin = new System.Windows.Forms.Padding(0);
this.chkIncludeVanilla.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkIncludeVanilla.MouseState = MaterialSkin.MouseState.HOVER;
this.chkIncludeVanilla.Name = "chkIncludeVanilla";
this.chkIncludeVanilla.Ripple = true;
this.chkIncludeVanilla.Size = new System.Drawing.Size(186, 30);
this.chkIncludeVanilla.TabIndex = 2;
this.chkIncludeVanilla.Text = "Include vanilla wads";
this.chkIncludeVanilla.UseVisualStyleBackColor = true;
this.chkIncludeVanilla.CheckedChanged += new System.EventHandler(this.settingsChanged);
//
// chkIncludePorts
//
this.chkIncludePorts.AutoSize = true;
this.chkIncludePorts.Depth = 0;
this.chkIncludePorts.Font = new System.Drawing.Font("Roboto", 10F);
this.chkIncludePorts.Location = new System.Drawing.Point(19, 59);
this.chkIncludePorts.Margin = new System.Windows.Forms.Padding(0);
this.chkIncludePorts.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkIncludePorts.MouseState = MaterialSkin.MouseState.HOVER;
this.chkIncludePorts.Name = "chkIncludePorts";
this.chkIncludePorts.Ripple = true;
this.chkIncludePorts.Size = new System.Drawing.Size(168, 30);
this.chkIncludePorts.TabIndex = 1;
this.chkIncludePorts.Text = "Include port wads";
this.chkIncludePorts.UseVisualStyleBackColor = true;
this.chkIncludePorts.CheckedChanged += new System.EventHandler(this.settingsChanged);
//
// chkIncludeMegawads
//
this.chkIncludeMegawads.AutoSize = true;
this.chkIncludeMegawads.Depth = 0;
this.chkIncludeMegawads.Font = new System.Drawing.Font("Roboto", 10F);
this.chkIncludeMegawads.Location = new System.Drawing.Point(19, 25);
this.chkIncludeMegawads.Margin = new System.Windows.Forms.Padding(0);
this.chkIncludeMegawads.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkIncludeMegawads.MouseState = MaterialSkin.MouseState.HOVER;
this.chkIncludeMegawads.Name = "chkIncludeMegawads";
this.chkIncludeMegawads.Ripple = true;
this.chkIncludeMegawads.Size = new System.Drawing.Size(175, 30);
this.chkIncludeMegawads.TabIndex = 0;
this.chkIncludeMegawads.Text = "Include Megawads";
this.chkIncludeMegawads.UseVisualStyleBackColor = true;
this.chkIncludeMegawads.CheckedChanged += new System.EventHandler(this.settingsChanged);
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Depth = 0;
this.tabControl1.Location = new System.Drawing.Point(7, 70);
this.tabControl1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabControl1.MouseState = MaterialSkin.MouseState.HOVER;
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(924, 788);
this.tabControl1.TabIndex = 11;
//
// tabPage1
//
this.tabPage1.BackColor = System.Drawing.Color.White;
this.tabPage1.Controls.Add(this.lstAdditionalWads);
this.tabPage1.Controls.Add(this.btnRemoveWad);
this.tabPage1.Controls.Add(this.btnAddWad);
this.tabPage1.Controls.Add(this.label2);
this.tabPage1.Controls.Add(this.grpGames);
this.tabPage1.Controls.Add(this.btnPlay);
this.tabPage1.Controls.Add(this.groupBox2);
this.tabPage1.Controls.Add(this.lblStatus);
this.tabPage1.Controls.Add(this.btnRunPrevious);
this.tabPage1.Controls.Add(this.groupBox1);
this.tabPage1.Location = new System.Drawing.Point(4, 25);
this.tabPage1.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabPage1.Size = new System.Drawing.Size(916, 759);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Main";
//
// lstAdditionalWads
//
this.lstAdditionalWads.FormattingEnabled = true;
this.lstAdditionalWads.ItemHeight = 16;
this.lstAdditionalWads.Location = new System.Drawing.Point(21, 458);
this.lstAdditionalWads.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lstAdditionalWads.Name = "lstAdditionalWads";
this.lstAdditionalWads.Size = new System.Drawing.Size(223, 148);
this.lstAdditionalWads.TabIndex = 16;
//
// btnRemoveWad
//
this.btnRemoveWad.AutoSize = true;
this.btnRemoveWad.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnRemoveWad.Depth = 0;
this.btnRemoveWad.Icon = null;
this.btnRemoveWad.Location = new System.Drawing.Point(85, 610);
this.btnRemoveWad.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnRemoveWad.MouseState = MaterialSkin.MouseState.HOVER;
this.btnRemoveWad.Name = "btnRemoveWad";
this.btnRemoveWad.Primary = true;
this.btnRemoveWad.Size = new System.Drawing.Size(90, 36);
this.btnRemoveWad.TabIndex = 15;
this.btnRemoveWad.Text = "Remove";
this.btnRemoveWad.UseVisualStyleBackColor = true;
this.btnRemoveWad.Click += new System.EventHandler(this.btnRemoveWad_Click);
//
// btnAddWad
//
this.btnAddWad.AutoSize = true;
this.btnAddWad.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnAddWad.Depth = 0;
this.btnAddWad.Icon = null;
this.btnAddWad.Location = new System.Drawing.Point(23, 610);
this.btnAddWad.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnAddWad.MouseState = MaterialSkin.MouseState.HOVER;
this.btnAddWad.Name = "btnAddWad";
this.btnAddWad.Primary = true;
this.btnAddWad.Size = new System.Drawing.Size(56, 36);
this.btnAddWad.TabIndex = 14;
this.btnAddWad.Text = "Add";
this.btnAddWad.UseVisualStyleBackColor = true;
this.btnAddWad.Click += new System.EventHandler(this.btnAddWad_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Depth = 0;
this.label2.Font = new System.Drawing.Font("Roboto", 11F);
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))));
this.label2.Location = new System.Drawing.Point(19, 430);
this.label2.MouseState = MaterialSkin.MouseState.HOVER;
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(138, 24);
this.label2.TabIndex = 13;
this.label2.Text = "Additional files";
//
// grpGames
//
this.grpGames.Controls.Add(this.radioDoom2);
this.grpGames.Controls.Add(this.radioFreedoom2);
this.grpGames.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grpGames.Location = new System.Drawing.Point(305, 37);
this.grpGames.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.grpGames.Name = "grpGames";
this.grpGames.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.grpGames.Size = new System.Drawing.Size(232, 111);
this.grpGames.TabIndex = 11;
this.grpGames.TabStop = false;
this.grpGames.Text = "Select Game";
//
// radioDoom2
//
this.radioDoom2.AutoSize = true;
this.radioDoom2.Checked = true;
this.radioDoom2.Depth = 0;
this.radioDoom2.Font = new System.Drawing.Font("Roboto", 10F);
this.radioDoom2.Location = new System.Drawing.Point(15, 63);
this.radioDoom2.Margin = new System.Windows.Forms.Padding(0);
this.radioDoom2.MouseLocation = new System.Drawing.Point(-1, -1);
this.radioDoom2.MouseState = MaterialSkin.MouseState.HOVER;
this.radioDoom2.Name = "radioDoom2";
this.radioDoom2.Ripple = true;
this.radioDoom2.Size = new System.Drawing.Size(90, 30);
this.radioDoom2.TabIndex = 3;
this.radioDoom2.TabStop = true;
this.radioDoom2.Text = "Doom 2";
this.radioDoom2.UseVisualStyleBackColor = true;
this.radioDoom2.CheckedChanged += new System.EventHandler(this.gameChanged);
//
// radioFreedoom2
//
this.radioFreedoom2.AutoSize = true;
this.radioFreedoom2.Depth = 0;
this.radioFreedoom2.Font = new System.Drawing.Font("Roboto", 10F);
this.radioFreedoom2.Location = new System.Drawing.Point(15, 26);
this.radioFreedoom2.Margin = new System.Windows.Forms.Padding(0);
this.radioFreedoom2.MouseLocation = new System.Drawing.Point(-1, -1);
this.radioFreedoom2.MouseState = MaterialSkin.MouseState.HOVER;
this.radioFreedoom2.Name = "radioFreedoom2";
this.radioFreedoom2.Ripple = true;
this.radioFreedoom2.Size = new System.Drawing.Size(174, 30);
this.radioFreedoom2.TabIndex = 1;
this.radioFreedoom2.Text = "Freedoom Phase 2";
this.radioFreedoom2.UseVisualStyleBackColor = true;
this.radioFreedoom2.CheckedChanged += new System.EventHandler(this.gameChanged);
//
// tabPage2
//
this.tabPage2.Controls.Add(this.groupBox5);
this.tabPage2.Controls.Add(this.groupBox4);
this.tabPage2.Controls.Add(this.groupBox3);
this.tabPage2.Location = new System.Drawing.Point(4, 25);
this.tabPage2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.tabPage2.Size = new System.Drawing.Size(916, 759);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "History";
this.tabPage2.UseVisualStyleBackColor = true;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.btnRateWad);
this.groupBox5.Controls.Add(this.btnDelete);
this.groupBox5.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox5.Location = new System.Drawing.Point(711, 52);
this.groupBox5.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox5.Size = new System.Drawing.Size(175, 489);
this.groupBox5.TabIndex = 12;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Misc";
//
// btnRateWad
//
this.btnRateWad.AutoSize = true;
this.btnRateWad.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnRateWad.Depth = 0;
this.btnRateWad.Icon = null;
this.btnRateWad.Location = new System.Drawing.Point(18, 43);
this.btnRateWad.MouseState = MaterialSkin.MouseState.HOVER;
this.btnRateWad.Name = "btnRateWad";
this.btnRateWad.Primary = true;
this.btnRateWad.Size = new System.Drawing.Size(106, 36);
this.btnRateWad.TabIndex = 1;
this.btnRateWad.Text = "Rate WAd";
this.btnRateWad.UseVisualStyleBackColor = true;
this.btnRateWad.Click += new System.EventHandler(this.BtnRateWad_Click);
//
// btnDelete
//
this.btnDelete.AutoSize = true;
this.btnDelete.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnDelete.Depth = 0;
this.btnDelete.Icon = null;
this.btnDelete.Location = new System.Drawing.Point(18, 87);
this.btnDelete.MouseState = MaterialSkin.MouseState.HOVER;
this.btnDelete.Name = "btnDelete";
this.btnDelete.Primary = true;
this.btnDelete.Size = new System.Drawing.Size(124, 36);
this.btnDelete.TabIndex = 0;
this.btnDelete.Text = "Delete wad";
this.btnDelete.UseVisualStyleBackColor = true;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.chkFilterUnrated);
this.groupBox4.Controls.Add(this.chkFilterDisliked);
this.groupBox4.Controls.Add(this.chkFilterLiked);
this.groupBox4.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox4.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox4.Location = new System.Drawing.Point(22, 52);
this.groupBox4.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox4.Size = new System.Drawing.Size(177, 489);
this.groupBox4.TabIndex = 11;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "Filter";
//
// chkFilterUnrated
//
this.chkFilterUnrated.AutoSize = true;
this.chkFilterUnrated.Depth = 0;
this.chkFilterUnrated.Font = new System.Drawing.Font("Roboto", 10F);
this.chkFilterUnrated.Location = new System.Drawing.Point(13, 87);
this.chkFilterUnrated.Margin = new System.Windows.Forms.Padding(0);
this.chkFilterUnrated.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkFilterUnrated.MouseState = MaterialSkin.MouseState.HOVER;
this.chkFilterUnrated.Name = "chkFilterUnrated";
this.chkFilterUnrated.Ripple = true;
this.chkFilterUnrated.Size = new System.Drawing.Size(92, 30);
this.chkFilterUnrated.TabIndex = 9;
this.chkFilterUnrated.Text = "Unrated";
this.chkFilterUnrated.UseVisualStyleBackColor = true;
this.chkFilterUnrated.CheckedChanged += new System.EventHandler(this.filterChanged);
//
// chkFilterDisliked
//
this.chkFilterDisliked.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.chkFilterDisliked.AutoSize = true;
this.chkFilterDisliked.Depth = 0;
this.chkFilterDisliked.Font = new System.Drawing.Font("Roboto", 10F);
this.chkFilterDisliked.Location = new System.Drawing.Point(13, 56);
this.chkFilterDisliked.Margin = new System.Windows.Forms.Padding(0);
this.chkFilterDisliked.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkFilterDisliked.MouseState = MaterialSkin.MouseState.HOVER;
this.chkFilterDisliked.Name = "chkFilterDisliked";
this.chkFilterDisliked.Ripple = true;
this.chkFilterDisliked.Size = new System.Drawing.Size(92, 30);
this.chkFilterDisliked.TabIndex = 8;
this.chkFilterDisliked.Text = "Disliked";
this.chkFilterDisliked.UseVisualStyleBackColor = true;
this.chkFilterDisliked.CheckedChanged += new System.EventHandler(this.filterChanged);
//
// chkFilterLiked
//
this.chkFilterLiked.AutoSize = true;
this.chkFilterLiked.Checked = true;
this.chkFilterLiked.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkFilterLiked.Depth = 0;
this.chkFilterLiked.Font = new System.Drawing.Font("Roboto", 10F);
this.chkFilterLiked.Location = new System.Drawing.Point(13, 25);
this.chkFilterLiked.Margin = new System.Windows.Forms.Padding(0);
this.chkFilterLiked.MouseLocation = new System.Drawing.Point(-1, -1);
this.chkFilterLiked.MouseState = MaterialSkin.MouseState.HOVER;
this.chkFilterLiked.Name = "chkFilterLiked";
this.chkFilterLiked.Ripple = true;
this.chkFilterLiked.Size = new System.Drawing.Size(73, 30);
this.chkFilterLiked.TabIndex = 7;
this.chkFilterLiked.Text = "Liked";
this.chkFilterLiked.UseVisualStyleBackColor = true;
this.chkFilterLiked.CheckedChanged += new System.EventHandler(this.filterChanged);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.lblPages);
this.groupBox3.Controls.Add(this.listPlayedWads);
this.groupBox3.Controls.Add(this.btnPlayrandomLiked);
this.groupBox3.Controls.Add(this.btnNextWads);
this.groupBox3.Controls.Add(this.btnPreviousWads);
this.groupBox3.Controls.Add(this.btnShowInfo);
this.groupBox3.Controls.Add(this.btnPlayselected);
this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.groupBox3.Location = new System.Drawing.Point(205, 52);
this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox3.Size = new System.Drawing.Size(500, 489);
this.groupBox3.TabIndex = 0;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "Played wads";
//
// lblPages
//
this.lblPages.AutoSize = true;
this.lblPages.Location = new System.Drawing.Point(205, 272);
this.lblPages.Name = "lblPages";
this.lblPages.Size = new System.Drawing.Size(51, 25);
this.lblPages.TabIndex = 7;
this.lblPages.Text = "0/10";
//
// listPlayedWads
//
this.listPlayedWads.FormattingEnabled = true;
this.listPlayedWads.ItemHeight = 25;
this.listPlayedWads.Location = new System.Drawing.Point(7, 33);
this.listPlayedWads.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.listPlayedWads.Name = "listPlayedWads";
this.listPlayedWads.Size = new System.Drawing.Size(487, 229);
this.listPlayedWads.TabIndex = 0;
//
// btnPlayrandomLiked
//
this.btnPlayrandomLiked.AutoSize = true;
this.btnPlayrandomLiked.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnPlayrandomLiked.Depth = 0;
this.btnPlayrandomLiked.Icon = null;
this.btnPlayrandomLiked.Location = new System.Drawing.Point(175, 332);
this.btnPlayrandomLiked.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPlayrandomLiked.MouseState = MaterialSkin.MouseState.HOVER;
this.btnPlayrandomLiked.Name = "btnPlayrandomLiked";
this.btnPlayrandomLiked.Primary = true;
this.btnPlayrandomLiked.Size = new System.Drawing.Size(141, 36);
this.btnPlayrandomLiked.TabIndex = 6;
this.btnPlayrandomLiked.Text = "Play random";
this.btnPlayrandomLiked.UseVisualStyleBackColor = true;
this.btnPlayrandomLiked.Click += new System.EventHandler(this.btnPlayrandomLiked_Click);
//
// btnNextWads
//
this.btnNextWads.AutoSize = true;
this.btnNextWads.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnNextWads.Depth = 0;
this.btnNextWads.Icon = null;
this.btnNextWads.Location = new System.Drawing.Point(463, 266);
this.btnNextWads.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnNextWads.MouseState = MaterialSkin.MouseState.HOVER;
this.btnNextWads.Name = "btnNextWads";
this.btnNextWads.Primary = true;
this.btnNextWads.Size = new System.Drawing.Size(31, 36);
this.btnNextWads.TabIndex = 5;
this.btnNextWads.Text = ">";
this.btnNextWads.UseVisualStyleBackColor = true;
this.btnNextWads.Click += new System.EventHandler(this.btnNextLikedwads_Click);
//
// btnPreviousWads
//
this.btnPreviousWads.AutoSize = true;
this.btnPreviousWads.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnPreviousWads.Depth = 0;
this.btnPreviousWads.Icon = null;
this.btnPreviousWads.Location = new System.Drawing.Point(7, 266);
this.btnPreviousWads.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPreviousWads.MouseState = MaterialSkin.MouseState.HOVER;
this.btnPreviousWads.Name = "btnPreviousWads";
this.btnPreviousWads.Primary = true;
this.btnPreviousWads.Size = new System.Drawing.Size(31, 36);
this.btnPreviousWads.TabIndex = 4;
this.btnPreviousWads.Text = "<";
this.btnPreviousWads.UseVisualStyleBackColor = true;
this.btnPreviousWads.Click += new System.EventHandler(this.btnPrevLikedwads_Click);
//
// btnShowInfo
//
this.btnShowInfo.AutoSize = true;
this.btnShowInfo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnShowInfo.Depth = 0;
this.btnShowInfo.Icon = null;
this.btnShowInfo.Location = new System.Drawing.Point(189, 423);
this.btnShowInfo.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnShowInfo.MouseState = MaterialSkin.MouseState.HOVER;
this.btnShowInfo.Name = "btnShowInfo";
this.btnShowInfo.Primary = true;
this.btnShowInfo.Size = new System.Drawing.Size(114, 36);
this.btnShowInfo.TabIndex = 3;
this.btnShowInfo.Text = "Show info";
this.btnShowInfo.UseVisualStyleBackColor = true;
this.btnShowInfo.Click += new System.EventHandler(this.btnShowInfo_Click);
//
// btnPlayselected
//
this.btnPlayselected.AutoSize = true;
this.btnPlayselected.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnPlayselected.Depth = 0;
this.btnPlayselected.Icon = null;
this.btnPlayselected.Location = new System.Drawing.Point(147, 378);
this.btnPlayselected.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPlayselected.MouseState = MaterialSkin.MouseState.HOVER;
this.btnPlayselected.Name = "btnPlayselected";
this.btnPlayselected.Primary = true;
this.btnPlayselected.Size = new System.Drawing.Size(192, 36);
this.btnPlayselected.TabIndex = 2;
this.btnPlayselected.Text = "Play selected Wad";
this.btnPlayselected.UseVisualStyleBackColor = true;
this.btnPlayselected.Click += new System.EventHandler(this.btnPlayselected_Click);
//
// materialTabSelector1
//
this.materialTabSelector1.BaseTabControl = this.tabControl1;
this.materialTabSelector1.Depth = 0;
this.materialTabSelector1.Location = new System.Drawing.Point(-3, 25);
this.materialTabSelector1.Margin = new System.Windows.Forms.Padding(4);
this.materialTabSelector1.MouseState = MaterialSkin.MouseState.HOVER;
this.materialTabSelector1.Name = "materialTabSelector1";
this.materialTabSelector1.Size = new System.Drawing.Size(933, 54);
this.materialTabSelector1.TabIndex = 12;
this.materialTabSelector1.Text = "materialTabSelector1";
//
// frmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(933, 766);
this.Controls.Add(this.materialTabSelector1);
this.Controls.Add(this.tabControl1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.MaximizeBox = false;
this.Name = "frmMain";
this.Sizable = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmMain_FormClosed);
this.Load += new System.EventHandler(this.Form1_Load);
this.Shown += new System.EventHandler(this.frmMain_Shown);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numMinrating)).EndInit();
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.tabPage1.PerformLayout();
this.grpGames.ResumeLayout(false);
this.grpGames.PerformLayout();
this.tabPage2.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnPlay;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.NumericUpDown numMinrating;
//private System.Windows.Forms.TabControl tabControl1;
private MaterialTabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.ListBox listPlayedWads;
private System.Windows.Forms.GroupBox grpGames;
private System.Windows.Forms.DateTimePicker createdDate;
private System.Windows.Forms.ListBox lstAdditionalWads;
private MaterialSkin.Controls.MaterialTabSelector materialTabSelector1;
private MaterialRaisedButton btnRunPrevious;
private MaterialRadioButton radio_sk_baby;
private MaterialRadioButton radio_sk_hard;
private MaterialRadioButton radio_sk_nightmare;
private MaterialRadioButton radio_sk_medium;
private MaterialRadioButton radio_sk_easy;
private MaterialRadioButton radioDoom2;
private MaterialRadioButton radioFreedoom2;
private MaterialCheckBox chkIncludeVanilla;
private MaterialCheckBox chkIncludePorts;
private MaterialCheckBox chkIncludeMegawads;
private MaterialLabel lblStatus;
private MaterialLabel label1;
private MaterialLabel label2;
private MaterialCheckBox chkEnableDate;
private MaterialRaisedButton btnAdvancedSettings;
private MaterialRaisedButton btnRemoveWad;
private MaterialRaisedButton btnAddWad;
private MaterialRaisedButton btnPlayselected;
private MaterialRaisedButton btnShowInfo;
private MaterialRaisedButton btnPlayrandomLiked;
private MaterialRaisedButton btnNextWads;
private MaterialRaisedButton btnPreviousWads;
private MaterialCheckBox chkFilterLiked;
private System.Windows.Forms.GroupBox groupBox5;
private MaterialRaisedButton btnDelete;
private System.Windows.Forms.GroupBox groupBox4;
private MaterialCheckBox chkFilterUnrated;
private MaterialCheckBox chkFilterDisliked;
private MaterialRaisedButton btnRateWad;
private System.Windows.Forms.Label lblPages;
}
}
| 55.744944 | 169 | 0.628323 | [
"MIT"
] | DDMan2019/Doomroulette | Doomroulette/Main.Designer.cs | 49,615 | C# |
using UnityEngine;
using System.Collections;
using OpenCvSharp;
using OpenCvSharp.Blob;
using OpenCvSharp.CPlusPlus;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization.Formatters.Binary;
using System;
//using System.Configuration;
//using System.Collections.Specialized;
public class ColorDetector : MonoBehaviour {
public int scaleFactor = 1;
public bool ShowDebugImage = true;
public CvMat rawcolorImage = null;
public float hueFilterThreshold = 4.0f;
private CvMat colorImg=null;
private CvMat debugImg = null;
private CvMat regionImgHSV = null;
private CvMat signImg = null;
private CvMat labelImg = null;
CvWindow debugWindow;
CvWindow debugWindow2;
CvWindow debugWindow3;
CvWindow debugWindow4;
private List<CvMat> colorblobImage = null;
private List<CvMat> tmpImage = null;
// Use this for initialization
public static ColorDetector instance = null;
private static List<CvPoint> regionPoints = new List<CvPoint>();
public static colorProfile mCP;
private static int BlobAccumulationN = -1;
private static int DebugIteration = 0;
private int TemporalWindow = 10;
private int RegionImgRepoIndex = 0;
private CvMat[] RegionImgRepo = new CvMat[10];
public static void mouseCallback(MouseEvent @mevent, int x, int y, MouseEvent flags)
{
if (mevent == MouseEvent.LButtonUp)
{
//mouse click
CvMat regionHSV = GlobalRepo.GetRepo(RepoDataType.dRawRegionHSV);
if (regionHSV != null )
{
CvScalar t = regionHSV.Get2D(y, x);
// Debug.Log(t.Val0 + " " + t.Val1 + " " + t.Val2 + " " + t.Val3);
// colorModel cm = new colorModel(t.Val2, t.Val1, t.Val0);
colorModel cm = new colorModel(t.Val0, t.Val1, t.Val2);
mCP.addSampleColor(cm);
}
}
}
public static void mouseCallback2(MouseEvent @mevent, int x, int y, MouseEvent flags)
{
if (mevent == MouseEvent.LButtonUp)
{
//mouse click
CvPoint t = new CvPoint(x, y);
ImageBlender2D.startCollect2DBlobs(t);
}
}
void Start () {
mCP = new colorProfile();
mCP.setParamThreshold(0.04f);
// SignDetector.TestTemplateMatching();
if (this.ShowDebugImage)
{
}
//using (new CvWindow("dst image", dst))
//Cv.SetMouseCallback("debug2", mouseCallback2);
instance = this;
}
// Update is called once per frame
void Update () {
//if(Time.deltaTime>0.1f) Debug.Log("delta time: " + Time.deltaTime);
regionImgHSV = GlobalRepo.GetRepo(RepoDataType.dRawRegionHSV);
if(regionImgHSV==null || mCP.mProfileList ==null || mCP.mProfileList.Count == 0)
{
Debug.Log("[DEBUG][ColorDectector] Fail to load data/profile");
return;
}
if (GameObject.FindGameObjectWithTag("SystemControl").GetComponent<SystemModeControl>().BackgroundProcessing)
{
//check if the image is stable
if (GlobalRepo.getLearningCount() > 0)
{
System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
sw.Start();
processColorBlobs();
UnityEngine.Debug.Log("Color Processing..." + GlobalRepo.getLearningCount() + " frames remain");
GlobalRepo.tickLearningCount();
if (GlobalRepo.getLearningCount() == 0)
{ //learning finished
// GlobalRepo.setLearningCount(-1);
createPrototypeFromColorBlobs();
} else { }
sw.Stop();
SystemLogger.activeInstance.AddPerformance(0, sw.ElapsedMilliseconds);
}
} else if (GlobalRepo.getLearningCount()> 0)
{
processColorBlobs();
Debug.Log("Color Processing..." + GlobalRepo.getLearningCount() + " frames remain");
if (GlobalRepo.getLearningCount() == 1)
{
//BlobAccumulationN = 40;
GlobalRepo.setLearningCount(-1);
DebugIteration++;
createPrototypeFromColorBlobs();
/*if (DebugIteration > 2) createPrototypeFromColorBlobs();
else colorblobImage.ForEach(p => p.Zero());*/
}
}
//DEBUG
if (this.ShowDebugImage)
{
if (regionImgHSV != null) GlobalRepo.showDebugImage("colorBlob", regionImgHSV);
if (colorblobImage != null)
{
for (int i = 0; i < colorblobImage.Count; i++)
{
// GlobalRepo.showDebugImage("colorBlob#"+i,colorblobImage[i]);
}
}
}
}
public void reset()
{
ResetandGo();
}
public static void processKeyInput(int key)
{
if(key == '0')
{
mCP.updateIndexCursor = 0;
Debug.Log("Update Color index = 0");
} else if (key =='1')
{
mCP.updateIndexCursor = 1;
Debug.Log("Update Color index = 1");
}
else if (key == '2')
{
mCP.updateIndexCursor = 2;
Debug.Log("Update Color index = 2");
}
else if (key == '3')
{
mCP.updateIndexCursor = 3;
Debug.Log("Update Color index = 3");
}
else if (key == '4')
{
mCP.updateIndexCursor = 4;
Debug.Log("Update Color index = 4");
} else if (key =='s')
{
Debug.Log("Start Color Processing...");
GlobalRepo.setLearningCount(10);
} else if( key == 'c')
{
Debug.Log("Image Captured");
CaptureImage();
}
}
public static void CaptureImage()
{
string path = "./log/input/InputImage_";
CvMat img = GlobalRepo.GetRepo(RepoDataType.dRawBGR);
if (img == null) return;
path = path + System.DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss")+".png";
//Debug.Log("Image Saved to " + path);
img.SaveImage(path);
}
private void ResetandGo()
{
if(colorblobImage!=null)
{
foreach(var t in colorblobImage)
{
t.Zero();
}
}
if (tmpImage != null)
{
foreach(var t in tmpImage)
{
t.Zero();
}
}
}
private void processColorBlobs()
{
//init debug windows and images
if (colorblobImage == null)
{
colorblobImage = new List<CvMat>();
tmpImage = new List<CvMat>();
for (int i = 0; i < mCP.paramNColors; i++)
{
CvMat t1 = new CvMat(regionImgHSV.Rows, regionImgHSV.Cols, MatrixType.U8C1);
t1.Zero();
CvMat t2 = new CvMat(regionImgHSV.Rows, regionImgHSV.Cols, MatrixType.U8C1);
colorblobImage.Add(t1);
tmpImage.Add(t2);
}
}
if(!colorblobImage[0].GetSize().Equals(regionImgHSV.GetSize()))
{
colorblobImage.Clear();
tmpImage.Clear();
for (int i = 0; i < mCP.paramNColors; i++)
{
CvMat t1 = new CvMat(regionImgHSV.Rows, regionImgHSV.Cols, MatrixType.U8C1);
t1.Zero();
CvMat t2 = new CvMat(regionImgHSV.Rows, regionImgHSV.Cols, MatrixType.U8C1);
colorblobImage.Add(t1);
tmpImage.Add(t2);
}
}
FindColorBlosandAccumulate(regionImgHSV);
}
private void createPrototypeFromColorBlobs()
{
prototypeDef newPrototype = this.createPrototypeDescription();
colorblobImage.ForEach(p => p.Zero());
//behavioral marker
List<UserDescriptionInfo> markerList=new List<UserDescriptionInfo>();
List<UserDescriptionInfo> behaviorList = new List<UserDescriptionInfo>();
List<UserDescriptionInfo> BVList = new List<UserDescriptionInfo>();
List<UserDescriptionInfo> ConnList = new List<UserDescriptionInfo>();
designARManager m = this.GetComponentInParent<designARManager>();
//***FOR deployment 2017-10-17. Ignore behavior and connection.
CvMat regionImgClone = GlobalRepo.GetRepo(RepoDataType.dRawRegionGray);
{
// SignDetector.ConnectivityandBehaviorRecognition(regionImgClone, ref newPrototype, ref markerList, ref behaviorList, ref BVList,ref ConnList);
if (SystemConfig.ActiveInstnace.Get(EvaluationConfigItem._Behavior_Missing_labels)
|| SystemConfig.ActiveInstnace.Get(EvaluationConfigItem._Behavior_Move_labels)
|| SystemConfig.ActiveInstnace.Get(EvaluationConfigItem._Behavior_Extra_labels))
{
this.GetComponentInParent<BehaviorDetector>().recognizeBehaviorVariables(m.pConceptModelManager.pFBSModel, newPrototype);
behaviorList = this.GetComponentInParent<BehaviorDetector>().exportBehaviorList();
debugTextLabels(behaviorList);
}
// debugSignMarkers(markerList);
// debugTextLabels(behaviorList);
//function label
}
foreach (var t in behaviorList)
{
newPrototype.addBehavior(t);
}
foreach (var t in ConnList)
{
newPrototype.addConnectivity(t);
}
GameObject.FindGameObjectWithTag("SystemControl").GetComponent<ApplicationControl>().Reset();
if (m != null && newPrototype != null)
{
m.addPrototype(newPrototype);
}
}
private void debugSignMarkers(List<UserDescriptionInfo> listM)
{
if (signImg == null) signImg = new CvMat(1500, 1900, MatrixType.U8C1);
int markerIndex = 0;
signImg.SetZero();
int heightStep = 20;
int widthStep = 50;
foreach (UserDescriptionInfo t in listM)
{
t.image.Copy(signImg.GetRows(heightStep, heightStep + t.image.Rows).GetCols(widthStep, widthStep + t.image.Cols));
signImg.PutText(t.instanceID+" : " + t.InfoBehaviorTypeId, new CvPoint(widthStep+t.image.Cols+30, heightStep), new CvFont(FontFace.HersheyTriplex, 1.0f, 1.0f), CvColor.White);
heightStep += t.image.Rows + 20;
markerIndex++;
if(heightStep>900)
{
heightStep = 20;
widthStep += 500;
}
}
debugWindow3.ShowImage(signImg);
}
private void debugTextLabels(List<UserDescriptionInfo> listT)
{
if (labelImg == null) labelImg = new CvMat(1500, 1900, MatrixType.U8C1);
int markerIndex = 0;
labelImg.SetZero();
int heightStep = 20;
foreach (UserDescriptionInfo t in listT)
{
t.image.Copy(labelImg.GetRows(heightStep, heightStep + t.image.Rows).GetCols(20, 20 + t.image.Cols));
labelImg.PutText("\""+t.InfoTextLabelstring+"\"", new CvPoint(400, heightStep), new CvFont(FontFace.HersheyTriplex, 1.0f, 1.0f), CvColor.White);
heightStep += t.image.Rows + 20;
markerIndex++;
}
GlobalRepo.showDebugImage("Behavior Labels", labelImg);
}
public static CvScalar getColorforModelIndex(int index)
{
CvScalar ret = CvColor.White;
if (mCP == null || index<1 || index> mCP.mProfileList.Count) return ret;
// Debug.Log("Get Color for index = " + index);
ret = mCP.mProfileList[index - 1].BGRA;
return ret;
}
//construct and return a prototypeDef only with structure models
public prototypeDef createPrototypeDescription()
{
if (mCP.paramNColors > mCP.mProfileList.Count) return null;
prototypeDef pProto = new prototypeDef();
int validColorsN = 0;
ModelCategory[] colorObjectMap = Content.loadColorObjectMap(out validColorsN);
if (this.ShowDebugImage)
{
//if (debugWindow3 != null && signImg != null) debugWindow3.ShowImage(signImg);
if (colorblobImage != null)
{
for (int i = 0; i < colorblobImage.Count; i++)
{
GlobalRepo.showDebugImage("colorBlob#" + i, colorblobImage[i]);
}
Cv.WaitKey(10);
}
}
for (int i = 0; i < validColorsN; i++)
{
List<ModelDef> extractedModels = BlobAnalysis.ExtractStrcutureInfoFromImageBlob(colorblobImage[i], regionImgHSV, colorObjectMap[i]);
if (extractedModels!=null && (colorObjectMap[i] == ModelCategory.FrontChainring ||
colorObjectMap[i] == ModelCategory.RearSprocket ||
colorObjectMap[i] == ModelCategory.PedalCrank ||
colorObjectMap[i] == ModelCategory.C4_lens ||
colorObjectMap[i] == ModelCategory.C4_shutter ||
colorObjectMap[i] == ModelCategory.C4_sensor)
) {
int maxIdx = -1;
double maxSize = 0;
for (int j = 0; j < extractedModels.Count; j++)
{
if (extractedModels[j].AreaSize > maxSize)
{
maxSize = extractedModels[j].AreaSize;
maxIdx = j;
}
}
if (maxIdx >= 0)
{
ModelDef t = extractedModels[maxIdx];
extractedModels.Clear();
extractedModels.Add(t);
}
}
pProto.addModels(extractedModels);
}
//debug
if(pProto.mModels!=null) {
Debug.Log("New Prototype N of Models : " + pProto.GetNumberofModels());
}
PostRefinePrototype(pProto);
return pProto;
}
private void PostRefinePrototype(prototypeDef proto)
{
//refine models with classifying models in a same category
if (proto.mModels == null) return;
//upper and lower chain. deafult:upper
if(proto.mModels[ModelCategory.Chain].Count>=1)
{
for(int i=0;i< proto.mModels[ModelCategory.Chain].Count;i++)
{
ModelCategory det = ModelCategory.UpperChain;
for (int j = 0; j < proto.mModels[ModelCategory.Chain].Count; j++)
{
if (i == j) continue;
if (proto.mModels[ModelCategory.Chain][i].centeroidAbsolute.Y < proto.mModels[ModelCategory.Chain][j].centeroidAbsolute.Y) det = ModelCategory.UpperChain;
else det = ModelCategory.LowerChain;
}
proto.mModels[ModelCategory.Chain][i].modelType = det;
proto.addModeltoCategory(proto.mModels[ModelCategory.Chain][i]);
}
}
proto.mModels[ModelCategory.Chain].Clear();
}
private void FindColorBlosandAccumulate(CvMat srcImgHSV)
{
PointerAccessor1D_Int32 p = srcImgHSV.DataArrayInt32;
int length = srcImgHSV.Height * srcImgHSV.Width;
CvScalar in_, out_;
float hue_temp;
float sat_val;
float canvasMaxSaturation = GlobalRepo.getParamInt("CanvasSaturationValueMax");
int validColorN = 0;
ModelCategory[] colorObjectMap = Content.loadColorObjectMap(out validColorN);
CvMat srcImgH = GlobalRepo.GetRepo(RepoDataType.dRawRegionH);
CvMat srcImgH2 = GlobalRepo.GetRepo(RepoDataType.dRawRegionH2);
CvMat srcImgS = GlobalRepo.GetRepo(RepoDataType.dRawRegionSaturated);
CvMat srcImgH3 = srcImgH2.EmptyClone();
// srcImgHSV.Split(srcImgH, srcImgS, srcImgV,null);
srcImgS.InRangeS(new CvScalar(canvasMaxSaturation), new CvScalar(255), srcImgS);
for (int j = 0; j < validColorN; j++)
{
srcImgH.InRangeS(new CvScalar(mCP.mProfileList[j].HueClass1- hueFilterThreshold),
new CvScalar(mCP.mProfileList[j].HueClass1 + hueFilterThreshold), srcImgH2);
if (j == 2)
{
srcImgH.InRangeS(new CvScalar(0),new CvScalar(5), srcImgH3);
srcImgH2.Or(srcImgH3, srcImgH2);
srcImgH.InRangeS(new CvScalar(175), new CvScalar(180), srcImgH3);
srcImgH2.Or(srcImgH3, srcImgH2);
/* if (mCP.mProfileList[j].HueClass1 - hueFilterThreshold < 0)
{
srcImgH.InRangeS(new CvScalar(360 + mCP.mProfileList[j].HueClass1 - hueFilterThreshold),
new CvScalar(360), srcImgH3);
srcImgH2.Or(srcImgH3, srcImgH2);
}
if (mCP.mProfileList[j].HueClass1 + hueFilterThreshold > 360)
{
srcImgH.InRangeS(new CvScalar(0),
new CvScalar(mCP.mProfileList[j].HueClass1 + hueFilterThreshold - 360), srcImgH3);
srcImgH2.Or(srcImgH3, srcImgH2);
}
*/
}
srcImgH2.And(srcImgS, srcImgH2);
colorblobImage[j].Add(srcImgH2, colorblobImage[j]);
}
/*
for (int i = 0; i < length; i++)
{
in_ = srcImgHSV.Get1D(i);
//hue_temp = colorModel.getHue1(in_.Val2, in_.Val1, in_.Val0);
for(int j = 0; j < validColorN; j++)
{
//if (in_.Val1 < canvasMaxSaturation || Mathf.Abs((float)in_.Val0 - mCP.mProfileList[j].HueClass1) > mCP.mProfileList[j].classficationThreshold)
if (in_.Val1 < canvasMaxSaturation ||
Mathf.Abs((float)in_.Val0 - mCP.mProfileList[j].HueClass1) > hueFilterThreshold)
{
tmpImage[j].Set1D(i, 0);
}
else tmpImage[j].Set1D(i, 255);
}
}
for (int j = 0; j < validColorN; j++)
{
// debugImagelist[j].Smooth(debugImagelist[j],SmoothType.Gaussian);
// Cv.Erode(tmpImage[j], tmpImage[j]);
// Cv.Dilate(tmpImage[j], tmpImage[j]);
colorblobImage[j].Add(tmpImage[j], colorblobImage[j]);
}*/
}
//DEPRECATED
public void UpdateColorImage(byte[] rgbaImage,byte[] overlayedRGBAimage,int width, int height)
{ // called by kinect.
int[] from_to = { 0, 2, 1, 1, 2, 0, 3, 3 };
if (colorImg==null)
{
colorImg = new CvMat(height / scaleFactor, width / scaleFactor, MatrixType.U8C4);
rawcolorImage = new CvMat(height, width, MatrixType.U8C4);
// debugImg = new CvMat(height / scaleFactor, width / scaleFactor, MatrixType.U8C4);
}
CvMat rawcolorImageRGBA = new CvMat(height, width, MatrixType.U8C4, rgbaImage);
//Cv.Flip(rawcolorImage2, rawcolorImage, FlipMode.Y); //flip mode for text recognition
rawcolorImageRGBA.Copy(rawcolorImage);
Cv.Resize(rawcolorImage, colorImg);
// GlobalRepo.updateRepo(RepoDataType.pRawRGBA, rawcolorImageRGBA);
// GlobalRepo.updateRepo(RepoDataType.pOverlayRGBA, new CvMat(height, width, MatrixType.U8C4, overlayedRGBAimage));
if (regionPoints.Count==2)
{
// regionImg = Cv.GetSubRect(colorImg, out regionImg, new CvRect(regionPoints[0].X, regionPoints[0].Y, regionPoints[1].X - regionPoints[0].X, regionPoints[1].Y - regionPoints[0].Y));
// regionImg = Cv.GetSubRect(rawcolorImage, out regionImg, new CvRect((regionPoints[0].X*scaleFactor), (regionPoints[0].Y * scaleFactor), (regionPoints[1].X - regionPoints[0].X) * scaleFactor, (regionPoints[1].Y - regionPoints[0].Y) * scaleFactor));
CvRect regionBox = new CvRect((regionPoints[0].X * scaleFactor), (regionPoints[0].Y * scaleFactor), (regionPoints[1].X - regionPoints[0].X) * scaleFactor, (regionPoints[1].Y - regionPoints[0].Y) * scaleFactor);
//Y flip
GlobalRepo.setRegionBox(regionBox);
GlobalRepo.updateInternalRepo(true);
//debugWindow2.ShowImage(regionImg);
// GlobalRepo.tickLearningCount();
}
// Cv.MixChannels(colorImg, colorImg, from_to);
//Cv.ConvertImage(colorImg, colorImg, ConvertImageFlag.SwapRB);
}
void OnDestroy()
{
mCP.exportProfiletoFile();
CvWindow.DestroyAllWindows();
}
}
public class colorModel : System.IComparable
{
public CvScalar BGRA;
public float HueClass1=-1;
public float profileThreshold=-1;
public float learningAlpha = 0.1f;
public int hit = 0;
public float classficationThreshold = -1;
private static double constant1 = Mathf.Sqrt(3.0f);
public static float getHue1(double R, double G, double B)
{
return (float) R;
/*float y = (float)(R - G) * (float)constant1;
float x = (float)(R + G - 2 * B);
return Mathf.Atan2(y, x);*/
}
public colorModel(double R, double G, double B)
{
//base
BGRA.Val0 = B;
BGRA.Val1 = G;
BGRA.Val2 = R;
BGRA.Val3 = 255;
//hue descriptor #1 (Van De Weijer, ECCV 2006)
/* float y = (float) (R - G) * (float)constant1;
float x = (float) ( R+ G - 2 * B);
HueClass1 = Mathf.Atan2(y,x);*/
HueClass1 = (float) R;
}
public bool isDifferent(colorModel refCM)
{
if (profileThreshold < 0) return true;
//hue1
if (Mathf.Abs(refCM.HueClass1 - this.HueClass1) < profileThreshold)
{
Debug.Log("ColorProfile Exists: hue distance = "+(refCM.HueClass1 - this.HueClass1));
return false;
}
Debug.Log("ColorProfile Differs: hue distance = " + (refCM.HueClass1 - this.HueClass1));
return true;
}
public bool isDifferentLearning(colorModel refCM)
{
if (profileThreshold < 0) return true;
//
float diff = refCM.HueClass1 - this.HueClass1;
if (Mathf.Abs(refCM.HueClass1 - this.HueClass1) < profileThreshold)
{
this.HueClass1 += this.learningAlpha * diff;
this.hit++;
return false;
}
return true;
}
public bool LearningColor(colorModel refCM)
{
if (profileThreshold < 0) return false;
//
float diff = refCM.HueClass1 - this.HueClass1;
this.HueClass1 += this.learningAlpha * diff;
this.hit++;
this.BGRA.Val0 += (refCM.BGRA.Val0 - this.BGRA.Val0) * this.learningAlpha;
this.BGRA.Val1 += (refCM.BGRA.Val1 - this.BGRA.Val1) * this.learningAlpha;
this.BGRA.Val2 += (refCM.BGRA.Val2 - this.BGRA.Val2) * this.learningAlpha;
this.BGRA.Val3 += (refCM.BGRA.Val3 - this.BGRA.Val3) * this.learningAlpha;
return true;
}
public serialColorModel exportModel()
{
serialColorModel t = new serialColorModel();
t.BGRA_Val0 = this.BGRA.Val0;
t.BGRA_Val1 = this.BGRA.Val1;
t.BGRA_Val2 = this.BGRA.Val2;
t.BGRA_Val3 = this.BGRA.Val3;
t.HueClass1 = this.HueClass1;
t.learningAlpha = this.learningAlpha;
t.ProfileThreshold = this.profileThreshold;
t.hit = this.hit;
t.classficationThreshold = this.classficationThreshold;
return t;
}
public int CompareTo(object obj)
{
colorModel objt = obj as colorModel;
return objt.hit.CompareTo(hit);
}
public colorModel(serialColorModel t)
{
this.BGRA.Val0= t.BGRA_Val0;
this.BGRA.Val1 = t.BGRA_Val1;
this.BGRA.Val2= t.BGRA_Val2;
this.BGRA.Val3 = t.BGRA_Val3;
this.HueClass1 = t.HueClass1 ;
this.learningAlpha = t.learningAlpha ;
this.profileThreshold = t.ProfileThreshold;
this.hit = t.hit;
this.classficationThreshold = t.classficationThreshold;
if (this.classficationThreshold <= 0) this.classficationThreshold = 0.06f;
}
}
public class colorProfile
{
public List<colorModel> mProfileList;
private float defaultprofileThreshold = 0.1f;
private float defaultclassificationThreshold = 0.06f;
private string path = "colorprofile.txt";
private ConfigObject config;
public int paramNColors=5;
public int updateIndexCursor = -1;
public colorProfile()
{
mProfileList = new List<colorModel>();
readProfileFromFile();
}
public void setParamThreshold(float pThresh)
{
defaultprofileThreshold = pThresh;
}
public void addSampleColor(colorModel cm)
{
bool isExisting = false;
if(this.updateIndexCursor>=0)
{
mProfileList[updateIndexCursor].LearningColor(cm);
Debug.Log("Color index " + updateIndexCursor + " learned to " + mProfileList[updateIndexCursor].HueClass1);
isExisting = true;
}
if(!isExisting)
{
cm.profileThreshold = defaultprofileThreshold;
cm.classficationThreshold = defaultclassificationThreshold;
mProfileList.Add(cm);
}
Debug.Log("ColorProfile : Total profiles = " + mProfileList.Count);
}
private int readProfileFromFile()
{
mProfileList.Clear();
if (!File.Exists(path))
{
for (int i = 0; i < this.paramNColors; i++)
{
colorModel cm = new colorModel(0, 0, 0);
cm.profileThreshold = defaultprofileThreshold;
cm.classficationThreshold = defaultclassificationThreshold;
mProfileList.Add(cm);
}
return 1;
}
using (Stream file = File.Open(path, FileMode.Open))
{
BinaryFormatter bf = new BinaryFormatter();
object obj = bf.Deserialize(file);
List<object> objects = obj as List<object>;
//you may want to run some checks (objects is not null and contains 2 elements for example
for(int i = 0; i < objects.Count; i++)
{
var t = objects[i] as serialColorModel;
mProfileList.Add(new colorModel(t as serialColorModel));
mProfileList[i].classficationThreshold = 2.00f;
}
// mProfileList.Sort();
//mProfileList[3].classficationThreshold = 2.00f;
//use nodes and dictionary
}
// Debug.Log("Color Profile Loaded N=" + mProfileList.Count);
// printProfile();
return 1;
}
private void printProfile()
{
for (int i = 0; i < mProfileList.Count; i++)
{
Debug.Log(i + ") hueclass1 = " + mProfileList[i].HueClass1+" , hit = " + mProfileList[i].hit);
}
}
public int exportProfiletoFile() {
List<object> objects = new List<object>();
for (int i = 0; i < mProfileList.Count; i++)
{
if (i >= this.paramNColors) break;
objects.Add(mProfileList[i].exportModel());
}
if (File.Exists(path))
{
File.Delete(path);
}
using (Stream file = File.Open(path, FileMode.Create))
{
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(file, objects);
}
printProfile();
return 1;
}
private static void Add
(FileStream fs, string value)
{
byte[] info = new UTF8Encoding(true).GetBytes(value);
fs.Write(info, 0, info.Length);
}
}
| 35.526576 | 260 | 0.556174 | [
"MIT"
] | SeokbinKang/PrototypAR | src/unity/Assets/Scripts/ColorDetector.cs | 28,743 | C# |
using System;
using System.Collections.Generic;
using System.Security.Cryptography;
using System.Text;
namespace PasswordVault.Utilities
{
public static class KeyGenerator
{
internal static readonly char[] chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*-_=+?".ToCharArray();
public static string GenerateRandomPassword(int length)
{
byte[] data = new byte[4 * length];
using (RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider())
{
crypto.GetBytes(data);
}
StringBuilder result = new StringBuilder(length);
for (int i = 0; i < length; i++)
{
var rnd = BitConverter.ToUInt32(data, i * 4);
var idx = rnd % chars.Length;
result.Append(chars[idx]);
}
return result.ToString();
}
}
}
| 28.969697 | 104 | 0.57636 | [
"Apache-2.0"
] | willem445/PasswordVault | PasswordVault.Utilities/KeyGenerator.cs | 958 | C# |
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
namespace MudBlazor.Markdown.Server
{
public class Program
{
public static Task Main(string[] args)
{
return CreateHostBuilder(args).Build().RunAsync();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| 21.454545 | 64 | 0.735169 | [
"MIT"
] | MyNihongo/MudBlazor.Markdown | samples/Server/Program.cs | 472 | C# |
namespace SlipeServer.Server.AllSeeingEye;
public interface IAseQueryService
{
string? GetRule(string key);
bool RemoveRule(string key);
void SetRule(string key, string value);
string GetVersion();
byte[] QueryFull();
byte[] QueryLight();
byte[] QueryXFireLight();
}
| 22.846154 | 43 | 0.69697 | [
"MIT"
] | correaAlex/Slipe-Server | SlipeServer.Server/AllSeeingEye/IAseQueryService.cs | 299 | C# |
using Altaliza.Core.Entities;
namespace Altaliza.Core.Repositories
{
public interface ICharacterRepository : IBaseEntityRepository<Character> { }
} | 25.333333 | 80 | 0.809211 | [
"MIT"
] | felipehac/outplay-altaliza | backend/Altaliza.Core/Repositories/ICharacterRepository.cs | 152 | C# |
// ===================================
// The use and distribution terms for this software are covered by the Microsoft public license,
// visit for more info : http://www.testcontrol.org (or) http://testcontrol.codeplex.com
//
// You must not remove this copyright notice, or any other, from this software
//
// Senthil Maruthaiappan [email protected]
// ===================================
namespace TestControl.Net.Interfaces
{
public interface ICodeBase
{
}
} | 34.357143 | 97 | 0.613306 | [
"MIT"
] | qamatic/testcontrol.net | TestControl.Net/Interfaces/ICodeBase.cs | 483 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
namespace Swapping
{
class Link
{
public int Value { get; private set; }
public Link Left { get; private set; }
public Link Right { get; private set; }
public Link(Link end, int x)
{
this.Value = x;
this.Left = end;
this.Right = null;
if (end != null)
{
end.Right = this;
}
}
public static void Detach(Link x)
{
if(x.Left != null)
{
x.Left.Right = null;
}
if (x.Right != null)
{
x.Right.Left = null;
}
x.Left = null;
x.Right = null;
}
public static void Attach(Link l, Link r)
{
if(l == r)
{
return;
}
l.Right = r;
r.Left = l;
}
}
class Program
{
public static int[] SubArray(int[] data, int index, int length)
{
int[] result = new int[length];
Array.Copy(data, index, result, 0, length);
return result;
}
static void Main()
{
#region not working sollutions calls
//Solution1();
//Solution2();
//Solution3();
//Solution4();
//Solution5();
//Solution6();
//Solution7();
//Solution8();
#endregion
AuthorSolution();
}
static void AuthorSolution()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
Link[] links = new Link[n + 1];
for(int i = 1; i <= n; ++i)
{
links[i] = new Link(links[i - 1], i);
}
var leftEnd = links[1];
var rightEnd = links[n];
foreach (int x in numbers)
{
var mid = links[x];
var newRight = mid.Left;
var newLeft = mid.Right;
Link.Detach(mid);
Link.Attach(rightEnd, mid);
Link.Attach(mid, leftEnd);
if (newLeft == null)
{
leftEnd = mid;
}
else
{
leftEnd = newLeft;
}
if (newRight == null)
{
rightEnd = mid;
}
else
{
rightEnd = newRight;
}
}
var num = new int[n];
for (int i = 0; i < n; i++)
{
num[i] = leftEnd.Value;
leftEnd = leftEnd.Right;
}
Console.WriteLine(string.Join(" ", num));
}
#region not working solutions
static void Solution1()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int[] sequence = new int[n];
for (int j = 1; j <= n; j++)
{
sequence[j - 1] = j;
}
for (int i = 0; i < numbers.Length; i++)
{
List<int> left = new List<int>();
List<int> right = new List<int>();
int mid = numbers[i];
int index = Array.IndexOf(sequence, mid);
for (int k = 0; k < sequence.Length; k++)
{
if (k < index)
{
left.Add(sequence[k]);
}
if (k > index)
{
right.Add(sequence[k]);
}
}
right.Add(mid);
if (left.Count == 0)
{
sequence = right.ToArray();
}
else
{
sequence = right.Concat(left).ToArray();
}
}
Console.WriteLine(string.Join(" ", sequence));
}
static void Solution2()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
int[] sequence = new int[n];
for (int j = 1; j <= n; j++)
{
sequence[j - 1] = j;
}
for (int i = 0; i < numbers.Length; i++)
{
int mid = numbers[i];
int index = Array.IndexOf(sequence, mid);
int[] left = sequence.Take(index).ToArray();
int[] right = sequence.Skip(index).ToArray();
int length = right.Length;
for (int j = 0; j < length - 1; j++)
{
if (length == 1)
{
break;
}
else
{
right[j] = right[j + 1];
}
}
right[right.Length - 1] = mid;
sequence = right.Concat(left).ToArray();
}
Console.WriteLine(string.Join(" ", sequence));
}
static void Solution3()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
List<int> sequence = new List<int>();
for (int j = 1; j <= n; j++)
{
sequence.Add(j);
}
for (int i = 0; i < numbers.Length; i++)
{
int index = sequence.IndexOf(numbers[i]);
sequence.Add(numbers[i]);
sequence.Remove(sequence[index]);
for (int j = 0; j < index; j++)
{
sequence.Add(sequence[0]);
sequence.Remove(sequence[0]);
}
}
Console.WriteLine(string.Join(" ", sequence));
}
static void Solution4()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
List<int> sequence = Enumerable.Range(1, n).ToList();
for (int i = 0; i < numbers.Length; i++)
{
int index = sequence.IndexOf(numbers[i]);
sequence.Add(numbers[i]);
sequence.Remove(sequence[index]);
for (int j = 0; j < index; j++)
{
sequence.Add(sequence[0]);
sequence.Remove(sequence[0]);
}
}
Console.WriteLine(string.Join(" ", sequence));
}
static void Solution5()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
List<int> sequence = Enumerable.Range(1, n).ToList();
for (int i = 0; i < numbers.Length; i++)
{
List<int> left = new List<int>();
List<int> right = new List<int>();
int mid = numbers[i];
int index = sequence.IndexOf(numbers[i]);
for (int k = 0; k < sequence.Count; k++)
{
if (k < index)
{
left.Add(sequence[k]);
}
if (k > index)
{
right.Add(sequence[k]);
}
}
right.Add(mid);
if (left.Count == 0)
{
sequence = right;
}
else
{
sequence = right.Concat(left).ToList();
}
}
Console.WriteLine(string.Join(" ", sequence));
}
static void Solution6()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
LinkedList<int> list = new LinkedList<int>(Enumerable.Range(1, n));
foreach (int t in numbers)
{
var call = list.Find(t);
var newCall = new LinkedListNode<int>(call.Value);
Console.WriteLine(string.Join(" ", list));
var sep = call.Previous;
list.Remove(call);
list.AddFirst(newCall);
while (list.Last.Value != sep.Value)
{
var lastElem = list.Last.Value;
list.RemoveLast();
list.AddFirst(new LinkedListNode<int>(lastElem));
}
}
Console.WriteLine(string.Join(" ", list));
}
static void Solution7()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
LinkedList<int> list = new LinkedList<int>(Enumerable.Range(1, n));
for (int i = 0; i < numbers.Length; i++)
{
int t = numbers[i];
var call = list.Find(t);
if (call.Value != list.First.Value && call.Value != list.Last.Value)
{
var val = call.Previous.Value;
list.Remove(call);
list.AddFirst(call);
while (list.Last.Value != val)
{
var lastElem = list.Last;
list.RemoveLast();
list.AddFirst(lastElem);
}
}
else if (call.Value == list.First.Value)
{
var node = list.First();
list.RemoveFirst();
list.AddLast(node);
}
else if (call.Value == list.Last.Value)
{
var node = list.Last();
list.RemoveLast();
list.AddFirst(node);
}
}
Console.WriteLine(string.Join(" ", list));
}
static void Solution8()
{
int n = int.Parse(Console.ReadLine());
int[] numbers = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
LinkedList<int> list = new LinkedList<int>(Enumerable.Range(1, n));
for (int i = 0; i < numbers.Length; i++)
{
int t = numbers[i];
var call = list.Find(t);
if (call.Value != list.First.Value && call.Value != list.Last.Value)
{
}
else if (call.Value == list.First.Value)
{
}
else if (call.Value == list.Last.Value)
{
}
}
Console.WriteLine(string.Join(" ", list));
}
#endregion
}
}
| 28.184729 | 86 | 0.386699 | [
"MIT"
] | zachdimitrov/Learning_2017 | DSA/MiniExams/_2017-07-01_MiniExam/Swapping/Program.cs | 11,445 | C# |
// <auto-generated>
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/cloud/recommendationengine/v1beta1/prediction_service.proto
// </auto-generated>
#pragma warning disable 1591, 0612, 3021
#region Designer generated code
using pb = global::Google.Protobuf;
using pbc = global::Google.Protobuf.Collections;
using pbr = global::Google.Protobuf.Reflection;
using scg = global::System.Collections.Generic;
namespace Google.Cloud.RecommendationEngine.V1Beta1 {
/// <summary>Holder for reflection information generated from google/cloud/recommendationengine/v1beta1/prediction_service.proto</summary>
public static partial class PredictionServiceReflection {
#region Descriptor
/// <summary>File descriptor for google/cloud/recommendationengine/v1beta1/prediction_service.proto</summary>
public static pbr::FileDescriptor Descriptor {
get { return descriptor; }
}
private static pbr::FileDescriptor descriptor;
static PredictionServiceReflection() {
byte[] descriptorData = global::System.Convert.FromBase64String(
string.Concat(
"CkJnb29nbGUvY2xvdWQvcmVjb21tZW5kYXRpb25lbmdpbmUvdjFiZXRhMS9w",
"cmVkaWN0aW9uX3NlcnZpY2UucHJvdG8SKWdvb2dsZS5jbG91ZC5yZWNvbW1l",
"bmRhdGlvbmVuZ2luZS52MWJldGExGhxnb29nbGUvYXBpL2Fubm90YXRpb25z",
"LnByb3RvGh9nb29nbGUvYXBpL2ZpZWxkX2JlaGF2aW9yLnByb3RvGhlnb29n",
"bGUvYXBpL3Jlc291cmNlLnByb3RvGjpnb29nbGUvY2xvdWQvcmVjb21tZW5k",
"YXRpb25lbmdpbmUvdjFiZXRhMS91c2VyX2V2ZW50LnByb3RvGhxnb29nbGUv",
"cHJvdG9idWYvc3RydWN0LnByb3RvGhdnb29nbGUvYXBpL2NsaWVudC5wcm90",
"byKuBAoOUHJlZGljdFJlcXVlc3QSQwoEbmFtZRgBIAEoCUI14EEC+kEvCi1y",
"ZWNvbW1lbmRhdGlvbmVuZ2luZS5nb29nbGVhcGlzLmNvbS9QbGFjZW1lbnQS",
"TQoKdXNlcl9ldmVudBgCIAEoCzI0Lmdvb2dsZS5jbG91ZC5yZWNvbW1lbmRh",
"dGlvbmVuZ2luZS52MWJldGExLlVzZXJFdmVudEID4EECEhYKCXBhZ2Vfc2l6",
"ZRgHIAEoBUID4EEBEhcKCnBhZ2VfdG9rZW4YCCABKAlCA+BBARITCgZmaWx0",
"ZXIYAyABKAlCA+BBARIUCgdkcnlfcnVuGAQgASgIQgPgQQESWgoGcGFyYW1z",
"GAYgAygLMkUuZ29vZ2xlLmNsb3VkLnJlY29tbWVuZGF0aW9uZW5naW5lLnYx",
"YmV0YTEuUHJlZGljdFJlcXVlc3QuUGFyYW1zRW50cnlCA+BBARJaCgZsYWJl",
"bHMYCSADKAsyRS5nb29nbGUuY2xvdWQucmVjb21tZW5kYXRpb25lbmdpbmUu",
"djFiZXRhMS5QcmVkaWN0UmVxdWVzdC5MYWJlbHNFbnRyeUID4EEBGkUKC1Bh",
"cmFtc0VudHJ5EgsKA2tleRgBIAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2ds",
"ZS5wcm90b2J1Zi5WYWx1ZToCOAEaLQoLTGFiZWxzRW50cnkSCwoDa2V5GAEg",
"ASgJEg0KBXZhbHVlGAIgASgJOgI4ASLiBAoPUHJlZGljdFJlc3BvbnNlElwK",
"B3Jlc3VsdHMYASADKAsySy5nb29nbGUuY2xvdWQucmVjb21tZW5kYXRpb25l",
"bmdpbmUudjFiZXRhMS5QcmVkaWN0UmVzcG9uc2UuUHJlZGljdGlvblJlc3Vs",
"dBIcChRyZWNvbW1lbmRhdGlvbl90b2tlbhgCIAEoCRIgChhpdGVtc19taXNz",
"aW5nX2luX2NhdGFsb2cYAyADKAkSDwoHZHJ5X3J1bhgEIAEoCBJaCghtZXRh",
"ZGF0YRgFIAMoCzJILmdvb2dsZS5jbG91ZC5yZWNvbW1lbmRhdGlvbmVuZ2lu",
"ZS52MWJldGExLlByZWRpY3RSZXNwb25zZS5NZXRhZGF0YUVudHJ5EhcKD25l",
"eHRfcGFnZV90b2tlbhgGIAEoCRrhAQoQUHJlZGljdGlvblJlc3VsdBIKCgJp",
"ZBgBIAEoCRJ0Cg1pdGVtX21ldGFkYXRhGAIgAygLMl0uZ29vZ2xlLmNsb3Vk",
"LnJlY29tbWVuZGF0aW9uZW5naW5lLnYxYmV0YTEuUHJlZGljdFJlc3BvbnNl",
"LlByZWRpY3Rpb25SZXN1bHQuSXRlbU1ldGFkYXRhRW50cnkaSwoRSXRlbU1l",
"dGFkYXRhRW50cnkSCwoDa2V5GAEgASgJEiUKBXZhbHVlGAIgASgLMhYuZ29v",
"Z2xlLnByb3RvYnVmLlZhbHVlOgI4ARpHCg1NZXRhZGF0YUVudHJ5EgsKA2tl",
"eRgBIAEoCRIlCgV2YWx1ZRgCIAEoCzIWLmdvb2dsZS5wcm90b2J1Zi5WYWx1",
"ZToCOAEy4gIKEVByZWRpY3Rpb25TZXJ2aWNlEvMBCgdQcmVkaWN0EjkuZ29v",
"Z2xlLmNsb3VkLnJlY29tbWVuZGF0aW9uZW5naW5lLnYxYmV0YTEuUHJlZGlj",
"dFJlcXVlc3QaOi5nb29nbGUuY2xvdWQucmVjb21tZW5kYXRpb25lbmdpbmUu",
"djFiZXRhMS5QcmVkaWN0UmVzcG9uc2UicYLT5JMCWSJUL3YxYmV0YTEve25h",
"bWU9cHJvamVjdHMvKi9sb2NhdGlvbnMvKi9jYXRhbG9ncy8qL2V2ZW50U3Rv",
"cmVzLyovcGxhY2VtZW50cy8qfTpwcmVkaWN0OgEq2kEPbmFtZSx1c2VyX2V2",
"ZW50GlfKQSNyZWNvbW1lbmRhdGlvbmVuZ2luZS5nb29nbGVhcGlzLmNvbdJB",
"Lmh0dHBzOi8vd3d3Lmdvb2dsZWFwaXMuY29tL2F1dGgvY2xvdWQtcGxhdGZv",
"cm1CnwIKLWNvbS5nb29nbGUuY2xvdWQucmVjb21tZW5kYXRpb25lbmdpbmUu",
"djFiZXRhMVABWl1nb29nbGUuZ29sYW5nLm9yZy9nZW5wcm90by9nb29nbGVh",
"cGlzL2Nsb3VkL3JlY29tbWVuZGF0aW9uZW5naW5lL3YxYmV0YTE7cmVjb21t",
"ZW5kYXRpb25lbmdpbmWiAgVSRUNBSaoCKUdvb2dsZS5DbG91ZC5SZWNvbW1l",
"bmRhdGlvbkVuZ2luZS5WMUJldGExygIpR29vZ2xlXENsb3VkXFJlY29tbWVu",
"ZGF0aW9uRW5naW5lXFYxYmV0YTHqAixHb29nbGU6OkNsb3VkOjpSZWNvbW1l",
"bmRhdGlvbkVuZ2luZTo6VjFiZXRhMWIGcHJvdG8z"));
descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
new pbr::FileDescriptor[] { global::Google.Api.AnnotationsReflection.Descriptor, global::Google.Api.FieldBehaviorReflection.Descriptor, global::Google.Api.ResourceReflection.Descriptor, global::Google.Cloud.RecommendationEngine.V1Beta1.UserEventReflection.Descriptor, global::Google.Protobuf.WellKnownTypes.StructReflection.Descriptor, global::Google.Api.ClientReflection.Descriptor, },
new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.RecommendationEngine.V1Beta1.PredictRequest), global::Google.Cloud.RecommendationEngine.V1Beta1.PredictRequest.Parser, new[]{ "Name", "UserEvent", "PageSize", "PageToken", "Filter", "DryRun", "Params", "Labels" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, null, }),
new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse), global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Parser, new[]{ "Results", "RecommendationToken", "ItemsMissingInCatalog", "DryRun", "Metadata", "NextPageToken" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult), global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult.Parser, new[]{ "Id", "ItemMetadata" }, null, null, null, new pbr::GeneratedClrTypeInfo[] { null, }),
null, })
}));
}
#endregion
}
#region Messages
/// <summary>
/// Request message for Predict method.
/// </summary>
public sealed partial class PredictRequest : pb::IMessage<PredictRequest>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PredictRequest> _parser = new pb::MessageParser<PredictRequest>(() => new PredictRequest());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<PredictRequest> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.RecommendationEngine.V1Beta1.PredictionServiceReflection.Descriptor.MessageTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictRequest() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictRequest(PredictRequest other) : this() {
name_ = other.name_;
userEvent_ = other.userEvent_ != null ? other.userEvent_.Clone() : null;
pageSize_ = other.pageSize_;
pageToken_ = other.pageToken_;
filter_ = other.filter_;
dryRun_ = other.dryRun_;
params_ = other.params_.Clone();
labels_ = other.labels_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictRequest Clone() {
return new PredictRequest(this);
}
/// <summary>Field number for the "name" field.</summary>
public const int NameFieldNumber = 1;
private string name_ = "";
/// <summary>
/// Required. Full resource name of the format:
/// `{name=projects/*/locations/global/catalogs/default_catalog/eventStores/default_event_store/placements/*}`
/// The id of the recommendation engine placement. This id is used to identify
/// the set of models that will be used to make the prediction.
///
/// We currently support three placements with the following IDs by default:
///
/// * `shopping_cart`: Predicts items frequently bought together with one or
/// more catalog items in the same shopping session. Commonly displayed after
/// `add-to-cart` events, on product detail pages, or on the shopping cart
/// page.
///
/// * `home_page`: Predicts the next product that a user will most likely
/// engage with or purchase based on the shopping or viewing history of the
/// specified `userId` or `visitorId`. For example - Recommendations for you.
///
/// * `product_detail`: Predicts the next product that a user will most likely
/// engage with or purchase. The prediction is based on the shopping or
/// viewing history of the specified `userId` or `visitorId` and its
/// relevance to a specified `CatalogItem`. Typically used on product detail
/// pages. For example - More items like this.
///
/// * `recently_viewed_default`: Returns up to 75 items recently viewed by the
/// specified `userId` or `visitorId`, most recent ones first. Returns
/// nothing if neither of them has viewed any items yet. For example -
/// Recently viewed.
///
/// The full list of available placements can be seen at
/// https://console.cloud.google.com/recommendation/datafeeds/default_catalog/dashboard
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Name {
get { return name_; }
set {
name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "user_event" field.</summary>
public const int UserEventFieldNumber = 2;
private global::Google.Cloud.RecommendationEngine.V1Beta1.UserEvent userEvent_;
/// <summary>
/// Required. Context about the user, what they are looking at and what action
/// they took to trigger the predict request. Note that this user event detail
/// won't be ingested to userEvent logs. Thus, a separate userEvent write
/// request is required for event logging.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public global::Google.Cloud.RecommendationEngine.V1Beta1.UserEvent UserEvent {
get { return userEvent_; }
set {
userEvent_ = value;
}
}
/// <summary>Field number for the "page_size" field.</summary>
public const int PageSizeFieldNumber = 7;
private int pageSize_;
/// <summary>
/// Optional. Maximum number of results to return per page. Set this property
/// to the number of prediction results required. If zero, the service will
/// choose a reasonable default.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int PageSize {
get { return pageSize_; }
set {
pageSize_ = value;
}
}
/// <summary>Field number for the "page_token" field.</summary>
public const int PageTokenFieldNumber = 8;
private string pageToken_ = "";
/// <summary>
/// Optional. The previous PredictResponse.next_page_token.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string PageToken {
get { return pageToken_; }
set {
pageToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "filter" field.</summary>
public const int FilterFieldNumber = 3;
private string filter_ = "";
/// <summary>
/// Optional. Filter for restricting prediction results. Accepts values for
/// tags and the `filterOutOfStockItems` flag.
///
/// * Tag expressions. Restricts predictions to items that match all of the
/// specified tags. Boolean operators `OR` and `NOT` are supported if the
/// expression is enclosed in parentheses, and must be separated from the
/// tag values by a space. `-"tagA"` is also supported and is equivalent to
/// `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings
/// with a size limit of 1 KiB.
///
/// * filterOutOfStockItems. Restricts predictions to items that do not have a
/// stockState value of OUT_OF_STOCK.
///
/// Examples:
///
/// * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional")
/// * filterOutOfStockItems tag=(-"promotional")
/// * filterOutOfStockItems
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Filter {
get { return filter_; }
set {
filter_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "dry_run" field.</summary>
public const int DryRunFieldNumber = 4;
private bool dryRun_;
/// <summary>
/// Optional. Use dryRun mode for this prediction query. If set to true, a
/// dummy model will be used that returns arbitrary catalog items.
/// Note that the dryRun mode should only be used for testing the API, or if
/// the model is not ready.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool DryRun {
get { return dryRun_; }
set {
dryRun_ = value;
}
}
/// <summary>Field number for the "params" field.</summary>
public const int ParamsFieldNumber = 6;
private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_params_codec
= new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 50);
private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> params_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>();
/// <summary>
/// Optional. Additional domain specific parameters for the predictions.
///
/// Allowed values:
///
/// * `returnCatalogItem`: Boolean. If set to true, the associated catalogItem
/// object will be returned in the
/// `PredictResponse.PredictionResult.itemMetadata` object in the method
/// response.
/// * `returnItemScore`: Boolean. If set to true, the prediction 'score'
/// corresponding to each returned item will be set in the `metadata`
/// field in the prediction response. The given 'score' indicates the
/// probability of an item being clicked/purchased given the user's context
/// and history.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Params {
get { return params_; }
}
/// <summary>Field number for the "labels" field.</summary>
public const int LabelsFieldNumber = 9;
private static readonly pbc::MapField<string, string>.Codec _map_labels_codec
= new pbc::MapField<string, string>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForString(18, ""), 74);
private readonly pbc::MapField<string, string> labels_ = new pbc::MapField<string, string>();
/// <summary>
/// Optional. The labels for the predict request.
///
/// * Label keys can contain lowercase letters, digits and hyphens, must start
/// with a letter, and must end with a letter or digit.
/// * Non-zero label values can contain lowercase letters, digits and hyphens,
/// must start with a letter, and must end with a letter or digit.
/// * No more than 64 labels can be associated with a given request.
///
/// See https://goo.gl/xmQnxf for more information on and examples of labels.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, string> Labels {
get { return labels_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as PredictRequest);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(PredictRequest other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Name != other.Name) return false;
if (!object.Equals(UserEvent, other.UserEvent)) return false;
if (PageSize != other.PageSize) return false;
if (PageToken != other.PageToken) return false;
if (Filter != other.Filter) return false;
if (DryRun != other.DryRun) return false;
if (!Params.Equals(other.Params)) return false;
if (!Labels.Equals(other.Labels)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Name.Length != 0) hash ^= Name.GetHashCode();
if (userEvent_ != null) hash ^= UserEvent.GetHashCode();
if (PageSize != 0) hash ^= PageSize.GetHashCode();
if (PageToken.Length != 0) hash ^= PageToken.GetHashCode();
if (Filter.Length != 0) hash ^= Filter.GetHashCode();
if (DryRun != false) hash ^= DryRun.GetHashCode();
hash ^= Params.GetHashCode();
hash ^= Labels.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (userEvent_ != null) {
output.WriteRawTag(18);
output.WriteMessage(UserEvent);
}
if (Filter.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Filter);
}
if (DryRun != false) {
output.WriteRawTag(32);
output.WriteBool(DryRun);
}
params_.WriteTo(output, _map_params_codec);
if (PageSize != 0) {
output.WriteRawTag(56);
output.WriteInt32(PageSize);
}
if (PageToken.Length != 0) {
output.WriteRawTag(66);
output.WriteString(PageToken);
}
labels_.WriteTo(output, _map_labels_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Name.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Name);
}
if (userEvent_ != null) {
output.WriteRawTag(18);
output.WriteMessage(UserEvent);
}
if (Filter.Length != 0) {
output.WriteRawTag(26);
output.WriteString(Filter);
}
if (DryRun != false) {
output.WriteRawTag(32);
output.WriteBool(DryRun);
}
params_.WriteTo(ref output, _map_params_codec);
if (PageSize != 0) {
output.WriteRawTag(56);
output.WriteInt32(PageSize);
}
if (PageToken.Length != 0) {
output.WriteRawTag(66);
output.WriteString(PageToken);
}
labels_.WriteTo(ref output, _map_labels_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Name.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
}
if (userEvent_ != null) {
size += 1 + pb::CodedOutputStream.ComputeMessageSize(UserEvent);
}
if (PageSize != 0) {
size += 1 + pb::CodedOutputStream.ComputeInt32Size(PageSize);
}
if (PageToken.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(PageToken);
}
if (Filter.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Filter);
}
if (DryRun != false) {
size += 1 + 1;
}
size += params_.CalculateSize(_map_params_codec);
size += labels_.CalculateSize(_map_labels_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(PredictRequest other) {
if (other == null) {
return;
}
if (other.Name.Length != 0) {
Name = other.Name;
}
if (other.userEvent_ != null) {
if (userEvent_ == null) {
UserEvent = new global::Google.Cloud.RecommendationEngine.V1Beta1.UserEvent();
}
UserEvent.MergeFrom(other.UserEvent);
}
if (other.PageSize != 0) {
PageSize = other.PageSize;
}
if (other.PageToken.Length != 0) {
PageToken = other.PageToken;
}
if (other.Filter.Length != 0) {
Filter = other.Filter;
}
if (other.DryRun != false) {
DryRun = other.DryRun;
}
params_.Add(other.params_);
labels_.Add(other.labels_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
if (userEvent_ == null) {
UserEvent = new global::Google.Cloud.RecommendationEngine.V1Beta1.UserEvent();
}
input.ReadMessage(UserEvent);
break;
}
case 26: {
Filter = input.ReadString();
break;
}
case 32: {
DryRun = input.ReadBool();
break;
}
case 50: {
params_.AddEntriesFrom(input, _map_params_codec);
break;
}
case 56: {
PageSize = input.ReadInt32();
break;
}
case 66: {
PageToken = input.ReadString();
break;
}
case 74: {
labels_.AddEntriesFrom(input, _map_labels_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Name = input.ReadString();
break;
}
case 18: {
if (userEvent_ == null) {
UserEvent = new global::Google.Cloud.RecommendationEngine.V1Beta1.UserEvent();
}
input.ReadMessage(UserEvent);
break;
}
case 26: {
Filter = input.ReadString();
break;
}
case 32: {
DryRun = input.ReadBool();
break;
}
case 50: {
params_.AddEntriesFrom(ref input, _map_params_codec);
break;
}
case 56: {
PageSize = input.ReadInt32();
break;
}
case 66: {
PageToken = input.ReadString();
break;
}
case 74: {
labels_.AddEntriesFrom(ref input, _map_labels_codec);
break;
}
}
}
}
#endif
}
/// <summary>
/// Response message for predict method.
/// </summary>
public sealed partial class PredictResponse : pb::IMessage<PredictResponse>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PredictResponse> _parser = new pb::MessageParser<PredictResponse>(() => new PredictResponse());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<PredictResponse> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.RecommendationEngine.V1Beta1.PredictionServiceReflection.Descriptor.MessageTypes[1]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictResponse() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictResponse(PredictResponse other) : this() {
results_ = other.results_.Clone();
recommendationToken_ = other.recommendationToken_;
itemsMissingInCatalog_ = other.itemsMissingInCatalog_.Clone();
dryRun_ = other.dryRun_;
metadata_ = other.metadata_.Clone();
nextPageToken_ = other.nextPageToken_;
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictResponse Clone() {
return new PredictResponse(this);
}
/// <summary>Field number for the "results" field.</summary>
public const int ResultsFieldNumber = 1;
private static readonly pb::FieldCodec<global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult> _repeated_results_codec
= pb::FieldCodec.ForMessage(10, global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult.Parser);
private readonly pbc::RepeatedField<global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult> results_ = new pbc::RepeatedField<global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult>();
/// <summary>
/// A list of recommended items. The order represents the ranking (from the
/// most relevant item to the least).
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Types.PredictionResult> Results {
get { return results_; }
}
/// <summary>Field number for the "recommendation_token" field.</summary>
public const int RecommendationTokenFieldNumber = 2;
private string recommendationToken_ = "";
/// <summary>
/// A unique recommendation token. This should be included in the user event
/// logs resulting from this recommendation, which enables accurate attribution
/// of recommendation model performance.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string RecommendationToken {
get { return recommendationToken_; }
set {
recommendationToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "items_missing_in_catalog" field.</summary>
public const int ItemsMissingInCatalogFieldNumber = 3;
private static readonly pb::FieldCodec<string> _repeated_itemsMissingInCatalog_codec
= pb::FieldCodec.ForString(26);
private readonly pbc::RepeatedField<string> itemsMissingInCatalog_ = new pbc::RepeatedField<string>();
/// <summary>
/// IDs of items in the request that were missing from the catalog.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::RepeatedField<string> ItemsMissingInCatalog {
get { return itemsMissingInCatalog_; }
}
/// <summary>Field number for the "dry_run" field.</summary>
public const int DryRunFieldNumber = 4;
private bool dryRun_;
/// <summary>
/// True if the dryRun property was set in the request.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool DryRun {
get { return dryRun_; }
set {
dryRun_ = value;
}
}
/// <summary>Field number for the "metadata" field.</summary>
public const int MetadataFieldNumber = 5;
private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_metadata_codec
= new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 42);
private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> metadata_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>();
/// <summary>
/// Additional domain specific prediction response metadata.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> Metadata {
get { return metadata_; }
}
/// <summary>Field number for the "next_page_token" field.</summary>
public const int NextPageTokenFieldNumber = 6;
private string nextPageToken_ = "";
/// <summary>
/// If empty, the list is complete. If nonempty, the token to pass to the next
/// request's PredictRequest.page_token.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string NextPageToken {
get { return nextPageToken_; }
set {
nextPageToken_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as PredictResponse);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(PredictResponse other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if(!results_.Equals(other.results_)) return false;
if (RecommendationToken != other.RecommendationToken) return false;
if(!itemsMissingInCatalog_.Equals(other.itemsMissingInCatalog_)) return false;
if (DryRun != other.DryRun) return false;
if (!Metadata.Equals(other.Metadata)) return false;
if (NextPageToken != other.NextPageToken) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
hash ^= results_.GetHashCode();
if (RecommendationToken.Length != 0) hash ^= RecommendationToken.GetHashCode();
hash ^= itemsMissingInCatalog_.GetHashCode();
if (DryRun != false) hash ^= DryRun.GetHashCode();
hash ^= Metadata.GetHashCode();
if (NextPageToken.Length != 0) hash ^= NextPageToken.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
results_.WriteTo(output, _repeated_results_codec);
if (RecommendationToken.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RecommendationToken);
}
itemsMissingInCatalog_.WriteTo(output, _repeated_itemsMissingInCatalog_codec);
if (DryRun != false) {
output.WriteRawTag(32);
output.WriteBool(DryRun);
}
metadata_.WriteTo(output, _map_metadata_codec);
if (NextPageToken.Length != 0) {
output.WriteRawTag(50);
output.WriteString(NextPageToken);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
results_.WriteTo(ref output, _repeated_results_codec);
if (RecommendationToken.Length != 0) {
output.WriteRawTag(18);
output.WriteString(RecommendationToken);
}
itemsMissingInCatalog_.WriteTo(ref output, _repeated_itemsMissingInCatalog_codec);
if (DryRun != false) {
output.WriteRawTag(32);
output.WriteBool(DryRun);
}
metadata_.WriteTo(ref output, _map_metadata_codec);
if (NextPageToken.Length != 0) {
output.WriteRawTag(50);
output.WriteString(NextPageToken);
}
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
size += results_.CalculateSize(_repeated_results_codec);
if (RecommendationToken.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(RecommendationToken);
}
size += itemsMissingInCatalog_.CalculateSize(_repeated_itemsMissingInCatalog_codec);
if (DryRun != false) {
size += 1 + 1;
}
size += metadata_.CalculateSize(_map_metadata_codec);
if (NextPageToken.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(NextPageToken);
}
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(PredictResponse other) {
if (other == null) {
return;
}
results_.Add(other.results_);
if (other.RecommendationToken.Length != 0) {
RecommendationToken = other.RecommendationToken;
}
itemsMissingInCatalog_.Add(other.itemsMissingInCatalog_);
if (other.DryRun != false) {
DryRun = other.DryRun;
}
metadata_.Add(other.metadata_);
if (other.NextPageToken.Length != 0) {
NextPageToken = other.NextPageToken;
}
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
results_.AddEntriesFrom(input, _repeated_results_codec);
break;
}
case 18: {
RecommendationToken = input.ReadString();
break;
}
case 26: {
itemsMissingInCatalog_.AddEntriesFrom(input, _repeated_itemsMissingInCatalog_codec);
break;
}
case 32: {
DryRun = input.ReadBool();
break;
}
case 42: {
metadata_.AddEntriesFrom(input, _map_metadata_codec);
break;
}
case 50: {
NextPageToken = input.ReadString();
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
results_.AddEntriesFrom(ref input, _repeated_results_codec);
break;
}
case 18: {
RecommendationToken = input.ReadString();
break;
}
case 26: {
itemsMissingInCatalog_.AddEntriesFrom(ref input, _repeated_itemsMissingInCatalog_codec);
break;
}
case 32: {
DryRun = input.ReadBool();
break;
}
case 42: {
metadata_.AddEntriesFrom(ref input, _map_metadata_codec);
break;
}
case 50: {
NextPageToken = input.ReadString();
break;
}
}
}
}
#endif
#region Nested types
/// <summary>Container for nested types declared in the PredictResponse message type.</summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static partial class Types {
/// <summary>
/// PredictionResult represents the recommendation prediction results.
/// </summary>
public sealed partial class PredictionResult : pb::IMessage<PredictionResult>
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
, pb::IBufferMessage
#endif
{
private static readonly pb::MessageParser<PredictionResult> _parser = new pb::MessageParser<PredictionResult>(() => new PredictionResult());
private pb::UnknownFieldSet _unknownFields;
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pb::MessageParser<PredictionResult> Parser { get { return _parser; } }
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public static pbr::MessageDescriptor Descriptor {
get { return global::Google.Cloud.RecommendationEngine.V1Beta1.PredictResponse.Descriptor.NestedTypes[0]; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
pbr::MessageDescriptor pb::IMessage.Descriptor {
get { return Descriptor; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictionResult() {
OnConstruction();
}
partial void OnConstruction();
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictionResult(PredictionResult other) : this() {
id_ = other.id_;
itemMetadata_ = other.itemMetadata_.Clone();
_unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public PredictionResult Clone() {
return new PredictionResult(this);
}
/// <summary>Field number for the "id" field.</summary>
public const int IdFieldNumber = 1;
private string id_ = "";
/// <summary>
/// ID of the recommended catalog item
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public string Id {
get { return id_; }
set {
id_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
}
}
/// <summary>Field number for the "item_metadata" field.</summary>
public const int ItemMetadataFieldNumber = 2;
private static readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec _map_itemMetadata_codec
= new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>.Codec(pb::FieldCodec.ForString(10, ""), pb::FieldCodec.ForMessage(18, global::Google.Protobuf.WellKnownTypes.Value.Parser), 18);
private readonly pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> itemMetadata_ = new pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value>();
/// <summary>
/// Additional item metadata / annotations.
///
/// Possible values:
///
/// * `catalogItem`: JSON representation of the catalogItem. Will be set if
/// `returnCatalogItem` is set to true in `PredictRequest.params`.
/// * `score`: Prediction score in double value. Will be set if
/// `returnItemScore` is set to true in `PredictRequest.params`.
/// </summary>
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public pbc::MapField<string, global::Google.Protobuf.WellKnownTypes.Value> ItemMetadata {
get { return itemMetadata_; }
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override bool Equals(object other) {
return Equals(other as PredictionResult);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public bool Equals(PredictionResult other) {
if (ReferenceEquals(other, null)) {
return false;
}
if (ReferenceEquals(other, this)) {
return true;
}
if (Id != other.Id) return false;
if (!ItemMetadata.Equals(other.ItemMetadata)) return false;
return Equals(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override int GetHashCode() {
int hash = 1;
if (Id.Length != 0) hash ^= Id.GetHashCode();
hash ^= ItemMetadata.GetHashCode();
if (_unknownFields != null) {
hash ^= _unknownFields.GetHashCode();
}
return hash;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public override string ToString() {
return pb::JsonFormatter.ToDiagnosticString(this);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void WriteTo(pb::CodedOutputStream output) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
output.WriteRawMessage(this);
#else
if (Id.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Id);
}
itemMetadata_.WriteTo(output, _map_itemMetadata_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(output);
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) {
if (Id.Length != 0) {
output.WriteRawTag(10);
output.WriteString(Id);
}
itemMetadata_.WriteTo(ref output, _map_itemMetadata_codec);
if (_unknownFields != null) {
_unknownFields.WriteTo(ref output);
}
}
#endif
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public int CalculateSize() {
int size = 0;
if (Id.Length != 0) {
size += 1 + pb::CodedOutputStream.ComputeStringSize(Id);
}
size += itemMetadata_.CalculateSize(_map_itemMetadata_codec);
if (_unknownFields != null) {
size += _unknownFields.CalculateSize();
}
return size;
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(PredictionResult other) {
if (other == null) {
return;
}
if (other.Id.Length != 0) {
Id = other.Id;
}
itemMetadata_.Add(other.itemMetadata_);
_unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
}
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
public void MergeFrom(pb::CodedInputStream input) {
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
input.ReadRawMessage(this);
#else
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
break;
case 10: {
Id = input.ReadString();
break;
}
case 18: {
itemMetadata_.AddEntriesFrom(input, _map_itemMetadata_codec);
break;
}
}
}
#endif
}
#if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE
[global::System.Diagnostics.DebuggerNonUserCodeAttribute]
[global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) {
uint tag;
while ((tag = input.ReadTag()) != 0) {
switch(tag) {
default:
_unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input);
break;
case 10: {
Id = input.ReadString();
break;
}
case 18: {
itemMetadata_.AddEntriesFrom(ref input, _map_itemMetadata_codec);
break;
}
}
}
}
#endif
}
}
#endregion
}
#endregion
}
#endregion Designer generated code
| 41.6875 | 667 | 0.662104 | [
"Apache-2.0"
] | AlexandrTrf/google-cloud-dotnet | apis/Google.Cloud.RecommendationEngine.V1Beta1/Google.Cloud.RecommendationEngine.V1Beta1/PredictionService.g.cs | 51,359 | C# |
using System;
using Xunit;
namespace ASLang.Executor.Tests
{
public class CodeExecutor
{
[Fact]
public void TestHelloWorldProgram()
{
//Given
//When
//new CodeExecutor().Execute("test");
//Then
Assert.True(true);
}
}
}
| 16.666667 | 49 | 0.457143 | [
"MIT"
] | reenanms/AlpesSuinosLang | ASLang.Executor.Tests/CodeExecutor.cs | 350 | C# |
using System;
using System.Threading;
using System.Threading.Tasks;
using Vit.Core.Util.ConfigurationManager;
using Vit.Extensions.Redis;
namespace Vit.Db.Redis.QpsTest
{
public class RedisQpsTest
{
long requestCount = 0;
public int threadCount = Vit.Core.Util.ConfigurationManager.ConfigurationManager.Instance.GetByPath<int>("threadCount");
public RedisQpsTest()
{
requestCount = 0;
}
class ModelA {
public string va;
}
string[] keyM = { "dbA", "model" };
public void Start()
{
#region (x.1) set value to redis
string connection = ConfigurationManager.Instance.GetStringByPath("ConnectionStrings.Redis");
using (var redis = StackExchange.Redis.ConnectionMultiplexer.Connect(connection))
{
var db = redis.GetDatabase(1);
var maA = new ModelA { va = "asddas" };
db.Set(maA, TimeSpan.FromSeconds(600),keyM);
}
#endregion
for (int t = 0; t < threadCount; t++) {
Task.Run((Action)ThreadReadRedis);
}
ThreadPrintQps();
//Task.Run((Action)ThreadPrintQps);
}
void ThreadReadRedis()
{
string connection = ConfigurationManager.Instance.GetStringByPath("ConnectionStrings.Redis");
using (var redis = StackExchange.Redis.ConnectionMultiplexer.Connect(connection))
{
var db = redis.GetDatabase(1);
ModelA obj;
while (true) {
obj=db.Get<ModelA>(keyM);
Interlocked.Increment(ref requestCount);
}
}
}
void ThreadPrintQps()
{
DateTime dtLast = DateTime.Now;
long lastRequest = requestCount;
DateTime dtNow;
long curRequest;
while (true)
{
Thread.Sleep(1000);
dtNow = DateTime.Now;
curRequest = requestCount;
int qps =(int)( (curRequest - lastRequest) / (dtNow - dtLast).TotalSeconds);
Console.WriteLine("qps:" + qps);
dtLast = dtNow;
lastRequest = curRequest;
}
}
}
}
| 27.483516 | 129 | 0.5002 | [
"Apache-2.0"
] | serset/Vit.Library | Vit.Db/Test/Vit.Db.Redis.QpsTest/RedisQpsTest.cs | 2,503 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
namespace ContainerReader
{
class Program
{
static void Main(string[] args)
{
if (args.Length != 1)
{
Console.WriteLine("ContainerReader\nA program that prints infomation about Windows Containers.index files, used to store metadata (such as the package family name, guid, and filename) about configuration/save game files for UWP apps and games.\nContainer \"filenames\" are actually directories, as they can have more than one file inside of them.\nUsage: ContainerReader containers.index\nNOTE: Doesn't, at the current time, handle all forms of containers.index. Will add support, but most are supported.");
return;
}
try
{
// Open a filestream with the user selected file
FileStream file = new FileStream(args[0], FileMode.Open);
// Create a binary reader that will be used to read the file
BinaryReader reader = new BinaryReader(file);
// Grab the type, currently the only supported type is 0xD
int type = reader.ReadInt32();
// Throw generic exception
if (type != 0xd && type != 0xe)
{
throw new Exception();
}
// Could be something other than int32, but very unlikely
int numFiles = reader.ReadInt32();
Console.WriteLine("Friendly Name: " + BinaryReaderHelper.ReadUnicodeString(reader, reader.ReadInt32()));
string[] name = BinaryReaderHelper.ReadUnicodeString(reader, reader.ReadInt32()).Split('!');
Console.WriteLine("Package Full Name: " + name[0]);
Console.WriteLine("Id: " + name[1]);
// Not awfully sure what this is, so I'll just skip past it until I can figure out what it is. Possibly title ID or other internal data
reader.ReadBytes(0xc);
// Not sure what this is either, but I'll print it
Console.WriteLine("Unknown GUID: " + BinaryReaderHelper.ReadUnicodeString(reader, reader.ReadInt32()));
if (type == 0xe)
{
// 8 padding bytes
reader.ReadBytes(8);
}
// Loop through every file in the index, and print info about it
for (int i = 0; i < numFiles; i++)
{
string fileName = BinaryReaderHelper.ReadUnicodeString(reader, reader.ReadInt32());
string secondName = BinaryReaderHelper.ReadUnicodeString(reader, reader.ReadInt32());
// Unknown value, surrounded by quotes for some reason
string UnknownValue = BinaryReaderHelper.ReadUnicodeString(reader, reader.ReadInt32());
byte containerNum = reader.ReadByte();
// Unknown, will add later if it is important
reader.ReadBytes(4);
// The guid folder that the files reside in
byte[] guid1 = reader.ReadBytes(4);
Array.Reverse(guid1);
byte[] guid2 = reader.ReadBytes(2);
Array.Reverse(guid2);
byte[] guid3 = reader.ReadBytes(2);
Array.Reverse(guid3);
byte[] guid4 = reader.ReadBytes(2);
byte[] guid5 = reader.ReadBytes(6);
// More unknown data... really gotta try to figure this out
reader.ReadBytes(0x18);
// holy unwieldy code batman...gotta condense this sometime
// TODO: condense this
string guid = BitConverter.ToString(guid1).Replace("-", string.Empty) + "-" + BitConverter.ToString(guid2).Replace("-", string.Empty) + "-" + BitConverter.ToString(guid3).Replace("-", string.Empty) + "-" + BitConverter.ToString(guid4).Replace("-", string.Empty) + "-" + BitConverter.ToString(guid5).Replace("-", string.Empty);
Console.WriteLine(fileName + " | " + UnknownValue + " | " + containerNum + " | " + guid);
// Go through every sub files
try
{
if (type == 0xe) // (1 file = a block lenght 160)
{
string subContainerName = Path.Combine(guid.Replace("-", string.Empty).ToUpper(), "container." + containerNum);
// Open a filestream with the user selected file
FileStream subFile = new FileStream(Path.Combine(Path.GetDirectoryName(args[0]), subContainerName), FileMode.Open);
// Create a binary reader that will be used to read the file
BinaryReader subReader = new BinaryReader(subFile);
// Grab the type, currently the only supported type is 0xD
int subType = subReader.ReadInt32();
// Throw generic exception
if (subType != 0x04)
{
throw new Exception();
}
int subNumFiles = subReader.ReadInt32();
for (int y = 0; y < subNumFiles; y++)
{
// subFileName has a fixed length
string subfileName = BinaryReaderHelper.ReadUnicodeString(subReader, 0x40);
// The sub guid folder that the files reside in
byte[] subGuid1 = subReader.ReadBytes(4);
Array.Reverse(subGuid1);
byte[] subGuid2 = subReader.ReadBytes(2);
Array.Reverse(subGuid2);
byte[] subGuid3 = subReader.ReadBytes(2);
Array.Reverse(subGuid3);
byte[] subGuid4 = subReader.ReadBytes(2);
byte[] subGuid5 = subReader.ReadBytes(6);
// The second sub guid folder that the files reside in
byte[] subGuid6 = subReader.ReadBytes(4);
Array.Reverse(subGuid6);
byte[] subGuid7 = subReader.ReadBytes(2);
Array.Reverse(subGuid7);
byte[] subGuid8 = subReader.ReadBytes(2);
Array.Reverse(subGuid8);
byte[] subGuid9 = subReader.ReadBytes(2);
byte[] subGuid10 = subReader.ReadBytes(6);
string subGuid = BitConverter.ToString(subGuid1).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid2).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid3).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid4).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid5).Replace("-", string.Empty);
// The second guid is the same
string subSecondGuid = BitConverter.ToString(subGuid6).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid7).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid8).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid9).Replace("-", string.Empty) + "-" + BitConverter.ToString(subGuid10).Replace("-", string.Empty);
Console.WriteLine("\t" + subfileName + " | " + subGuid);
}
subReader.Dispose();
subFile.Dispose();
}
}
catch
{
Console.WriteLine("This sub type is not supported yet.");
}
}
}
catch (FileNotFoundException)
{
Console.WriteLine("File not found!");
}
catch (UnauthorizedAccessException)
{
Console.WriteLine("File could not be accessed!");
}
catch (Exception)
{
Console.WriteLine("This type is not supported yet.");
}
}
}
} | 50.473988 | 523 | 0.504924 | [
"MIT"
] | Tom60chat/ContainerReader | ContainerReader/Program.cs | 8,732 | C# |
using System;
using ContextNLog = NLog.NestedDiagnosticsContext;
using Common.Logging;
namespace HostBox.Logging
{
public class NLogNestedThreadVariablesContext : INestedVariablesContext
{
/// <inheritdoc />
public IDisposable Push(string text)
{
return ContextNLog.Push(text);
}
/// <inheritdoc />
public string Pop()
{
return ContextNLog.Pop();
}
/// <inheritdoc />
public void Clear()
{
ContextNLog.Clear();
}
/// <inheritdoc />
public bool HasItems => ContextNLog.GetAllMessages().Length > 0;
}
} | 21.483871 | 75 | 0.561562 | [
"MIT"
] | DenisKrasakovSDV/HostBox | Sources/HostBox/Logging/NLogNestedThreadVariablesContext.cs | 668 | C# |
using System;
using System.Linq;
namespace AGXUnity
{
/// <summary>
/// AGX Dynamics version and license information.
/// </summary>
public struct LicenseInfo
{
/// <summary>
/// AGX Dynamics modules.
/// </summary>
[Flags]
public enum Module
{
None = 0,
AGX = 1 << 0,
AGXParticles = 1 << 1,
AGXCable = 1 << 2,
AGXCableDamage = 1 << 3,
AGXDriveTrain = 1 << 4,
AGXGranular = 1 << 5,
AGXHydraulics = 1 << 6,
AGXHydrodynamics = 1 << 7,
AGXSimulink = 1 << 8,
AGXTerrain = 1 << 9,
AGXTires = 1 << 10,
AGXTracks = 1 << 11,
AGXWireLink = 1 << 12,
AGXWires = 1 << 13,
All = ~0
}
/// <summary>
/// License types that AGX Dynamics supports.
/// </summary>
public enum LicenseType
{
/// <summary>
/// Unidentified license type.
/// </summary>
Unknown,
/// <summary>
/// An agx.lfx file or encrypted string.
/// </summary>
Service,
/// <summary>
/// An agx.lic file or obfuscated string.
/// </summary>
Legacy
}
/// <summary>
/// Create and parse native license info.
/// </summary>
/// <returns>Native license info.</returns>
public static LicenseInfo Create()
{
var info = new LicenseInfo();
try {
info.Version = agx.agxSWIG.agxGetVersion( false );
if ( info.Version.ToLower().StartsWith( "agx-" ) )
info.Version = info.Version.Remove( 0, 4 );
var endDateString = agx.Runtime.instance().readValue( "EndDate" );
try {
info.EndDate = DateTime.Parse( endDateString );
}
catch ( FormatException ) {
if ( endDateString.ToLower() == "none" )
info.EndDate = DateTime.MaxValue;
else
info.EndDate = DateTime.MinValue;
}
info.IsValid = agx.Runtime.instance().isValid();
info.Status = agx.Runtime.instance().getStatus();
info.User = agx.Runtime.instance().readValue( "User" );
info.Contact = agx.Runtime.instance().readValue( "Contact" );
var subscriptionType = agx.Runtime.instance().readValue( "Product" ).Split( '-' );
if ( subscriptionType.Length == 2 )
info.TypeDescription = subscriptionType[ 1 ].Trim();
if ( string.IsNullOrEmpty( info.TypeDescription ) )
info.TypeDescription = "Unknown";
if ( agx.Runtime.instance().hasKey( "InstallationID" ) ) {
info.Type = LicenseType.Service;
info.UniqueId = agx.Runtime.instance().readValue( "InstallationID" );
}
else {
info.Type = LicenseType.Legacy;
info.UniqueId = agx.Runtime.instance().readValue( "License" );
}
var enabledModules = agx.Runtime.instance().getEnabledModules().ToArray();
info.EnabledModules = Module.None;
foreach ( var module in enabledModules ) {
if ( module == "AgX" ) {
info.EnabledModules |= Module.AGX;
continue;
}
else if ( !module.StartsWith( "AgX-" ) )
continue;
var enabledModule = module.Replace( "AgX-", "AGX" );
if ( Enum.TryParse<Module>( enabledModule, out var enumModule ) )
info.EnabledModules |= enumModule;
}
}
catch ( System.Exception ) {
info = new LicenseInfo();
}
return info;
}
/// <summary>
/// AGX Dynamics version.
/// </summary>
public string Version;
/// <summary>
/// License end data.
/// </summary>
public DateTime EndDate;
/// <summary>
/// User name of the license.
/// </summary>
public string User;
/// <summary>
/// Contact information.
/// </summary>
public string Contact;
/// <summary>
/// Activated AGX Dynamics modules.
/// </summary>
public Module EnabledModules;
/// <summary>
/// True if all available modules are enabled.
/// </summary>
public bool AllModulesEnabled
{
get
{
var allSet = true;
foreach ( Module eVal in Enum.GetValues( typeof( Module ) ) ) {
if ( eVal == Module.None || eVal == Module.All )
continue;
allSet = allSet && ( (long)eVal & (long)EnabledModules ) != 0;
}
return allSet;
}
}
/// <summary>
/// True if the license is valid - otherwise false.
/// </summary>
public bool IsValid;
/// <summary>
/// License status if something is wrong - otherwise an empty string.
/// </summary>
public string Status;
/// <summary>
/// AGX Dynamics license type.
/// </summary>
public LicenseType Type;
/// <summary>
/// License type - "Unknown" if not successfully parsed.
/// </summary>
public string TypeDescription;
/// <summary>
/// Unique license identifier.
/// </summary>
public string UniqueId;
/// <summary>
/// True if there's a parsed, valid end date - otherwise false.
/// </summary>
public bool ValidEndDate { get { return !DateTime.Equals( EndDate, DateTime.MinValue ); } }
/// <summary>
/// True if the license has expired.
/// </summary>
public bool IsExpired { get { return !ValidEndDate || EndDate < DateTime.Now; } }
/// <summary>
/// Info string regarding how long it is until the license expires or
/// the time since the license expired.
/// </summary>
public string DiffString
{
get
{
var diff = EndDate - DateTime.Now;
var str = diff.Days != 0 ?
$"{Math.Abs( diff.Days )} day" + ( System.Math.Abs( diff.Days ) != 1 ? "s" : string.Empty ) :
string.Empty;
str += diff.Days == 0 && diff.Hours != 0 ?
$"{Math.Abs( diff.Hours )} hour" + ( System.Math.Abs( diff.Hours ) != 1 ? "s" : string.Empty ) :
string.Empty;
str += string.IsNullOrEmpty( str ) ?
$"{Math.Abs( diff.Minutes )} minute" + ( System.Math.Abs( diff.Minutes ) != 1 ? "s" : string.Empty ) :
string.Empty;
return str;
}
}
/// <summary>
/// True when the license information has been parsed from AGX Dynamics.
/// </summary>
public bool IsParsed { get { return Type != LicenseType.Unknown; } }
/// <summary>
/// True if the license expires within given <paramref name="days"/>.
/// </summary>
/// <param name="days">Number of days.</param>
/// <returns>True if the license expires within given <paramref name="days"/> - otherwise false.</returns>
public bool IsAboutToBeExpired( int days )
{
var diff = EndDate - DateTime.Now;
return Convert.ToInt32( diff.TotalDays + 0.5 ) < days;
}
public override string ToString()
{
return $"Valid: {IsValid}, Valid End Date: {ValidEndDate}, End Date: {EndDate}, " +
$"Modules: [{string.Join( ",", EnabledModules )}], User: {User}, Contact: {Contact}, " +
$"Status: {Status}";
}
}
}
| 29.680328 | 122 | 0.541563 | [
"Apache-2.0"
] | Algoryx/AGXUnity | AGXUnity/LicenseInfo.cs | 7,244 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using System;
using Android.App;
using Android.Content;
using Android.OS;
using Microsoft.Identity.Client.Platforms.Android.SystemWebview;
namespace Microsoft.Identity.Client
{
/// <summary>
/// BrowserTabActivity to get the redirect with code from authorize endpoint. Intent filter has to be declared in the
/// android manifest for this activity. When chrome custom tab is launched, and we're redirected back with the redirect
/// uri (redirect_uri has to be unique across apps), the os will fire an intent with the redirect,
/// and the BrowserTabActivity will be launched.
/// </summary>
//[Activity(Name = "microsoft.identity.client.BrowserTabActivity")]
[CLSCompliant(false)]
public class BrowserTabActivity : Activity
{
/// <summary>
///
/// </summary>
/// <param name="savedInstanceState"></param>
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Intent intent = new Intent(this, typeof (AuthenticationActivity));
intent.PutExtra(AndroidConstants.CustomTabRedirect, Intent.DataString);
intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.SingleTop);
StartActivity(intent);
}
}
}
| 37.756757 | 123 | 0.690766 | [
"MIT"
] | SpillChek2/microsoft-authentication-library-for-dotnet | src/Microsoft.Identity.Client/Platforms/Android/BrowserTabActivity.cs | 1,397 | C# |
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("Client")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Client")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
[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("abf3f8dc-3813-4dc2-807e-e1b1053d5651")]
// 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")]
| 37.783784 | 84 | 0.748927 | [
"MIT"
] | Team-on/works | 0_homeworks/C#/9 wcf/1/DiskServise/Client/Properties/AssemblyInfo.cs | 1,401 | C# |
namespace DSAnimStudio.TaeEditor
{
partial class TaeComboMenu
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buttonPlayCombo = new System.Windows.Forms.Button();
this.buttonCancelCombo = new System.Windows.Forms.Button();
this.checkBoxLoop = new System.Windows.Forms.CheckBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.textBoxComboSeq = new System.Windows.Forms.TextBox();
this.checkBoxRecord = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// buttonPlayCombo
//
this.buttonPlayCombo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonPlayCombo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonPlayCombo.ForeColor = System.Drawing.Color.White;
this.buttonPlayCombo.Location = new System.Drawing.Point(349, 326);
this.buttonPlayCombo.Name = "buttonPlayCombo";
this.buttonPlayCombo.Size = new System.Drawing.Size(88, 23);
this.buttonPlayCombo.TabIndex = 1;
this.buttonPlayCombo.Text = "Play Combo";
this.buttonPlayCombo.UseVisualStyleBackColor = true;
this.buttonPlayCombo.Click += new System.EventHandler(this.buttonPlayCombo_Click);
//
// buttonCancelCombo
//
this.buttonCancelCombo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonCancelCombo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.buttonCancelCombo.ForeColor = System.Drawing.Color.White;
this.buttonCancelCombo.Location = new System.Drawing.Point(252, 326);
this.buttonCancelCombo.Name = "buttonCancelCombo";
this.buttonCancelCombo.Size = new System.Drawing.Size(91, 23);
this.buttonCancelCombo.TabIndex = 2;
this.buttonCancelCombo.Text = "Stop Combo";
this.buttonCancelCombo.UseVisualStyleBackColor = true;
this.buttonCancelCombo.Click += new System.EventHandler(this.buttonCancelCombo_Click);
//
// checkBoxLoop
//
this.checkBoxLoop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxLoop.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkBoxLoop.ForeColor = System.Drawing.Color.White;
this.checkBoxLoop.Location = new System.Drawing.Point(16, 331);
this.checkBoxLoop.Name = "checkBoxLoop";
this.checkBoxLoop.Size = new System.Drawing.Size(97, 17);
this.checkBoxLoop.TabIndex = 5;
this.checkBoxLoop.Text = "Loop";
this.checkBoxLoop.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(452, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(120, 190);
this.label1.TabIndex = 7;
this.label1.Text = "NoCancel\r\nEnemyAtk\r\nEnemyComboAtk\r\nEnemyMove\r\nEnemyDodge\r\nPlayerRH\r\nPlayerMove\r\nP" +
"layerLH\r\nPlayerGuard\r\nPlayerDodge\r\nPlayerEstus\r\nPlayerItem\r\nPlayerWeaponSwitch\r\n" +
"ThrowEscape";
//
// label2
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.White;
this.label2.Location = new System.Drawing.Point(443, 12);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(127, 13);
this.label2.TabIndex = 8;
this.label2.Text = "Available Commands:";
//
// textBoxComboSeq
//
this.textBoxComboSeq.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBoxComboSeq.AutoCompleteCustomSource.AddRange(new string[] {
"EnemyAtk",
"EnemyComboAtk",
"EnemyMove",
"EnemyDodge",
"PlayerRH",
"PlayerMove",
"PlayerLH",
"PlayerGuard",
"PlayerDodge",
"PlayerEstus",
"PlayerItem",
"PlayerWeaponSwitch",
"ThrowEscape"});
this.textBoxComboSeq.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
this.textBoxComboSeq.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxComboSeq.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.textBoxComboSeq.ForeColor = System.Drawing.Color.White;
this.textBoxComboSeq.Location = new System.Drawing.Point(12, 12);
this.textBoxComboSeq.Multiline = true;
this.textBoxComboSeq.Name = "textBoxComboSeq";
this.textBoxComboSeq.Size = new System.Drawing.Size(425, 304);
this.textBoxComboSeq.TabIndex = 9;
this.textBoxComboSeq.Text = "EnemyComboAtk 3000\r\nEnemyComboAtk 3001\r\nEnemyComboAtk 3002\r\n";
//
// checkBoxRecord
//
this.checkBoxRecord.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.checkBoxRecord.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.checkBoxRecord.ForeColor = System.Drawing.Color.White;
this.checkBoxRecord.Location = new System.Drawing.Point(119, 331);
this.checkBoxRecord.Name = "checkBoxRecord";
this.checkBoxRecord.Size = new System.Drawing.Size(127, 17);
this.checkBoxRecord.TabIndex = 10;
this.checkBoxRecord.Text = "Record (Experimental)";
this.checkBoxRecord.UseVisualStyleBackColor = true;
this.checkBoxRecord.Visible = false;
//
// TaeComboMenu
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoValidate = System.Windows.Forms.AutoValidate.EnablePreventFocusChange;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ClientSize = new System.Drawing.Size(584, 361);
this.Controls.Add(this.checkBoxRecord);
this.Controls.Add(this.textBoxComboSeq);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.checkBoxLoop);
this.Controls.Add(this.buttonCancelCombo);
this.Controls.Add(this.buttonPlayCombo);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(600, 200);
this.Name = "TaeComboMenu";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Combo Viewer";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.TaeComboMenu_FormClosing);
this.Load += new System.EventHandler(this.TaeComboMenu_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonPlayCombo;
private System.Windows.Forms.Button buttonCancelCombo;
private System.Windows.Forms.CheckBox checkBoxLoop;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBoxComboSeq;
private System.Windows.Forms.CheckBox checkBoxRecord;
}
} | 53.847826 | 168 | 0.626867 | [
"MIT"
] | Meowmaritus/DSAnimStudio | DSAnimStudio/TaeEditor/TaeComboMenu.Designer.cs | 9,910 | C# |
using AutoFixture.NUnit3;
using FluentAssertions;
using NUnit.Framework;
using SFA.DAS.Location.Domain.Models;
namespace SFA.DAS.Location.Domain.UnitTests.Models
{
public class WhenMappingLocationToSuggestedLocationModel
{
[Test, AutoData]
public void Then_The_Fields_Are_Correctly_Mapped(Domain.Entities.Location source)
{
//Arrange & Act
var actual = (SuggestedLocation)source;
//Assert
actual.Should().BeEquivalentTo(source, options => options.ExcludingMissingMembers());
}
}
}
| 27.428571 | 97 | 0.684028 | [
"MIT"
] | SkillsFundingAgency/das-location-api | src/SFA.DAS.Location.Domain.UnitTests/Models/WhenMappingLocationToSuggestedLocationModel.cs | 578 | C# |
using FoxTool.Fox.Types.Structs;
using FoxTool.Fox.Types.Values;
namespace FoxTool.Tpp.Classes
{
public class TppGlobalVolumetricFogParam
{
// Static properties
public FoxEntityHandle Owner { get; set; }
public FoxBool Enable { get; set; }
public FoxColor Color { get; set; }
public FoxFloat Luminance { get; set; }
public FoxColor Albedo { get; set; }
public FoxFloat Density { get; set; }
public FoxFloat NearDistance { get; set; }
public FoxFloat Far { get; set; }
public FoxFloat Height { get; set; }
public FoxFloat Bottom { get; set; }
public FoxFloat Falloff { get; set; }
public FoxFloat InfluenceOfAtmosphere { get; set; }
public FoxFloat InfluenceOfLightning { get; set; }
public FoxFloat PseudoAbsorption { get; set; }
public FoxFloat PseudoDiffusion { get; set; }
public FoxFloat Turbidity { get; set; }
public FoxFloat AerialPerspective { get; set; }
public FoxColor AerialPersColor { get; set; }
}
}
| 38.172414 | 60 | 0.617886 | [
"MIT"
] | Atvaark/FoxTool | FoxTool/Tpp/Classes/TppGlobalVolumetricFogParam.cs | 1,107 | C# |
#if false
// The following may not work when accessed using interfaces, because the ArrayList is cloned / boxed then
using System.Collections.Generic;
using System;
namespace Toolbox
{
public struct ArrayList<TypeT> : IList<TypeT>
{
TypeT[] _data;
int _count;
uint _version;
const int InitialCapacity = 4;
public ArrayList(uint capacity)
{
_data = new TypeT[capacity];
_count = 0;
_version = 0;
}
#region IList<TypeT> Members
public int IndexOf(TypeT item)
{
if (_data == null)
return -1;
return Array.IndexOf(_data, item, 0, _count);
}
public void Insert(int index, TypeT item)
{
ensureCapacity(_count + 1);
Array.Copy(_data, index, _data, index + 1, _count - index - 1);
_data[index] = item;
++_count;
++_version;
}
public void RemoveAt(int index)
{
testIndex(index);
Array.Copy(_data, index + 1, _data, index, _count - index - 1);
_data[_count - 1] = default(TypeT);
--_count;
++_version;
}
public TypeT this[int index]
{
get
{
testIndex(index);
return _data[index];
}
set
{
testIndex(index);
_data[index] = value;
++_version;
}
}
#endregion
#region ICollection<TypeT> Members
public void Add(TypeT item)
{
ensureCapacity(_count + 1);
_data[_count++] = item;
++_version;
}
public void Clear()
{
if (_data != null)
{
Array.Clear(_data, 0, _count);
_count = 0;
++_version;
}
}
public bool Contains(TypeT item)
{
return IndexOf(item) != -1;
}
public void CopyTo(TypeT[] array, int arrayIndex)
{
if (_data == null)
return;
Array.Copy(_data, 0, array, arrayIndex, _count);
}
int ICollection<TypeT>.Count
{
get { return _count; }
}
public bool IsReadOnly
{
get { return false; }
}
public bool Remove(TypeT item)
{
int i = IndexOf(item);
if (i == -1)
return false;
RemoveAt(i);
return true;
}
#endregion
#region IEnumerable<TypeT> Members
public IEnumerator<TypeT> GetEnumerator()
{
var version = _version;
for (int i = 0; i != _count; ++i)
{
if (version != _version)
throw new Exception("Array was changed while in enumeration");
yield return _data[i];
}
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
#region Helpers
void testIndex(int index)
{
if (index < 0 || index >= _count)
throw new ArgumentOutOfRangeException("index");
}
void ensureCapacity(int capacity)
{
if (_data == null)
_data = new TypeT[Math.Max(InitialCapacity, capacity)];
int newCapacity = _data.Length;
while (_data.Length < capacity)
{
newCapacity *= 2;
}
if (newCapacity != _data.Length)
{
var newData = new TypeT[newCapacity];
Array.Copy(_data, newData, _count);
_data = newData;
}
}
#endregion
}
}
#endif
| 17.395604 | 107 | 0.58686 | [
"MIT",
"Unlicense"
] | sharedsafe/SharedSafe.Toolbox | ArrayList.cs | 3,168 | C# |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
using System;
using System.Collections.Generic;
using UnityEngine;
namespace Microsoft.MixedReality.Toolkit
{
/// <summary>
/// Static class that represents the Mixed Reality Toolkit service registry.
/// </summary>
/// <remarks>
/// The service registry is used to enable discovery of and access to active Mixed Reality Toolkit services at
/// runtime without requiring direct code reference to a singleton style component.
/// </remarks>
public static class MixedRealityServiceRegistry
{
/// <summary>
/// The service registry store where the key is the Type of the service interface and the value is
/// a pair in which they key is the service instance and the value is the registrar instance.
/// </summary>
private static Dictionary<Type, List<KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>>> registry =
new Dictionary<Type, List<KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>>>();
/// <summary>
/// A cache used to power <seealso cref="GetAllServices(IMixedRealityServiceRegistrar)"/>
/// </summary>
/// <remarks>
/// Lists are sorted in ascending priority order (i.e. services with a smaller priority
/// value are first in the list).
/// </remarks>
private static Dictionary<IMixedRealityServiceRegistrar, List<IMixedRealityService>> allServicesByRegistrar =
new Dictionary<IMixedRealityServiceRegistrar, List<IMixedRealityService>>();
/// <summary>
/// A cache used to power <seealso cref="GetAllServices"/>
/// </summary>
/// <remarks>
/// The list is sorted in ascending priority order (i.e. services with a smaller priority
/// value are first in the list).
/// </remarks>
private static List<IMixedRealityService> allServices = new List<IMixedRealityService>();
/// <summary>
/// A comparer used to sort the allServices and allServiceByRegistrar lists in-place.
/// </summary>
private static readonly Comparer<IMixedRealityService> ascendingOrderComparer =
Comparer<IMixedRealityService>.Create((i1, i2) => i1.Priority.CompareTo(i2.Priority));
/// <summary>
/// Static constructor.
/// </summary>
static MixedRealityServiceRegistry()
{ }
/// <summary>
/// Adds an <see cref="IMixedRealityService"/> instance to the registry.
/// </summary>
/// <typeparam name="T">The interface type of the service being added.</typeparam>
/// <param name="serviceInstance">Instance of the service to add.</param>
/// <param name="registrar">Instance of the registrar manages the service.</param>
/// <returns>
/// True if the service was successfully added, false otherwise.
/// </returns>
public static bool AddService<T>(T serviceInstance, IMixedRealityServiceRegistrar registrar) where T : IMixedRealityService
{
if (serviceInstance == null)
{
// Adding a null service instance is not supported.
return false;
}
if (serviceInstance is IMixedRealityDataProvider)
{
// Data providers are generally not used by application code. Services that intend for clients to
// directly communicate with their data providers will expose a GetDataProvider or similarly named
// method.
return false;
}
Type interfaceType = typeof(T);
T existingService;
if (TryGetService<T>(out existingService, serviceInstance.Name))
{
return false;
}
// Ensure we have a place to put our newly registered service.
if (!registry.ContainsKey(interfaceType))
{
registry.Add(interfaceType, new List<KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>>());
}
List<KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>> services = registry[interfaceType];
services.Add(new KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>(serviceInstance, registrar));
AddServiceToCache(serviceInstance, registrar);
return true;
}
/// <summary>
/// Removes an <see cref="IMixedRealityService"/> instance from the registry.
/// </summary>
/// <typeparam name="T">The interface type of the service being removed.</typeparam>
/// <param name="serviceInstance">Instance of the service to remove.</param>
/// <param name="registrar">Instance of the registrar manages the service.</param>
/// <returns>
/// True if the service was successfully removed, false otherwise.
/// </returns>
public static bool RemoveService<T>(T serviceInstance, IMixedRealityServiceRegistrar registrar) where T : IMixedRealityService
{
return RemoveServiceInternal(typeof(T), serviceInstance, registrar);
}
/// <summary>
/// Removes an <see cref="IMixedRealityService"/> instance from the registry.
/// </summary>
/// <typeparam name="T">The interface type of the service being removed.</typeparam>
/// <param name="serviceInstance">Instance of the service to remove.</param>
/// <returns>
/// True if the service was successfully removed, false otherwise.
/// </returns>
public static bool RemoveService<T>(T serviceInstance) where T : IMixedRealityService
{
T tempService;
IMixedRealityServiceRegistrar registrar;
if (!TryGetService<T>(out tempService, out registrar))
{
return false;
}
if (!object.ReferenceEquals(serviceInstance, tempService))
{
return false;
}
return RemoveServiceInternal(typeof(T), serviceInstance, registrar);
}
/// <summary>
/// Removes an <see cref="IMixedRealityService"/> instance from the registry.
/// </summary>
/// <typeparam name="T">The interface type of the service being removed.</typeparam>
/// <param name="name">The friendly name of the service to remove.</param>
/// <returns>
/// True if the service was successfully removed, false otherwise.
/// </returns>
public static bool RemoveService<T>(string name) where T : IMixedRealityService
{
T tempService;
IMixedRealityServiceRegistrar registrar;
if (!TryGetService<T>(out tempService, out registrar, name))
{
return false;
}
return RemoveServiceInternal(typeof(T), tempService, registrar);
}
/// <summary>
/// Removes an <see cref="IMixedRealityService"/> instance from the registry.
/// </summary>
/// <param name="interfaceType">The interface type of the service being removed.</param>
/// <param name="serviceInstance">Instance of the service to remove.</param>
/// <param name="registrar">Instance of the registrar manages the service.</param>
/// <returns>
/// True if the service was successfully removed, false otherwise.
/// </returns>
private static bool RemoveServiceInternal(
Type interfaceType,
IMixedRealityService serviceInstance,
IMixedRealityServiceRegistrar registrar)
{
if (!registry.ContainsKey(interfaceType)) { return false; }
List<KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>> services = registry[interfaceType];
bool removed = services.Remove(new KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>(serviceInstance, registrar));
if (services.Count == 0)
{
// If the last service was removed, the key can be removed.
registry.Remove(interfaceType);
}
RemoveServiceFromCache(serviceInstance, registrar);
return removed;
}
/// <summary>
/// Adds the given service/registrar combination to the GetAllServices cache
/// </summary>
private static void AddServiceToCache(
IMixedRealityService service,
IMixedRealityServiceRegistrar registrar)
{
// Services are stored in ascending priority order - adding them to the
// list requires that we re-enforce that order. This must happen
// in both the allServices and allServicesByRegistrar data structures.
allServices.Add(service);
allServices.Sort(ascendingOrderComparer);
if (!allServicesByRegistrar.ContainsKey(registrar))
{
allServicesByRegistrar.Add(registrar, new List<IMixedRealityService>());
}
allServicesByRegistrar[registrar].Add(service);
allServicesByRegistrar[registrar].Sort(ascendingOrderComparer);
}
/// <summary>
/// Removes the given service/registrar combination from the GetAllServices cache
/// </summary>
private static void RemoveServiceFromCache(
IMixedRealityService service,
IMixedRealityServiceRegistrar registrar)
{
// Removing from the sorted list keeps sort order, so re-sorting isn't necessary
allServices.Remove(service);
if (allServicesByRegistrar.ContainsKey(registrar))
{
allServicesByRegistrar[registrar].Remove(service);
if (allServicesByRegistrar[registrar].Count == 0)
{
allServicesByRegistrar.Remove(registrar);
}
}
}
/// <summary>
/// Gets the first instance of the requested service from the registry that matches the given query.
/// </summary>
/// <typeparam name="T">The interface type of the service being requested.</typeparam>
/// <param name="serviceInstance">Output parameter to receive the requested service instance.</param>
/// <param name="name">Optional name of the service.</param>
/// <returns>
/// True if the requested service is being returned, false otherwise.
/// </returns>
public static bool TryGetService<T>(
out T serviceInstance,
string name = null) where T : IMixedRealityService
{
return TryGetService<T>(
out serviceInstance,
out _, // The registrar out param is not used, it can be discarded.
name);
}
/// <summary>
/// Gets the first instance of the requested service from the registry that matches the given query.
/// </summary>
/// <typeparam name="T">The interface type of the service being requested.</typeparam>
/// <param name="serviceInstance">Output parameter to receive the requested service instance.</param>
/// <param name="registrar">Output parameter to receive the registrar that loaded the service instance.</param>
/// <param name="name">Optional name of the service.</param>
/// <returns>
/// True if the requested service is being returned, false otherwise.
/// </returns>
public static bool TryGetService<T>(
out T serviceInstance,
out IMixedRealityServiceRegistrar registrar,
string name = null) where T : IMixedRealityService
{
Type interfaceType = typeof(T);
IMixedRealityService tempService;
if (TryGetServiceInternal(interfaceType, out tempService, out registrar, name))
{
Debug.Assert(tempService is T, "The service in the registry does not match the expected type.");
serviceInstance = (T)tempService;
return true;
}
serviceInstance = default(T);
registrar = null;
return false;
}
/// <summary>
/// Gets the first instance of the requested service from the registry that matches the given query.
/// </summary>
/// <param name="interfaceType">The interface type of the service being requested.</param>
/// <param name="serviceInstance">Output parameter to receive the requested service instance.</param>
/// <param name="registrar">Output parameter to receive the registrar that loaded the service instance.</param>
/// <param name="name">Optional name of the service.</param>
/// <returns>
/// True if the requested service is being returned, false otherwise.
/// </returns>
public static bool TryGetService(Type interfaceType,
out IMixedRealityService serviceInstance,
out IMixedRealityServiceRegistrar registrar,
string name = null)
{
if (!typeof(IMixedRealityService).IsAssignableFrom(interfaceType))
{
Debug.LogWarning($"Cannot find type {interfaceType.Name} since it does not extend IMixedRealityService");
serviceInstance = null;
registrar = null;
return false;
}
return TryGetServiceInternal(interfaceType, out serviceInstance, out registrar, name);
}
private static bool TryGetServiceInternal(Type interfaceType,
out IMixedRealityService serviceInstance,
out IMixedRealityServiceRegistrar registrar,
string name = null)
{
// Assume failed and return null unless proven otherwise
serviceInstance = null;
registrar = null;
// If there is an entry for the interface key provided, search that small list first
if (registry.ContainsKey(interfaceType))
{
if (FindEntry(registry[interfaceType], interfaceType, name, out serviceInstance, out registrar))
{
return true;
}
}
// Either there is no entry for the interface type, or it was not placed in that list.
// Services can have multiple supported interfaces thus they may match the requested query but be placed in a different registry bin
// Thus, search all bins until a match is found
foreach (var list in registry.Values)
{
if (FindEntry(list, interfaceType, name, out serviceInstance, out registrar))
{
return true;
}
}
return false;
}
/// <summary>
/// Helper method to search list of IMixedRealityService/IMixedRealityServiceRegistrar pairs to find first service that matches name and interface type query
/// </summary>
/// <param name="serviceList">list of IMixedRealityService/IMixedRealityServiceRegistrar pairs to search</param>
/// <param name="interfaceType">type of interface to check</param>
/// <param name="name">name of service to check. Wildcard if null or empty</param>
/// <param name="serviceInstance">reference to IMixedRealityService matching query, null otherwise</param>
/// <param name="registrar">reference to IMixedRealityServiceRegistrar matching query, null otherwise</param>
/// <returns>true if found first entry to match query, false otherwise</returns>
private static bool FindEntry(List<KeyValuePair<IMixedRealityService, IMixedRealityServiceRegistrar>> serviceList,
Type interfaceType,
string name,
out IMixedRealityService serviceInstance,
out IMixedRealityServiceRegistrar registrar)
{
serviceInstance = null;
registrar = null;
for (int i = 0; i < serviceList.Count; ++i)
{
var svc = serviceList[i].Key;
if ((string.IsNullOrEmpty(name) || svc.Name == name) && interfaceType.IsAssignableFrom(svc.GetType()))
{
serviceInstance = svc;
registrar = serviceList[i].Value;
return true;
}
}
return false;
}
/// <summary>
/// Clears the registry cache of all services
/// </summary>
public static void ClearAllServices()
{
if (registry != null)
{
registry.Clear();
allServices.Clear();
allServicesByRegistrar.Clear();
}
}
/// <summary>
/// Returns readonly list of all services registered
/// </summary>
/// <remarks>
/// The list is sorted in ascending priority order.
/// </remarks>
public static IReadOnlyList<IMixedRealityService> GetAllServices()
{
return allServices;
}
/// <summary>
/// Returns readonly list of all services registered for given registrar
/// </summary>
/// <param name="registrar">Registrar object to filter services by</param>
/// <remarks>
/// The list is sorted in ascending priority order.
/// </remarks>
/// <returns>Readonly list of all services registered for given registrar, all services if parameter null.
/// If given a registrar that the registry is not aware of, returns null.
/// </returns>
public static IReadOnlyCollection<IMixedRealityService> GetAllServices(IMixedRealityServiceRegistrar registrar)
{
if (registrar == null)
{
return GetAllServices();
}
if (allServicesByRegistrar.TryGetValue(registrar, out List<IMixedRealityService> services))
{
return services;
}
return null;
}
}
} | 43.805226 | 165 | 0.60937 | [
"MIT"
] | ABak9/AR-Sharing | Assets/MixedRealityToolkit/Utilities/MixedRealityServiceRegistry.cs | 18,444 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Mvc;
using Chinook.Application;
using Chinook.Data;
using EasyLOB.Library.Mvc;
using EasyLOB.Library.Resources;
/*
SELECT TOP 10 * FROM Invoice ORDER BY InvoiceId DESC
SELECT TOP 10 * FROM InvoiceLine ORDER BY InvoiceId DESC,InvoiceLineId DESC
--DELETE FROM InvoiceLine WHERE InvoiceId > 412
--DELETE FROM Invoice WHERE InvoiceId > 412
*/
namespace Chinook.Mvc
{
public partial class ChinookTasksController
{
// GET: Tasks/Sales
[HttpGet]
public ActionResult Sales()
{
if (!IsAuthorized("Sales", OperationResult))
{
return View("OperationResult", new OperationResultModel(OperationResult));
}
TaskSalesModel viewModel = new TaskSalesModel();
viewModel.OperationResult.StatusMessage = PresentationResources.Loading;
return View(viewModel);
}
// GET: Tasks/_Sales
[HttpGet]
public ActionResult _Sales()
{
try
{
if (IsAuthorized("Sales", OperationResult))
{
TaskSalesModel viewModel = new TaskSalesModel();
return PartialView("_Sales", viewModel);
}
}
catch (Exception exception)
{
OperationResult.ParseException(exception);
}
return JsonResultOperationResult(OperationResult);
}
// POST: Tasks/CreateInvoice
[HttpPost]
public ActionResult CreateInvoice(int customerId, DateTime invoiceDate)
{
try
{
if (IsAuthorized("Sales", OperationResult))
{
Invoice invoice = new Invoice(0,
customerId,
invoiceDate,
0);
IChinookGenericApplication<Invoice> invoiceApplication =
DependencyResolver.Current.GetService<IChinookGenericApplication<Invoice>>();
if (invoiceApplication.Create(OperationResult, invoice))
{
OperationResult.Data = new { InvoiceId = invoice.InvoiceId };
return JsonResultOperationResult(OperationResult);
}
}
}
catch (Exception exception)
{
OperationResult.ParseException(exception);
}
return JsonResultOperationResult(OperationResult);
}
// POST: Tasks/CreateInvoiceLine
[HttpPost]
public ActionResult CreateInvoiceLine(int invoiceId, int trackId, decimal unitPrice, int quantity)
{
try
{
if (IsAuthorized("Sales", OperationResult))
{
InvoiceLine invoiceLine = new InvoiceLine(0,
invoiceId,
trackId,
unitPrice,
quantity);
IChinookGenericApplication<InvoiceLine> invoiceLineApplication =
DependencyResolver.Current.GetService<IChinookGenericApplication<InvoiceLine>>();
if (invoiceLineApplication.Create(OperationResult, invoiceLine))
{
/*
IChinookGenericApplication<Invoice> invoiceApplication =
DependencyResolver.Current.GetService<IChinookGenericApplication<Invoice>>();
Invoice invoice = invoiceApplication.GetById(invoiceId);
OperationResult.Data = new { Total = invoice.Total }; // Invoice.Total is updated by DBMS Triggers
*/
Expression<Func<InvoiceLine, bool>> where = (x => x.InvoiceId == invoiceId);
IEnumerable<InvoiceLine> invoiceLines = invoiceLineApplication.Select(OperationResult, where);
decimal total = invoiceLines.Sum(x => Convert.ToDecimal(x.Quantity * x.UnitPrice));
OperationResult.Data = new { Total = total };
return JsonResultOperationResult(OperationResult);
}
}
}
catch (Exception exception)
{
OperationResult.ParseException(exception);
}
return JsonResultOperationResult(OperationResult);
}
}
} | 36.151515 | 123 | 0.529966 | [
"MIT"
] | EasyLOB/EasyLOB-Chinook-1 | Chinook.Mvc.AJAX/Controllers/Chinook/ChinookTasks/Sales.cs | 4,774 | C# |
//
// Copyright (c) Microsoft and contributors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.
using Microsoft.Azure.Commands.Compute.Automation.Models;
using Microsoft.Azure.Management.Compute;
using Microsoft.Azure.Management.Compute.Models;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Management.Automation;
namespace Microsoft.Azure.Commands.Compute.Automation
{
public partial class InvokeAzureComputeMethodCmdlet : ComputeAutomationBaseCmdlet
{
protected object CreateVirtualMachineScaleSetCreateOrUpdateDynamicParameters()
{
dynamicParameters = new RuntimeDefinedParameterDictionary();
var pResourceGroupName = new RuntimeDefinedParameter();
pResourceGroupName.Name = "ResourceGroupName";
pResourceGroupName.ParameterType = typeof(string);
pResourceGroupName.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 1,
Mandatory = true
});
pResourceGroupName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ResourceGroupName", pResourceGroupName);
var pVMScaleSetName = new RuntimeDefinedParameter();
pVMScaleSetName.Name = "VMScaleSetName";
pVMScaleSetName.ParameterType = typeof(string);
pVMScaleSetName.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 2,
Mandatory = true
});
pVMScaleSetName.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("VMScaleSetName", pVMScaleSetName);
var pParameters = new RuntimeDefinedParameter();
pParameters.Name = "VirtualMachineScaleSet";
pParameters.ParameterType = typeof(VirtualMachineScaleSet);
pParameters.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByDynamicParameters",
Position = 3,
Mandatory = true
});
pParameters.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("VirtualMachineScaleSet", pParameters);
var pArgumentList = new RuntimeDefinedParameter();
pArgumentList.Name = "ArgumentList";
pArgumentList.ParameterType = typeof(object[]);
pArgumentList.Attributes.Add(new ParameterAttribute
{
ParameterSetName = "InvokeByStaticParameters",
Position = 4,
Mandatory = true
});
pArgumentList.Attributes.Add(new AllowNullAttribute());
dynamicParameters.Add("ArgumentList", pArgumentList);
return dynamicParameters;
}
protected void ExecuteVirtualMachineScaleSetCreateOrUpdateMethod(object[] invokeMethodInputParameters)
{
string resourceGroupName = (string)ParseParameter(invokeMethodInputParameters[0]);
string vmScaleSetName = (string)ParseParameter(invokeMethodInputParameters[1]);
VirtualMachineScaleSet parameters = (VirtualMachineScaleSet)ParseParameter(invokeMethodInputParameters[2]);
var result = VirtualMachineScaleSetsClient.CreateOrUpdate(resourceGroupName, vmScaleSetName, parameters);
WriteObject(result);
}
}
public partial class NewAzureComputeArgumentListCmdlet : ComputeAutomationBaseCmdlet
{
protected PSArgument[] CreateVirtualMachineScaleSetCreateOrUpdateParameters()
{
string resourceGroupName = string.Empty;
string vmScaleSetName = string.Empty;
VirtualMachineScaleSet parameters = new VirtualMachineScaleSet();
return ConvertFromObjectsToArguments(
new string[] { "ResourceGroupName", "VMScaleSetName", "Parameters" },
new object[] { resourceGroupName, vmScaleSetName, parameters });
}
}
[Cmdlet(VerbsCommon.New, "AzureRmVmss", DefaultParameterSetName = "DefaultParameter", SupportsShouldProcess = true)]
[OutputType(typeof(PSVirtualMachineScaleSet))]
public partial class NewAzureRmVmss : ComputeAutomationBaseCmdlet
{
protected override void ProcessRecord()
{
ExecuteClientAction(() =>
{
if (ShouldProcess(this.VMScaleSetName, VerbsCommon.New))
{
string resourceGroupName = this.ResourceGroupName;
string vmScaleSetName = this.VMScaleSetName;
VirtualMachineScaleSet parameters = new VirtualMachineScaleSet();
ComputeAutomationAutoMapperProfile.Mapper.Map<PSVirtualMachineScaleSet, VirtualMachineScaleSet>(this.VirtualMachineScaleSet, parameters);
var result = VirtualMachineScaleSetsClient.CreateOrUpdate(resourceGroupName, vmScaleSetName, parameters);
var psObject = new PSVirtualMachineScaleSet();
ComputeAutomationAutoMapperProfile.Mapper.Map<VirtualMachineScaleSet, PSVirtualMachineScaleSet>(result, psObject);
WriteObject(psObject);
}
});
}
[Parameter(
ParameterSetName = "DefaultParameter",
Position = 1,
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = false)]
[AllowNull]
public string ResourceGroupName { get; set; }
[Parameter(
ParameterSetName = "DefaultParameter",
Position = 2,
Mandatory = true,
ValueFromPipelineByPropertyName = true,
ValueFromPipeline = false)]
[Alias("Name")]
[AllowNull]
public string VMScaleSetName { get; set; }
[Parameter(
ParameterSetName = "DefaultParameter",
Position = 3,
Mandatory = true,
ValueFromPipelineByPropertyName = false,
ValueFromPipeline = true)]
[AllowNull]
public PSVirtualMachineScaleSet VirtualMachineScaleSet { get; set; }
}
}
| 43.186747 | 158 | 0.639978 | [
"MIT"
] | Andrean/azure-powershell | src/StackAdmin/Compute/Commands.Compute/Generated/VirtualMachineScaleSet/VirtualMachineScaleSetCreateOrUpdateMethod.cs | 7,004 | C# |
// Copyright (c) .NET Foundation and Contributors (https://dotnetfoundation.org/ & https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Linq;
using Stride.Core.Annotations;
using Stride.Core.Mathematics;
using Stride.Assets.Presentation.ViewModel;
using Stride.UI;
using Stride.UI.Controls;
using Stride.UI.Panels;
namespace Stride.Assets.Presentation.AssetEditors.UIEditor.Game
{
/// <summary>
/// Helper class for updating the layout of a <see cref="UIElement"/>. Supports moving and resizing.
/// </summary>
internal static class UILayoutHelper
{
/// <summary>
/// Moves an element.
/// </summary>
/// <param name="element">The element to move.</param>
/// <param name="delta"></param>
/// <param name="magnetDistance">The maximum distance at which magnet will be applied</param>
/// <param name="resolution">The resolution of the UI.</param>
/// <returns><c>true</c> if the element has moved; otherwise, <c>false</c>.</returns>
public static bool Move([NotNull] UIElement element, ref Vector3 delta, float magnetDistance, ref Vector3 resolution)
{
if (element == null) throw new ArgumentNullException(nameof(element));
if (element.VisualParent is ContentControl)
return false;
// moving is almost equivalent to resizing in all direction
var parameters = new LayoutParameters
{
Left = true,
Right = true,
Top = true,
Bottom = true,
CanResize = false,
};
UpdateElementLayout(element, ref delta, magnetDistance, ref resolution, parameters);
return true;
}
/// <summary>
/// Resizes an element.
/// </summary>
/// <param name="element">The element to move.</param>
/// <param name="resizingDirection"></param>
/// <param name="delta"></param>
/// <param name="magnetDistance">The maximum distance at which magnet will be applied</param>
/// <param name="resolution">The resolution of the UI.</param>
/// <returns></returns>
public static bool Resize([NotNull] UIElement element, ResizingDirection resizingDirection, ref Vector3 delta, float magnetDistance, ref Vector3 resolution)
{
if (element == null) throw new ArgumentNullException(nameof(element));
var parameters = new LayoutParameters
{
Left = resizingDirection.HasFlag(ResizingDirection.Left),
Right = resizingDirection.HasFlag(ResizingDirection.Right),
Top = resizingDirection.HasFlag(ResizingDirection.Top),
Bottom = resizingDirection.HasFlag(ResizingDirection.Bottom),
CanResize = true,
};
UpdateElementLayout(element, ref delta, magnetDistance, ref resolution, parameters);
return true;
}
private class RectData
{
public RectangleF Container;
public RectangleF Element;
public RectangleF Parent;
public RectangleF[] Siblings;
}
private struct LayoutParameters
{
/// <summary>
/// <c>true</c> if layout should be updated on the left side; otherwise, <c>false</c>.
/// </summary>
public bool Left;
/// <summary>
/// <c>true</c> if layout should be updated on the right side; otherwise, <c>false</c>.
/// </summary>
public bool Right;
/// <summary>
/// <c>true</c> if layout should be updated on the top side; otherwise, <c>false</c>.
/// </summary>
public bool Top;
/// <summary>
/// <c>true</c> if layout should be updated on the right side; otherwise, <c>false</c>.
/// </summary>
public bool Bottom;
/// <summary>
/// <c>true</c> if the size of the element can be changed during the layout update; otherwise, <c>false</c>.
/// </summary>
public bool CanResize;
}
/// <summary>
/// Adapts the alignment relative to the position of the element in its container.
/// </summary>
/// <param name="elementRect"></param>
/// <param name="containerRect"></param>
/// <param name="horizontalAlignment"></param>
/// <param name="verticalAlignment"></param>
private static void AdjustAlignmentInContainer(ref RectangleF elementRect, ref RectangleF containerRect, out HorizontalAlignment horizontalAlignment, out VerticalAlignment verticalAlignment)
{
var containerCenter = containerRect.Center;
// adjust horizontal alignment
horizontalAlignment = HorizontalAlignment.Stretch;
if (elementRect.Width < 0.5f*containerRect.Width)
{
if (elementRect.Right < containerCenter.X)
horizontalAlignment = HorizontalAlignment.Left;
else if (elementRect.Left > containerCenter.X)
horizontalAlignment = HorizontalAlignment.Right;
}
// adjust vertical alignment
verticalAlignment = VerticalAlignment.Stretch;
if (elementRect.Height < 0.5f*containerRect.Height)
{
if (elementRect.Bottom < containerCenter.Y)
verticalAlignment = VerticalAlignment.Top;
else if (elementRect.Top > containerCenter.Y)
verticalAlignment = VerticalAlignment.Bottom;
}
}
/// <summary>
/// Calculates the rect of the element, its parent, its container (if different from the parent, e.g. in a grid) and its siblings elements.
/// </summary>
/// <param name="element">The element to calculate the rects from.</param>
/// <param name="resolution">The resolution of the UI.</param>
/// <returns></returns>
[NotNull]
private static RectData ExtractRects([NotNull] UIElement element, ref Vector3 resolution)
{
var rects = new RectData
{
// note: render offset is calculated relatively to the container (which can be the same as the parent)
Element = new RectangleF(element.RenderOffsets.X, element.RenderOffsets.Y, element.ActualWidth, element.ActualHeight)
};
var parent = element.VisualParent;
if (parent is GridBase)
{
var rowIndex = element.GetGridRow();
var rowSpan = element.GetGridRowSpan();
var colIndex = element.GetGridColumn();
var colSpan = element.GetGridColumnSpan();
var grid = parent as Grid;
if (grid != null)
{
var actualColumnDefinitions = grid.ActualColumnDefinitions;
var actualRowDefinitions = grid.ActualRowDefinitions;
var accWidth = 0.0f;
for (var i = 0; i < colIndex && i < actualColumnDefinitions.Count; i++)
{
var definition = actualColumnDefinitions[i];
accWidth += definition.ActualSize;
}
var accHeight = 0.0f;
for (var i = 0; i < rowIndex && i < actualRowDefinitions.Count; i++)
{
var definition = actualRowDefinitions[i];
accHeight += definition.ActualSize;
}
rects.Parent = new RectangleF
{
X = -accWidth, Y = -accHeight, Width = parent.ActualWidth, Height = parent.ActualHeight,
};
accWidth = 0.0f;
for (var i = colIndex; i < colIndex + colSpan && i < actualColumnDefinitions.Count; i++)
{
var definition = actualColumnDefinitions[i];
accWidth += definition.ActualSize;
}
accHeight = 0.0f;
for (var i = rowIndex; i < rowIndex + rowSpan && i < actualRowDefinitions.Count; i++)
{
var definition = actualRowDefinitions[i];
accHeight += definition.ActualSize;
}
rects.Container = new RectangleF
{
X = 0, Y = 0, Width = accWidth, Height = accHeight,
};
}
var uniformGrid = parent as UniformGrid;
if (uniformGrid != null)
{
var cellWidth = uniformGrid.ActualWidth/uniformGrid.Columns;
var cellHeight = uniformGrid.ActualHeight/uniformGrid.Rows;
rects.Parent = new RectangleF
{
X = -MathUtil.Clamp(colIndex, 0, uniformGrid.Columns - 1)*cellWidth, Y = -MathUtil.Clamp(rowIndex, 0, uniformGrid.Rows - 1)*cellHeight, Width = parent.ActualWidth, Height = parent.ActualHeight,
};
rects.Container = new RectangleF
{
X = 0, Y = 0, Width = MathUtil.Clamp(uniformGrid.Columns - colIndex, 1, colSpan)*cellWidth, Height = MathUtil.Clamp(uniformGrid.Rows - rowIndex, 1, rowSpan)*cellHeight,
};
}
rects.Siblings = (from c in parent.VisualChildren where c != element && c.GetGridRow() == rowIndex && c.GetGridColumn() == colIndex select new RectangleF(c.RenderOffsets.X, c.RenderOffsets.Y, c.ActualWidth, c.ActualHeight)).ToArray();
}
else if (parent != null)
{
rects.Parent = new RectangleF(0, 0, parent.ActualWidth, parent.ActualHeight);
rects.Container = rects.Parent;
rects.Siblings = (from c in parent.VisualChildren where c != element select new RectangleF(c.RenderOffsets.X, c.RenderOffsets.Y, c.ActualWidth, c.ActualHeight)).ToArray();
}
else
{
// no parent, take the whole UI resolution
rects.Parent = new RectangleF(0, 0, resolution.X, resolution.Y);
rects.Container = rects.Parent;
rects.Siblings = new RectangleF[0];
}
return rects;
}
/// <summary>
/// Snaps the bottom side of the element bounds to the magnet bounds.
/// </summary>
/// <param name="elementRect"></param>
/// <param name="magnetRect"></param>
/// <param name="verticallyMagnetized"></param>
/// <param name="magnetDistance"></param>
/// <param name="resize"></param>
private static void MagnetizeBottom(ref RectangleF elementRect, ref RectangleF magnetRect, ref bool verticallyMagnetized, float magnetDistance, bool resize)
{
if (verticallyMagnetized)
return;
// element's bottom/ magnet's top
var diffTop = elementRect.Bottom - magnetRect.Top;
if (Math.Abs(diffTop) < magnetDistance)
{
if (resize)
elementRect.Height -= diffTop;
else
elementRect.Top = magnetRect.Top - elementRect.Height;
verticallyMagnetized = true;
return;
}
// element's bottom/ magnet's bottom
var diffBottom = elementRect.Bottom - magnetRect.Bottom;
if (Math.Abs(diffBottom) < magnetDistance)
{
if (resize)
elementRect.Height -= diffBottom;
else
elementRect.Top = magnetRect.Bottom - elementRect.Height;
verticallyMagnetized = true;
}
}
/// <summary>
/// Snaps the left side of the element bounds to the magnet bounds.
/// </summary>
/// <param name="elementRect"></param>
/// <param name="magnetRect"></param>
/// <param name="horizontallyMagnetized"></param>
/// <param name="magnetDistance"></param>
/// <param name="resize"></param>
private static void MagnetizeLeft(ref RectangleF elementRect, ref RectangleF magnetRect, ref bool horizontallyMagnetized, float magnetDistance, bool resize)
{
if (horizontallyMagnetized)
return;
// element's left / magnet's left
var diffLeft = elementRect.Left - magnetRect.Left;
if (Math.Abs(diffLeft) < magnetDistance)
{
elementRect.Left = magnetRect.Left;
if (resize)
elementRect.Width += diffLeft;
horizontallyMagnetized = true;
return;
}
// element's left / magnet's right
var diffRight = elementRect.Left - magnetRect.Right;
if (Math.Abs(elementRect.Left - magnetRect.Right) < magnetDistance)
{
elementRect.Left = magnetRect.Right;
if (resize)
elementRect.Width += diffRight;
horizontallyMagnetized = true;
}
}
/// <summary>
/// Snaps the top side of the element bounds to the magnet bounds.
/// </summary>
/// <param name="elementRect"></param>
/// <param name="magnetRect"></param>
/// <param name="verticallyMagnetized"></param>
/// <param name="magnetDistance"></param>
/// <param name="resize"></param>
private static void MagnetizeTop(ref RectangleF elementRect, ref RectangleF magnetRect, ref bool verticallyMagnetized, float magnetDistance, bool resize)
{
if (verticallyMagnetized)
return;
// element's top/ magnet's top
var diffTop = elementRect.Top - magnetRect.Top;
if (Math.Abs(diffTop) < magnetDistance)
{
elementRect.Top = magnetRect.Top;
if (resize)
elementRect.Height += diffTop;
verticallyMagnetized = true;
return;
}
// element's top/ magnet's bottom
var diffBottom = elementRect.Top - magnetRect.Bottom;
if (Math.Abs(diffBottom) < magnetDistance)
{
elementRect.Top = magnetRect.Bottom;
if (resize)
elementRect.Height += diffBottom;
verticallyMagnetized = true;
}
}
/// <summary>
/// Snaps the right side of the element bounds to the magnet bounds.
/// </summary>
/// <param name="elementRect"></param>
/// <param name="magnetRect"></param>
/// <param name="horizontallyMagnetized"></param>
/// <param name="magnetDistance"></param>
/// <param name="resize"></param>
private static void MagnetizeRight(ref RectangleF elementRect, ref RectangleF magnetRect, ref bool horizontallyMagnetized, float magnetDistance, bool resize)
{
if (horizontallyMagnetized)
return;
// element's right / magnet's left
var diffLeft = elementRect.Right - magnetRect.Left;
if (Math.Abs(diffLeft) < magnetDistance)
{
if (resize)
elementRect.Width -= diffLeft;
else
elementRect.Left = magnetRect.Left - elementRect.Width;
horizontallyMagnetized = true;
return;
}
// element's right / magnet's right
var diffRight = elementRect.Right - magnetRect.Right;
if (Math.Abs(diffRight) < magnetDistance)
{
if (resize)
elementRect.Width -= diffRight;
else
elementRect.Left = magnetRect.Right - elementRect.Width;
horizontallyMagnetized = true;
}
}
private static void UpdateElementLayout([NotNull] UIElement element, ref Vector3 delta, float magnetDistance, ref Vector3 resolution, LayoutParameters parameters)
{
// Retrieve all notable rects from the parent (i.e. siblings, areas such as grid cell container, etc.)
var rects = ExtractRects(element, ref resolution);
// copy element's current rect
var currentElementRect = rects.Element;
// apply resizing delta to the element rect
if (parameters.Left)
{
rects.Element.X += delta.X;
rects.Element.Width -= delta.X;
}
if (parameters.Right)
rects.Element.Width += delta.X;
if (parameters.Top)
{
rects.Element.Y += delta.Y;
rects.Element.Height -= delta.Y;
}
if (parameters.Bottom)
rects.Element.Height += delta.Y;
// magnetize
var horizontallyMagnetized = false;
var verticallyMagnetized = false;
// .. parent
var contentControl = element.VisualParent as ContentControl;
if (contentControl == null || !float.IsNaN(contentControl.Width))
{
if (parameters.Left)
MagnetizeLeft(ref rects.Element, ref rects.Parent, ref horizontallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Right)
MagnetizeRight(ref rects.Element, ref rects.Parent, ref horizontallyMagnetized, magnetDistance, parameters.CanResize);
}
if (contentControl == null || !float.IsNaN(contentControl.Height))
{
if (parameters.Top)
MagnetizeTop(ref rects.Element, ref rects.Parent, ref verticallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Bottom)
MagnetizeBottom(ref rects.Element, ref rects.Parent, ref verticallyMagnetized, magnetDistance, parameters.CanResize);
}
// .. container
if (rects.Parent != rects.Container)
{
if (parameters.Left)
MagnetizeLeft(ref rects.Element, ref rects.Container, ref horizontallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Right)
MagnetizeRight(ref rects.Element, ref rects.Container, ref horizontallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Top)
MagnetizeTop(ref rects.Element, ref rects.Container, ref verticallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Bottom)
MagnetizeBottom(ref rects.Element, ref rects.Container, ref verticallyMagnetized, magnetDistance, parameters.CanResize);
}
// .. sibling in same container
for (var i = 0; i < rects.Siblings.Length; i++)
{
if (parameters.Left)
MagnetizeLeft(ref rects.Element, ref rects.Siblings[i], ref horizontallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Right)
MagnetizeRight(ref rects.Element, ref rects.Siblings[i], ref horizontallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Top)
MagnetizeTop(ref rects.Element, ref rects.Siblings[i], ref verticallyMagnetized, magnetDistance, parameters.CanResize);
if (parameters.Bottom)
MagnetizeBottom(ref rects.Element, ref rects.Siblings[i], ref verticallyMagnetized, magnetDistance, parameters.CanResize);
}
// calculate resulting margin
var margin = new Thickness
{
Left = rects.Element.Left,
Top = rects.Element.Top
};
var horizontalAlignment = element.HorizontalAlignment;
var verticalAlignment = element.VerticalAlignment;
if (element.VisualParent is Canvas)
{
// inside a Canvas, the alignment should be left-top
horizontalAlignment = HorizontalAlignment.Left;
verticalAlignment = VerticalAlignment.Top;
}
else if (element.VisualParent is ContentControl)
{
// inside a ContentControl, the margin remains unchanged ; only the size will be updated.
margin = element.Margin;
}
else
{
margin.Right = rects.Container.Right - rects.Element.Right;
margin.Bottom = rects.Container.Bottom - rects.Element.Bottom;
var stackPanel = element.VisualParent as StackPanel;
if (stackPanel != null)
{
// inside a stackpanel the alignment depends on the panel orientation
if (stackPanel.Orientation == Orientation.Horizontal)
horizontalAlignment = HorizontalAlignment.Left;
else
verticalAlignment = VerticalAlignment.Top;
}
else if (rects.Container == rects.Parent)
{
// adjust alignment relatively to the parent/container
AdjustAlignmentInContainer(ref rects.Element, ref rects.Container, out horizontalAlignment, out verticalAlignment);
}
// final adjustment of alignment, size and margin
switch (horizontalAlignment)
{
case HorizontalAlignment.Left:
// Compensate when out of container bounds
var overLeft = rects.Container.Width - (margin.Left + rects.Element.Width);
margin.Right = Math.Min(overLeft, 0);
break;
case HorizontalAlignment.Center:
// Fall back to Stretch alignment
horizontalAlignment = HorizontalAlignment.Stretch;
break;
case HorizontalAlignment.Right:
// Compensate when out of container bounds
var overRight = rects.Container.Width - (margin.Right + rects.Element.Width);
margin.Left = Math.Min(overRight, 0);
break;
}
switch (verticalAlignment)
{
case VerticalAlignment.Bottom:
// Compensate when out of container bounds
var overBottom = rects.Container.Height - (margin.Bottom + rects.Element.Height);
margin.Top = Math.Min(overBottom, 0);
break;
case VerticalAlignment.Center:
// Fall back to Stretch alignment
verticalAlignment = VerticalAlignment.Stretch;
break;
case VerticalAlignment.Top:
// Compensate when out of container bounds
var overTop = rects.Container.Height - (margin.Top + rects.Element.Height);
margin.Bottom = Math.Min(overTop, 0);
break;
}
}
// update element properties
element.Margin = margin;
element.HorizontalAlignment = horizontalAlignment;
element.VerticalAlignment = verticalAlignment;
element.Width = MathUtil.Clamp(rects.Element.Width, element.MinimumWidth, element.MaximumWidth);
element.Height = MathUtil.Clamp(rects.Element.Height, element.MinimumHeight, element.MaximumHeight);
// update to the real delta that was applied
delta = new Vector3
{
X = parameters.Left ? rects.Element.Left - currentElementRect.Left : rects.Element.Right - currentElementRect.Right,
Y = parameters.Top ? rects.Element.Top - currentElementRect.Top : rects.Element.Bottom - currentElementRect.Bottom,
Z = 0
};
}
}
}
| 47.100379 | 250 | 0.551771 | [
"MIT"
] | Alan-love/xenko | sources/editor/Stride.Assets.Presentation/AssetEditors/UIEditor/Game/UILayoutHelper.cs | 24,869 | C# |
using System;
using System.Configuration;
using System.IO;
using WWTWebservices;
namespace WWT.Providers
{
public class DustToastProvider : RequestProvider
{
public override void Run(IWwtContext context)
{
string query = context.Request.Params["Q"];
string[] values = query.Split(',');
int level = Convert.ToInt32(values[0]);
int tileX = Convert.ToInt32(values[1]);
int tileY = Convert.ToInt32(values[2]);
string file = "dust";
string wwtTilesDir = ConfigurationManager.AppSettings["WWTTilesDir"];
if (level < 8)
{
context.Response.ContentType = "image/png";
Stream s = PlateTilePyramid.GetFileStream(String.Format(wwtTilesDir + "\\{0}.plate", file), level, tileX, tileY);
int length = (int)s.Length;
byte[] data = new byte[length];
s.Read(data, 0, length);
context.Response.OutputStream.Write(data, 0, length);
context.Response.Flush();
context.Response.End();
return;
}
}
}
}
| 32.805556 | 129 | 0.552921 | [
"MIT"
] | twsouthwick/wwt-website | src/WWT.Providers/Providers/DustToastProvider.cs | 1,181 | C# |
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading.Tasks;
using Pulumi.Serialization;
namespace Pulumi.Linode
{
/// <summary>
/// > This content is derived from https://github.com/terraform-providers/terraform-provider-linode/blob/master/website/docs/r/nodebalancer_node.html.markdown.
/// </summary>
public partial class NodeBalancerNode : Pulumi.CustomResource
{
/// <summary>
/// The private IP Address where this backend can be reached. This must be a private IP address.
/// </summary>
[Output("address")]
public Output<string> Address { get; private set; } = null!;
/// <summary>
/// The ID of the NodeBalancerConfig to access.
/// </summary>
[Output("configId")]
public Output<int> ConfigId { get; private set; } = null!;
/// <summary>
/// The label of the Linode NodeBalancer Node. This is for display purposes only.
/// </summary>
[Output("label")]
public Output<string> Label { get; private set; } = null!;
/// <summary>
/// The mode this NodeBalancer should use when sending traffic to this backend. If set to `accept` this backend is accepting traffic. If set to `reject` this backend will not receive traffic. If set to `drain` this backend will not receive new traffic, but connections already pinned to it will continue to be routed to it
/// </summary>
[Output("mode")]
public Output<string> Mode { get; private set; } = null!;
/// <summary>
/// The ID of the NodeBalancer to access.
/// </summary>
[Output("nodebalancerId")]
public Output<int> NodebalancerId { get; private set; } = null!;
/// <summary>
/// The current status of this node, based on the configured checks of its NodeBalancer Config. (unknown, UP,
/// DOWN)
/// </summary>
[Output("status")]
public Output<string> Status { get; private set; } = null!;
/// <summary>
/// Used when picking a backend to serve a request and is not pinned to a single backend yet. Nodes with a higher weight will receive more traffic. (1-255).
/// </summary>
[Output("weight")]
public Output<int> Weight { get; private set; } = null!;
/// <summary>
/// Create a NodeBalancerNode resource with the given unique name, arguments, and options.
/// </summary>
///
/// <param name="name">The unique name of the resource</param>
/// <param name="args">The arguments used to populate this resource's properties</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public NodeBalancerNode(string name, NodeBalancerNodeArgs args, CustomResourceOptions? options = null)
: base("linode:index/nodeBalancerNode:NodeBalancerNode", name, args ?? ResourceArgs.Empty, MakeResourceOptions(options, ""))
{
}
private NodeBalancerNode(string name, Input<string> id, NodeBalancerNodeState? state = null, CustomResourceOptions? options = null)
: base("linode:index/nodeBalancerNode:NodeBalancerNode", name, state, MakeResourceOptions(options, id))
{
}
private static CustomResourceOptions MakeResourceOptions(CustomResourceOptions? options, Input<string>? id)
{
var defaultOptions = new CustomResourceOptions
{
Version = Utilities.Version,
};
var merged = CustomResourceOptions.Merge(defaultOptions, options);
// Override the ID if one was specified for consistency with other language SDKs.
merged.Id = id ?? merged.Id;
return merged;
}
/// <summary>
/// Get an existing NodeBalancerNode resource's state with the given name, ID, and optional extra
/// properties used to qualify the lookup.
/// </summary>
///
/// <param name="name">The unique name of the resulting resource.</param>
/// <param name="id">The unique provider ID of the resource to lookup.</param>
/// <param name="state">Any extra arguments used during the lookup.</param>
/// <param name="options">A bag of options that control this resource's behavior</param>
public static NodeBalancerNode Get(string name, Input<string> id, NodeBalancerNodeState? state = null, CustomResourceOptions? options = null)
{
return new NodeBalancerNode(name, id, state, options);
}
}
public sealed class NodeBalancerNodeArgs : Pulumi.ResourceArgs
{
/// <summary>
/// The private IP Address where this backend can be reached. This must be a private IP address.
/// </summary>
[Input("address", required: true)]
public Input<string> Address { get; set; } = null!;
/// <summary>
/// The ID of the NodeBalancerConfig to access.
/// </summary>
[Input("configId", required: true)]
public Input<int> ConfigId { get; set; } = null!;
/// <summary>
/// The label of the Linode NodeBalancer Node. This is for display purposes only.
/// </summary>
[Input("label", required: true)]
public Input<string> Label { get; set; } = null!;
/// <summary>
/// The mode this NodeBalancer should use when sending traffic to this backend. If set to `accept` this backend is accepting traffic. If set to `reject` this backend will not receive traffic. If set to `drain` this backend will not receive new traffic, but connections already pinned to it will continue to be routed to it
/// </summary>
[Input("mode")]
public Input<string>? Mode { get; set; }
/// <summary>
/// The ID of the NodeBalancer to access.
/// </summary>
[Input("nodebalancerId", required: true)]
public Input<int> NodebalancerId { get; set; } = null!;
/// <summary>
/// Used when picking a backend to serve a request and is not pinned to a single backend yet. Nodes with a higher weight will receive more traffic. (1-255).
/// </summary>
[Input("weight")]
public Input<int>? Weight { get; set; }
public NodeBalancerNodeArgs()
{
}
}
public sealed class NodeBalancerNodeState : Pulumi.ResourceArgs
{
/// <summary>
/// The private IP Address where this backend can be reached. This must be a private IP address.
/// </summary>
[Input("address")]
public Input<string>? Address { get; set; }
/// <summary>
/// The ID of the NodeBalancerConfig to access.
/// </summary>
[Input("configId")]
public Input<int>? ConfigId { get; set; }
/// <summary>
/// The label of the Linode NodeBalancer Node. This is for display purposes only.
/// </summary>
[Input("label")]
public Input<string>? Label { get; set; }
/// <summary>
/// The mode this NodeBalancer should use when sending traffic to this backend. If set to `accept` this backend is accepting traffic. If set to `reject` this backend will not receive traffic. If set to `drain` this backend will not receive new traffic, but connections already pinned to it will continue to be routed to it
/// </summary>
[Input("mode")]
public Input<string>? Mode { get; set; }
/// <summary>
/// The ID of the NodeBalancer to access.
/// </summary>
[Input("nodebalancerId")]
public Input<int>? NodebalancerId { get; set; }
/// <summary>
/// The current status of this node, based on the configured checks of its NodeBalancer Config. (unknown, UP,
/// DOWN)
/// </summary>
[Input("status")]
public Input<string>? Status { get; set; }
/// <summary>
/// Used when picking a backend to serve a request and is not pinned to a single backend yet. Nodes with a higher weight will receive more traffic. (1-255).
/// </summary>
[Input("weight")]
public Input<int>? Weight { get; set; }
public NodeBalancerNodeState()
{
}
}
}
| 43.540816 | 330 | 0.613194 | [
"ECL-2.0",
"Apache-2.0"
] | Charliekenney23/pulumi-linode | sdk/dotnet/NodeBalancerNode.cs | 8,534 | C# |
/* Copyright (c) Citrix Systems Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms,
* with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above
* copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other
* materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
using XenAdmin.Diagnostics.Problems.HostProblem;
using XenAPI;
using XenAdmin.Diagnostics.Problems;
using XenAdmin.Core;
using XenAdmin.Diagnostics.Problems.PoolProblem;
namespace XenAdmin.Diagnostics.Checks
{
public class HAOffCheck : Check
{
public HAOffCheck(Host host)
: base(host)
{
}
public override Problem RunCheck()
{
if (!Host.IsLive)
return new HostNotLive(this, Host);
Pool pool = Helpers.GetPoolOfOne(Host.Connection);
if (pool == null)
return null;
if (pool.ha_enabled)
return new HAEnabledProblem(this, Helpers.GetPoolOfOne(Host.Connection));
if (Helpers.WlbEnabled(pool.Connection))
return new WLBEnabledProblem(this, Helpers.GetPoolOfOne(Host.Connection));
return null;
}
public override string Description
{
get
{
return Messages.HA_CHECK_DESCRIPTION;
}
}
}
}
| 34.77027 | 91 | 0.650214 | [
"BSD-2-Clause"
] | ChrisH4rding/xenadmin | XenAdmin/Diagnostics/Checks/HAOffCheck.cs | 2,575 | C# |
namespace Palantir.Numeric.UnitTests
{
using System;
using FluentAssertions;
using Xunit;
// 0.01, up down and nearest
// 0.05, up down and nearest
// 0.10, up down and nearest
// 0.50, up down and nearest
// 1.00, up down and nearest
// 10.00, up down and nearest
public sealed class RoundingTests
{
private Currency usd = new Currency("USD", "$", 0.01M);
[Fact]
public void RoundUp_With1MinorUnit_ShouldRoundCorrectly()
{
Round.RoundUp(1.01M, 0.01M).Should().Be(1.01M);
Round.RoundUp(1.06M, 0.01M).Should().Be(1.06M);
Round.RoundUp(1.014M, 0.01M).Should().Be(1.02M);
Round.RoundUp(1.015M, 0.01M).Should().Be(1.02M);
Round.RoundUp(1.016M, 0.01M).Should().Be(1.02M);
}
[Fact]
public void RoundUp_With5MinorUnit_ShouldRoundCorrectly()
{
Round.RoundUp(1.05M, 0.05M).Should().Be(1.05M);
Round.RoundUp(1.01M, 0.05M).Should().Be(1.05M);
Round.RoundUp(1.001M, 0.05M).Should().Be(1.05M);
Round.RoundUp(1.051M, 0.05M).Should().Be(1.10M);
}
[Fact]
public void RoundDown_With1MinorUnit_ShouldRoundCorrectly()
{
Round.RoundDown(1.01M, 0.01M).Should().Be(1.01M);
Round.RoundDown(1.06M, 0.01M).Should().Be(1.06M);
Round.RoundDown(1.014M, 0.01M).Should().Be(1.01M);
Round.RoundDown(1.015M, 0.01M).Should().Be(1.01M);
Round.RoundDown(1.016M, 0.01M).Should().Be(1.01M);
}
[Fact]
public void RoundDown_With5MinorUnit_ShouldRoundCorrectly()
{
Round.RoundDown(1.05M, 0.05M).Should().Be(1.05M);
Round.RoundDown(1.01M, 0.05M).Should().Be(1.00M);
Round.RoundDown(1.001M, 0.05M).Should().Be(1.00M);
Round.RoundDown(1.051M, 0.05M).Should().Be(1.05M);
}
[Fact]
public void RoundHalfUp_With1MinorUnit_ShouldRoundCorrectly()
{
Round.RoundHalfUp(1.01M, 0.01M).Should().Be(1.01M);
Round.RoundHalfUp(1.06M, 0.01M).Should().Be(1.06M);
Round.RoundHalfUp(1.014M, 0.01M).Should().Be(1.01M);
Round.RoundHalfUp(1.015M, 0.01M).Should().Be(1.02M);
Round.RoundHalfUp(1.016M, 0.01M).Should().Be(1.02M);
}
[Fact]
public void RoundHalfUp_With5MinorUnit_ShouldRoundCorrectly()
{
Round.RoundHalfUp(1.05M, 0.05M).Should().Be(1.05M);
Round.RoundHalfUp(1.01M, 0.05M).Should().Be(1.00M);
Round.RoundHalfUp(1.001M, 0.05M).Should().Be(1.00M);
Round.RoundHalfUp(1.051M, 0.05M).Should().Be(1.05M);
Round.RoundHalfUp(1.074M, 0.05M).Should().Be(1.05M);
Round.RoundHalfUp(1.075M, 0.05M).Should().Be(1.10M);
}
[Fact]
public void RoundHalfDown_With1MinorUnit_ShouldRoundCorrectly()
{
Round.RoundHalfDown(1.01M, 0.01M).Should().Be(1.01M);
Round.RoundHalfDown(1.06M, 0.01M).Should().Be(1.06M);
Round.RoundHalfDown(1.014M, 0.01M).Should().Be(1.01M);
Round.RoundHalfDown(1.015M, 0.01M).Should().Be(1.01M);
Round.RoundHalfDown(1.016M, 0.01M).Should().Be(1.02M);
}
[Fact]
public void RoundHalfDown_With5MinorUnit_ShouldRoundCorrectly()
{
Round.RoundHalfDown(1.05M, 0.05M).Should().Be(1.05M);
Round.RoundHalfDown(1.01M, 0.05M).Should().Be(1.00M);
Round.RoundHalfDown(1.001M, 0.05M).Should().Be(1.00M);
Round.RoundHalfDown(1.051M, 0.05M).Should().Be(1.05M);
Round.RoundHalfDown(1.074M, 0.05M).Should().Be(1.05M);
Round.RoundHalfDown(1.075M, 0.05M).Should().Be(1.05M);
Round.RoundHalfDown(1.076M, 0.05M).Should().Be(1.10M);
}
[Fact]
public void RoundHalfEven_With1MinorUnit_ShouldRoundCorrectly()
{
Round.RoundHalfEven(1.01M, 0.01M).Should().Be(1.01M);
Round.RoundHalfEven(1.06M, 0.01M).Should().Be(1.06M);
Round.RoundHalfEven(1.014M, 0.01M).Should().Be(1.01M);
Round.RoundHalfEven(1.015M, 0.01M).Should().Be(1.02M);
Round.RoundHalfEven(1.025M, 0.01M).Should().Be(1.02M);
Round.RoundHalfEven(1.016M, 0.01M).Should().Be(1.02M);
}
[Fact]
public void RoundHalfEven_With5MinorUnit_ShouldRoundCorrectly()
{
Round.RoundHalfEven(1.05M, 0.05M).Should().Be(1.05M);
Round.RoundHalfEven(1.01M, 0.05M).Should().Be(1.00M);
Round.RoundHalfEven(1.001M, 0.05M).Should().Be(1.00M);
Round.RoundHalfEven(1.051M, 0.05M).Should().Be(1.05M);
Round.RoundHalfEven(1.074M, 0.05M).Should().Be(1.05M);
Round.RoundHalfEven(1.075M, 0.05M).Should().Be(1.10M);
Round.RoundHalfEven(1.175M, 0.05M).Should().Be(1.20M);
Round.RoundHalfEven(1.076M, 0.05M).Should().Be(1.10M);
}
[Fact]
public void RoundQuotient_ShouldRoundCorrectly()
{
var quotient = new Money(2.05M, usd) / 2;
Round.RoundUp(quotient).Amount.Should().Be(1.03M);
Round.RoundDown(quotient).Amount.Should().Be(1.02M);
Round.RoundHalfUp(quotient).Amount.Should().Be(1.03M);
Round.RoundHalfDown(quotient).Amount.Should().Be(1.02M);
Round.RoundHalfEven(quotient).Amount.Should().Be(1.02M);
}
[Fact]
public void RoundMoney_ShouldRoundCorrectly()
{
var value = new Money(1.025M, usd, 0.001M);
Round.RoundUp(value, 0.01M).Amount.Should().Be(1.03M);
Round.RoundDown(value, 0.01M).Amount.Should().Be(1.02M);
Round.RoundHalfUp(value, 0.01M).Amount.Should().Be(1.03M);
Round.RoundHalfDown(value, 0.01M).Amount.Should().Be(1.02M);
Round.RoundHalfEven(value, 0.01M).Amount.Should().Be(1.02M);
}
}
} | 41.469388 | 72 | 0.565125 | [
"MIT"
] | palantirza/Numeric | tst/Palantir.Numeric.UnitTests/RoundingTests.cs | 6,096 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using WeiXin.Helper;
namespace Yank.WeiXin.Messages
{
/// <summary>
///
/// </summary>
public class TextMessage:Message
{
/// <summary>
/// 模板静态字段
/// </summary>
private static string m_Template;
/// <summary>
/// 内容
/// </summary>
public string Content { get; set; }
/// <summary>
/// 消息ID
/// </summary>
public string MsgId { get; set; }
/// <summary>
/// 默认构造函数
/// </summary>
public TextMessage()
{
this.MsgType = "text";
}
/// <summary>
/// 从xml数据加载文本消息
/// </summary>
/// <param name="xml"></param>
public static TextMessage LoadFromXml(string xml)
{
TextMessage tm = null;
if (!string.IsNullOrEmpty(xml))
{
XElement element = XElement.Parse(xml);
if (element != null)
{
tm = new TextMessage();
tm.FromUserName = element.Element(Utilities.FROM_USERNAME).Value;
tm.ToUserName = element.Element(Utilities.TO_USERNAME).Value;
tm.CreateTime = element.Element(Utilities.CREATE_TIME).Value;
tm.Content = element.Element(Utilities.CONTENT).Value;
tm.MsgId = element.Element(Utilities.MSG_ID).Value;
}
}
return tm;
}
/// <summary>
/// 模板
/// </summary>
public override string Template
{
get
{
if (string.IsNullOrEmpty(m_Template))
{
LoadTemplate();
}
return m_Template;
}
}
/// <summary>
/// 生成内容
/// </summary>
/// <returns></returns>
public override string GenerateContent()
{
this.CreateTime = Utilities.GetNowTime();
return string.Format(this.Template,this.ToUserName,this.FromUserName,this.CreateTime,this.MsgType,this.Content,this.MsgId);
}
/// <summary>
/// 加载模板
/// </summary>
private static void LoadTemplate()
{
m_Template = @"<xml>
<ToUserName><![CDATA[{0}]]></ToUserName>
<FromUserName><![CDATA[{1}]]></FromUserName>
<CreateTime>{2}</CreateTime>
<MsgType><![CDATA[{3}]]></MsgType>
<Content><![CDATA[{4}]]></Content>
<MsgId>{5}</MsgId>
</xml>";
}
}
}
| 30.701031 | 136 | 0.435527 | [
"MIT"
] | kongpanda/WeiXin | Message/TextMessage.cs | 3,050 | C# |
// Copyright 2017 the original author or authors.
//
// 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 Steeltoe.CircuitBreaker.Hystrix.Strategy.ExecutionHook
{
public class HystrixCommandExecutionHookDefault : HystrixCommandExecutionHook
{
private static HystrixCommandExecutionHookDefault instance = new HystrixCommandExecutionHookDefault();
private HystrixCommandExecutionHookDefault()
{
}
public static HystrixCommandExecutionHook GetInstance()
{
return instance;
}
}
}
| 34.451613 | 110 | 0.733146 | [
"ECL-2.0",
"Apache-2.0"
] | spring-operator/CircuitBreaker | src/Steeltoe.CircuitBreaker.HystrixBase/Strategy/ExecutionHook/HystrixCommandExecutionHookDefault.cs | 1,070 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.239
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace BindingSample.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
| 31.483871 | 148 | 0.635246 | [
"MIT"
] | dotnetprojects/TreeViewEx | Samples/SelectionBinding/Properties/Settings.Designer.cs | 978 | C# |
namespace AniVetNetwork.Web.Areas.Administration.Controllers
{
using AniVetNetwork.Services.Data;
using AniVetNetwork.Web.ViewModels.Administration.Dashboard;
using Microsoft.AspNetCore.Mvc;
public class DashboardController : AdministrationController
{
private readonly ISettingsService settingsService;
public DashboardController(ISettingsService settingsService)
{
this.settingsService = settingsService;
}
public IActionResult Index()
{
var viewModel = new IndexViewModel { SettingsCount = this.settingsService.GetCount(), };
return this.View(viewModel);
}
}
}
| 28.541667 | 100 | 0.689051 | [
"MIT"
] | p-vascool/WebProject | Web/AniVetNetwork.Web/Areas/Administration/Controllers/DashboardController.cs | 687 | C# |
using System.Threading.Tasks;
using HitMeApp.Indentity.Contract.Dtos;
using HitMeApp.Indentity.Contract.Queries;
using HitMeApp.Indentity.Core;
using HitMeApp.Shared.Infrastructure.Cqrs.Queries;
namespace HitMeApp.Indentity.Infrastructure.Persistence.QueryHandlers
{
internal sealed class GetUserByIdHandler : IQueryHandler<GetUserById, UserDto>
{
private readonly IUserRepository _userRepository;
public GetUserByIdHandler(IUserRepository userRepository)
{
_userRepository = userRepository;
}
public async Task<UserDto> Handle(GetUserById query)
{
var user = await _userRepository.Get(new UserId(query.Id));
return user?.AsDto();
}
}
}
| 29.8 | 82 | 0.711409 | [
"MIT"
] | Somsiady-Inc/HitMeApp | backend/Modules/Identity/HitMeApp.Indentity/Infrastructure/Persistence/QueryHandlers/GetUserByIdHandler.cs | 747 | C# |
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class playanim : MonoBehaviour
{
public Animation anim;
// Start is called before the first frame update
void Start()
{
anim = gameObject.GetComponent<Animation>();
}
// Update is called once per frame
void Update()
{
anim.Play("Idle");
}
}
| 19.1 | 52 | 0.649215 | [
"Unlicense"
] | 23SAMY23/Drift-Into-Space | Drift Into Space/Assets/Scripts/playanim.cs | 384 | C# |
using Sanatana.DataGenerator.Generators;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Linq;
using System.Collections;
using System.Threading.Tasks;
using Sanatana.DataGenerator.Storages;
using Sanatana.DataGenerator.Entities;
using Sanatana.DataGenerator.Modifiers;
namespace Sanatana.DataGenerator.Internals
{
public class ReflectionInvoker
{
//fields
protected static Dictionary<Type, MethodInfo> _generateMethods;
protected static Dictionary<Type, MethodInfo> _modifyMethods;
protected static Dictionary<Type, MethodInfo> _insertMethods;
//init
public ReflectionInvoker()
{
_generateMethods = new Dictionary<Type, MethodInfo>();
_modifyMethods = new Dictionary<Type, MethodInfo>();
_insertMethods = new Dictionary<Type, MethodInfo>();
}
//methods
public virtual IList InvokeModify(IModifier modifier,
GeneratorContext context, object generatedEntities)
{
Type targetType = context.Description.Type;
MethodInfo modifyMethod;
if (!_modifyMethods.ContainsKey(targetType))
{
Type generatorType = typeof(IModifier);
modifyMethod = generatorType.GetMethods()
.First(x => x.Name == nameof(IModifier.Modify));
modifyMethod = modifyMethod.MakeGenericMethod(targetType);
_modifyMethods.Add(targetType, modifyMethod);
}
modifyMethod = _modifyMethods[targetType];
object result = modifyMethod.Invoke(modifier, new object[] { context, generatedEntities });
return (IList)result;
}
public virtual Task InvokeInsert(IPersistentStorage storage,
IEntityDescription description, IList itemsList)
{
Type targetType = description.Type;
MethodInfo insertMethod;
if (!_insertMethods.ContainsKey(targetType))
{
Type generatorType = typeof(IPersistentStorage);
insertMethod = generatorType.GetMethods()
.First(x => x.Name == nameof(IPersistentStorage.Insert));
insertMethod = insertMethod.MakeGenericMethod(targetType);
_insertMethods.Add(targetType, insertMethod);
}
insertMethod = _insertMethods[targetType];
object result = insertMethod.Invoke(storage, new object[] { itemsList });
return (Task)result;
}
public virtual IList CreateEntityList(Type entityType)
{
Type listType = typeof(List<>);
Type constructedListType = listType.MakeGenericType(entityType);
return (IList)Activator.CreateInstance(constructedListType);
}
}
}
| 35.304878 | 103 | 0.638687 | [
"MIT"
] | RodionKulin/Sanatana.DataGenerator | Sanatana.DataGenerator/Internals/ReflectionInvoker.cs | 2,897 | C# |
using HarmonyLib;
using UnityEngine;
namespace GalacticScale
{
public partial class PatchOnUIPlanetDetail
{
[HarmonyPrefix]
[HarmonyPatch(typeof(UIPlanetDetail), "SetResCount")]
public static bool SetResCount(int count, ref RectTransform ___rectTrans, ref RectTransform ___paramGroup) // Adjust the height of the PlanetDetail UI to allow for Radius Text
{
___rectTrans.sizeDelta = new Vector2(___rectTrans.sizeDelta.x, 210 + count * 20 + 20f);
___paramGroup.anchoredPosition = new Vector2(___paramGroup.anchoredPosition.x, -90 - count * 20);
return false;
}
}
} | 38.294118 | 183 | 0.689708 | [
"CC0-1.0"
] | PhantomGamers/GalacticScale3 | Scripts/Patches/UIPlanetDetail/SetResCount.cs | 653 | C# |
using System;
using System.Collections.Generic;
using DotVVM.Framework.Utils;
using System.Reflection;
using System.Linq;
using DotVVM.Framework.Controls;
using DotVVM.Framework.Compilation.Styles;
public static partial class StyleBuilderExtensionMethods
{
/// <summary> Adds a new postback handler to the PostBack.Handlers property </summary>
public static T AddPostbackHandler<T>(
this T sb,
PostBackHandler handler)
where T: IStyleBuilder =>
sb.SetControlProperty(PostBack.HandlersProperty, handler, options: StyleOverrideOptions.Append);
/// <summary> Adds a new postback handler to the PostBack.Handlers property </summary>
public static IStyleBuilder<T> AddPostbackHandler<T>(
this IStyleBuilder<T> sb,
Func<IStyleMatchContext<T>, PostBackHandler> handler)
where T: DotvvmBindableObject =>
sb.SetDotvvmProperty(PostBack.HandlersProperty, handler, StyleOverrideOptions.Append);
/// <summary> Requests a resource to be included if this control is in the page. </summary>
public static T AddRequiredResource<T>(
this T sb,
params string[] resources)
where T: IStyleBuilder =>
sb.SetDotvvmProperty(Styles.RequiredResourcesProperty, resources, StyleOverrideOptions.Append);
/// <summary> Replaces the matching controls with a new control while copying all properties to the new one.</summary>
public static T ReplaceWith<T, TControl>(
this T sb,
TControl newControl,
Action<IStyleBuilder<TControl>>? styleBuilder = null,
StyleOverrideOptions options = StyleOverrideOptions.Overwrite)
where T: IStyleBuilder
where TControl: DotvvmBindableObject =>
sb.SetControlProperty(
Styles.ReplaceWithProperty,
newControl,
styleBuilder,
options
);
/// <summary> Replaces the matching controls with a new control while copying all properties to the new one.</summary>
public static IStyleBuilder<T> ReplaceWith<T>(
this IStyleBuilder<T> sb,
Func<IStyleMatchContext<T>, DotvvmBindableObject> handler,
StyleOverrideOptions options = StyleOverrideOptions.Overwrite) =>
sb.SetDotvvmProperty(Styles.ReplaceWithProperty, handler, options);
/// <summary> Wraps the matching controls with a new control - places the new control instead of the original control which is moved inside the wrapper control </summary>
public static T WrapWith<T, TControl>(
this T sb,
TControl wrapperControl,
Action<IStyleBuilder<TControl>>? styleBuilder = null,
StyleOverrideOptions options = StyleOverrideOptions.Append)
where T: IStyleBuilder
where TControl: DotvvmBindableObject =>
sb.SetControlProperty(
Styles.WrappersProperty,
wrapperControl,
styleBuilder,
options
);
/// <summary> Wraps the matching controls with a new control - places the new control instead of the original control which is moved inside the wrapper control </summary>
public static IStyleBuilder<T> WrapWith<T>(
this IStyleBuilder<T> sb,
Func<IStyleMatchContext<T>, DotvvmBindableObject> handler,
StyleOverrideOptions options = StyleOverrideOptions.Append) =>
sb.SetDotvvmProperty(Styles.WrappersProperty, handler, options);
/// <summary> Adds a new control bellow the matched control. </summary>
public static T Append<T, TControl>(
this T sb,
TControl control,
Action<IStyleBuilder<TControl>>? styleBuilder = null,
StyleOverrideOptions options = StyleOverrideOptions.Append)
where T: IStyleBuilder
where TControl: DotvvmBindableObject =>
sb.SetControlProperty(
Styles.AppendProperty,
control,
styleBuilder,
options
);
/// <summary> Adds a new control bellow the matched control. </summary>
public static IStyleBuilder<T> Append<T>(
this IStyleBuilder<T> sb,
Func<IStyleMatchContext<T>, DotvvmBindableObject> handler,
StyleOverrideOptions options = StyleOverrideOptions.Append) =>
sb.SetDotvvmProperty(Styles.AppendProperty, handler, options);
/// <summary> Adds a new control above the matched control. </summary>
public static T Prepend<T, TControl>(
this T sb,
TControl control,
Action<IStyleBuilder<TControl>>? styleBuilder = null,
StyleOverrideOptions options = StyleOverrideOptions.Append)
where T: IStyleBuilder
where TControl: DotvvmBindableObject =>
sb.SetControlProperty(
Styles.PrependProperty,
control,
styleBuilder,
options
);
/// <summary> Adds a new control above the matched control. </summary>
public static IStyleBuilder<T> Prepend<T, TControl>(
this IStyleBuilder<T> sb,
Func<IStyleMatchContext<T>, DotvvmBindableObject> handler,
StyleOverrideOptions options = StyleOverrideOptions.Append) =>
sb.SetDotvvmProperty(Styles.PrependProperty, handler, options);
}
| 44.299145 | 174 | 0.689562 | [
"Apache-2.0"
] | AlexanderSemenyak/dotvvm | src/Framework/Framework/Compilation/Styles/StyleBuilderMethods.Helpers.cs | 5,183 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;
namespace BACnet.IP
{
public delegate void DatagramReceivedDelegate(IPEndPoint ep, byte[] buffer, int length);
public class UDPAsyncServer : IDisposable
{
/// <summary>
/// Maximum length of a udp datagram
/// </summary>
public const int MaxDatagramLength = 1500;
/// <summary>
/// The lock object used to synchronize access to the
/// UDP server
/// </summary>
private readonly object _lock = new object();
/// <summary>
/// The underlying socket used to send and receive
/// UDP datagrams
/// </summary>
private Socket _socket;
/// <summary>
/// The endpoint of the device being received
/// from
/// </summary>
private EndPoint _remoteEP;
/// <summary>
/// Callback to invoke when a receive operation completes
/// </summary>
private readonly AsyncCallback _receiveCallback;
/// <summary>
/// Callback to invoke when a send operation completes
/// </summary>
private readonly AsyncCallback _sendCallback;
/// <summary>
/// Callback to user code whenever a datagram is received
/// </summary>
private readonly DatagramReceivedDelegate _receiveDelegate;
/// <summary>
/// Constructs a new UDPAsyncServer instance
/// </summary>
/// <param name="ep">The IP endpoint to bind to</param>
/// <param name="receiveDelegate">Callback to user code whenever a datagram is received</param>
public UDPAsyncServer(IPEndPoint ep, DatagramReceivedDelegate receiveDelegate)
{
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
_socket.Bind(ep);
_receiveCallback = new AsyncCallback(_receiveComplete);
_sendCallback = new AsyncCallback(_sendComplete);
_receiveDelegate = receiveDelegate;
_receiveNext();
}
/// <summary>
/// Disposes of all resources held
/// by the UDPAsyncServer instance
/// </summary>
private void _disposeAll()
{
if(_socket != null)
{
_socket.Dispose();
_socket = null;
}
}
/// <summary>
/// Begins receiving the next UDP datagram
/// </summary>
/// <returns>The async result</returns>
private IAsyncResult _receiveNext()
{
_remoteEP = new IPEndPoint(IPAddress.Any, 0);
byte[] buffer = new byte[MaxDatagramLength];
return _socket.BeginReceiveFrom(
buffer,
0,
MaxDatagramLength,
SocketFlags.None,
ref _remoteEP,
_receiveCallback,
buffer);
}
/// <summary>
/// Called when an asynchronous receive operation completes
/// </summary>
/// <param name="result">The IAsyncResult of the asynchronous receive</param>
private void _receiveComplete(IAsyncResult result)
{
if (result.CompletedSynchronously)
return;
bool received = false;
IPEndPoint ep = null;
int length = 0;
byte[] buffer = (byte[])result.AsyncState;
Queue<IAsyncResult> queue = null;
while (result != null)
{
received = false;
lock(_lock)
{
if (_socket != null)
{
try
{
// complete this receive operation
length = _socket.EndReceiveFrom(result, ref _remoteEP);
ep = (IPEndPoint)_remoteEP;
// queue the next receive operation
IAsyncResult tempResult = _receiveNext();
if (tempResult.CompletedSynchronously)
{
if (queue == null)
queue = new Queue<IAsyncResult>();
queue.Enqueue(tempResult);
}
received = true;
}
catch (SocketException)
{
_disposeAll();
break;
}
}
}
if (received)
{
_receiveDelegate(ep, buffer, length);
}
result = (queue == null || queue.Count == 0) ? null : queue.Dequeue();
}
}
/// <summary>
/// Called when an asynchronous send operation completes
/// </summary>
/// <param name="result">The IAsyncResult instance</param>
private void _sendComplete(IAsyncResult result)
{
lock(_lock)
{
if(_socket != null)
{
try
{
_socket.EndSendTo(result);
}
catch(SocketException)
{
_disposeAll();
}
}
}
}
/// <summary>
/// Disposes the UDPAsyncServer instance
/// </summary>
public void Dispose()
{
lock (_lock)
{
_disposeAll();
}
}
/// <summary>
/// Sends a datagram
/// </summary>
/// <param name="ep">The IPEndPoint of the destination device</param>
/// <param name="buffer">The buffer containing the datagram to send</param>
/// <param name="length">The length of the datagram to send</param>
public void Send(IPEndPoint ep, byte[] buffer, int length)
{
lock(_lock)
{
_socket.BeginSendTo(buffer, 0, length, SocketFlags.None, ep, _sendCallback, null);
}
}
}
}
| 30.630332 | 103 | 0.480272 | [
"MIT"
] | LorenVS/bacstack | BACnet.IP/UDPAsyncServer.cs | 6,465 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using Tavis.UriTemplates;
using Xunit;
using Xunit.Extensions;
namespace UriTemplateTests
{
public class ParameterMatchingTests
{
[Fact]
public void MatchUriToTemplate()
{
var uri = new Uri("http://example.com/foo/bar");
var sTemplate = "http://example.com/{p1}/{p2}";
var x = UriTemplate.CreateMatchingRegex(sTemplate);
var match = Regex.IsMatch(uri.AbsoluteUri,x);
Assert.True(match);
}
[Fact]
public void GetParameters()
{
var uri = new Uri("http://example.com/foo/bar");
var sTemplate = "http://example.com/{p1}/{p2}";
var x = UriTemplate.CreateMatchingRegex(sTemplate);
var regex = new Regex(x);
var match = regex.Match(uri.AbsoluteUri);
Assert.Equal("foo",match.Groups["p1"].Value);
Assert.Equal("bar", match.Groups["p2"].Value);
}
[Fact]
public void GetParametersWithOperators()
{
var uri = new Uri("http://example.com/foo/bar");
var template = new UriTemplate("http://example.com/{+p1}/{p2*}");
var parameters = template.GetParameters(uri);
Assert.Equal(2, parameters.Count);
Assert.Equal("foo", parameters["p1"]);
Assert.Equal("bar", parameters["p2"]);
}
[Fact]
public void GetParametersFromQueryString()
{
var uri = new Uri("http://example.com/foo/bar?blur=45");
var template = new UriTemplate("http://example.com/{+p1}/{p2*}{?blur}");
var parameters = template.GetParameters(uri);
Assert.Equal(3, parameters.Count);
Assert.Equal("foo", parameters["p1"]);
Assert.Equal("bar", parameters["p2"]);
Assert.Equal("45", parameters["blur"]);
}
[Fact]
public void GetParametersFromMultipleQueryString()
{
var uri = new Uri("http://example.com/foo/bar?blur=45");
var template = new UriTemplate("http://example.com/{+p1}/{p2*}{?blur,blob}");
var parameters = template.GetParameters(uri);
Assert.Equal(3, parameters.Count);
Assert.Equal("foo", parameters["p1"]);
Assert.Equal("bar", parameters["p2"]);
Assert.Equal("45", parameters["blur"]);
}
[Fact]
public void GetParametersFromMultipleQueryStringWithTwoParamValues()
{
var uri = new Uri("http://example.com/foo/bar?blur=45&blob=23");
var template = new UriTemplate("http://example.com/{+p1}/{p2*}{?blur,blob}");
var parameters = template.GetParameters(uri);
Assert.Equal(4, parameters.Count);
Assert.Equal("foo", parameters["p1"]);
Assert.Equal("bar", parameters["p2"]);
Assert.Equal("45", parameters["blur"]);
Assert.Equal("23", parameters["blob"]);
}
[Fact]
public void GetParameterFromArrayParameter()
{
var uri = new Uri("http://example.com?blur=45,23");
var template = new UriTemplate("http://example.com{?blur}");
var parameters = template.GetParameters(uri);
Assert.Equal(1, parameters.Count);
Assert.Equal("45,23", parameters["blur"]);
}
[Fact]
public void GetParametersFromMultipleQueryStringWithOptionalAndMandatoryParameters()
{
var uri = new Uri("http://example.com/foo/bar?blur=45&blob=23");
var template = new UriTemplate("http://example.com/{+p1}/{p2*}{?blur}{&blob}");
var parameters = template.GetParameters(uri);
Assert.Equal(4, parameters.Count);
Assert.Equal("foo", parameters["p1"]);
Assert.Equal("bar", parameters["p2"]);
Assert.Equal("45", parameters["blur"]);
Assert.Equal("23", parameters["blob"]);
}
[Fact]
public void GetParametersFromMultipleQueryStringWithOptionalParameters()
{
var uri = new Uri("http://example.com/foo/bar");
var template = new UriTemplate("http://example.com/{+p1}/{p2*}{?blur,blob}");
var parameters = template.GetParameters(uri);
Assert.Equal("foo", parameters["p1"]);
Assert.Equal("bar", parameters["p2"]);
}
[Fact]
public void TestGlimpseUrl()
{
var uri = new Uri("http://example.com/Glimpse.axd?n=glimpse_ajax&parentRequestId=123232323&hash=23ADE34FAE&callback=http%3A%2F%2Fexample.com%2Fcallback");
var template = new UriTemplate("http://example.com/Glimpse.axd?n=glimpse_ajax&parentRequestId={parentRequestId}{&hash,callback}");
var parameters = template.GetParameters(uri);
Assert.Equal(3, parameters.Count);
Assert.Equal("123232323", parameters["parentRequestId"]);
Assert.Equal("23ADE34FAE", parameters["hash"]);
Assert.Equal("http://example.com/callback", parameters["callback"]);
}
[Fact]
public void TestUrlWithQuestionMarkAsFirstCharacter()
{
var parameters = new UriTemplate("?hash={hash}").GetParameters(new Uri("http://localhost:5000/glimpse/metadata?hash=123"));;
Assert.Equal(1, parameters.Count);
Assert.Equal("123", parameters["hash"]);
}
[Fact]
public void TestExactParameterCount()
{
var uri = new Uri("http://example.com/foo?bar=10");
var template = new UriTemplate("http://example.com/foo{?bar}");
var parameters = template.GetParameters(uri);
Assert.Equal(1, parameters.Count);
}
[Fact]
public void SimplePerfTest()
{
var uri = new Uri("http://example.com/Glimpse.axd?n=glimpse_ajax&parentRequestId=123232323&hash=23ADE34FAE&callback=http%3A%2F%2Fexample.com%2Fcallback");
var template = new UriTemplate("http://example.com/Glimpse.axd?n=glimpse_ajax&parentRequestId={parentRequestId}{&hash,callback}");
for (int i = 0; i < 100000; i++)
{
var parameters = template.GetParameters(uri);
}
}
[Fact]
public void Level1Decode()
{
var uri = new Uri("/Hello%20World", UriKind.RelativeOrAbsolute);
var template = new UriTemplate("/{p1}");
var parameters = template.GetParameters(uri);
Assert.Equal("Hello World", parameters["p1"]);
}
//[Fact]
//public void Level2Decode()
//{
// var uri = new Uri("/foo?path=Hello/World", UriKind.RelativeOrAbsolute);
// var template = new UriTemplate("/foo?path={+p1}");
// var parameters = template.GetParameters(uri);
// Assert.Equal("Hello/World", parameters["p1"]);
//}
[Fact]
public void FragmentParam()
{
var uri = new Uri("/foo#Hello%20World!", UriKind.RelativeOrAbsolute);
var template = new UriTemplate("/foo{#p1}");
var parameters = template.GetParameters(uri);
Assert.Equal("Hello World!", parameters["p1"]);
}
[Fact]
public void FragmentParams()
{
var uri = new Uri("/foo#Hello%20World!,blurg", UriKind.RelativeOrAbsolute);
var template = new UriTemplate("/foo{#p1,p2}");
var parameters = template.GetParameters(uri);
Assert.Equal("Hello World!", parameters["p1"]);
Assert.Equal("blurg", parameters["p2"]);
}
[Fact]
public void OptionalPathParam()
{
var uri = new Uri("/foo/yuck/bob", UriKind.RelativeOrAbsolute);
var template = new UriTemplate("/foo{/bar}/bob");
var parameters = template.GetParameters(uri);
Assert.Equal("yuck", parameters["bar"]);
}
[Fact]
public void OptionalPathParamWithMultipleValues()
{
var uri = new Uri("/foo/yuck/yob/bob", UriKind.RelativeOrAbsolute);
var template = new UriTemplate("/foo{/bar,baz}/bob");
var parameters = template.GetParameters(uri);
Assert.Equal(2, parameters.Count); // This current fails
Assert.Equal("yuck", parameters["bar"]);
Assert.Equal("yob", parameters["baz"]);
}
}
}
| 29.506757 | 166 | 0.562056 | [
"Apache-2.0"
] | augustoproiete-forks/tavis-software--Tavis.UriTemplates | src/UriTemplateTests/ParameterMatchingTests.cs | 8,736 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using Microsoft.AspNetCore.JsonPatch.Operations;
namespace Microsoft.AspNetCore.JsonPatch.Exceptions;
public class JsonPatchException : Exception
{
public Operation FailedOperation { get; private set; }
public object AffectedObject { get; private set; }
public JsonPatchException()
{
}
public JsonPatchException(JsonPatchError jsonPatchError, Exception innerException)
: base(jsonPatchError.ErrorMessage, innerException)
{
FailedOperation = jsonPatchError.Operation;
AffectedObject = jsonPatchError.AffectedObject;
}
public JsonPatchException(JsonPatchError jsonPatchError)
: this(jsonPatchError, null)
{
}
public JsonPatchException(string message, Exception innerException)
: base(message, innerException)
{
}
}
| 27.571429 | 86 | 0.733679 | [
"MIT"
] | 3ejki/aspnetcore | src/Features/JsonPatch/src/Exceptions/JsonPatchException.cs | 965 | C# |
using System.Runtime.CompilerServices;
using Xamarin.Forms;
using Xamarin.Forms.Internals;
using Xamarin.Forms.Platform.Android;
// These renderers are now registered via the RenderWithAttribute in the Android Forwarders project.
// Note that AppCompat and FastRenderers are also registered conditionally in FormsAppCompatActivity.LoadApplication
#if ROOT_RENDERERS
[assembly: ExportRenderer (typeof (BoxView), typeof (BoxRenderer))]
[assembly: ExportRenderer (typeof (Entry), typeof (EntryRenderer))]
[assembly: ExportRenderer (typeof (Editor), typeof (EditorRenderer))]
[assembly: ExportRenderer (typeof (Label), typeof (LabelRenderer))]
[assembly: ExportRenderer (typeof (Image), typeof (ImageRenderer))]
[assembly: ExportRenderer (typeof (Button), typeof (ButtonRenderer))]
[assembly: ExportRenderer (typeof (ImageButton), typeof (ImageButtonRenderer))]
[assembly: ExportRenderer (typeof (TableView), typeof (TableViewRenderer))]
[assembly: ExportRenderer (typeof (ListView), typeof (ListViewRenderer))]
[assembly: ExportRenderer (typeof (CollectionView), typeof (CollectionViewRenderer))]
[assembly: ExportRenderer (typeof (CarouselView), typeof (CarouselViewRenderer))]
[assembly: ExportRenderer (typeof (Slider), typeof (SliderRenderer))]
[assembly: ExportRenderer (typeof (WebView), typeof (WebViewRenderer))]
[assembly: ExportRenderer (typeof (SearchBar), typeof (SearchBarRenderer))]
[assembly: ExportRenderer (typeof (Switch), typeof (SwitchRenderer))]
[assembly: ExportRenderer (typeof (DatePicker), typeof (DatePickerRenderer))]
[assembly: ExportRenderer (typeof (TimePicker), typeof (TimePickerRenderer))]
[assembly: ExportRenderer (typeof (Picker), typeof (PickerRenderer))]
[assembly: ExportRenderer (typeof (Stepper), typeof (StepperRenderer))]
[assembly: ExportRenderer (typeof (ProgressBar), typeof (ProgressBarRenderer))]
[assembly: ExportRenderer (typeof (ScrollView), typeof (ScrollViewRenderer))]
[assembly: ExportRenderer (typeof (ActivityIndicator), typeof (ActivityIndicatorRenderer))]
[assembly: ExportRenderer (typeof (Frame), typeof (FrameRenderer))]
[assembly: ExportRenderer (typeof (OpenGLView), typeof (OpenGLViewRenderer))]
[assembly: ExportRenderer (typeof (TabbedPage), typeof (TabbedRenderer))]
[assembly: ExportRenderer (typeof (NavigationPage), typeof (NavigationRenderer))]
[assembly: ExportRenderer (typeof (CarouselPage), typeof (CarouselPageRenderer))]
[assembly: ExportRenderer (typeof (Page), typeof (PageRenderer))]
[assembly: ExportRenderer (typeof (MasterDetailPage), typeof (MasterDetailRenderer))]
#endif
[assembly: ExportRenderer(typeof(Shell), typeof(ShellRenderer))]
[assembly: ExportRenderer(typeof(NativeViewWrapper), typeof(NativeViewWrapperRenderer))]
[assembly: ExportCell(typeof(Cell), typeof(CellRenderer))]
[assembly: ExportCell(typeof(EntryCell), typeof(EntryCellRenderer))]
[assembly: ExportCell(typeof(SwitchCell), typeof(SwitchCellRenderer))]
[assembly: ExportCell(typeof(TextCell), typeof(TextCellRenderer))]
[assembly: ExportCell(typeof(ImageCell), typeof(ImageCellRenderer))]
[assembly: ExportCell(typeof(ViewCell), typeof(ViewCellRenderer))]
[assembly: ExportImageSourceHandler(typeof(FileImageSource), typeof(FileImageSourceHandler))]
[assembly: ExportImageSourceHandler(typeof(StreamImageSource), typeof(StreamImagesourceHandler))]
[assembly: ExportImageSourceHandler(typeof(UriImageSource), typeof(ImageLoaderSourceHandler))]
[assembly: ExportImageSourceHandler(typeof(FontImageSource), typeof(FontImageSourceHandler))]
[assembly: Xamarin.Forms.Dependency(typeof(Deserializer))]
[assembly: Xamarin.Forms.Dependency(typeof(ResourcesProvider))]
[assembly: Preserve]
[assembly: InternalsVisibleTo("Xamarin.Forms.Platform")]
[assembly: InternalsVisibleTo("Xamarin.Forms.Material")] | 64.706897 | 116 | 0.805755 | [
"MIT"
] | puppetSpace/Xamarin.Forms | Xamarin.Forms.Platform.Android/Properties/AssemblyInfo.cs | 3,753 | C# |
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
using Google.Api.Gax;
using Google.Api.Gax.Rest;
using Google.Apis.Bigquery.v2;
using Google.Apis.Bigquery.v2.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Google.Cloud.BigQuery.V2
{
public partial class BigQueryClientImpl
{
private sealed class TableRowPageManager : IPageManager<TabledataResource.ListRequest, TableDataList, BigQueryRow>
{
private readonly BigQueryClient _client;
private readonly TableSchema _schema;
private readonly Dictionary<string, int> _fieldNameToIndexMap;
internal TableRowPageManager(BigQueryClient client, TableSchema schema)
{
_client = client;
_schema = schema;
_fieldNameToIndexMap = schema.IndexFieldNames();
}
public string GetNextPageToken(TableDataList response) => response.PageToken;
public IEnumerable<BigQueryRow> GetResources(TableDataList response) => response.Rows?.Select(row => new BigQueryRow(row, _schema, _fieldNameToIndexMap));
public void SetPageSize(TabledataResource.ListRequest request, int pageSize) => request.MaxResults = pageSize;
public void SetPageToken(TabledataResource.ListRequest request, string pageToken)
{
// If there's a non-null StartIndex, the page token is ignored, so we'd get the same page again.
request.StartIndex = null;
request.PageToken = pageToken;
}
}
/// <inheritdoc />
public override BigQueryJob CreateQueryJob(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions options = null)
{
var request = CreateInsertQueryJobRequest(sql, parameters, options);
var job = request.Execute();
return new BigQueryJob(this, job);
}
/// <inheritdoc />
public override async Task<BigQueryJob> CreateQueryJobAsync(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions options = null, CancellationToken cancellationToken = default)
{
var request = CreateInsertQueryJobRequest(sql, parameters, options);
var job = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false);
return new BigQueryJob(this, job);
}
/// <inheritdoc />
public override BigQueryResults GetQueryResults(JobReference jobReference, GetQueryResultsOptions options = null)
{
GaxPreconditions.CheckNotNull(jobReference, nameof(jobReference));
var job = GetJob(jobReference);
return job.GetQueryResults(options);
}
internal override BigQueryResults GetQueryResults(JobReference jobReference, TableReference tableReference, GetQueryResultsOptions options)
{
GaxPreconditions.CheckNotNull(jobReference, nameof(jobReference));
GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
// This validates the options before we make any RPCs
var listRowsOptions = options?.ToListRowsOptions();
DateTime start = Clock.GetCurrentDateTimeUtc();
while (true)
{
// This will throw if the query has timed out.
var request = CreateGetQueryResultsRequest(jobReference, options, start);
var response = request.Execute();
if (response.JobComplete == true)
{
return new BigQueryResults(this, response, tableReference, listRowsOptions);
}
}
}
/// <inheritdoc />
public override async Task<BigQueryResults> GetQueryResultsAsync(JobReference jobReference, GetQueryResultsOptions options = null, CancellationToken cancellationToken = default)
{
GaxPreconditions.CheckNotNull(jobReference, nameof(jobReference));
var job = await GetJobAsync(jobReference, cancellationToken: cancellationToken).ConfigureAwait(false);
return await job.GetQueryResultsAsync(options, cancellationToken).ConfigureAwait(false);
}
internal override async Task<BigQueryResults> GetQueryResultsAsync(JobReference jobReference, TableReference tableReference, GetQueryResultsOptions options, CancellationToken cancellationToken)
{
GaxPreconditions.CheckNotNull(jobReference, nameof(jobReference));
GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
// This validates the options before we make any RPCs
var listRowsOptions = options?.ToListRowsOptions();
DateTime start = Clock.GetCurrentDateTimeUtc();
while (true)
{
// This will throw if the query has timed out.
var request = CreateGetQueryResultsRequest(jobReference, options, start);
var response = await request.ExecuteAsync(cancellationToken).ConfigureAwait(false);
if (response.JobComplete == true)
{
return new BigQueryResults(this, response, tableReference, listRowsOptions);
}
}
}
/// <inheritdoc />
public override PagedEnumerable<TableDataList, BigQueryRow> ListRows(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
{
GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
schema = schema ?? GetSchema(tableReference);
var pageManager = new TableRowPageManager(this, schema);
return new RestPagedEnumerable<TabledataResource.ListRequest, TableDataList, BigQueryRow>(
() => CreateListRequest(tableReference, options), pageManager);
}
/// <inheritdoc />
public override PagedAsyncEnumerable<TableDataList, BigQueryRow> ListRowsAsync(TableReference tableReference, TableSchema schema = null, ListRowsOptions options = null)
{
GaxPreconditions.CheckNotNull(tableReference, nameof(tableReference));
// TODO: This is a synchronous call. We can't easily make this part asynchronous - we don't have a cancellation token, and we're returning
// a non-task value. We could defer until the first MoveNext call, but that's tricky.
schema = schema ?? GetSchema(tableReference);
var pageManager = new TableRowPageManager(this, schema);
return new RestPagedAsyncEnumerable<TabledataResource.ListRequest, TableDataList, BigQueryRow>(
() => CreateListRequest(tableReference, options), pageManager);
}
// Request creation
private JobsResource.InsertRequest CreateInsertQueryJobRequest(JobConfigurationQuery query, QueryOptions options)
{
options?.ModifyRequest(query);
return CreateInsertJobRequest(new JobConfiguration { Query = query, DryRun = options?.DryRun }, options);
}
private JobsResource.InsertRequest CreateInsertQueryJobRequest(string sql, IEnumerable<BigQueryParameter> parameters, QueryOptions options)
{
GaxPreconditions.CheckNotNull(sql, nameof(sql));
if (parameters != null)
{
parameters = parameters.ToList();
GaxPreconditions.CheckArgument(!parameters.Contains(null), nameof(parameters), "Parameter list must not contain null elements");
}
var jobConfigurationQuery = new JobConfigurationQuery
{
Query = sql,
UseLegacySql = false,
ParameterMode = "named",
QueryParameters = parameters?.Select(p => p.ToQueryParameter()).ToList()
};
options?.ModifyRequest(jobConfigurationQuery);
// If there aren't any parameters, set ParameterMode to null - otherwise legacy SQL queries fail,
// even if haven't set any parameters.
if (parameters == null)
{
jobConfigurationQuery.ParameterMode = null;
}
// Now we've definitely set the parameter mode, validate that all parameters have names if appropriate.
if (jobConfigurationQuery.ParameterMode == "named")
{
GaxPreconditions.CheckArgument(parameters.All(p => !string.IsNullOrEmpty(p.Name)), nameof(parameters),
$"When using a parameter mode of '{nameof(BigQueryParameterMode.Named)}', all parameters must have names");
}
return CreateInsertJobRequest(new JobConfiguration { Query = jobConfigurationQuery, DryRun = options?.DryRun }, options);
}
private TabledataResource.ListRequest CreateListRequest(TableReference tableReference, ListRowsOptions options)
{
var request = Service.Tabledata.List(tableReference.ProjectId, tableReference.DatasetId, tableReference.TableId);
request.ModifyRequest += _versionHeaderAction;
options?.ModifyRequest(request);
RetryHandler.MarkAsRetriable(request);
return request;
}
private static readonly long s_maxGetQueryResultsRequestTimeout = (long) TimeSpan.FromMinutes(1).TotalMilliseconds;
private JobsResource.GetQueryResultsRequest CreateGetQueryResultsRequest(JobReference jobReference, GetQueryResultsOptions options, DateTime loopStart)
{
var timeSoFar = Clock.GetCurrentDateTimeUtc() - loopStart;
var timeout = options?.Timeout ?? GetQueryResultsOptions.DefaultTimeout;
var timeRemainingMs = (long) (timeout - timeSoFar).TotalMilliseconds;
if (timeRemainingMs < 1)
{
// TODO: Check this is correct
throw new TimeoutException("Query timed out");
}
var requestTimeoutMs = Math.Min(timeRemainingMs, s_maxGetQueryResultsRequestTimeout);
var request = Service.Jobs.GetQueryResults(jobReference.ProjectId, jobReference.JobId);
// We never use the results within the first response; instead, we're just checking that the job has
// completed and using the statistics and schema from it.
request.MaxResults = 0;
request.ModifyRequest += _versionHeaderAction;
request.TimeoutMs = requestTimeoutMs;
options?.ModifyRequest(request);
RetryHandler.MarkAsRetriable(request);
return request;
}
}
}
| 51.35 | 201 | 0.663539 | [
"Apache-2.0"
] | chrisdunelm/gcloud-dotnet | apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2/BigQueryClientImpl.Queries.cs | 11,299 | C# |
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Globalization;
namespace Microsoft.NodejsTools.Npm
{
/// <summary>
/// Fired when an attempt to execute an npm command is completed, whether
/// successfully or not.
/// </summary>
public class NpmCommandCompletedEventArgs : EventArgs
{
public NpmCommandCompletedEventArgs(string arguments, bool withErrors, bool cancelled)
{
this.Arguments = arguments;
this.WithErrors = withErrors;
this.Cancelled = cancelled;
}
public string Arguments { get; }
public string CommandText
{
get { return string.IsNullOrEmpty(this.Arguments) ? "npm" : string.Format(CultureInfo.InvariantCulture, "npm {0}", this.Arguments); }
}
/// <summary>
/// Indicates whether or not there were errors whilst executing npm.
/// </summary>
public bool WithErrors { get; }
/// <summary>
/// Indicates whether or not the command was cancelled, with or without errors.
/// </summary>
public bool Cancelled { get; }
}
}
| 33.666667 | 161 | 0.614623 | [
"Apache-2.0"
] | Abd-Elrazek/nodejstools | Nodejs/Product/Npm/NpmCommandCompletedEventArgs.cs | 1,275 | C# |
namespace Unicorn.Internal
{
internal enum uc_arch
{
// From unicorn.h
UC_ARCH_ARM = 1, // ARM architecture (including Thumb, Thumb-2)
UC_ARCH_ARM64, // ARM-64, also called AArch64
UC_ARCH_MIPS, // Mips architecture
UC_ARCH_X86, // X86 architecture (including x86 & x86-64)
UC_ARCH_PPC, // PowerPC architecture (currently unsupported)
UC_ARCH_SPARC, // Sparc architecture
UC_ARCH_M68K, // M68K architecture
UC_ARCH_MAX
}
}
| 33.176471 | 76 | 0.579787 | [
"MIT"
] | ElektroKill/unicorn-net | src/Unicorn.Net/Internal/uc_arch.cs | 566 | C# |
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
namespace AnimeSearch.Models
{
public class TheMovieDBResult : Result
{
private TheMovieDBGenres[] genres_tmp = null;
public int Id { get => id; set => this.SetId(value); }
public string Name { get => name; set => this.SetName(value); }
public string Title { get => name; set => this.SetName(value); }
public CultureInfo Original_language { get => language; set => SetLanguage(value); }
public string Original_title { get => GetOtherName(); set => AddOtherName(value); }
public string Original_Name { get => GetOtherName(); set => AddOtherName(value); }
public string Media_type { get => type; set => this.SetTypeResult(value); }
public Dictionary<CultureInfo, List<string>> OthersName { get => this.otherNames; }
public DateTime? Release_date { get => realeaseDate; set => SetRealeaseDate(value); }
public DateTime? First_air_date { get => realeaseDate; set => SetRealeaseDate(value); }
public Uri Poster_path { get => image;
set => SetImage(value == null ? null : new Uri((value.ToString().StartsWith(Utilities.BASE_URL_IMAGE_TMDB) ? "" : Utilities.BASE_URL_IMAGE_TMDB) + value.OriginalString)); }
public bool Adult { get; set; }
public int[] Genre_ids
{
get => null; set
{
if(value != null && value.Length > 0)
{
TheMovieDBGenres[] genres = Utilities.TMBD_GENRES.Where(p => value.Contains(p.Id)).ToArray();
genres_tmp = genres;
AddGenre(genres.Select(p => p.Name).ToArray());
}
}
}
public TheMovieDBGenres[] Genres
{
get => genres_tmp; set
{
genres_tmp = value;
if (value == null)
return;
string[] genres = new string[value.Length];
for (int i = 0; i < value.Length; i++)
if(value[i].Name != null)
genres[i] = value[i].Name;
AddGenre(genres);
}
}
public Uri Url { get => url; set => SetUrl(value); }
public string Status { get => GetStatus(); set => SetStatus(value); }
private string keyWords = null;
private readonly Task keyWordTask;
public TheMovieDBResult()
{
keyWordTask = Task.Run(async () =>
{
await Task.Delay(100);
var val = await Utilities.GetAndDeserialiseAnonymousFromUrl("https://api.themoviedb.org/3/" + Media_type + "/" + Id + "/keywords?api_key=" + Utilities.MOVIEDB_API_KEY, new
{
id = 0,
results = Array.Empty<Dictionary<string, object>>(),
keywords = Array.Empty<Dictionary<string, object>>()
});
if (val != null && (val.results != null || val.keywords != null))
{
keyWords = string.Join(",", (val.results ?? val.keywords).Select(dic => dic.GetValueOrDefault("name")).Where(str => str != null)).ToLowerInvariant();
if (keyWords.Contains("hentai"))
{
if (!GetGenres().Contains("hentai"))
AddGenre("hentai");
}
}
});
}
public bool IsHentai()
{
if (keyWords == null)
keyWordTask.Wait();
var genres = GetGenres();
if (genres != null && genres.Contains("hentai"))
return true;
return Adult && IsAnime();
}
public bool IsFilmAnimation()
{
var genres = GetGenres();
return IsFilm() && genres != null && genres.Contains("Animation");
}
}
}
| 35.025641 | 187 | 0.52123 | [
"MIT"
] | Dim145/AnimeSearch | AnimeSearch/Models/TheMovieDBResult.cs | 4,100 | C# |
// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------------------------------------------------------------
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Microsoft Azure Powershell - Resource Manager")]
[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)]
[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)]
[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)]
[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]
[assembly: Guid("e386b843-f3f0-4db3-8664-37d16b860dde")]
[assembly: AssemblyVersion("1.3.0")]
[assembly: AssemblyFileVersion("1.3.0")]
#if !SIGN
[assembly: InternalsVisibleTo("Microsoft.Azure.PowerShell.Cmdlets.Resources.Test")]
#endif
| 47.969697 | 104 | 0.695515 | [
"MIT"
] | AzPsTest/azure-powershell | src/Resources/Resources/Properties/AssemblyInfo.cs | 1,551 | C# |
#region license
// Copyright (c) 2007-2010 Mauricio Scheffer
//
// 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;
using System.IO;
using System.Reflection;
using System.Text;
using System.Xml.Linq;
namespace SolrNet.Tests.Utils {
public class EmbeddedResource {
/// <summary>
/// Extracts an embedded file out of a given assembly.
/// </summary>
/// <param name="assemblyName">The namespace of you assembly.</param>
/// <param name="fileName">The name of the file to extract.</param>
/// <returns>A stream containing the file data.</returns>
public static Stream GetEmbeddedFile(string assemblyName, string fileName) {
try {
Assembly a = Assembly.Load(assemblyName);
Stream str = a.GetManifestResourceStream(assemblyName + "." + fileName);
if (str == null)
throw new Exception("Could not locate embedded resource '" + fileName + "' in assembly '" + assemblyName + "'");
return str;
} catch (Exception e) {
throw new Exception(assemblyName + ": " + e.Message);
}
}
/// <summary>
/// Extracts an embedded resource as a Stream.
/// </summary>
/// <param name="assembly">The assembly containing the resouce.</param>
/// <param name="fileName">The name of the resource.</param>
/// <returns>A Stream with the contents of the embedded resource.</returns>
public static Stream GetEmbeddedFile(Assembly assembly, string fileName) {
string assemblyName = assembly.GetName().Name;
return GetEmbeddedFile(assemblyName, fileName);
}
/// <summary>
/// Extracts an embedded resource as a Stream.
/// </summary>
/// <param name="type">A type contained in the assembly containing the resource.</param>
/// <param name="fileName">The name of the resource.</param>
/// <returns>A Stream with the contents of the embedded resource.</returns>
public static Stream GetEmbeddedFile(Type type, string fileName) {
string assemblyName = type.Assembly.GetName().Name;
return GetEmbeddedFile(assemblyName, fileName);
}
/// <summary>
/// Extracts an embedded resource as a string.
/// </summary>
/// <param name="type">A type contained in the assembly containing the resource.</param>
/// <param name="fileName">The name of the resource.</param>
/// <returns>A string with the contents of the embedded resource.</returns>
public static string GetEmbeddedString(Type type, string fileName) {
using (var s = GetEmbeddedFile(type, fileName))
using (var sr = new StreamReader(s, Encoding.UTF8))
return sr.ReadToEnd();
}
/// <summary>
/// Extracts an XmlDocument out of a embedded resource.
/// </summary>
/// <param name="type">A type contained in the assembly containing the resource.</param>
/// <param name="fileName">The name of the resource</param>
/// <returns>An XmlDocument with the contents of the embedded resource.</returns>
public static XDocument GetEmbeddedXml(Type type, string fileName) {
using (Stream str = GetEmbeddedFile(type, fileName))
using (var sr = new StreamReader(str))
return XDocument.Load(sr);
}
}
} | 43.554348 | 132 | 0.631645 | [
"Apache-2.0"
] | 071300726/SN | SolrNet.Tests/Utils/EmbeddedResource.cs | 4,009 | C# |
using System;
using System.Collections.Generic;
using System.Text;
namespace BonusCalcListener.Domain
{
public static class PayElementTypeIds
{
public const int Reactive = 301;
public const int Overtime = 401;
public const int OutOfHours = 501;
}
}
| 20.428571 | 42 | 0.692308 | [
"MIT"
] | LBHackney-IT/bonuscalc-listener | BonusCalcListener/Domain/PayElementTypeIds.cs | 286 | C# |
namespace Machete.X12Schema.V5010.Maps
{
using X12;
using X12.Configuration;
public class R4Map :
X12SegmentMap<R4, X12Entity>
{
public R4Map()
{
Id = "V1";
Name = "Vessel Identification";
Value(x => x.PortOrTerminalFunctionCode, 1, x => x.FixedLength(1));
Value(x => x.LocationQualifier, 2, x => x.MinLength(1).MaxLength(2));
Value(x => x.LocationIdentifier, 3, x => x.MinLength(1).MaxLength(30));
Value(x => x.PortName, 4, x => x.MinLength(2).MaxLength(24));
Value(x => x.CountryCode, 5, x => x.MinLength(2).MaxLength(3));
Value(x => x.TerminalName, 6, x => x.MinLength(2).MaxLength(30));
Value(x => x.PierNumber, 7, x => x.MinLength(1).MaxLength(4));
Value(x => x.StateOrProvinceCode, 8, x => x.FixedLength(2));
}
}
} | 36.28 | 83 | 0.540243 | [
"Apache-2.0"
] | ahives/Machete | src/Machete.X12Schema/V5010/Segments/Maps/R4Map.cs | 907 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace WebApi.Entities
{
public partial class PostcodeAvailableDate
{
[Key]
[Column("id")]
public int Id { get; set; }
[StringLength(10)]
public string Postcode { get; set; }
[Column(TypeName = "date")]
public DateTime? AvailableDeliveryDate { get; set; }
public bool? DoesServiceProvide { get; set; }
public int? ServiceLevel { get; set; }
}
}
| 27.571429 | 60 | 0.649396 | [
"MIT"
] | uskudaristanbul/aspnet-core-3-signup-verification-api | Entities/PostcodeAvailableDate.cs | 581 | C# |
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Options;
using Serilog;
using ServiceComponents.Api.Mediator;
namespace ServiceComponents.AspNet.Http
{
public class HttpQueryReceiverCorrelationBehavior : HttpReceiverCorrelationBehavior, IReceiveHttpQuery
{
private readonly IReceiveHttpQuery _next;
public HttpQueryReceiverCorrelationBehavior(ILogger log, IHttpContextAccessor httpContextAccessor, IOptions<HttpRequestOptions> httpRequestOptions, Infrastructure.CorrelationContext.Correlation correlation, IReceiveHttpQuery next)
: base(log, httpContextAccessor, httpRequestOptions, correlation)
{
_next = next;
}
public async Task<TResult> ReceiveAsync<TResult>(IQuery<TResult> query, CancellationToken cancellationToken = default)
{
UpdateCorrelation(query.QueryId);
return await _next.ReceiveAsync(query, cancellationToken);
}
}
}
| 36.5 | 239 | 0.753425 | [
"MIT"
] | davidsarkany/servicecomponents | src/ServiceComponents.AspNet/Http/HttpQueryReceiverCorrelationBehavior.cs | 1,024 | C# |
using System;
using DefaultEcs.Internal.Serialization;
using DefaultEcs.Internal.Serialization.TextSerializer;
using DefaultEcs.Internal.Serialization.TextSerializer.ConverterAction;
namespace DefaultEcs.Serialization
{
/// <summary>
/// Represents a context used by the <see cref="TextSerializer"/> to convert types during serialization and deserialization operations.
/// </summary>
public sealed class TextSerializationContext : IDisposable
{
#region Types
private sealed class MarshalComponentOperation<TIn, TOut> : TextSerializer.IComponentOperation
{
#region Fields
private readonly Func<TIn, TOut> _converter;
#endregion
#region Initialisation
public MarshalComponentOperation(Func<TIn, TOut> converter)
{
_converter = converter;
}
#endregion
#region IOperation
public void SetMaxCapacity(World world, int maxCapacity) => world.SetMaxCapacity<TOut>(maxCapacity);
public void Set(World world, StreamReaderWrapper reader) => world.Set(_converter(Converter<TIn>.Read(reader)));
public void Set(in Entity entity, StreamReaderWrapper reader) => entity.Set(_converter(Converter<TIn>.Read(reader)));
public void SetSameAs(in Entity entity, in Entity reference) => entity.SetSameAs<TOut>(reference);
public void SetSameAsWorld(in Entity entity) => entity.SetSameAsWorld<TOut>();
public void SetDisabled(in Entity entity, StreamReaderWrapper reader)
{
Set(entity, reader);
entity.Disable<TOut>();
}
public void SetDisabledSameAs(in Entity entity, in Entity reference)
{
SetSameAs(entity, reference);
entity.Disable<TOut>();
}
public void SetDisabledSameAsWorld(in Entity entity)
{
SetSameAsWorld(entity);
entity.Disable<TOut>();
}
public TextSerializer.IComponentOperation ApplyContext(TextSerializationContext context) => this;
#endregion
}
#endregion
#region Fields
private readonly int _id;
internal string TypeMarshalling;
#endregion
#region Initialisation
/// <summary>
/// Initializes a new instance of the <see cref="TextSerializationContext"/> class.
/// </summary>
public TextSerializationContext()
{
_id = SerializationContext.GetId();
}
#endregion
#region Methods
internal Action<ComponentTypeWriter, int, bool> GetWorldWrite<T>() => _id < SerializationContext<T>.Actions.Length ? SerializationContext<T>.Actions[_id].WorldWrite as Action<ComponentTypeWriter, int, bool> : null;
internal Action<EntityWriter, T, Entity, bool> GetEntityWrite<T>() => _id < SerializationContext<T>.Actions.Length ? SerializationContext<T>.Actions[_id].EntityWrite as Action<EntityWriter, T, Entity, bool> : null;
internal WriteAction<T> GetValueWrite<T>() => _id < SerializationContext<T>.Actions.Length ? SerializationContext<T>.Actions[_id].ValueWrite as WriteAction<T> : null;
internal ReadAction<TOut> GetValueRead<TIn, TOut>() => _id < SerializationContext<TIn>.Actions.Length ? SerializationContext<TIn>.Actions[_id].ValueRead as ReadAction<TOut> : null;
internal TextSerializer.IComponentOperation GetComponentOperation<TIn>() => _id < SerializationContext<TIn>.Actions.Length ? SerializationContext<TIn>.Actions[_id].ComponentRead as TextSerializer.IComponentOperation : null;
/// <summary>
/// Adds a convertion between the type <typeparamref name="TIn"/> and the type <typeparamref name="TOut"/> during a serialization operation.
/// </summary>
/// <typeparam name="TIn">The type which need to be converted.</typeparam>
/// <typeparam name="TOut">The resulting type of the conversion.</typeparam>
/// <param name="converter">The function used for the conversion.</param>
/// <returns>Returns itself.</returns>
public TextSerializationContext Marshal<TIn, TOut>(Func<TIn, TOut> converter)
{
if (converter is null)
{
SerializationContext<TIn>.SetWriteActions(_id, null, null, null);
}
else
{
SerializationContext<TIn>.SetWriteActions(
_id,
new Action<ComponentTypeWriter, int, bool>((writer, maxCapacity, hasComponent) => writer.WriteComponent(maxCapacity, hasComponent, w => converter(w.Get<TIn>()))),
new Action<EntityWriter, TIn, Entity, bool>((writer, value, owner, isEnabled) => writer.WriteComponent(converter(value), owner, isEnabled)),
new WriteAction<TIn>((StreamWriterWrapper writer, in TIn value) =>
{
writer.WriteTypeMarshalling(TypeNames.Get(typeof(TOut)));
writer.WriteValue(converter(value));
}));
}
return this;
}
/// <summary>
/// Adds a convertion between the type <typeparamref name="TIn"/> and the type <typeparamref name="TOut"/> during a deserialization operation.
/// </summary>
/// <typeparam name="TIn">The type which need to be converted.</typeparam>
/// <typeparam name="TOut">The resulting type of the conversion.</typeparam>
/// <param name="converter">The function used for the conversion.</param>
/// <returns>Returns itself.</returns>
public TextSerializationContext Unmarshal<TIn, TOut>(Func<TIn, TOut> converter)
{
if (converter is null)
{
SerializationContext<TIn>.SetReadActions(_id, null, null);
}
else
{
SerializationContext<TIn>.SetReadActions(
_id,
new MarshalComponentOperation<TIn, TOut>(converter),
new ReadAction<TOut>((StreamReaderWrapper reader) => converter(reader.ReadValue<TIn>())));
}
return this;
}
#endregion
#region IDisposable
/// <summary>
/// Releases inner resources.
/// </summary>
public void Dispose()
{
SerializationContext.ReleaseId(_id);
GC.SuppressFinalize(this);
}
#endregion
}
}
| 38.789474 | 231 | 0.615106 | [
"MIT-0"
] | DagobertDev/DefaultEcs | source/DefaultEcs/Serialization/TextSerializationContext.cs | 6,635 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace CodePooper.iOS
{
// The UIApplicationDelegate for the application. This class is responsible for launching the
// User Interface of the application, as well as listening (and optionally responding) to
// application events from iOS.
[Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{
//
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
//
// You have 17 seconds to return from this method, or iOS will terminate your application.
//
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new CodePooper.App());
return base.FinishedLaunching(app, options);
}
}
}
| 34.75 | 98 | 0.679856 | [
"MIT"
] | willbuildapps/talks | azuretechnights/cosmos/demo/CodePooper/CodePooper.iOS/AppDelegate.cs | 1,114 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
/******************************************************************************
* This file is auto-generated from a template file by the GenerateTests.csx *
* script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make *
* changes, please update the corresponding template and run according to the *
* directions listed in the file. *
******************************************************************************/
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.Arm;
namespace JIT.HardwareIntrinsics.Arm
{
public static partial class Program
{
private static void StoreSelectedScalar_Vector128_Byte_15()
{
var test = new StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15();
if (test.IsSupported)
{
// Validates basic functionality works, using Unsafe.Read
test.RunBasicScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates basic functionality works, using Load
test.RunBasicScenario_Load();
}
// Validates calling via reflection works, using Unsafe.Read
test.RunReflectionScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates calling via reflection works, using Load
test.RunReflectionScenario_Load();
}
// Validates passing a static member works
test.RunClsVarScenario();
if (AdvSimd.IsSupported)
{
// Validates passing a static member works, using pinning and Load
test.RunClsVarScenario_Load();
}
// Validates passing a local works, using Unsafe.Read
test.RunLclVarScenario_UnsafeRead();
if (AdvSimd.IsSupported)
{
// Validates passing a local works, using Load
test.RunLclVarScenario_Load();
}
// Validates passing the field of a local class works
test.RunClassLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local class works, using pinning and Load
test.RunClassLclFldScenario_Load();
}
// Validates passing an instance member of a class works
test.RunClassFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a class works, using pinning and Load
test.RunClassFldScenario_Load();
}
// Validates passing the field of a local struct works
test.RunStructLclFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing the field of a local struct works, using pinning and Load
test.RunStructLclFldScenario_Load();
}
// Validates passing an instance member of a struct works
test.RunStructFldScenario();
if (AdvSimd.IsSupported)
{
// Validates passing an instance member of a struct works, using pinning and Load
test.RunStructFldScenario_Load();
}
}
else
{
// Validates we throw on unsupported hardware
test.RunUnsupportedScenario();
}
if (!test.Succeeded)
{
throw new Exception("One or more scenarios did not complete as expected.");
}
}
}
public sealed unsafe class StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15
{
private struct DataTable
{
private byte[] inArray1;
private byte[] outArray;
private GCHandle inHandle1;
private GCHandle outHandle;
private ulong alignment;
public DataTable(Byte[] inArray1, Byte[] outArray, int alignment)
{
int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Byte>();
int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Byte>();
if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray)
{
throw new ArgumentException("Invalid value of alignment");
}
this.inArray1 = new byte[alignment * 2];
this.outArray = new byte[alignment * 2];
this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned);
this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned);
this.alignment = (ulong)alignment;
Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Byte, byte>(ref inArray1[0]), (uint)sizeOfinArray1);
}
public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment);
public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment);
public void Dispose()
{
inHandle1.Free();
outHandle.Free();
}
private static unsafe void* Align(byte* buffer, ulong expectedAlignment)
{
return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1));
}
}
private struct TestStruct
{
public Vector128<Byte> _fld1;
public static TestStruct Create()
{
var testStruct = new TestStruct();
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
return testStruct;
}
public void RunStructFldScenario(StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15 testClass)
{
AdvSimd.StoreSelectedScalar((Byte*)testClass._dataTable.outArrayPtr, _fld1, 15);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
public void RunStructFldScenario_Load(StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15 testClass)
{
fixed (Vector128<Byte>* pFld1 = &_fld1)
{
AdvSimd.StoreSelectedScalar((Byte*)testClass._dataTable.outArrayPtr, AdvSimd.LoadVector128((Byte*)(pFld1)), 15);
testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr);
}
}
}
private static readonly int LargestVectorSize = 16;
private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte);
private static readonly int RetElementCount = 1;
private static readonly byte ElementIndex = 15;
private static Byte[] _data1 = new Byte[Op1ElementCount];
private static Vector128<Byte> _clsVar1;
private Vector128<Byte> _fld1;
private DataTable _dataTable;
static StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15()
{
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
}
public StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15()
{
Succeeded = true;
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); }
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Byte>>());
for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); }
_dataTable = new DataTable(_data1, new Byte[RetElementCount], LargestVectorSize);
}
public bool IsSupported => AdvSimd.IsSupported;
public bool Succeeded { get; set; }
public void RunBasicScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead));
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, Unsafe.Read<Vector128<Byte>>(_dataTable.inArray1Ptr), 15);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunBasicScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load));
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, AdvSimd.LoadVector128((Byte*)(_dataTable.inArray1Ptr)), 15);
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead));
typeof(AdvSimd).GetMethod(nameof(AdvSimd.StoreSelectedScalar), new Type[] { typeof(Byte*), typeof(Vector128<Byte>), typeof(byte) })
.Invoke(null, new object[] {
Pointer.Box(_dataTable.outArrayPtr, typeof(Byte*)),
Unsafe.Read<Vector128<Byte>>(_dataTable.inArray1Ptr),
ElementIndex });
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunReflectionScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load));
typeof(AdvSimd).GetMethod(nameof(AdvSimd.StoreSelectedScalar), new Type[] { typeof(Byte*), typeof(Vector128<Byte>), typeof(byte) })
.Invoke(null, new object[] {
Pointer.Box(_dataTable.outArrayPtr, typeof(Byte*)),
AdvSimd.LoadVector128((Byte*)(_dataTable.inArray1Ptr)),
ElementIndex });
ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr);
}
public void RunClsVarScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario));
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, _clsVar1, 15);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
public void RunClsVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load));
fixed (Vector128<Byte>* pClsVar1 = &_clsVar1)
{
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, AdvSimd.LoadVector128((Byte*)(pClsVar1)), 15);
ValidateResult(_clsVar1, _dataTable.outArrayPtr);
}
}
public void RunLclVarScenario_UnsafeRead()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead));
var op1 = Unsafe.Read<Vector128<Byte>>(_dataTable.inArray1Ptr);
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, op1, 15);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunLclVarScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load));
var op1 = AdvSimd.LoadVector128((Byte*)(_dataTable.inArray1Ptr));
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, op1, 15);
ValidateResult(op1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario));
var test = new StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15();
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, test._fld1, 15);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunClassLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load));
var test = new StoreSelectedScalarTest__StoreSelectedScalar_Vector128_Byte_15();
fixed (Vector128<Byte>* pFld1 = &test._fld1)
{
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, AdvSimd.LoadVector128((Byte*)(pFld1)), 15);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
}
public void RunClassFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario));
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, _fld1, 15);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
public void RunClassFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load));
fixed (Vector128<Byte>* pFld1 = &_fld1)
{
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, AdvSimd.LoadVector128((Byte*)(pFld1)), 15);
ValidateResult(_fld1, _dataTable.outArrayPtr);
}
}
public void RunStructLclFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario));
var test = TestStruct.Create();
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, test._fld1, 15);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructLclFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load));
var test = TestStruct.Create();
AdvSimd.StoreSelectedScalar((Byte*)_dataTable.outArrayPtr, AdvSimd.LoadVector128((Byte*)(&test._fld1)), 15);
ValidateResult(test._fld1, _dataTable.outArrayPtr);
}
public void RunStructFldScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario));
var test = TestStruct.Create();
test.RunStructFldScenario(this);
}
public void RunStructFldScenario_Load()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load));
var test = TestStruct.Create();
test.RunStructFldScenario_Load(this);
}
public void RunUnsupportedScenario()
{
TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario));
bool succeeded = false;
try
{
RunBasicScenario_UnsafeRead();
}
catch (PlatformNotSupportedException)
{
succeeded = true;
}
if (!succeeded)
{
Succeeded = false;
}
}
private void ValidateResult(Vector128<Byte> op1, void* result, [CallerMemberName] string method = "")
{
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), op1);
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, outArray[0], method);
}
private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "")
{
Byte[] inArray1 = new Byte[Op1ElementCount];
Byte[] outArray = new Byte[RetElementCount];
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Byte>>());
Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Byte>>());
ValidateResult(inArray1, outArray[0], method);
}
private void ValidateResult(Byte[] firstOp, Byte result, [CallerMemberName] string method = "")
{
bool succeeded = true;
if (firstOp[ElementIndex] != result)
{
succeeded = false;
}
if (!succeeded)
{
TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.StoreSelectedScalar)}<Byte>(Byte*, Vector128<Byte>, 15): {method} failed:");
TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})");
TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})");
TestLibrary.TestFramework.LogInformation(string.Empty);
Succeeded = false;
}
}
}
}
| 39.061269 | 184 | 0.592908 | [
"MIT"
] | 71221-maker/runtime | src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/StoreSelectedScalar.Vector128.Byte.15.cs | 17,851 | C# |
// <copyright file="CrossBrowserTestingCredentialsResolver.cs" company="Automate The Planet Ltd.">
// Copyright 2021 Automate The Planet Ltd.
// Licensed under the Apache License, Version 2.0 (the "License");
// You may not use this file except in compliance with the License.
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// <author>Anton Angelov</author>
// <site>https://bellatrix.solutions/</site>
using System;
using Bellatrix.Mobile.Configuration;
namespace Bellatrix.Mobile.Plugins
{
public class CrossBrowserTestingCredentialsResolver : CloudProviderCredentialsResolver
{
protected override string UserEnvironmentVariable => "crossBrowserTesting.user";
protected override string AccessKeyEnvironmentVariable => "crossBrowserTesting.accessKey";
protected override Tuple<string, string> GetCredentialsFromConfig()
{
string user = ConfigurationService.GetSection<MobileSettings>().CrossBrowserTesting.User;
string accessKey = ConfigurationService.GetSection<MobileSettings>().CrossBrowserTesting.Key;
if (string.IsNullOrEmpty(user) || string.IsNullOrEmpty(accessKey))
{
throw new ArgumentException("To use CrossBrowserTesting execution you need to set environment variables called (crossBrowserTesting.user and crossBrowserTesting.accessKey) or set them in browser settings file.");
}
return Tuple.Create(user, accessKey);
}
}
}
| 48.842105 | 228 | 0.741379 | [
"Apache-2.0"
] | alexandrejulien/BELLATRIX | src/Bellatrix.Mobile/plugins/execution/Helpers/CrossBrowserTestingCredentialsResolver.cs | 1,858 | C# |
using GraphQL.Execution;
using GraphQL.Instrumentation;
using GraphQL.Types;
using GraphQL.Validation;
using GraphQLParser.AST;
namespace GraphQL
{
/// <summary>
/// A mutable implementation of <see cref="IResolveFieldContext"/>
/// </summary>
public class ResolveFieldContext : IResolveFieldContext<object?>
{
/// <inheritdoc/>
public GraphQLField FieldAst { get; set; }
/// <inheritdoc/>
public FieldType FieldDefinition { get; set; }
/// <inheritdoc/>
public IObjectGraphType ParentType { get; set; }
/// <inheritdoc/>
public IResolveFieldContext? Parent { get; set; }
/// <inheritdoc/>
public IDictionary<string, ArgumentValue>? Arguments { get; set; }
/// <inheritdoc/>
public IDictionary<string, DirectiveInfo>? Directives { get; set; }
/// <inheritdoc/>
public object? RootValue { get; set; }
/// <inheritdoc/>
public IDictionary<string, object?> UserContext { get; set; }
/// <inheritdoc/>
public object? Source { get; set; }
/// <inheritdoc/>
public ISchema Schema { get; set; }
/// <inheritdoc/>
public GraphQLDocument Document { get; set; }
/// <inheritdoc/>
public GraphQLOperationDefinition Operation { get; set; }
/// <inheritdoc/>
public Variables Variables { get; set; }
/// <inheritdoc/>
public CancellationToken CancellationToken { get; set; }
/// <inheritdoc/>
public Metrics Metrics { get; set; }
/// <inheritdoc/>
public ExecutionErrors Errors { get; set; }
/// <inheritdoc/>
public IEnumerable<object> Path { get; set; }
/// <inheritdoc/>
public IEnumerable<object> ResponsePath { get; set; }
/// <inheritdoc/>
public Dictionary<string, (GraphQLField Field, FieldType FieldType)>? SubFields { get; set; }
/// <inheritdoc/>
public IServiceProvider? RequestServices { get; set; }
/// <inheritdoc/>
public IReadOnlyDictionary<string, object?> InputExtensions { get; set; }
/// <inheritdoc/>
public IDictionary<string, object?> OutputExtensions { get; set; }
/// <inheritdoc/>
public IExecutionArrayPool ArrayPool { get; set; }
/// <summary>
/// Initializes a new instance with all fields set to their default values.
/// </summary>
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
public ResolveFieldContext() { }
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
/// <summary>
/// Clone the specified <see cref="IResolveFieldContext"/>.
/// </summary>
public ResolveFieldContext(IResolveFieldContext context)
{
Source = context.Source;
FieldAst = context.FieldAst;
FieldDefinition = context.FieldDefinition;
ParentType = context.ParentType;
Parent = context.Parent;
Arguments = context.Arguments;
Directives = context.Directives;
Schema = context.Schema;
Document = context.Document;
RootValue = context.RootValue;
UserContext = context.UserContext;
Operation = context.Operation;
Variables = context.Variables;
CancellationToken = context.CancellationToken;
Metrics = context.Metrics;
Errors = context.Errors;
SubFields = context.SubFields;
Path = context.Path;
ResponsePath = context.ResponsePath;
RequestServices = context.RequestServices;
InputExtensions = context.InputExtensions;
OutputExtensions = context.OutputExtensions;
ArrayPool = context.ArrayPool;
}
}
/// <inheritdoc cref="ResolveFieldContext"/>
public class ResolveFieldContext<TSource> : ResolveFieldContext, IResolveFieldContext<TSource>
{
/// <inheritdoc cref="ResolveFieldContext()"/>
public ResolveFieldContext()
{
}
/// <summary>
/// Clone the specified <see cref="IResolveFieldContext"/>
/// </summary>
/// <exception cref="ArgumentException">Thrown if the <see cref="IResolveFieldContext.Source"/> property cannot be cast to <typeparamref name="TSource"/></exception>
public ResolveFieldContext(IResolveFieldContext context) : base(context)
{
if (context.Source != null && !(context.Source is TSource))
throw new ArgumentException($"IResolveFieldContext.Source must be an instance of type '{typeof(TSource).Name}'", nameof(context));
}
/// <inheritdoc cref="ResolveFieldContext.Source"/>
public new TSource Source
{
get => (TSource)base.Source!;
set => base.Source = value;
}
}
}
| 34.836735 | 173 | 0.608475 | [
"MIT"
] | BearerPipelineTest/graphql-dotnet | src/GraphQL/ResolveFieldContext/ResolveFieldContext.cs | 5,121 | C# |
using System;
using JetBrains.Annotations;
using Microsoft.Xna.Framework.Graphics;
namespace MonoGame.Extended.WinForms.WindowsDX {
public sealed class SwapChainUpdatedEventArgs : EventArgs {
public SwapChainUpdatedEventArgs([NotNull] SwapChainRenderTarget swapChainRenderTarget) {
Guard.ArgumentNotNull(swapChainRenderTarget, nameof(swapChainRenderTarget));
SwapChain = swapChainRenderTarget;
}
[NotNull]
public SwapChainRenderTarget SwapChain { get; }
}
}
| 27.789474 | 97 | 0.732955 | [
"BSD-3-Clause-Clear"
] | hozuki/MonoGame.Extended2 | Sources/MonoGame.Extended.WinForms.WindowsDX/SwapChainUpdatedEventArgs.cs | 530 | C# |
/*
* Swagger Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
* Contact: [email protected]
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using NUnit.Framework;
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Model;
using Org.OpenAPITools.Client;
using System.Reflection;
using Newtonsoft.Json;
namespace Org.OpenAPITools.Test
{
/// <summary>
/// Class for testing EnumTest
/// </summary>
/// <remarks>
/// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech).
/// Please update the test case below to test the model.
/// </remarks>
[TestFixture]
public class EnumTestTests
{
// TODO uncomment below to declare an instance variable for EnumTest
//private EnumTest instance;
/// <summary>
/// Setup before each test
/// </summary>
[SetUp]
public void Init()
{
// TODO uncomment below to create an instance of EnumTest
//instance = new EnumTest();
}
/// <summary>
/// Clean up after each test
/// </summary>
[TearDown]
public void Cleanup()
{
}
/// <summary>
/// Test an instance of EnumTest
/// </summary>
[Test]
public void EnumTestInstanceTest()
{
// TODO uncomment below to test "IsInstanceOfType" EnumTest
//Assert.IsInstanceOfType<EnumTest> (instance, "variable 'instance' is a EnumTest");
}
/// <summary>
/// Test the property 'EnumString'
/// </summary>
[Test]
public void EnumStringTest()
{
// TODO unit test for the property 'EnumString'
}
/// <summary>
/// Test the property 'EnumStringRequired'
/// </summary>
[Test]
public void EnumStringRequiredTest()
{
// TODO unit test for the property 'EnumStringRequired'
}
/// <summary>
/// Test the property 'EnumInteger'
/// </summary>
[Test]
public void EnumIntegerTest()
{
// TODO unit test for the property 'EnumInteger'
}
/// <summary>
/// Test the property 'EnumNumber'
/// </summary>
[Test]
public void EnumNumberTest()
{
// TODO unit test for the property 'EnumNumber'
}
/// <summary>
/// Test the property 'OuterEnum'
/// </summary>
[Test]
public void OuterEnumTest()
{
// TODO unit test for the property 'OuterEnum'
}
}
}
| 25.902655 | 159 | 0.563375 | [
"Apache-2.0"
] | 3v1lW1th1n/openapi-generator | samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/EnumTestTests.cs | 2,927 | C# |
//-----------------------------------------------------------------
// All Rights Reserved. Copyright (C) 2021, DotNet.
//-----------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Data;
namespace DotNet.Business
{
using Model;
using Util;
/// <summary>
///BaseCommentManager
/// 评论的基类
///
/// 考虑了多数据问题,但是还没有解决好。
/// 是否使用存储过程标志改进
/// 表名,字段名映射改进,可以更换表名,字段名
/// 方法修改为静态方法,调用简单化
/// 添加的参数名也为字段名一致
/// 修改了是否处理的默认值为-1,这样方便切换是否处理这个状态。
///
/// 修改记录
/// 2012.10.09 版本:4.7 zgl 修改string.format sql语句拼接
/// 2009.10.30 版本:4.6 JiRiGaLa TableName 可以自由设置的功能。
/// 2006.02.05 版本:4.6 JiRiGaLa 重新调整主键的规范化。
/// 2005.08.13 版本:1.0 JiRiGaLa 将缺少的主键彻底完善好。
/// 2005.07.11 版本:1.0 JiRiGaLa 主键排版更友善化。
/// 2005.02.02 版本:1.0 JiRiGaLa 主键进行改进,规范化。
/// 2004.07.23 版本:1.0 JiRiGaLa 标准接口进行了改进,来了装箱拆箱的Object技术,以前也是一直想玩,这次真的玩了感觉不错。
/// 增加大分类为:功能提示Prompt,待审核WaitingAudit,代办事件Todolist,备注Memo。
/// 修改了方法的排序顺序、这样方便大规模生产、复制粘贴、然后修改修改程序就可以了。
/// Worked 需要修改,所以为了简单期间用了1、-1两个状态。
/// 其实整个系统里ID字段是不可以随便变的,一定要保持一致,除非有特殊需要。
/// 2004.07.21 版本:1.0 JiRiGaLa 添加异常处理,让程序更加完美了一些,哎程序想写好,真是无止境。
/// 增加GetProperty、SetProperty两个方法部分,同时增加了接口定义部分。
/// 2004.07.20 版本:1.0 JiRiGaLa 分类ID字段修改为CategoryId,这样更符合更专业一点。
/// 优先等级也修改为PriorityId,因为ID是唯一字段,Code为客户自定义字段。
/// 出于外数据库外键的考虑,还是修改为ID合适,不然无法做数据库完整性校验。
/// 方法的参数改进,程序的错误隐患少了很多,主键也进一步整理了。
/// 2004.07.20 版本:1.0 JiRiGaLa 被修改的评论用最新产生的ID,这样可以解决被修改的不被发现的问题,有点创新啊。
/// 同时2个人修改同一个评论的问题,虽然第二个问题发生的概率几乎是零。
/// 2004.03.31 版本:1.0 JiRiGaLa 修改一些方法,修改发布评论的人为ID,因为以后有同名可能性,
/// 添加主键折叠方法,添加最后修改人字段,IPAddress地址等.
/// 尽量去掉SqlServer独有的方法,尽量满足能支持多数据的需求.
/// 2004.03.22 版本:1.0 JiRiGaLa 变量名等进行修改,使用表结构定义等
///
/// <author>
/// <name>Troy.Cui</name>
/// <date>2006.02.05</date>
/// </author>
/// </summary>
public partial class BaseCommentManager : BaseManager, IBaseManager
{
#region public string Add(string categoryCode, string objectId, string contents, string ipAddress) 添加评论
/// <summary>
/// 添加评论
/// </summary>
/// <param name="categoryCode">分类区分</param>
/// <param name="objectId">标志区分</param>
/// <param name="contents">内容</param>
/// <param name="ipAddress">IP地址</param>
/// <returns>评论主键</returns>
public string Add(string categoryCode, string objectId, string contents, string ipAddress)
{
var commentEntity = new BaseCommentEntity
{
CreateUserId = UserInfo.Id,
CategoryCode = categoryCode,
ObjectId = objectId,
Contents = contents,
DeletionStateCode = 0,
Enabled = 0,
IpAddress = ipAddress,
CreateBy = UserInfo.RealName
};
return Add(commentEntity, false, false);
}
#endregion
#region public int Update(string id, string categoryId, string title, string content, bool worked, string priorityId, bool important) 更新评论
/// <summary>
/// 更新评论
/// </summary>
/// <param name="id">主键</param>
/// <param name="categoryCode">分类区分</param>
/// <param name="title">标题</param>
/// <param name="contents">内容</param>
/// <param name="worked">是否处理过</param>
/// <param name="priorityId">优先级别</param>
/// <param name="important">重要性</param>
/// <returns>影响行数</returns>
public int Update(string id, string categoryCode, string title, string contents, bool worked, string priorityId, bool important)
{
var commentEntity = new BaseCommentEntity
{
Id = id,
ModifiedUserId = UserInfo.Id,
CategoryCode = categoryCode,
Title = title,
Contents = contents
};
// commentEntity.Worked = worked;
// commentEntity.PriorityId = priorityId;
// commentEntity.Important = important;
return Update(commentEntity);
}
#endregion
#region public int ChangeWorked(string id) 更新处理状态
/// <summary>
/// 更新处理状态
/// </summary>
/// <param name="id">评论主键</param>
/// <returns>影响行数</returns>
public int ChangeWorked(string id)
{
var result = 0;
/*
string sql = "UPDATE " + BaseCommentEntity.TableName
+ " SET " + BaseCommentEntity.FieldWorked + " = (CASE " + BaseCommentEntity.FieldWorked + " WHEN 0 THEN 1 WHEN 1 THEN 0 END)"
+ " WHERE (" + BaseCommentEntity.FieldId + " = ? )";
string[] names = new string[1];
Object[] values = new Object[1];
names[0] = BaseCommentEntity.FieldId;
values[0] = id;
result = DbHelper.ExecuteNonQuery(sql, DbHelper.MakeParameters(names, values));
*/
return result;
}
#endregion
#region public int SetWorked(string[] id, int worked) 设置评论处理
/// <summary>
/// 设置评论处理
/// </summary>
/// <param name="ids">评论主键数组</param>
/// <param name="worked">处理状态</param>
/// <returns>影响行数</returns>
public int SetWorked(string[] ids, int worked)
{
var result = 0;
var id = string.Empty;
try
{
DbHelper.BeginTransaction();
for (var i = 0; i < ids.Length; i++)
{
id = ids[i];
// result += this.SetProperty(id, BaseCommentEntity.FieldWorked, worked.ToString());
}
DbHelper.CommitTransaction();
}
catch (Exception ex)
{
DbHelper.RollbackTransaction();
BaseExceptionManager.LogException(DbHelper, UserInfo, ex);
throw;
}
//Troy.Cui 2018.07.02
finally
{
// 关闭数据库库连接
DbHelper.Close();
}
return result;
}
#endregion
#region public int ChageWorked(IDbHelper dbHelper, string id, bool worked) 更新处理状态
/// <summary>
/// 更新处理状态
/// </summary>
/// <param name="dbHelper"></param>
/// <param name="id">评论主键</param>
/// <param name="worked">处理状态</param>
/// <returns>影响行数</returns>
public int ChageWorked(IDbHelper dbHelper, string id, bool worked)
{
var sqlBuilder = new SqlBuilder(DbHelper);
sqlBuilder.BeginUpdate(CurrentTableName);
// sqlBuilder.SetValue(BaseCommentEntity.FieldWorked, worked ? 1 : -1);
sqlBuilder.SetWhere(BaseCommentEntity.FieldId, id);
return sqlBuilder.EndUpdate();
}
#endregion
#region public DataTable Search(string departmentId, string searchKey) 查询
/// <summary>
/// 查询
/// </summary>
/// <param name="departmentId">部门主键</param>
/// <param name="searchKey">查询字符</param>
/// <returns>数据表</returns>
public DataTable Search(string departmentId, string searchKey)
{
return Search(departmentId, string.Empty, string.Empty, searchKey);
}
#endregion
#region public DataTable Search(string departmentId, string year, string month, string searchKey) 查询具体方法
/// <summary>
/// 查询具体方法
/// </summary>
/// <param name="departmentId">部门主键</param>
/// <param name="year">年</param>
/// <param name="month">月</param>
/// <param name="searchKey">查询字符</param>
/// <returns>数据表</returns>
public DataTable Search(string departmentId, string year, string month, string searchKey)
{
var dt = new DataTable(CurrentTableName);
var sql = String.Format("SELECT * FROM {0} WHERE ({1}=0) ", CurrentTableName,
BaseCommentEntity.FieldDeleted);
if (!string.IsNullOrEmpty(departmentId) && !departmentId.Equals("All"))
{
sql += String.Format(" AND {0}={1} ", BaseCommentEntity.FieldDepartmentId, departmentId);
}
var dbParameters = new List<IDbDataParameter>();
if (!string.IsNullOrEmpty(year) && (!year.Equals("All")))
{
sql += String.Format(" AND YEAR({0}={1}) ", BaseCommentEntity.FieldCreateTime, DbHelper.GetParameter("CurrentYear"));
dbParameters.Add(DbHelper.MakeParameter("CurrentYear", year));
}
if (!string.IsNullOrEmpty(month) && (!month.Equals("All")))
{
sql += String.Format(" AND MONTH({0}={1}) ", BaseCommentEntity.FieldCreateTime, DbHelper.GetParameter("CurrentMonth"));
dbParameters.Add(DbHelper.MakeParameter("CurrentMonth", month));
}
if (!string.IsNullOrEmpty(searchKey))
{
sql += String.Format(" AND ({0} LIKE {1} OR {2} LIKE {3} OR {4} LIKE {5}) ",
BaseCommentEntity.FieldTitle,
DbHelper.GetParameter(BaseCommentEntity.FieldTitle),
BaseCommentEntity.FieldCreateBy,
DbHelper.GetParameter(BaseCommentEntity.FieldCreateBy),
BaseCommentEntity.FieldContents,
DbHelper.GetParameter(BaseCommentEntity.FieldContents)
);
searchKey = StringUtil.GetSearchString(searchKey);
dbParameters.Add(DbHelper.MakeParameter(BaseCommentEntity.FieldTitle, searchKey));
dbParameters.Add(DbHelper.MakeParameter(BaseCommentEntity.FieldCreateBy, searchKey));
dbParameters.Add(DbHelper.MakeParameter(BaseCommentEntity.FieldContents, searchKey));
}
sql += String.Format(" ORDER BY {0} DESC ", BaseCommentEntity.FieldCreateTime);
DbHelper.Fill(dt, sql, dbParameters.ToArray());
return dt;
}
#endregion
#region public DataTable GetPreviousNextId(string id) 获得主键列表中的,上一条,下一条记录的主键
/// <summary>
/// 获得主键列表中的,上一条,下一条记录的主键
/// </summary>
/// <param name="id">评论主键</param>
/// <returns>数据表</returns>
public DataTable GetPreviousNextId(string id)
{
var sql = String.Format("SELECT Id FROM {0} WHERE ({1} = ?) ORDER BY {2}", BaseCommentEntity.TableName, BaseCommentEntity.FieldCreateUserId, BaseCommentEntity.FieldCreateTime);
var names = new string[1];
var values = new Object[1];
names[0] = BaseCommentEntity.FieldCreateUserId;
values[0] = UserInfo.Id;
var dt = new DataTable(BaseCommentEntity.TableName);
DbHelper.Fill(dt, sql, DbHelper.MakeParameters(names, values));
// this.NextId = this.GetNextId(result, UserInfo, id);
// this.PreviousId = this.GetPreviousId(result, UserInfo, id);
return dt;
}
#endregion
#region public DataTable GetDataTableByPermissionScope(string[] departmentIds = null, int topLimit = 10) 获得最新评论列表
/// <summary>
/// 获得最新评论列表
/// </summary>
/// <param name="departmentIds">组织机构组件</param>
/// <param name="topLimit">前几个</param>
/// <returns>数据表</returns>
public DataTable GetDataTableByPermissionScope(string[] departmentIds = null, int topLimit = 10)
{
var parametersList = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>(BaseCommentEntity.FieldDeleted, 0),
new KeyValuePair<string, object>(BaseCommentEntity.FieldEnabled, 1)
};
if (departmentIds == null)
{
parametersList.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldObjectId, UserInfo.Id));
}
else
{
parametersList.Add(new KeyValuePair<string, object>(BaseCommentEntity.FieldDepartmentId, departmentIds));
}
return GetDataTable(parametersList, topLimit, BaseCommentEntity.FieldCreateTime + " DESC");
}
#endregion
#region public DataTable GetDataTableByCategory(string categoryId, string objectId) 获取评论列表
/// <summary>
/// 获取评论列表
/// </summary>
/// <param name="categoryCode">分类主键</param>
/// <param name="objectId">标志主键</param>
/// <returns>数据表</returns>
public DataTable GetDataTableByCategory(string categoryCode, string objectId)
{
var parameters = new List<KeyValuePair<string, object>>
{
new KeyValuePair<string, object>(BaseCommentEntity.FieldCategoryCode, categoryCode),
new KeyValuePair<string, object>(BaseCommentEntity.FieldObjectId, objectId),
new KeyValuePair<string, object>(BaseCommentEntity.FieldDeleted, 0)
};
return GetDataTable(parameters, BaseCommentEntity.FieldCreateTime);
}
#endregion
#region public DataTable GetDataTableByPage(BaseUserInfo userInfo, string departmentId, string searchKey, out int recordCount, int pageIndex = 0, int pageSize = 20, string sortExpression = null, string sortDirection = null) 分页查询
/// <summary>
/// 分页查询
/// </summary>
/// <param name="userInfo">用户信息</param>
/// <param name="recordCount">记录数</param>
/// <param name="departmentIds"></param>
/// <param name="pageIndex">当前页</param>
/// <param name="pageSize">每页显示</param>
/// <param name="sortExpression">排序字段</param>
/// <param name="sortDirection">排序方向</param>
/// <returns>数据表</returns>
public DataTable GetDataTableByPage(BaseUserInfo userInfo, out int recordCount, string[] departmentIds = null, int pageIndex = 0, int pageSize = 20, string sortExpression = null, string sortDirection = null)
{
var condition = string.Format("{0} = 0 ", BaseCommentEntity.FieldDeleted);
if (departmentIds != null && departmentIds.Length > 0)
{
condition += string.Format(" AND {0} IN ({1}) ", BaseCommentEntity.FieldDepartmentId, string.Join(",", departmentIds));
}
else
{
condition += string.Format(" AND {0} = '{1}' ", BaseCommentEntity.FieldObjectId, UserInfo.Id);
}
return GetDataTableByPage(out recordCount, pageIndex, pageSize, sortExpression, sortDirection, CurrentTableName, condition, null, "*");
}
#endregion
}
} | 43.738506 | 236 | 0.559359 | [
"MIT"
] | cuiwenyuan/DotNet.Util | src/DotNet.Business/BaseComment/BaseCommentManager.cs | 17,219 | C# |
using System.Threading.Tasks;
using Xemio.Logic.Requests.Organizations;
using Xunit;
namespace Xemio.Logic.Tests.Requests
{
public class OrganizationsTests : RequestTests
{
[Fact]
public async Task CreateOrganizationQueryAndDeleteIt()
{
var organizationName = "Test-Organization";
string organizationId;
var token = await this.CreateUserAndLogin();
using (var context = this.RequestManager.StartRequestContext())
{
context.CurrentUser = token;
await context.Send(new CreateOrganizationRequest
{
Name = organizationName,
});
await context.CommitAsync();
}
using (var context = this.RequestManager.StartRequestContext())
{
context.CurrentUser = token;
var myOrganizations = await context.Send(new GetMyOrganizationsRequest());
Assert.NotNull(myOrganizations);
Assert.NotEmpty(myOrganizations);
Assert.Single(myOrganizations);
Assert.Equal(organizationName, myOrganizations[0].Name);
organizationId = myOrganizations[0].Id;
}
using (var context = this.RequestManager.StartRequestContext())
{
context.CurrentUser = token;
await context.Send(new DeleteOrganizationRequest
{
OrganizationId = organizationId
});
await context.CommitAsync();
}
using (var context = this.RequestManager.StartRequestContext())
{
context.CurrentUser = token;
var myOrganizations = await context.Send(new GetMyOrganizationsRequest());
Assert.Empty(myOrganizations);
}
}
}
} | 30.920635 | 90 | 0.555441 | [
"MIT"
] | haefele/Xemio | tests/Xemio.Logic.Tests/Requests/OrganizationsTests.cs | 1,948 | C# |
using System.Collections.Generic;
using System.IO;
namespace OpenVIII
{
public partial class Kernel_bin
{
/// <summary>
/// Junction Abilities Data
/// </summary>
/// <see cref="https://github.com/alexfilth/doomtrain/wiki/Junction-abilities"/>
public class Junction_abilities : Ability
{
public new const int count = 20;
public new const int id = 11;
//public BitArray J_Flags { get; private set; }
public JunctionAbilityFlags J_Flags { get; private set; }
public override void Read(BinaryReader br, int i)
{
Name = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2);
//0x0000 2 bytes Offset to name
Description = Memory.Strings.Read(Strings.FileID.KERNEL, id, i * 2 + 1);
//0x0002 2 bytes Offset to description
br.BaseStream.Seek(4, SeekOrigin.Current);
AP = br.ReadByte();
//0x0004 1 byte AP Required to learn ability
//J_Flags = new BitArray(br.ReadBytes(3));
byte[] tmp = br.ReadBytes(3);
J_Flags = (JunctionAbilityFlags)(tmp[2] << 16 | tmp[1] << 8 | tmp[0]);
//0x0005 3 byte J_Flag
}
public static Dictionary<Abilities,Junction_abilities> Read(BinaryReader br)
{
Dictionary<Abilities, Junction_abilities> ret = new Dictionary<Abilities, Junction_abilities>(count);
for (int i = 0; i < count; i++)
{
Junction_abilities tmp = new Junction_abilities();
tmp.Read(br, i);
ret[(Abilities)i] = tmp;
}
return ret;
}
}
}
} | 36.68 | 117 | 0.527263 | [
"MIT"
] | A-n-d-y/OpenVIII | Core/Kernel/Kernel_bin.Junction_abilities.cs | 1,836 | C# |
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
#region Usings
using System;
using System.Collections.Specialized;
using System.Web.UI;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Instrumentation;
using DotNetNuke.Services.Localization;
#endregion
namespace DotNetNuke.UI.WebControls
{
/// -----------------------------------------------------------------------------
/// Project: DotNetNuke
/// Namespace: DotNetNuke.UI.WebControls
/// Class: TrueFalseEditControl
/// -----------------------------------------------------------------------------
/// <summary>
/// The TrueFalseEditControl control provides a standard UI component for editing
/// true/false (boolean) properties.
/// </summary>
/// <remarks>
/// </remarks>
/// -----------------------------------------------------------------------------
[ToolboxData("<{0}:TrueFalseEditControl runat=server></{0}:TrueFalseEditControl>")]
public class TrueFalseEditControl : EditControl
{
private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof (TrueFalseEditControl));
#region "Constructors"
/// -----------------------------------------------------------------------------
/// <summary>
/// Constructs a TrueFalseEditControl
/// </summary>
/// -----------------------------------------------------------------------------
public TrueFalseEditControl()
{
this.SystemType = "System.Boolean";
}
#endregion
#region "Public Properties"
/// -----------------------------------------------------------------------------
/// <summary>
/// BooleanValue returns the Boolean representation of the Value
/// </summary>
/// <value>A Boolean representing the Value</value>
/// -----------------------------------------------------------------------------
protected bool BooleanValue
{
get
{
bool boolValue = Null.NullBoolean;
try
{
//Try and cast the value to an Boolean
boolValue = Convert.ToBoolean(this.Value);
}
catch (Exception exc)
{
Logger.Error(exc);
}
return boolValue;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// OldBooleanValue returns the Boolean representation of the OldValue
/// </summary>
/// <value>A Boolean representing the OldValue</value>
/// -----------------------------------------------------------------------------
protected bool OldBooleanValue
{
get
{
bool boolValue = Null.NullBoolean;
try
{
//Try and cast the value to an Boolean
boolValue = Convert.ToBoolean(this.OldValue);
}
catch (Exception exc)
{
Logger.Error(exc);
}
return boolValue;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// StringValue is the value of the control expressed as a String
/// </summary>
/// <value>A string representing the Value</value>
/// -----------------------------------------------------------------------------
protected override string StringValue
{
get
{
return this.BooleanValue.ToString();
}
set
{
bool setValue = bool.Parse(value);
this.Value = setValue;
}
}
#endregion
#region "Protected Methods"
/// -----------------------------------------------------------------------------
/// <summary>
/// OnDataChanged runs when the PostbackData has changed. It raises the ValueChanged
/// Event
/// </summary>
/// -----------------------------------------------------------------------------
protected override void OnDataChanged(EventArgs e)
{
var args = new PropertyEditorEventArgs(this.Name);
args.Value = this.BooleanValue;
args.OldValue = this.OldBooleanValue;
args.StringValue = this.StringValue;
base.OnValueChanged(args);
}
/// -----------------------------------------------------------------------------
/// <summary>
/// RenderEditMode renders the Edit mode of the control
/// </summary>
/// <param name="writer">A HtmlTextWriter.</param>
/// -----------------------------------------------------------------------------
protected override void RenderEditMode(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Type, "radio");
if ((this.BooleanValue))
{
writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
}
writer.AddAttribute(HtmlTextWriterAttribute.Value, "True");
writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
this.ControlStyle.AddAttributesToRender(writer);
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.Write(Localization.GetString("True", Localization.SharedResourceFile));
writer.RenderEndTag();
writer.AddAttribute(HtmlTextWriterAttribute.Type, "radio");
if ((!this.BooleanValue))
{
writer.AddAttribute(HtmlTextWriterAttribute.Checked, "checked");
}
writer.AddAttribute(HtmlTextWriterAttribute.Value, "False");
writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID);
writer.RenderBeginTag(HtmlTextWriterTag.Input);
writer.RenderEndTag();
this.ControlStyle.AddAttributesToRender(writer);
writer.RenderBeginTag(HtmlTextWriterTag.Span);
writer.Write(Localization.GetString("False", Localization.SharedResourceFile));
writer.RenderEndTag();
}
#endregion
}
}
| 37.303371 | 106 | 0.461145 | [
"MIT"
] | MaiklT/Dnn.Platform | DNN Platform/Library/UI/WebControls/PropertyEditor/Edit Controls/TrueFalseEditControl.cs | 6,642 | C# |
/*
* OpenAPI Petstore
*
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
*
* OpenAPI spec version: 1.0.0
*
* Generated by: https://github.com/openapitools/openapi-generator.git
*/
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;
namespace Org.OpenAPITools.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IStoreApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
void DeleteOrder (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeleteOrderWithHttpInfo (string orderId);
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Dictionary<string, int?></returns>
Dictionary<string, int?> GetInventory ();
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>ApiResponse of Dictionary<string, int?></returns>
ApiResponse<Dictionary<string, int?>> GetInventoryWithHttpInfo ();
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Order GetOrderById (long? orderId);
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of Order</returns>
ApiResponse<Order> GetOrderByIdWithHttpInfo (long? orderId);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Order</returns>
Order PlaceOrder (Order order);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>ApiResponse of Order</returns>
ApiResponse<Order> PlaceOrderWithHttpInfo (Order order);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task DeleteOrderAsync (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> DeleteOrderAsyncWithHttpInfo (string orderId);
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of Dictionary<string, int?></returns>
System.Threading.Tasks.Task<Dictionary<string, int?>> GetInventoryAsync ();
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of ApiResponse (Dictionary<string, int?>)</returns>
System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ();
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Task of Order</returns>
System.Threading.Tasks.Task<Order> GetOrderByIdAsync (long? orderId);
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Task of ApiResponse (Order)</returns>
System.Threading.Tasks.Task<ApiResponse<Order>> GetOrderByIdAsyncWithHttpInfo (long? orderId);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Task of Order</returns>
System.Threading.Tasks.Task<Order> PlaceOrderAsync (Order order);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Task of ApiResponse (Order)</returns>
System.Threading.Tasks.Task<ApiResponse<Order>> PlaceOrderAsyncWithHttpInfo (Order order);
#endregion Asynchronous Operations
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public partial class StoreApi : IStoreApi
{
private Org.OpenAPITools.Client.ExceptionFactory _exceptionFactory = (name, response) => null;
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
/// <returns></returns>
public StoreApi(String basePath)
{
this.Configuration = new Org.OpenAPITools.Client.Configuration { BasePath = basePath };
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class
/// </summary>
/// <returns></returns>
public StoreApi()
{
this.Configuration = Org.OpenAPITools.Client.Configuration.Default;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class
/// using Configuration object
/// </summary>
/// <param name="configuration">An instance of Configuration</param>
/// <returns></returns>
public StoreApi(Org.OpenAPITools.Client.Configuration configuration = null)
{
if (configuration == null) // use the default one in Configuration
this.Configuration = Org.OpenAPITools.Client.Configuration.Default;
else
this.Configuration = configuration;
ExceptionFactory = Org.OpenAPITools.Client.Configuration.DefaultExceptionFactory;
}
/// <summary>
/// Gets the base path of the API client.
/// </summary>
/// <value>The base path</value>
public String GetBasePath()
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
}
/// <summary>
/// Sets the base path of the API client.
/// </summary>
/// <value>The base path</value>
[Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
public void SetBasePath(String basePath)
{
// do nothing
}
/// <summary>
/// Gets or sets the configuration object
/// </summary>
/// <value>An instance of the Configuration</value>
public Org.OpenAPITools.Client.Configuration Configuration {get; set;}
/// <summary>
/// Provides a factory method hook for the creation of exceptions.
/// </summary>
public Org.OpenAPITools.Client.ExceptionFactory ExceptionFactory
{
get
{
if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
{
throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
}
return _exceptionFactory;
}
set { _exceptionFactory = value; }
}
/// <summary>
/// Gets the default header.
/// </summary>
/// <returns>Dictionary of HTTP header</returns>
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
public IDictionary<String, String> DefaultHeader()
{
return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
}
/// <summary>
/// Add default header.
/// </summary>
/// <param name="key">Header field name.</param>
/// <param name="value">Header field value.</param>
/// <returns></returns>
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
public void AddDefaultHeader(string key, string value)
{
this.Configuration.AddDefaultHeader(key, value);
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
public void DeleteOrder (string orderId)
{
DeleteOrderWithHttpInfo(orderId);
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>ApiResponse of Object(void)</returns>
public ApiResponse<Object> DeleteOrderWithHttpInfo (string orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null)
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
var localVarPath = "/store/order/{order_id}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (orderId != null) localVarPathParams.Add("order_id", this.Configuration.ApiClient.ParameterToString(orderId)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("DeleteOrder", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>Task of void</returns>
public async System.Threading.Tasks.Task DeleteOrderAsync (string orderId)
{
await DeleteOrderAsyncWithHttpInfo(orderId);
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>Task of ApiResponse</returns>
public async System.Threading.Tasks.Task<ApiResponse<Object>> DeleteOrderAsyncWithHttpInfo (string orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null)
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->DeleteOrder");
var localVarPath = "/store/order/{order_id}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (orderId != null) localVarPathParams.Add("order_id", this.Configuration.ApiClient.ParameterToString(orderId)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("DeleteOrder", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Dictionary<string, int?></returns>
public Dictionary<string, int?> GetInventory ()
{
ApiResponse<Dictionary<string, int?>> localVarResponse = GetInventoryWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>ApiResponse of Dictionary<string, int?></returns>
public ApiResponse< Dictionary<string, int?> > GetInventoryWithHttpInfo ()
{
var localVarPath = "/store/inventory";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// authentication (api_key) required
if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key")))
{
localVarHeaderParams["api_key"] = this.Configuration.GetApiKeyWithPrefix("api_key");
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetInventory", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Dictionary<string, int?>>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Dictionary<string, int?>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary<string, int?>)));
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of Dictionary<string, int?></returns>
public async System.Threading.Tasks.Task<Dictionary<string, int?>> GetInventoryAsync ()
{
ApiResponse<Dictionary<string, int?>> localVarResponse = await GetInventoryAsyncWithHttpInfo();
return localVarResponse.Data;
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <returns>Task of ApiResponse (Dictionary<string, int?>)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ()
{
var localVarPath = "/store/inventory";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
// authentication (api_key) required
if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("api_key")))
{
localVarHeaderParams["api_key"] = this.Configuration.GetApiKeyWithPrefix("api_key");
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetInventory", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Dictionary<string, int?>>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Dictionary<string, int?>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Dictionary<string, int?>)));
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
public Order GetOrderById (long? orderId)
{
ApiResponse<Order> localVarResponse = GetOrderByIdWithHttpInfo(orderId);
return localVarResponse.Data;
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of Order</returns>
public ApiResponse< Order > GetOrderByIdWithHttpInfo (long? orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null)
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
var localVarPath = "/store/order/{order_id}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/xml",
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (orderId != null) localVarPathParams.Add("order_id", this.Configuration.ApiClient.ParameterToString(orderId)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetOrderById", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Order>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Order) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order)));
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Task of Order</returns>
public async System.Threading.Tasks.Task<Order> GetOrderByIdAsync (long? orderId)
{
ApiResponse<Order> localVarResponse = await GetOrderByIdAsyncWithHttpInfo(orderId);
return localVarResponse.Data;
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Task of ApiResponse (Order)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Order>> GetOrderByIdAsyncWithHttpInfo (long? orderId)
{
// verify the required parameter 'orderId' is set
if (orderId == null)
throw new ApiException(400, "Missing required parameter 'orderId' when calling StoreApi->GetOrderById");
var localVarPath = "/store/order/{order_id}";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/xml",
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (orderId != null) localVarPathParams.Add("order_id", this.Configuration.ApiClient.ParameterToString(orderId)); // path parameter
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("GetOrderById", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Order>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Order) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order)));
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Order</returns>
public Order PlaceOrder (Order order)
{
ApiResponse<Order> localVarResponse = PlaceOrderWithHttpInfo(order);
return localVarResponse.Data;
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>ApiResponse of Order</returns>
public ApiResponse< Order > PlaceOrderWithHttpInfo (Order order)
{
// verify the required parameter 'order' is set
if (order == null)
throw new ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder");
var localVarPath = "/store/order";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/xml",
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (order != null && order.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(order); // http body (model) parameter
}
else
{
localVarPostBody = order; // byte array
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("PlaceOrder", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Order>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Order) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order)));
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Task of Order</returns>
public async System.Threading.Tasks.Task<Order> PlaceOrderAsync (Order order)
{
ApiResponse<Order> localVarResponse = await PlaceOrderAsyncWithHttpInfo(order);
return localVarResponse.Data;
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <exception cref="Org.OpenAPITools.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="order">order placed for purchasing the pet</param>
/// <returns>Task of ApiResponse (Order)</returns>
public async System.Threading.Tasks.Task<ApiResponse<Order>> PlaceOrderAsyncWithHttpInfo (Order order)
{
// verify the required parameter 'order' is set
if (order == null)
throw new ApiException(400, "Missing required parameter 'order' when calling StoreApi->PlaceOrder");
var localVarPath = "/store/order";
var localVarPathParams = new Dictionary<String, String>();
var localVarQueryParams = new List<KeyValuePair<String, String>>();
var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
var localVarFormParams = new Dictionary<String, String>();
var localVarFileParams = new Dictionary<String, FileParameter>();
Object localVarPostBody = null;
// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/xml",
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
if (order != null && order.GetType() != typeof(byte[]))
{
localVarPostBody = this.Configuration.ApiClient.Serialize(order); // http body (model) parameter
}
else
{
localVarPostBody = order; // byte array
}
// make the HTTP request
IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
int localVarStatusCode = (int) localVarResponse.StatusCode;
if (ExceptionFactory != null)
{
Exception exception = ExceptionFactory("PlaceOrder", localVarResponse);
if (exception != null) throw exception;
}
return new ApiResponse<Order>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
(Order) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Order)));
}
}
}
| 48.712941 | 159 | 0.632227 | [
"Apache-2.0"
] | DenKoren/openapi-generator | samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Api/StoreApi.cs | 41,406 | C# |
using System;
using System.Reflection;
namespace AOPTest.Aspect02
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Interface, Inherited = true)]
public abstract class AspectAttribute : Attribute
{
public abstract object Action(object target, MethodBase method, object[] parameters, object result);
}
} | 31.727273 | 117 | 0.799427 | [
"MIT"
] | treytomes/ILExperiments | AOPTest/Aspect02/AspectAttribute.cs | 351 | C# |
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("P1_ShubertFunction")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("P1_ShubertFunction")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[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("511df5d0-6c92-44c1-9cdd-c3d72683929c")]
// 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")]
| 37.945946 | 84 | 0.75 | [
"MIT"
] | quackwilson/ParticleSwarmOptimization | CS_Ver/P1_ShubertFunction/P1_ShubertFunction/Properties/AssemblyInfo.cs | 1,407 | C# |
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by \generate-code.bat.
//
// Changes to this file will be lost when the code is regenerated.
// The build server regenerates the code before each build and a pre-build
// step will regenerate the code on each local build.
//
// See https://github.com/angularsen/UnitsNet/wiki/Adding-a-New-Unit for how to add or edit units.
//
// Add CustomCode\Quantities\MyQuantity.extra.cs files to add code to generated quantities.
// Add UnitDefinitions\MyQuantity.json and run generate-code.bat to generate new units or quantities.
//
// </auto-generated>
//------------------------------------------------------------------------------
// Copyright (c) 2013 Andreas Gullberg Larsen ([email protected]).
// https://github.com/angularsen/UnitsNet
//
// 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.Globalization;
using System.Linq;
using JetBrains.Annotations;
using UnitsNet.Units;
using UnitsNet.InternalHelpers;
// ReSharper disable once CheckNamespace
namespace UnitsNet
{
/// <summary>
/// A unit that represents a fractional change in size in response to a change in temperature.
/// </summary>
// Windows Runtime Component has constraints on public types: https://msdn.microsoft.com/en-us/library/br230301.aspx#Declaring types in Windows Runtime Components
// Public structures can't have any members other than public fields, and those fields must be value types or strings.
// Public classes must be sealed (NotInheritable in Visual Basic). If your programming model requires polymorphism, you can create a public interface and implement that interface on the classes that must be polymorphic.
public sealed partial class CoefficientOfThermalExpansion : IQuantity
{
/// <summary>
/// The numeric value this quantity was constructed with.
/// </summary>
private readonly double _value;
/// <summary>
/// The unit this quantity was constructed with.
/// </summary>
private readonly CoefficientOfThermalExpansionUnit? _unit;
static CoefficientOfThermalExpansion()
{
BaseDimensions = new BaseDimensions(0, 0, 0, 0, -1, 0, 0);
}
/// <summary>
/// Creates the quantity with a value of 0 in the base unit InverseKelvin.
/// </summary>
/// <remarks>
/// Windows Runtime Component requires a default constructor.
/// </remarks>
public CoefficientOfThermalExpansion()
{
_value = 0;
_unit = BaseUnit;
}
/// <summary>
/// Creates the quantity with the given numeric value and unit.
/// </summary>
/// <param name="numericValue">The numeric value to contruct this quantity with.</param>
/// <param name="unit">The unit representation to contruct this quantity with.</param>
/// <remarks>Value parameter cannot be named 'value' due to constraint when targeting Windows Runtime Component.</remarks>
/// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
private CoefficientOfThermalExpansion(double numericValue, CoefficientOfThermalExpansionUnit unit)
{
if(unit == CoefficientOfThermalExpansionUnit.Undefined)
throw new ArgumentException("The quantity can not be created with an undefined unit.", nameof(unit));
_value = Guard.EnsureValidNumber(numericValue, nameof(numericValue));
_unit = unit;
}
#region Static Properties
/// <summary>
/// The <see cref="BaseDimensions" /> of this quantity.
/// </summary>
public static BaseDimensions BaseDimensions { get; }
/// <summary>
/// The base unit of CoefficientOfThermalExpansion, which is InverseKelvin. All conversions go via this value.
/// </summary>
public static CoefficientOfThermalExpansionUnit BaseUnit { get; } = CoefficientOfThermalExpansionUnit.InverseKelvin;
/// <summary>
/// Represents the largest possible value of CoefficientOfThermalExpansion
/// </summary>
public static CoefficientOfThermalExpansion MaxValue { get; } = new CoefficientOfThermalExpansion(double.MaxValue, BaseUnit);
/// <summary>
/// Represents the smallest possible value of CoefficientOfThermalExpansion
/// </summary>
public static CoefficientOfThermalExpansion MinValue { get; } = new CoefficientOfThermalExpansion(double.MinValue, BaseUnit);
/// <summary>
/// The <see cref="QuantityType" /> of this quantity.
/// </summary>
public static QuantityType QuantityType { get; } = QuantityType.CoefficientOfThermalExpansion;
/// <summary>
/// All units of measurement for the CoefficientOfThermalExpansion quantity.
/// </summary>
public static CoefficientOfThermalExpansionUnit[] Units { get; } = Enum.GetValues(typeof(CoefficientOfThermalExpansionUnit)).Cast<CoefficientOfThermalExpansionUnit>().Except(new CoefficientOfThermalExpansionUnit[]{ CoefficientOfThermalExpansionUnit.Undefined }).ToArray();
/// <summary>
/// Gets an instance of this quantity with a value of 0 in the base unit InverseKelvin.
/// </summary>
public static CoefficientOfThermalExpansion Zero { get; } = new CoefficientOfThermalExpansion(0, BaseUnit);
#endregion
#region Properties
/// <summary>
/// The numeric value this quantity was constructed with.
/// </summary>
public double Value => Convert.ToDouble(_value);
/// <summary>
/// The unit this quantity was constructed with -or- <see cref="BaseUnit" /> if default ctor was used.
/// </summary>
public CoefficientOfThermalExpansionUnit Unit => _unit.GetValueOrDefault(BaseUnit);
/// <summary>
/// The <see cref="QuantityType" /> of this quantity.
/// </summary>
public QuantityType Type => CoefficientOfThermalExpansion.QuantityType;
/// <summary>
/// The <see cref="BaseDimensions" /> of this quantity.
/// </summary>
public BaseDimensions Dimensions => CoefficientOfThermalExpansion.BaseDimensions;
#endregion
#region Conversion Properties
/// <summary>
/// Get CoefficientOfThermalExpansion in InverseDegreeCelsius.
/// </summary>
public double InverseDegreeCelsius => As(CoefficientOfThermalExpansionUnit.InverseDegreeCelsius);
/// <summary>
/// Get CoefficientOfThermalExpansion in InverseDegreeFahrenheit.
/// </summary>
public double InverseDegreeFahrenheit => As(CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit);
/// <summary>
/// Get CoefficientOfThermalExpansion in InverseKelvin.
/// </summary>
public double InverseKelvin => As(CoefficientOfThermalExpansionUnit.InverseKelvin);
#endregion
#region Static Methods
/// <summary>
/// Get unit abbreviation string.
/// </summary>
/// <param name="unit">Unit to get abbreviation for.</param>
/// <returns>Unit abbreviation string.</returns>
public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit)
{
return GetAbbreviation(unit, null);
}
/// <summary>
/// Get unit abbreviation string.
/// </summary>
/// <param name="unit">Unit to get abbreviation for.</param>
/// <returns>Unit abbreviation string.</returns>
/// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public static string GetAbbreviation(CoefficientOfThermalExpansionUnit unit, [CanBeNull] string cultureName)
{
IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);
return UnitAbbreviationsCache.Default.GetDefaultAbbreviation(unit, provider);
}
#endregion
#region Static Factory Methods
/// <summary>
/// Get CoefficientOfThermalExpansion from InverseDegreeCelsius.
/// </summary>
/// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
[Windows.Foundation.Metadata.DefaultOverload]
public static CoefficientOfThermalExpansion FromInverseDegreeCelsius(double inversedegreecelsius)
{
double value = (double) inversedegreecelsius;
return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeCelsius);
}
/// <summary>
/// Get CoefficientOfThermalExpansion from InverseDegreeFahrenheit.
/// </summary>
/// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
[Windows.Foundation.Metadata.DefaultOverload]
public static CoefficientOfThermalExpansion FromInverseDegreeFahrenheit(double inversedegreefahrenheit)
{
double value = (double) inversedegreefahrenheit;
return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit);
}
/// <summary>
/// Get CoefficientOfThermalExpansion from InverseKelvin.
/// </summary>
/// <exception cref="ArgumentException">If value is NaN or Infinity.</exception>
[Windows.Foundation.Metadata.DefaultOverload]
public static CoefficientOfThermalExpansion FromInverseKelvin(double inversekelvin)
{
double value = (double) inversekelvin;
return new CoefficientOfThermalExpansion(value, CoefficientOfThermalExpansionUnit.InverseKelvin);
}
/// <summary>
/// Dynamically convert from value and unit enum <see cref="CoefficientOfThermalExpansionUnit" /> to <see cref="CoefficientOfThermalExpansion" />.
/// </summary>
/// <param name="value">Value to convert from.</param>
/// <param name="fromUnit">Unit to convert from.</param>
/// <returns>CoefficientOfThermalExpansion unit value.</returns>
// Fix name conflict with parameter "value"
[return: System.Runtime.InteropServices.WindowsRuntime.ReturnValueName("returnValue")]
public static CoefficientOfThermalExpansion From(double value, CoefficientOfThermalExpansionUnit fromUnit)
{
return new CoefficientOfThermalExpansion((double)value, fromUnit);
}
#endregion
#region Static Parse Methods
/// <summary>
/// Parse a string with one or two quantities of the format "<quantity> <unit>".
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <example>
/// Length.Parse("5.5 m", new CultureInfo("en-US"));
/// </example>
/// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
/// <exception cref="ArgumentException">
/// Expected string to have one or two pairs of quantity and unit in the format
/// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in"
/// </exception>
/// <exception cref="AmbiguousUnitParseException">
/// More than one unit is represented by the specified unit abbreviation.
/// Example: Volume.Parse("1 cup") will throw, because it can refer to any of
/// <see cref="VolumeUnit.MetricCup" />, <see cref="VolumeUnit.UsLegalCup" /> and <see cref="VolumeUnit.UsCustomaryCup" />.
/// </exception>
/// <exception cref="UnitsNetException">
/// If anything else goes wrong, typically due to a bug or unhandled case.
/// We wrap exceptions in <see cref="UnitsNetException" /> to allow you to distinguish
/// Units.NET exceptions from other exceptions.
/// </exception>
public static CoefficientOfThermalExpansion Parse(string str)
{
return Parse(str, null);
}
/// <summary>
/// Parse a string with one or two quantities of the format "<quantity> <unit>".
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <example>
/// Length.Parse("5.5 m", new CultureInfo("en-US"));
/// </example>
/// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
/// <exception cref="ArgumentException">
/// Expected string to have one or two pairs of quantity and unit in the format
/// "<quantity> <unit>". Eg. "5.5 m" or "1ft 2in"
/// </exception>
/// <exception cref="AmbiguousUnitParseException">
/// More than one unit is represented by the specified unit abbreviation.
/// Example: Volume.Parse("1 cup") will throw, because it can refer to any of
/// <see cref="VolumeUnit.MetricCup" />, <see cref="VolumeUnit.UsLegalCup" /> and <see cref="VolumeUnit.UsCustomaryCup" />.
/// </exception>
/// <exception cref="UnitsNetException">
/// If anything else goes wrong, typically due to a bug or unhandled case.
/// We wrap exceptions in <see cref="UnitsNetException" /> to allow you to distinguish
/// Units.NET exceptions from other exceptions.
/// </exception>
/// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public static CoefficientOfThermalExpansion Parse(string str, [CanBeNull] string cultureName)
{
IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);
return QuantityParser.Default.Parse<CoefficientOfThermalExpansion, CoefficientOfThermalExpansionUnit>(
str,
provider,
From);
}
/// <summary>
/// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <param name="result">Resulting unit quantity if successful.</param>
/// <example>
/// Length.Parse("5.5 m", new CultureInfo("en-US"));
/// </example>
public static bool TryParse([CanBeNull] string str, out CoefficientOfThermalExpansion result)
{
return TryParse(str, null, out result);
}
/// <summary>
/// Try to parse a string with one or two quantities of the format "<quantity> <unit>".
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <param name="result">Resulting unit quantity if successful.</param>
/// <returns>True if successful, otherwise false.</returns>
/// <example>
/// Length.Parse("5.5 m", new CultureInfo("en-US"));
/// </example>
/// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public static bool TryParse([CanBeNull] string str, [CanBeNull] string cultureName, out CoefficientOfThermalExpansion result)
{
IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);
return QuantityParser.Default.TryParse<CoefficientOfThermalExpansion, CoefficientOfThermalExpansionUnit>(
str,
provider,
From,
out result);
}
/// <summary>
/// Parse a unit string.
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <example>
/// Length.ParseUnit("m", new CultureInfo("en-US"));
/// </example>
/// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
/// <exception cref="UnitsNetException">Error parsing string.</exception>
public static CoefficientOfThermalExpansionUnit ParseUnit(string str)
{
return ParseUnit(str, null);
}
/// <summary>
/// Parse a unit string.
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <example>
/// Length.ParseUnit("m", new CultureInfo("en-US"));
/// </example>
/// <exception cref="ArgumentNullException">The value of 'str' cannot be null. </exception>
/// <exception cref="UnitsNetException">Error parsing string.</exception>
/// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public static CoefficientOfThermalExpansionUnit ParseUnit(string str, [CanBeNull] string cultureName)
{
IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);
return UnitParser.Default.Parse<CoefficientOfThermalExpansionUnit>(str, provider);
}
public static bool TryParseUnit(string str, out CoefficientOfThermalExpansionUnit unit)
{
return TryParseUnit(str, null, out unit);
}
/// <summary>
/// Parse a unit string.
/// </summary>
/// <param name="str">String to parse. Typically in the form: {number} {unit}</param>
/// <param name="unit">The parsed unit if successful.</param>
/// <returns>True if successful, otherwise false.</returns>
/// <example>
/// Length.TryParseUnit("m", new CultureInfo("en-US"));
/// </example>
/// <param name="cultureName">Name of culture (ex: "en-US") to use when parsing number and unit. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public static bool TryParseUnit(string str, [CanBeNull] string cultureName, out CoefficientOfThermalExpansionUnit unit)
{
IFormatProvider provider = GetFormatProviderFromCultureName(cultureName);
return UnitParser.Default.TryParse<CoefficientOfThermalExpansionUnit>(str, provider, out unit);
}
#endregion
#region Equality / IComparable
public int CompareTo(object obj)
{
if(obj is null) throw new ArgumentNullException(nameof(obj));
if(!(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion)) throw new ArgumentException("Expected type CoefficientOfThermalExpansion.", nameof(obj));
return CompareTo(objCoefficientOfThermalExpansion);
}
// Windows Runtime Component does not allow public methods/ctors with same number of parameters: https://msdn.microsoft.com/en-us/library/br230301.aspx#Overloaded methods
internal int CompareTo(CoefficientOfThermalExpansion other)
{
return _value.CompareTo(other.AsBaseNumericType(this.Unit));
}
[Windows.Foundation.Metadata.DefaultOverload]
public override bool Equals(object obj)
{
if(obj is null || !(obj is CoefficientOfThermalExpansion objCoefficientOfThermalExpansion))
return false;
return Equals(objCoefficientOfThermalExpansion);
}
public bool Equals(CoefficientOfThermalExpansion other)
{
return _value.Equals(other.AsBaseNumericType(this.Unit));
}
/// <summary>
/// <para>
/// Compare equality to another CoefficientOfThermalExpansion within the given absolute or relative tolerance.
/// </para>
/// <para>
/// Relative tolerance is defined as the maximum allowable absolute difference between this quantity's value and
/// <paramref name="other"/> as a percentage of this quantity's value. <paramref name="other"/> will be converted into
/// this quantity's unit for comparison. A relative tolerance of 0.01 means the absolute difference must be within +/- 1% of
/// this quantity's value to be considered equal.
/// <example>
/// In this example, the two quantities will be equal if the value of b is within +/- 1% of a (0.02m or 2cm).
/// <code>
/// var a = Length.FromMeters(2.0);
/// var b = Length.FromInches(50.0);
/// a.Equals(b, 0.01, ComparisonType.Relative);
/// </code>
/// </example>
/// </para>
/// <para>
/// Absolute tolerance is defined as the maximum allowable absolute difference between this quantity's value and
/// <paramref name="other"/> as a fixed number in this quantity's unit. <paramref name="other"/> will be converted into
/// this quantity's unit for comparison.
/// <example>
/// In this example, the two quantities will be equal if the value of b is within 0.01 of a (0.01m or 1cm).
/// <code>
/// var a = Length.FromMeters(2.0);
/// var b = Length.FromInches(50.0);
/// a.Equals(b, 0.01, ComparisonType.Absolute);
/// </code>
/// </example>
/// </para>
/// <para>
/// Note that it is advised against specifying zero difference, due to the nature
/// of floating point operations and using System.Double internally.
/// </para>
/// </summary>
/// <param name="other">The other quantity to compare to.</param>
/// <param name="tolerance">The absolute or relative tolerance value. Must be greater than or equal to 0.</param>
/// <param name="comparisonType">The comparison type: either relative or absolute.</param>
/// <returns>True if the absolute difference between the two values is not greater than the specified relative or absolute tolerance.</returns>
public bool Equals(CoefficientOfThermalExpansion other, double tolerance, ComparisonType comparisonType)
{
if(tolerance < 0)
throw new ArgumentOutOfRangeException("tolerance", "Tolerance must be greater than or equal to 0.");
double thisValue = (double)this.Value;
double otherValueInThisUnits = other.As(this.Unit);
return UnitsNet.Comparison.Equals(thisValue, otherValueInThisUnits, tolerance, comparisonType);
}
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>A hash code for the current CoefficientOfThermalExpansion.</returns>
public override int GetHashCode()
{
return new { QuantityType, Value, Unit }.GetHashCode();
}
#endregion
#region Conversion Methods
/// <summary>
/// Convert to the unit representation <paramref name="unit" />.
/// </summary>
/// <returns>Value converted to the specified unit.</returns>
public double As(CoefficientOfThermalExpansionUnit unit)
{
if(Unit == unit)
return Convert.ToDouble(Value);
var converted = AsBaseNumericType(unit);
return Convert.ToDouble(converted);
}
/// <summary>
/// Converts this CoefficientOfThermalExpansion to another CoefficientOfThermalExpansion with the unit representation <paramref name="unit" />.
/// </summary>
/// <returns>A CoefficientOfThermalExpansion with the specified unit.</returns>
public CoefficientOfThermalExpansion ToUnit(CoefficientOfThermalExpansionUnit unit)
{
var convertedValue = AsBaseNumericType(unit);
return new CoefficientOfThermalExpansion(convertedValue, unit);
}
/// <summary>
/// Converts the current value + unit to the base unit.
/// This is typically the first step in converting from one unit to another.
/// </summary>
/// <returns>The value in the base unit representation.</returns>
private double AsBaseUnit()
{
switch(Unit)
{
case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return _value;
case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return _value*5/9;
case CoefficientOfThermalExpansionUnit.InverseKelvin: return _value;
default:
throw new NotImplementedException($"Can not convert {Unit} to base units.");
}
}
private double AsBaseNumericType(CoefficientOfThermalExpansionUnit unit)
{
if(Unit == unit)
return _value;
var baseUnitValue = AsBaseUnit();
switch(unit)
{
case CoefficientOfThermalExpansionUnit.InverseDegreeCelsius: return baseUnitValue;
case CoefficientOfThermalExpansionUnit.InverseDegreeFahrenheit: return baseUnitValue*9/5;
case CoefficientOfThermalExpansionUnit.InverseKelvin: return baseUnitValue;
default:
throw new NotImplementedException($"Can not convert {Unit} to {unit}.");
}
}
#endregion
#region ToString Methods
/// <summary>
/// Get default string representation of value and unit.
/// </summary>
/// <returns>String representation.</returns>
public override string ToString()
{
return ToString(null);
}
/// <summary>
/// Get string representation of value and unit. Using two significant digits after radix.
/// </summary>
/// <returns>String representation.</returns>
/// <param name="cultureName">Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public string ToString([CanBeNull] string cultureName)
{
var provider = cultureName;
return ToString(provider, 2);
}
/// <summary>
/// Get string representation of value and unit.
/// </summary>
/// <param name="significantDigitsAfterRadix">The number of significant digits after the radix point.</param>
/// <returns>String representation.</returns>
/// <param name="cultureName">Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public string ToString(string cultureName, int significantDigitsAfterRadix)
{
var provider = cultureName;
var value = Convert.ToDouble(Value);
var format = UnitFormatter.GetFormat(value, significantDigitsAfterRadix);
return ToString(provider, format);
}
/// <summary>
/// Get string representation of value and unit.
/// </summary>
/// <param name="format">String format to use. Default: "{0:0.##} {1} for value and unit abbreviation respectively."</param>
/// <param name="args">Arguments for string format. Value and unit are implictly included as arguments 0 and 1.</param>
/// <returns>String representation.</returns>
/// <param name="cultureName">Name of culture (ex: "en-US") to use for localization and number formatting. Defaults to <see cref="GlobalConfiguration.DefaultCulture" /> if null.</param>
public string ToString([CanBeNull] string cultureName, [NotNull] string format, [NotNull] params object[] args)
{
var provider = GetFormatProviderFromCultureName(cultureName);
if (format == null) throw new ArgumentNullException(nameof(format));
if (args == null) throw new ArgumentNullException(nameof(args));
provider = provider ?? GlobalConfiguration.DefaultCulture;
var value = Convert.ToDouble(Value);
var formatArgs = UnitFormatter.GetFormatArgs(Unit, value, provider, args);
return string.Format(provider, format, formatArgs);
}
#endregion
private static IFormatProvider GetFormatProviderFromCultureName([CanBeNull] string cultureName)
{
return cultureName != null ? new CultureInfo(cultureName) : (IFormatProvider)null;
}
}
}
| 48.80937 | 280 | 0.635223 | [
"MIT"
] | tongbong/UnitsNet | UnitsNet.WindowsRuntimeComponent/GeneratedCode/Quantities/CoefficientOfThermalExpansion.WindowsRuntimeComponent.g.cs | 30,215 | C# |
using System;
using System.Web;
using System.Web.UI;
using System.Collections.Specialized;
using Newtonsoft.Json;
using PBIWebApp.Properties;
using Microsoft.IdentityModel.Clients.ActiveDirectory;
namespace PBIWebApp
{
/* NOTE: This code is for sample purposes only. In a production application, you could use a MVC design pattern.
* In addition, you should provide appropriate exception handling and refactor authentication settings into
* a secure configuration. Authentication settings are hard-coded in the sample to make it easier to follow the flow of authentication.
* In addition, the sample uses a single web page so that all code is in one location. However, you could refactor the code into
* your own production model.
*/
public partial class _Default : Page
{
string baseUri = Properties.Settings.Default.PowerBiDataset;
protected void Page_Load(object sender, EventArgs e)
{
//Need an Authorization Code from Azure AD before you can get an access token to be able to call Power BI operations
//You get the Authorization Code when you click Get Tile (see below).
//After you call AcquireAuthorizationCode(), Azure AD redirects back to this page with an Authorization Code.
if (Request.Params.Get("code") != null)
{
//After you get an AccessToken, you can call Power BI API operations such as Get Tile
Session["AccessToken"] = GetAccessToken(
Request.Params.GetValues("code")[0],
Settings.Default.ClientID,
Settings.Default.ClientSecret,
Settings.Default.RedirectUri);
//Redirect again to get rid of code=
Response.Redirect("/Default.aspx");
}
//After the redirect above to get rid of code=, Session["authResult"] does not equal null, which means you have an
//Access Token. With the Acccess Token, you can call the Power BI Get Tiles operation. Get Tiles returns information
//about a tile, not the actual tile visual. You get the tile visual later with some JavaScript. See postActionLoadTile()
//in Default.aspx.
if (Session["AccessToken"] != null)
{
//You need the Access Token in an HTML element so that the JavaScript can load a tile visual into an IFrame.
//Without the Access Token, you can not access the tile visual.
accessToken.Value = Session["AccessToken"].ToString();
//Get first dashboard. Sample assumes one dashboard with one tile
string dashboardId = GetDashboard(0);
//You can get the Dashboard ID with the Get Dashboards operation. Or go to your dashboard, and get it from the url for the dashboard.
//The dashboard id is at the end if the url. For example, https://msit.powerbi.com/groups/me/dashboards/00b7e871-cb98-48ed-bddc-0000c000e000
//In this sample, you get the first tile in the first dashbaord. In a production app, you would create a more robost
//solution
GetTile(dashboardId, 0);
}
}
protected void getTileButton_Click(object sender, EventArgs e)
{
//You need an Authorization Code from Azure AD so that you can get an Access Token
//Values are hard-coded for sample purposes.
GetAuthorizationCode();
}
//Get a dashbaord id.
protected string GetDashboard(int index)
{
string dashboardId = string.Empty;
//Configure tiles request
System.Net.WebRequest request = System.Net.WebRequest.Create(
String.Format("{0}Dashboards",
baseUri)) as System.Net.HttpWebRequest;
request.Method = "GET";
request.ContentLength = 0;
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken.Value));
//Get dashboards response from request.GetResponse()
using (var response = request.GetResponse() as System.Net.HttpWebResponse)
{
//Get reader from response stream
using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
{
//Deserialize JSON string
PBIDashboards dashboards = JsonConvert.DeserializeObject<PBIDashboards>(reader.ReadToEnd());
//Sample assumes at least one Dashboard with one Tile.
//You could write an app that lists all tiles in a dashboard
dashboardId = dashboards.value[index].id;
}
}
return dashboardId;
}
//Get a tile from a dashboard. In this sample, you get the first tile.
protected void GetTile(string dashboardId, int index)
{
//Configure tiles request
System.Net.WebRequest request = System.Net.WebRequest.Create(
String.Format("{0}Dashboards/{1}/Tiles",
baseUri,
dashboardId)) as System.Net.HttpWebRequest;
request.Method = "GET";
request.ContentLength = 0;
request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken.Value));
//Get tiles response from request.GetResponse()
using (var response = request.GetResponse() as System.Net.HttpWebResponse)
{
//Get reader from response stream
using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
{
//Deserialize JSON string
PBITiles tiles = JsonConvert.DeserializeObject<PBITiles>(reader.ReadToEnd());
//Sample assumes at least one Dashboard with one Tile.
//You could write an app that lists all tiles in a dashboard
if (tiles.value.Length > 0)
tileEmbedUrl.Text = tiles.value[index].embedUrl;
}
}
}
public void GetAuthorizationCode()
{
//NOTE: Values are hard-coded for sample purposes.
//Create a query string
//Create a sign-in NameValueCollection for query string
var @params = new NameValueCollection
{
//Azure AD will return an authorization code.
{"response_type", "code"},
//Client ID is used by the application to identify themselves to the users that they are requesting permissions from.
//You get the client id when you register your Azure app.
{"client_id", Settings.Default.ClientID},
//Resource uri to the Power BI resource to be authorized
//The resource uri is hard-coded for sample purposes
{"resource", Properties.Settings.Default.PowerBiAPI},
//After app authenticates, Azure AD will redirect back to the web app. In this sample, Azure AD redirects back
//to Default page (Default.aspx).
{ "redirect_uri", Settings.Default.RedirectUri}
};
//Create sign-in query string
var queryString = HttpUtility.ParseQueryString(string.Empty);
queryString.Add(@params);
//Redirect to Azure AD Authority
// Authority Uri is an Azure resource that takes a client id and client secret to get an Access token
// QueryString contains
// response_type of "code"
// client_id that identifies your app in Azure AD
// resource which is the Power BI API resource to be authorized
// redirect_uri which is the uri that Azure AD will redirect back to after it authenticates
//Redirect to Azure AD to get an authorization code
Response.Redirect(String.Format(Properties.Settings.Default.AADAuthorityUri + "?{0}", queryString));
}
public string GetAccessToken(string authorizationCode, string clientID, string clientSecret, string redirectUri)
{
//Redirect uri must match the redirect_uri used when requesting Authorization code.
//Note: If you use a redirect back to Default, as in this sample, you need to add a forward slash
//such as http://localhost:13526/
// Get auth token from auth code
TokenCache TC = new TokenCache();
//Values are hard-coded for sample purposes
string authority = Properties.Settings.Default.AADAuthorityUri;
AuthenticationContext AC = new AuthenticationContext(authority, TC);
ClientCredential cc = new ClientCredential(clientID, clientSecret);
//Set token from authentication result
return AC.AcquireTokenByAuthorizationCode(
authorizationCode,
new Uri(redirectUri), cc).AccessToken;
}
}
//Power BI Dashboards used to deserialize the Get Dashboards response.
public class PBIDashboards
{
public PBIDashboard[] value { get; set; }
}
public class PBIDashboard
{
public string id { get; set; }
public string displayName { get; set; }
}
//Power BI Tiles used to deserialize the Get Tiles response.
public class PBITiles
{
public PBITile[] value { get; set; }
}
public class PBITile
{
public string id { get; set; }
public string title { get; set; }
public string embedUrl { get; set; }
}
} | 45.637209 | 170 | 0.611904 | [
"MIT"
] | anuradhak06/POWERBI | samples/webforms/integrate-tile-web-app/PBIWebApp/Default.aspx.cs | 9,814 | C# |
using Snuggle.Core.IO;
using Snuggle.Core.Meta;
namespace Snuggle.Core.Models.Objects.Settings;
public record OculusSettings(bool SharedDepthBuffer, bool DashSupport, bool LowOverheadMode, bool ProtectedContext, bool V2Signing) {
public static OculusSettings Default { get; } = new(false, false, false, false, false);
public static OculusSettings FromReader(BiEndianBinaryReader reader, SerializedFile file) {
var shared = reader.ReadBoolean();
var dash = reader.ReadBoolean();
var lowOverhead = false;
var protectedContext = false;
var signing = false;
if (file.Version >= UnityVersionRegister.Unity2018_4 && file.Version < UnityVersionRegister.Unity2019_1 || file.Version >= UnityVersionRegister.Unity2019_2) {
lowOverhead = reader.ReadBoolean();
}
if (file.Version >= UnityVersionRegister.Unity2018_4 && file.Version < UnityVersionRegister.Unity2019_1 || file.Version >= UnityVersionRegister.Unity2019_3) {
protectedContext = reader.ReadBoolean();
signing = reader.ReadBoolean();
}
reader.Align();
return new OculusSettings(shared, dash, lowOverhead, protectedContext, signing);
}
}
| 43.857143 | 166 | 0.703583 | [
"MIT"
] | yretenai/Snuggle | Snuggle.Core/Models/Objects/Settings/OculusSettings.cs | 1,230 | C# |
// <auto-generated />
using System;
using DutchTreat.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace DutchTreat.Migrations
{
[DbContext(typeof(DutchContext))]
partial class DutchContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "2.2.3-servicing-35854")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("DutchTreat.Data.Entities.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<DateTime>("OrderDate");
b.Property<string>("OrderNumber");
b.Property<string>("UserId");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("Orders");
b.HasData(
new
{
Id = 1,
OrderDate = new DateTime(2019, 5, 6, 3, 56, 20, 689, DateTimeKind.Utc).AddTicks(5420),
OrderNumber = "12345"
});
});
modelBuilder.Entity("DutchTreat.Data.Entities.OrderItem", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<int?>("OrderId");
b.Property<int?>("ProductId");
b.Property<int>("Quantity");
b.Property<decimal>("UnitPrice");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("ProductId");
b.ToTable("OrderItems");
});
modelBuilder.Entity("DutchTreat.Data.Entities.Product", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ArtDating");
b.Property<string>("ArtDescription");
b.Property<string>("ArtId");
b.Property<string>("Artist");
b.Property<DateTime>("ArtistBirthDate");
b.Property<DateTime>("ArtistDeathDate");
b.Property<string>("ArtistNationality");
b.Property<string>("Category");
b.Property<decimal>("Price");
b.Property<string>("Size");
b.Property<string>("Title");
b.HasKey("Id");
b.ToTable("Products");
});
modelBuilder.Entity("DutchTreat.Data.Entities.StoreUser", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<int>("AccessFailedCount");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Email")
.HasMaxLength(256);
b.Property<bool>("EmailConfirmed");
b.Property<string>("FirstName");
b.Property<string>("LastName");
b.Property<bool>("LockoutEnabled");
b.Property<DateTimeOffset?>("LockoutEnd");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256);
b.Property<string>("NormalizedUserName")
.HasMaxLength(256);
b.Property<string>("PasswordHash");
b.Property<string>("PhoneNumber");
b.Property<bool>("PhoneNumberConfirmed");
b.Property<string>("SecurityStamp");
b.Property<bool>("TwoFactorEnabled");
b.Property<string>("UserName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasName("UserNameIndex")
.HasFilter("[NormalizedUserName] IS NOT NULL");
b.ToTable("AspNetUsers");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.ValueGeneratedOnAdd();
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken();
b.Property<string>("Name")
.HasMaxLength(256);
b.Property<string>("NormalizedName")
.HasMaxLength(256);
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasName("RoleNameIndex")
.HasFilter("[NormalizedName] IS NOT NULL");
b.ToTable("AspNetRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("RoleId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
b.Property<string>("ClaimType");
b.Property<string>("ClaimValue");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider");
b.Property<string>("ProviderKey");
b.Property<string>("ProviderDisplayName");
b.Property<string>("UserId")
.IsRequired();
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("RoleId");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId");
b.Property<string>("LoginProvider");
b.Property<string>("Name");
b.Property<string>("Value");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens");
});
modelBuilder.Entity("DutchTreat.Data.Entities.Order", b =>
{
b.HasOne("DutchTreat.Data.Entities.StoreUser", "User")
.WithMany()
.HasForeignKey("UserId");
});
modelBuilder.Entity("DutchTreat.Data.Entities.OrderItem", b =>
{
b.HasOne("DutchTreat.Data.Entities.Order", "Order")
.WithMany("Items")
.HasForeignKey("OrderId");
b.HasOne("DutchTreat.Data.Entities.Product", "Product")
.WithMany()
.HasForeignKey("ProductId");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("DutchTreat.Data.Entities.StoreUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("DutchTreat.Data.Entities.StoreUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole")
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade);
b.HasOne("DutchTreat.Data.Entities.StoreUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("DutchTreat.Data.Entities.StoreUser")
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade);
});
#pragma warning restore 612, 618
}
}
}
| 34.142857 | 125 | 0.47045 | [
"MIT"
] | RuchiraGamage/DutchTreat | DutchTreat/Data/Migrations/DutchContextModelSnapshot.cs | 11,474 | C# |
using System;
using System.Collections.Generic;
using System.Net.Http.Headers;
using KeyPayV2.Uk.Models.Common;
using KeyPayV2.Uk.Enums;
namespace KeyPayV2.Uk.Models.Business
{
public class LocationItemModel
{
public int Id { get; set; }
public string Name { get; set; }
}
}
| 21.2 | 41 | 0.666667 | [
"MIT"
] | KeyPay/keypay-dotnet-v2 | src/keypay-dotnet/Uk/Models/Business/LocationItemModel.cs | 318 | C# |
using BEPUphysics.BroadPhaseEntries;
using BEPUphysics.BroadPhaseEntries.MobileCollidables;
using BEPUutilities.ResourceManagement;
using Microsoft.Xna.Framework;
using BEPUutilities;
namespace BEPUphysics.NarrowPhaseSystems.Pairs
{
///<summary>
/// Handles a mobile mesh-mobile mesh collision pair.
///</summary>
public class MobileMeshMobileMeshPairHandler : MobileMeshMeshPairHandler
{
MobileMeshCollidable mesh;
public override Collidable CollidableB
{
get { return mesh; }
}
public override Entities.Entity EntityB
{
get { return mesh.entity; }
}
protected override Materials.Material MaterialB
{
get { return mesh.entity.material; }
}
protected override TriangleCollidable GetOpposingCollidable(int index)
{
//Construct a TriangleCollidable from the static mesh.
var toReturn = PhysicsResources.GetTriangleCollidable();
toReturn.Shape.sidedness = mesh.Shape.Sidedness;
toReturn.Shape.collisionMargin = mobileMesh.Shape.MeshCollisionMargin;
toReturn.Entity = mesh.entity;
return toReturn;
}
protected override void CleanUpCollidable(TriangleCollidable collidable)
{
collidable.Entity = null;
base.CleanUpCollidable(collidable);
}
protected override void ConfigureCollidable(TriangleEntry entry, float dt)
{
var shape = entry.Collidable.Shape;
mesh.Shape.TriangleMesh.Data.GetTriangle(entry.Index, out shape.vA, out shape.vB, out shape.vC);
Matrix3x3 o;
Matrix3x3.CreateFromQuaternion(ref mesh.worldTransform.Orientation, out o);
Matrix3x3.Transform(ref shape.vA, ref o, out shape.vA);
Matrix3x3.Transform(ref shape.vB, ref o, out shape.vB);
Matrix3x3.Transform(ref shape.vC, ref o, out shape.vC);
Vector3 center;
Vector3.Add(ref shape.vA, ref shape.vB, out center);
Vector3.Add(ref center, ref shape.vC, out center);
Vector3.Multiply(ref center, 1 / 3f, out center);
Vector3.Subtract(ref shape.vA, ref center, out shape.vA);
Vector3.Subtract(ref shape.vB, ref center, out shape.vB);
Vector3.Subtract(ref shape.vC, ref center, out shape.vC);
Vector3.Add(ref center, ref mesh.worldTransform.Position, out center);
//The bounding box doesn't update by itself.
entry.Collidable.worldTransform.Position = center;
entry.Collidable.worldTransform.Orientation = Quaternion.Identity;
entry.Collidable.UpdateBoundingBoxInternal(dt);
}
///<summary>
/// Initializes the pair handler.
///</summary>
///<param name="entryA">First entry in the pair.</param>
///<param name="entryB">Second entry in the pair.</param>
public override void Initialize(BroadPhaseEntry entryA, BroadPhaseEntry entryB)
{
mesh = (MobileMeshCollidable)entryB;
base.Initialize(entryA, entryB);
}
///<summary>
/// Cleans up the pair handler.
///</summary>
public override void CleanUp()
{
base.CleanUp();
mesh = null;
}
protected override void UpdateContainedPairs(float dt)
{
var overlappedElements = CommonResources.GetIntList();
BoundingBox localBoundingBox;
AffineTransform meshTransform;
AffineTransform.CreateFromRigidTransform(ref mesh.worldTransform, out meshTransform);
Vector3 sweep;
Vector3.Subtract(ref mobileMesh.entity.linearVelocity, ref mesh.entity.linearVelocity, out sweep);
Vector3.Multiply(ref sweep, dt, out sweep);
mobileMesh.Shape.GetSweptLocalBoundingBox(ref mobileMesh.worldTransform, ref meshTransform, ref sweep, out localBoundingBox);
mesh.Shape.TriangleMesh.Tree.GetOverlaps(localBoundingBox, overlappedElements);
for (int i = 0; i < overlappedElements.Count; i++)
{
TryToAdd(overlappedElements.Elements[i]);
}
CommonResources.GiveBack(overlappedElements);
}
}
}
| 34.456693 | 137 | 0.631856 | [
"Unlicense",
"MIT"
] | MSylvia/Lemma | BEPUphysics/NarrowPhaseSystems/Pairs/MobileMeshMobileMeshPairHandler.cs | 4,378 | C# |
namespace AssetStudio
{
class AssetFont
{
public string m_Name;
public byte[] m_FontData;
public AssetFont(AssetPreloadData preloadData, bool readSwitch)
{
AssetsFile sourceFile = preloadData.sourceFile;
EndianStream a_Stream = preloadData.sourceFile.a_Stream;
a_Stream.Position = preloadData.Offset;
if (sourceFile.platform == -2)
{
uint m_ObjectHideFlags = a_Stream.ReadUInt32();
PPtr m_PrefabParentObject = sourceFile.ReadPPtr();
PPtr m_PrefabInternal = sourceFile.ReadPPtr();
}
m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
if (readSwitch)
{
int m_AsciiStartOffset = a_Stream.ReadInt32();
if (sourceFile.version[0] <= 3)
{
int m_FontCountX = a_Stream.ReadInt32();
int m_FontCountY = a_Stream.ReadInt32();
}
float m_Kerning = a_Stream.ReadSingle();
float m_LineSpacing = a_Stream.ReadSingle();
if (sourceFile.version[0] <= 3)
{
int m_PerCharacterKerning_size = a_Stream.ReadInt32();
for (int i = 0; i < m_PerCharacterKerning_size; i++)
{
int first = a_Stream.ReadInt32();
float second = a_Stream.ReadSingle();
}
}
else
{
int m_CharacterSpacing = a_Stream.ReadInt32();
int m_CharacterPadding = a_Stream.ReadInt32();
}
int m_ConvertCase = a_Stream.ReadInt32();
PPtr m_DefaultMaterial = sourceFile.ReadPPtr();
int m_CharacterRects_size = a_Stream.ReadInt32();
for (int i = 0; i < m_CharacterRects_size; i++)
{
int index = a_Stream.ReadInt32();
//Rectf uv
float uvx = a_Stream.ReadSingle();
float uvy = a_Stream.ReadSingle();
float uvwidth = a_Stream.ReadSingle();
float uvheight = a_Stream.ReadSingle();
//Rectf vert
float vertx = a_Stream.ReadSingle();
float verty = a_Stream.ReadSingle();
float vertwidth = a_Stream.ReadSingle();
float vertheight = a_Stream.ReadSingle();
float width = a_Stream.ReadSingle();
if (sourceFile.version[0] >= 4)
{
bool flipped = a_Stream.ReadBoolean();
a_Stream.Position += 3;
}
}
PPtr m_Texture = sourceFile.ReadPPtr();
int m_KerningValues_size = a_Stream.ReadInt32();
for (int i = 0; i < m_KerningValues_size; i++)
{
int pairfirst = a_Stream.ReadInt16();
int pairsecond = a_Stream.ReadInt16();
float second = a_Stream.ReadSingle();
}
if (sourceFile.version[0] <= 3)
{
bool m_GridFont = a_Stream.ReadBoolean();
a_Stream.Position += 3; //4 byte alignment
}
else { float m_PixelScale = a_Stream.ReadSingle(); }
int m_FontData_size = a_Stream.ReadInt32();
if (m_FontData_size > 0)
{
m_FontData = new byte[m_FontData_size];
a_Stream.Read(m_FontData, 0, m_FontData_size);
if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79)
{ preloadData.extension = ".otf"; }
else { preloadData.extension = ".ttf"; }
}
float m_FontSize = a_Stream.ReadSingle();//problem here in minifootball
float m_Ascent = a_Stream.ReadSingle();
uint m_DefaultStyle = a_Stream.ReadUInt32();
int m_FontNames = a_Stream.ReadInt32();
for (int i = 0; i < m_FontNames; i++)
{
string m_FontName = a_Stream.ReadAlignedString(a_Stream.ReadInt32());
}
if (sourceFile.version[0] >= 4)
{
int m_FallbackFonts = a_Stream.ReadInt32();
for (int i = 0; i < m_FallbackFonts; i++)
{
PPtr m_FallbackFont = sourceFile.ReadPPtr();
}
int m_FontRenderingMode = a_Stream.ReadInt32();
}
}
else
{
if (m_Name != "") { preloadData.Text = m_Name; }
else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; }
preloadData.SubItems.AddRange(new string[] { preloadData.TypeString, preloadData.exportSize.ToString() });
}
}
}
}
| 38.321168 | 122 | 0.476762 | [
"MIT"
] | Ancherny/AssetStudio | AssetStudio/Classes/Font.cs | 5,252 | C# |
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace ProfilingApp
{
public class PersonBasicViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string _firstName;
private string _lastName;
private int _age;
public string FirstName
{
get { return _firstName; }
set
{
if (_firstName != value)
{
_firstName = value;
OnPropertyChanged();
}
}
}
public string LastName
{
get { return _lastName; }
set
{
if (_lastName != value)
{
_lastName = value;
OnPropertyChanged();
}
}
}
public int Age
{
get { return _age; }
set
{
if (_age != value)
{
_age = value;
OnPropertyChanged();
}
}
}
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
} | 24.75 | 95 | 0.453824 | [
"MIT"
] | putridparrot/Presentation.Core | ProfilingApp/PersonBasicViewModel.cs | 1,388 | C# |
using System.Net;
using Moq;
using Net.Http.OData.Model;
using Net.Http.OData.Query;
using Net.Http.OData.Query.Validators;
using Xunit;
namespace Net.Http.OData.Tests.Query.Validators
{
public class TopQueryValidatorTests
{
public class WhenTheTopQueryOptionIsSetAndItIsNotSpecifiedInAllowedQueryOptions
{
private readonly ODataQueryOptions _queryOptions;
private readonly ODataValidationSettings _validationSettings = new ODataValidationSettings
{
AllowedQueryOptions = AllowedQueryOptions.None
};
public WhenTheTopQueryOptionIsSetAndItIsNotSpecifiedInAllowedQueryOptions()
{
TestHelper.EnsureEDM();
_queryOptions = new ODataQueryOptions(
"?$top=50",
EntityDataModel.Current.EntitySets["Products"],
Mock.Of<IODataQueryOptionsValidator>());
}
[Fact]
public void An_ODataException_IsThrown_WithStatusNotImplemented()
{
ODataException odataException = Assert.Throws<ODataException>(
() => TopQueryOptionValidator.Validate(_queryOptions, _validationSettings));
Assert.Equal(HttpStatusCode.NotImplemented, odataException.StatusCode);
Assert.Equal("The query option $top is not implemented by this service", odataException.Message);
Assert.Equal("$top", odataException.Target);
}
}
public class WhenTheTopQueryOptionIsSetAndItIsSpecifiedInAllowedQueryOptions
{
private readonly ODataQueryOptions _queryOptions;
private readonly ODataValidationSettings _validationSettings = new ODataValidationSettings
{
AllowedQueryOptions = AllowedQueryOptions.Top,
MaxTop = 100
};
public WhenTheTopQueryOptionIsSetAndItIsSpecifiedInAllowedQueryOptions()
{
TestHelper.EnsureEDM();
_queryOptions = new ODataQueryOptions(
"?$top=50",
EntityDataModel.Current.EntitySets["Products"],
Mock.Of<IODataQueryOptionsValidator>());
}
[Fact]
public void AnExceptionShouldNotBeThrown()
{
TopQueryOptionValidator.Validate(_queryOptions, _validationSettings);
}
}
public class WhenValidatingAndNoMaxTopIsSetButTheValueIsBelowZero
{
private readonly ODataQueryOptions _queryOptions;
private readonly ODataValidationSettings _validationSettings = new ODataValidationSettings
{
AllowedQueryOptions = AllowedQueryOptions.Top
};
public WhenValidatingAndNoMaxTopIsSetButTheValueIsBelowZero()
{
TestHelper.EnsureEDM();
_queryOptions = new ODataQueryOptions(
"?$top=-1",
EntityDataModel.Current.EntitySets["Products"],
Mock.Of<IODataQueryOptionsValidator>());
}
[Fact]
public void An_ODataException_IsThrown_WithStatusBadRequest()
{
ODataException odataException = Assert.Throws<ODataException>(
() => TopQueryOptionValidator.Validate(_queryOptions, _validationSettings));
Assert.Equal(HttpStatusCode.BadRequest, odataException.StatusCode);
Assert.Equal("The integer value for $top is invalid, it must be an integer greater than zero and below the max value of 0 allowed by this service", odataException.Message);
Assert.Equal("$top", odataException.Target);
}
}
public class WhenValidatingAndTheQueryOptionDoesNotExceedTheSpecifiedMaxTopValue
{
private readonly ODataQueryOptions _queryOptions;
private readonly ODataValidationSettings _validationSettings = new ODataValidationSettings
{
AllowedQueryOptions = AllowedQueryOptions.Top,
MaxTop = 100
};
public WhenValidatingAndTheQueryOptionDoesNotExceedTheSpecifiedMaxTopValue()
{
TestHelper.EnsureEDM();
_queryOptions = new ODataQueryOptions(
"?$top=25",
EntityDataModel.Current.EntitySets["Products"],
Mock.Of<IODataQueryOptionsValidator>());
}
[Fact]
public void NoExceptionIsThrown()
{
TopQueryOptionValidator.Validate(_queryOptions, _validationSettings);
}
}
public class WhenValidatingAndTheQueryOptionDoesNotSpecifyATopValue
{
private readonly ODataQueryOptions _queryOptions;
private readonly ODataValidationSettings _validationSettings = new ODataValidationSettings
{
MaxTop = 100
};
public WhenValidatingAndTheQueryOptionDoesNotSpecifyATopValue()
{
TestHelper.EnsureEDM();
_queryOptions = new ODataQueryOptions(
"",
EntityDataModel.Current.EntitySets["Products"],
Mock.Of<IODataQueryOptionsValidator>());
}
[Fact]
public void NoExceptionIsThrown()
{
TopQueryOptionValidator.Validate(_queryOptions, _validationSettings);
}
}
public class WhenValidatingAndTheQueryOptionExceedsTheSpecifiedMaxTopValue
{
private readonly ODataQueryOptions _queryOptions;
private readonly ODataValidationSettings _validationSettings = new ODataValidationSettings
{
AllowedQueryOptions = AllowedQueryOptions.Top,
MaxTop = 100
};
public WhenValidatingAndTheQueryOptionExceedsTheSpecifiedMaxTopValue()
{
TestHelper.EnsureEDM();
_queryOptions = new ODataQueryOptions(
"?$top=150",
EntityDataModel.Current.EntitySets["Products"],
Mock.Of<IODataQueryOptionsValidator>());
}
[Fact]
public void An_ODataException_IsThrown_WithStatusBadRequest()
{
ODataException odataException = Assert.Throws<ODataException>(
() => TopQueryOptionValidator.Validate(_queryOptions, _validationSettings));
Assert.Equal(HttpStatusCode.BadRequest, odataException.StatusCode);
Assert.Equal("The integer value for $top is invalid, it must be an integer greater than zero and below the max value of 100 allowed by this service", odataException.Message);
Assert.Equal("$top", odataException.Target);
}
}
}
}
| 37.700535 | 190 | 0.604965 | [
"Apache-2.0"
] | Net-Http-OData/Net.Http.OData | Net.Http.OData.Tests/Query/Validators/TopQueryOptionValidatorTests.cs | 7,052 | C# |
using System;
using System.Buffers.Binary;
using System.Net;
using NetworkPrimitives.Utilities;
namespace NetworkPrimitives.Ipv4
{
/// <summary>
/// Represents an IPv4 Subnet Mask, in subnet mask notation.
/// </summary>
public readonly struct Ipv4SubnetMask : IBinaryNetworkPrimitive<Ipv4SubnetMask>, IEquatable<Ipv4SubnetMask>, IEquatable<Ipv4Cidr>
{
internal uint Value { get; }
private Ipv4SubnetMask(uint value) => this.Value = value;
#region Equality
/// <summary>
/// Returns a value indicating whether this instance is equal to a specified <see cref="Ipv4SubnetMask"/>.
/// </summary>
/// <param name="other">
/// A value to compare to this instance.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="other"/> has the same value as this instance; otherwise, <see langword="false"/>.
/// </returns>
public bool Equals(Ipv4SubnetMask other) => this.Value == other.Value;
/// <summary>
/// Returns a value indicating whether this instance is equal to a specified <see cref="Ipv4Cidr"/>.
/// </summary>
/// <param name="other">
/// A value to compare to this instance.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="other"/> has the same value as this instance; otherwise, <see langword="false"/>.
/// </returns>
public bool Equals(Ipv4Cidr other) => this.Equals(other.ToSubnetMask());
/// <summary>
/// Returns a value indicating whether this instance is equal to a specified <see cref="Ipv4Cidr"/>.
/// </summary>
/// <param name="obj">
/// A value to compare to this instance.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="obj"/> is an instance of <see cref="Ipv4Cidr"/> or
/// <see cref="Ipv4SubnetMask"/> and equals the value of this instance; otherwise, <see langword="false"/>.
/// </returns>
public override bool Equals(object? obj) => obj switch
{
Ipv4Cidr other => Equals(other),
Ipv4SubnetMask other => Equals(other),
byte other => this.Value == other,
_ => false,
};
/// <summary>
/// Returns the hash code for this instance.
/// </summary>
/// <returns>
/// A 32-bit signed integer hash code.
/// </returns>
public override int GetHashCode() => (int)this.Value;
/// <summary>
/// Returns a value indicating whether two instances of <see cref="Ipv4SubnetMask"/> are equal.
/// </summary>
/// <param name="left">
/// The first <see cref="Ipv4SubnetMask"/> to compare.
/// </param>
/// <param name="right">
/// The second <see cref="Ipv4SubnetMask"/> to compare.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are equal; otherwise <see langword="false"/>.
/// </returns>
public static bool operator ==(Ipv4SubnetMask left, Ipv4SubnetMask right) => left.Equals(right);
/// <summary>
/// Returns a value indicating whether two instances of <see cref="Ipv4SubnetMask"/> are not equal.
/// </summary>
/// <param name="left">
/// The first <see cref="Ipv4SubnetMask"/> to compare.
/// </param>
/// <param name="right">
/// The second <see cref="Ipv4SubnetMask"/> to compare.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are not equal; otherwise <see langword="false"/>.
/// </returns>
public static bool operator !=(Ipv4SubnetMask left, Ipv4SubnetMask right) => !left.Equals(right);
/// <summary>
/// Returns a value indicating whether an instance of <see cref="Ipv4SubnetMask"/> is equal to an instance of <see cref="Ipv4Cidr"/>.
/// </summary>
/// <param name="left">
/// An instance of <see cref="Ipv4SubnetMask"/>.
/// </param>
/// <param name="right">
/// An instance of <see cref="Ipv4Cidr"/>.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are equal; otherwise <see langword="false"/>.
/// </returns>
public static bool operator ==(Ipv4SubnetMask left, Ipv4Cidr right) => left.Equals(right);
/// <summary>
/// Returns a value indicating whether an instance of <see cref="Ipv4SubnetMask"/> is not equal to an instance of <see cref="Ipv4Cidr"/>.
/// </summary>
/// <param name="left">
/// An instance of <see cref="Ipv4SubnetMask"/>.
/// </param>
/// <param name="right">
/// An instance of <see cref="Ipv4Cidr"/>.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are not equal; otherwise <see langword="false"/>.
/// </returns>
public static bool operator !=(Ipv4SubnetMask left, Ipv4Cidr right) => !left.Equals(right);
/// <summary>
/// Returns a value indicating whether an instance of <see cref="Ipv4Cidr"/> is equal to an instance of <see cref="Ipv4SubnetMask"/>.
/// </summary>
/// <param name="left">
/// An instance of <see cref="Ipv4Cidr"/>.
/// </param>
/// <param name="right">
/// An instance of <see cref="Ipv4SubnetMask"/>.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are equal; otherwise <see langword="false"/>.
/// </returns>
public static bool operator ==(Ipv4Cidr left, Ipv4SubnetMask right) => left.Equals(right);
/// <summary>
/// Returns a value indicating whether an instance of <see cref="Ipv4Cidr"/> is not equal to an instance of <see cref="Ipv4SubnetMask"/>.
/// </summary>
/// <param name="left">
/// An instance of <see cref="Ipv4Cidr"/>.
/// </param>
/// <param name="right">
/// An instance of <see cref="Ipv4SubnetMask"/>.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="left"/> and <paramref name="right"/> are not equal; otherwise <see langword="false"/>.
/// </returns>
public static bool operator !=(Ipv4Cidr left, Ipv4SubnetMask right) => !left.Equals(right);
#endregion Equality
#region Conversion
/// <summary>
/// Converts an <see cref="Ipv4SubnetMask"/> to an <see cref="Ipv4Cidr"/>
/// </summary>
/// <param name="mask">An instance of <see cref="Ipv4SubnetMask"/></param>
/// <returns>The corresponding instance of <see cref="Ipv4Cidr"/></returns>
public static implicit operator Ipv4Cidr(Ipv4SubnetMask mask) => Ipv4Cidr.Parse(SubnetMaskLookups.GetCidr(mask.Value));
/// <summary>
/// Converts an <see cref="Ipv4SubnetMask"/> to an <see cref="Ipv4WildcardMask"/>
/// </summary>
/// <param name="mask">An instance of <see cref="Ipv4SubnetMask"/></param>
/// <returns>The corresponding instance of <see cref="Ipv4WildcardMask"/></returns>
public static implicit operator Ipv4WildcardMask(Ipv4SubnetMask mask) => Ipv4WildcardMask.Parse(mask);
/// <summary>
/// Converts an <see cref="Ipv4Cidr"/> to an <see cref="Ipv4SubnetMask"/>
/// </summary>
/// <param name="cidr">An instance of <see cref="Ipv4Cidr"/></param>
/// <returns>The corresponding instance of <see cref="Ipv4SubnetMask"/></returns>
public static implicit operator Ipv4SubnetMask(Ipv4Cidr cidr) => new (SubnetMaskLookups.GetSubnetMask(cidr.Value));
/// <summary>
/// Converts this instance to an <see cref="Ipv4Cidr"/>
/// </summary>
/// <returns>The corresponding instance of <see cref="Ipv4Cidr"/></returns>
public Ipv4Cidr ToCidr() => this;
/// <summary>
/// Converts this instance to an <see cref="Ipv4WildcardMask"/>
/// </summary>
/// <returns>The corresponding instance of <see cref="Ipv4WildcardMask"/></returns>
public Ipv4WildcardMask ToWildcardMask() => this;
/// <summary>
/// Converts this instance to an <see cref="IPAddress"/>
/// </summary>
/// <returns>The corresponding instance of <see cref="IPAddress"/></returns>
public IPAddress ToIpAddress() => this.Value.ToIpAddress();
#endregion Conversion
#region Subnetting
/// <summary>
/// The total number of hosts allowed by this <see cref="Ipv4Cidr"/>.
/// Includes the broadcast and network addresses.
/// </summary>
public ulong TotalHosts => SubnetMaskLookups.GetTotalHosts(this.Value);
/// <summary>
/// The number of usable hosts allowed by this <see cref="Ipv4Cidr"/>.
/// Does not include the broadcast or network address.
/// RFC 3021 states that for a /31 network, the number of usable hosts is 2.
/// The number of usable hosts for a /32 network is 1.
/// </summary>
/// <seealso href="https://datatracker.ietf.org/doc/html/rfc3021">RFC3021</seealso>
public uint UsableHosts => SubnetMaskLookups.GetUsableHosts(this.Value);
internal bool IsSlash32Or31 => Value is 0xFFFFFFFF or 0xFFFFFFFE;
internal bool IsSlash32 => Value is 0xFFFFFFFF;
private static bool IsValidMask(uint value) => SubnetMaskLookups.TryGetCidr(value, out _);
#endregion Subnetting
#region Parsing
/// <summary>
/// Converts a subnet mask string to an <see cref="Ipv4SubnetMask"/> instance.
/// </summary>
/// <param name="text">
/// A string that contains the subnet mask in dotted decimal form.
/// </param>
/// <returns></returns>
/// <exception cref="ArgumentNullException">
/// <paramref name="text"/> is <see langword="null"/>.
/// </exception>
/// <exception cref="FormatException">
/// <paramref name="text"/> is not a valid IPv4 subnet mask
/// </exception>
public static Ipv4SubnetMask Parse(string? text)
{
text = text ?? throw new ArgumentNullException(nameof(text));
return Ipv4SubnetMask.TryParse(text, out var mask)
? mask
: throw new FormatException();
}
/// <summary>
/// Converts a unsigned 32-bit integer that represents a subnet mask to an <see cref="Ipv4Cidr"/> instance.
/// </summary>
/// <param name="value">
/// An integer that represents a IPv4 subnet mask.
/// </param>
/// <returns>
/// The <see cref="Ipv4SubnetMask"/> representation of <paramref name="value"/>
/// </returns>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="value"/> is not a valid IPv4 subnet mask
/// </exception>
public static Ipv4SubnetMask Parse(uint value)
=> TryParse(value, out var mask)
? mask
: throw new FormatException();
/// <summary>
/// Converts an IPv4 subnet mask represented by a character span to an <see cref="Ipv4SubnetMask"/> instance.
/// </summary>
/// <param name="text">
/// A character span that contains an Ipv4 subnet mask
/// </param>
/// <returns>
/// The converted subnet mask
/// </returns>
/// <exception cref="FormatException">
/// <paramref name="text"/> is not a valid IPv4 subnet mask.
/// </exception>
public static Ipv4SubnetMask Parse(ReadOnlySpan<char> text)
=> TryParse(text, out var mask)
? mask
: throw new FormatException();
#endregion Parsing
#region TryParse
/// <summary>
/// Converts an unsigned 32-bit integer that represents a subnet mask to an <see cref="Ipv4SubnetMask"/> instance.
/// </summary>
/// <param name="value">
/// An unsigned 32-bit integer that represents a CIDR.
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> representation of <paramref name="value"/>
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="value"/> was able to be converted to an
/// <see cref="Ipv4SubnetMask"/>; otherwise, <see langword="false"/>.
/// </returns>
public static bool TryParse(uint value, out Ipv4SubnetMask result)
{
if (SubnetMaskLookups.IsValidSubnetMask(value))
{
result = new (value);
return true;
}
result = default;
return false;
}
/// <summary>
/// Converts an <see cref="Ipv4WildcardMask"/> to an <see cref="Ipv4SubnetMask"/> instance.
/// </summary>
/// <param name="value">
/// An <see cref="Ipv4WildcardMask"/> instance
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> representation of <paramref name="value"/>
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="value"/> was able to be converted to an
/// <see cref="Ipv4SubnetMask"/>; otherwise, <see langword="false"/>.
/// </returns>
public bool TryParse(Ipv4WildcardMask value, out Ipv4SubnetMask result) => TryParse(~value.Value, out result);
/// <summary>
/// Converts an <see cref="IPAddress"/> to an <see cref="Ipv4SubnetMask"/> instance.
/// </summary>
/// <param name="ipAddress">
/// An <see cref="Ipv4SubnetMask"/> instance
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> representation of <paramref name="ipAddress"/>
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="ipAddress"/> was able to be converted to an
/// <see cref="Ipv4SubnetMask"/>; otherwise, <see langword="false"/>.
/// </returns>
public static bool TryParse(IPAddress ipAddress, out Ipv4SubnetMask result)
{
result = default;
return Ipv4Address.TryParse(ipAddress, out var address)
&& TryParse(address, out result);
}
/// <summary>
/// Converts an <see cref="Ipv4Address"/> to an <see cref="Ipv4SubnetMask"/> instance.
/// </summary>
/// <param name="address">
/// An <see cref="Ipv4Address"/> instance
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> representation of <paramref name="address"/>
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="address"/> was able to be converted to an
/// <see cref="Ipv4SubnetMask"/>; otherwise, <see langword="false"/>.
/// </returns>
public static bool TryParse(Ipv4Address address, out Ipv4SubnetMask result)
{
if (IsValidMask(address.Value))
{
result = new (address.Value);
return true;
}
result = default;
return false;
}
/// <summary>
/// Determines whether the specified byte span represents a valid subnet mask.
/// </summary>
/// <param name="octets">
/// The byte span to validate
/// </param>
/// <param name="result">
/// When this method returns, the <see cref="Ipv4SubnetMask"/> version of the byte span.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="octets"/> was able to be parsed as a subnet mask; otherwise, <see langword="false"/>.
/// </returns>
public static bool TryParse(ReadOnlySpan<byte> octets, out Ipv4SubnetMask result)
{
result = default;
return Ipv4Address.TryParse(octets, out var address)
&& TryParse(address, out result);
}
/// <summary>
/// Determines whether string begins with a valid IPv4 subnet mask.
/// </summary>
/// <param name="text">
/// The string to validate.
/// </param>
/// <param name="charsRead">
/// The length of the valid Ipv4 subnet mask.
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> version of the string.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="text"/> was able to be parsed as an IP subnet mask; otherwise, <see langword="false"/>.
///
/// If <paramref name="text"/> begins with a valid <see cref="Ipv4SubnetMask"/>, and is followed by other characters, this method will
/// return <see langword="true"/>. <paramref name="charsRead"/> will contain the length of the valid <see cref="Ipv4SubnetMask"/>.
/// </returns>
public static bool TryParse(string? text, out int charsRead, out Ipv4SubnetMask result)
{
result = default;
return Ipv4Address.TryParse(text, out charsRead, out var address) && Ipv4SubnetMask.TryParse(address, out result);
}
/// <summary>
/// Determines whether string begins with a valid IPv4 subnet mask.
/// </summary>
/// <param name="text">
/// The string to validate.
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> version of the string.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="text"/> was able to be parsed as an IP subnet mask; otherwise, <see langword="false"/>.
/// </returns>
public static bool TryParse(string? text, out Ipv4SubnetMask result)
{
if (SubnetMaskLookups.TryGetSubnetMask(text, out var mask))
{
result = new (mask);
return true;
}
result = default;
return false;
}
internal static bool TryParse(ref ReadOnlySpan<char> text, ref int charsRead, out Ipv4SubnetMask result)
{
var textCopy = text;
var readCopy = charsRead;
result = default;
if (!Ipv4Address.TryParse(ref textCopy, ref readCopy, out var address) || !TryParse(address, out result))
return false;
text = textCopy;
charsRead = readCopy;
return true;
}
/// <summary>
/// Determines whether the specified character span represents a valid IPv4 subnet mask.
/// </summary>
/// <param name="text">
/// The character span to validate.
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> version of the character span.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="text"/> was able to be parsed as an IP subnet mask; otherwise, <see langword="false"/>.
/// </returns>
public static bool TryParse(ReadOnlySpan<char> text, out Ipv4SubnetMask result)
=> TryParse(text, out var charsRead, out result) && charsRead == text.Length;
/// <summary>
/// Determines whether the specified character span represents a valid IPv4 subnet mask.
/// </summary>
/// <param name="text">
/// The character span to validate.
/// </param>
/// <param name="charsRead">
/// The length of the valid Ipv4 subnet mask.
/// </param>
/// <param name="result">
/// The <see cref="Ipv4SubnetMask"/> version of the character span.
/// </param>
/// <returns>
/// <see langword="true"/> if <paramref name="text"/> was able to be parsed as an IP subnet mask; otherwise, <see langword="false"/>.
///
/// If <paramref name="text"/> begins with a valid <see cref="Ipv4SubnetMask"/>, and is followed by other characters, this method will
/// return <see langword="true"/>. <paramref name="charsRead"/> will contain the length of the valid <see cref="Ipv4SubnetMask"/>.
/// </returns>
public static bool TryParse(ReadOnlySpan<char> text, out int charsRead, out Ipv4SubnetMask result)
{
result = default;
return Ipv4Address.TryParse(text, out charsRead, out var address) && TryParse(address, out result);
}
#endregion TryParse
#region Octets
/// <summary>
/// Tries to write the current subnet mask into a span of bytes.
/// </summary>
/// <param name="destination">
/// When this method returns, the subnet mask as a span of bytes.
/// </param>
/// <param name="bytesWritten">
/// When this method returns, the number of bytes written into the span.
/// </param>
/// <returns>
/// <see langword="true"/> if the subnet mask is successfully written to the given span; otherwise, <see langword="false"/>.
/// </returns>
public bool TryWriteBytes(Span<byte> destination, out int bytesWritten)
=> this.Value.TryWriteBigEndian(destination, out bytesWritten);
/// <summary>
/// Provides a copy of the <see cref="Ipv4SubnetMask"/> as an array of <see cref="byte"/>.
/// </summary>
/// <returns>
/// A <see cref="byte"/> array.
/// </returns>
public byte[] GetBytes() => this.Value.ToBytesBigEndian();
#endregion Octets
#region Formatting
int ITryFormat.MaximumLengthRequired => Ipv4Address.MAXIMUM_LENGTH;
/// <summary>
/// Tries to format the current subnet mask into the provided span.
/// </summary>
/// <param name="destination">
/// When this method returns, the subnet mask as a span of characters.
/// </param>
/// <param name="charsWritten">
/// When this method returns, the number of characters written into the span.
/// </param>
/// <returns>
/// <see langword="true"/> if the formatting was successful; otherwise, <see langword="false"/>.
/// </returns>
public bool TryFormat(Span<char> destination, out int charsWritten)
{
charsWritten = 0;
var result = this.GetString();
if (destination.Length < result.Length)
return false;
foreach (var ch in result)
destination.TryWrite(ch, ref charsWritten);
return charsWritten == result.Length;
}
/// <summary>
/// Converts an <see cref="Ipv4SubnetMask"/> to its standard notation.
/// </summary>
/// <returns>
/// A string that contains the IP address in IPv4 dotted decimal notation.
/// </returns>
public override string ToString() => this.GetString();
private string GetString() => SubnetMaskLookups.GetString(Value);
#endregion Formatting
}
} | 43.113924 | 145 | 0.562621 | [
"MIT"
] | binarycow/NetworkPrimitives | src/NetworkPrimitives/Ipv4/Subnet/Ipv4SubnetMask.cs | 23,844 | C# |
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CursoWindowsForms
{
public partial class Frm_Principal_Menu_UC : Form
{
int ControleHelloWorld = 0;
int ControleDemostracaoKey = 0;
int ControleMascara = 0;
int ControleValidaCPF = 0;
int ControleValidaSenha = 0;
int ControleValidaCPF2 = 0;
int ControleArquivoImagem = 0;
int ControleCadastroClientes = 0;
public Frm_Principal_Menu_UC()
{
InitializeComponent();
novoToolStripMenuItem.Enabled = false;
apagarAbaToolStripMenuItem.Enabled = false;
abrirImagemToolStripMenuItem.Enabled = false;
desconectarToolStripMenuItem.Enabled = false;
cadastrosToolStripMenuItem.Enabled = false;
}
private void validaCPFToolStripMenuItem_Click(object sender, EventArgs e)
{
ControleValidaCPF += 1;
Frm_ValidaCPF_UC U = new Frm_ValidaCPF_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Valida CPF " + ControleValidaCPF;
TB.Text = "Valída CPF " + ControleValidaCPF;
TB.ImageIndex = 3;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
private void demonstraçãoKeyToolStripMenuItem_Click(object sender, EventArgs e)
{
ControleDemostracaoKey += 1;
Frm_DemostracaoKey_UC U = new Frm_DemostracaoKey_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Demostração Key " + ControleDemostracaoKey;
TB.Text = "Demostração Key " + ControleDemostracaoKey;
TB.ImageIndex = 0;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
private void helloWorldToolStripMenuItem_Click(object sender, EventArgs e)
{
ControleHelloWorld += 1;
Frm_HelloWorld_UC U = new Frm_HelloWorld_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Hello World " + ControleHelloWorld;
TB.Text = "Hello World " + ControleHelloWorld;
TB.ImageIndex = 1;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
private void mascaraToolStripMenuItem_Click(object sender, EventArgs e)
{
ControleMascara += 1;
Frm_Mascara_UC U = new Frm_Mascara_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Máscara " + ControleMascara;
TB.Text = "Máscara " + ControleMascara;
TB.ImageIndex = 2;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
private void valídaCPF2ToolStripMenuItem_Click(object sender, EventArgs e)
{
ControleValidaCPF2 += 1;
Frm_ValidaCPF2_UC U = new Frm_ValidaCPF2_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Valida CPF2 " + ControleValidaCPF2;
TB.Text = "Valída CPF2 " + ControleValidaCPF2;
TB.ImageIndex = 4;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
private void valídaSenhaToolStripMenuItem_Click(object sender, EventArgs e)
{
ControleValidaSenha += 1;
Frm_ValidaSenha_UC U = new Frm_ValidaSenha_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Valida Senha " + ControleValidaSenha;
TB.Text = "Valída Senha " + ControleValidaSenha;
TB.ImageIndex = 5;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
private void sairToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void apagarAbaToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!(Tbc_Aplicacoes.SelectedTab == null))
{
ApagaAba(Tbc_Aplicacoes.SelectedTab);
}
}
private void abrirImagemToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog Db = new OpenFileDialog();
Db.InitialDirectory = "C:\\WindowsForms\\Curso\\CursoWindowsForms\\CursoWindowsForms\\Imagens";
Db.Filter = "PNG|*.PNG";
Db.Title = "Escolha a Imagem";
if(Db.ShowDialog() == DialogResult.OK)
{
string nomeArquivoImagem = Db.FileName;
ControleArquivoImagem += 1;
Frm_ArquivoImagem_UC U = new Frm_ArquivoImagem_UC(nomeArquivoImagem);
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Arquivo Imagem " + ControleArquivoImagem;
TB.Text = "Arquivo Imagem " + ControleArquivoImagem;
TB.ImageIndex = 6;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
}
private void conectarToolStripMenuItem_Click(object sender, EventArgs e)
{
Frm_Login F = new Frm_Login();
F.ShowDialog();
if (F.DialogResult == DialogResult.OK)
{
string senha = F.senha;
string login = F.login;
if (CursoWindowsFormsBiblioteca.Cls_Uteis.validaSenhaLogin(senha) == true)
{
novoToolStripMenuItem.Enabled = true;
apagarAbaToolStripMenuItem.Enabled = true;
abrirImagemToolStripMenuItem.Enabled = true;
conectarToolStripMenuItem.Enabled = false;
desconectarToolStripMenuItem.Enabled = true;
cadastrosToolStripMenuItem.Enabled = true;
MessageBox.Show("Bem vindo " + login + " !", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Senha inválida !", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
private void desconectarToolStripMenuItem_Click(object sender, EventArgs e)
{
Frm_Questao Db = new Frm_Questao("icons8_question_mark_961", "Você deseja se desconectar ?");
Db.ShowDialog();
//if (MessageBox.Show("Você deseja realmente validar o CPF?", "Mensagem de Validação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
if (Db.DialogResult == DialogResult.Yes)
{
//Tbc_Aplicacoes.TabPages.Remove(Tbc_Aplicacoes.SelectedTab);
for (int i= Tbc_Aplicacoes.TabPages.Count - 1; i >= 0; i+=-1)
{
ApagaAba(Tbc_Aplicacoes.TabPages[i]);
}
novoToolStripMenuItem.Enabled = false;
apagarAbaToolStripMenuItem.Enabled = false;
abrirImagemToolStripMenuItem.Enabled = false;
conectarToolStripMenuItem.Enabled = true;
desconectarToolStripMenuItem.Enabled = false;
cadastrosToolStripMenuItem.Enabled = false;
}
}
private void Tbc_Aplicacoes_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == System.Windows.Forms.MouseButtons.Right)
{
//var PosicaoX = e.X;
//var PosicaoY = e.Y;
//MessageBox.Show("Clique com o botão da direita do mouse. A posição relativa foi (" + PosicaoX.ToString() + "," + PosicaoY.ToString() + ")");
var ContextMenu = new ContextMenuStrip();
var vToolTip001 = DesenhaItemMenu("Apagar a Aba", "DeleteTab");
var vToolTip002 = DesenhaItemMenu("Apagar Todas as Esquerda", "DeleteLeft");
var vToolTip003 = DesenhaItemMenu("Apagar Todas as Direita", "DeleteRight");
var vToolTip004 = DesenhaItemMenu("Apagar Todas menos Esta", "DeleteAll");
ContextMenu.Items.Add(vToolTip001);
ContextMenu.Items.Add(vToolTip002);
ContextMenu.Items.Add(vToolTip003);
ContextMenu.Items.Add(vToolTip004);
ContextMenu.Show(this, new Point(e.X, e.Y));
vToolTip001.Click += new System.EventHandler(vToolTip001_Click);
vToolTip002.Click += new System.EventHandler(vToolTip002_Click);
vToolTip003.Click += new System.EventHandler(vToolTip003_Click);
vToolTip004.Click += new System.EventHandler(vToolTip004_Click);
}
}
void vToolTip001_Click(object sender1, EventArgs e1)
{
if (!(Tbc_Aplicacoes.SelectedTab == null))
{
ApagaAba(Tbc_Aplicacoes.SelectedTab);
}
}
void vToolTip002_Click(object sender1, EventArgs e1)
{
if (!(Tbc_Aplicacoes.SelectedTab == null))
{
ApagaEsquerda(Tbc_Aplicacoes.SelectedIndex);
}
}
void vToolTip003_Click(object sender1, EventArgs e1)
{
if (!(Tbc_Aplicacoes.SelectedTab == null))
{
ApagaDireita(Tbc_Aplicacoes.SelectedIndex);
}
}
void vToolTip004_Click(object sender1, EventArgs e1)
{
if (!(Tbc_Aplicacoes.SelectedTab == null))
{
ApagaEsquerda(Tbc_Aplicacoes.SelectedIndex);
ApagaDireita(Tbc_Aplicacoes.SelectedIndex);
}
}
ToolStripMenuItem DesenhaItemMenu(string text, string nomeImagem)
{
var vToolTip = new ToolStripMenuItem();
vToolTip.Text = text;
Image MyImage = (Image)global::CursoWindowsForms.Properties.Resources.ResourceManager.GetObject(nomeImagem);
vToolTip.Image = MyImage;
return vToolTip;
}
void ApagaDireita(int ItemSelecionado)
{
for (int i = Tbc_Aplicacoes.TabCount - 1;
i > ItemSelecionado; i += -1)
{
ApagaAba(Tbc_Aplicacoes.TabPages[i]);
}
}
void ApagaEsquerda(int ItemSelecionado)
{
for (int i = ItemSelecionado - 1; i >= 0; i += -1)
{
ApagaAba(Tbc_Aplicacoes.TabPages[i]);
}
}
private void clientesToolStripMenuItem_Click(object sender, EventArgs e)
{
if (ControleCadastroClientes == 0)
{
ControleCadastroClientes += 1;
Frm_CadastroCliente_UC U = new Frm_CadastroCliente_UC();
U.Dock = DockStyle.Fill;
TabPage TB = new TabPage();
TB.Name = "Cadastro de Clientes";
TB.Text = "Cadastro de Clientes";
TB.ImageIndex = 7;
TB.Controls.Add(U);
Tbc_Aplicacoes.TabPages.Add(TB);
}
else
{
MessageBox.Show("Não posso abrir o Cadastro de Clientes porque já está aberto.", "Banco ByteBank", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
void ApagaAba(TabPage TB)
{
if (TB.Name == "Cadastro de Clientes")
{
ControleCadastroClientes = 0;
}
Tbc_Aplicacoes.TabPages.Remove(TB);
}
private void agenciaToolStripMenuItem_Click(object sender, EventArgs e)
{
Frm_Agencia A = new Frm_Agencia();
A.ShowDialog();
}
}
}
| 36.669697 | 169 | 0.55921 | [
"MIT"
] | DiogoBarbosaSilvaSousa/windows-forms-com-c-sharp-parte-7-sql-server | Curso/CursoWindowsForms/CursoWindowsForms/Frm_Principal_Menu_UC.cs | 12,127 | C# |
// ==========================================================================
// FuncDispatcher.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
using System.Linq;
using System.Reflection;
#pragma warning disable IDE0033 // Use explicitly provided tuple name
namespace Squidex.Infrastructure.Dispatching
{
public static class ActionDispatcher<TTarget, TIn>
{
public delegate void ActionDelegate<in T>(TTarget target, T input) where T : TIn;
public static readonly Func<TTarget, TIn, bool> On = CreateHandler();
public static Func<TTarget, TIn, bool> CreateHandler(string methodName = "On")
{
Guard.NotNullOrEmpty(methodName, nameof(methodName));
var handlers =
typeof(TTarget)
.GetMethods(
BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance)
.Where(m =>
m.HasMatchingName(methodName) &&
m.HasMatchingParameters<TIn>() &&
m.HasMatchingReturnType(typeof(void)))
.Select(m =>
{
var inputType = m.GetParameters()[0].ParameterType;
var handler =
typeof(ActionDispatcher<TTarget, TIn>)
.GetMethod(nameof(Factory),
BindingFlags.Static |
BindingFlags.NonPublic)
.MakeGenericMethod(inputType)
.Invoke(null, new object[] { m });
return (inputType, handler);
})
.ToDictionary(m => m.Item1, h => (ActionDelegate<TIn>)h.Item2);
return (target, input) =>
{
if (handlers.TryGetValue(input.GetType(), out var handler))
{
handler(target, input);
return true;
}
return false;
};
}
private static ActionDelegate<TIn> Factory<T>(MethodInfo methodInfo) where T : TIn
{
var handler = (ActionDelegate<T>)methodInfo.CreateDelegate(typeof(ActionDelegate<T>));
return (target, input) => handler(target, (T)input);
}
}
} | 36.205479 | 98 | 0.454408 | [
"MIT"
] | maooson/squidex | src/Squidex.Infrastructure/Dispatching/ActionDispatcher.cs | 2,643 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Autofac.Extensions.DependencyInjection;
namespace DependencyInjectionAutofacDemo
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}
| 28.758621 | 75 | 0.676259 | [
"MIT"
] | tilark/geeknetcorestudy | DependencyInjectionAutofacDemo/Program.cs | 834 | C# |
// Copyright (c) 2021 Alachisoft
//
// 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 Alachisoft.NCache.Common.Enum
{
/// <summary>
/// Client cache information on client nodes in NCache Explorer tree.
/// 1. Unavailable means, client node is no more the part of this cluster.
/// i.e. Cluster entry removed from client config on this node
/// 2. ClientCacheUnavailable means, client cache is not created on the client node.
/// 3. ClientCacheEnabled means, client cache is created and is started.
/// 4. ClientCacheDisabled means, client cache is created but is stopped.
/// 5. ClientCacheNotRegistered is same as ClientCacheUnavailable.. but it is used to change the
/// state of client cache instead of client node.
/// </summary>
public enum ClientNodeStatus
{
Unavailable,
UpdatingStatus
}
} | 45.032258 | 101 | 0.709169 | [
"Apache-2.0"
] | Alachisoft/NCache | Src/NCCommon/Enum/ClientNodeStatus.cs | 1,396 | C# |
// ReSharper disable once CheckNamespace
namespace Easy.Common
{
using System;
using System.Linq.Expressions;
using System.Reflection;
using System.Reflection.Emit;
using Easy.Common.Extensions;
/// <summary>
/// Provides a very fast and efficient property setter and getter access as well
/// as object creation.
/// </summary>
public static class AccessorBuilder
{
/// <summary>
/// Builds a property setter for a given instance type of <typeparamref name="TInstance"/>
/// and property type of <typeparamref name="TProperty"/> with the name of <paramref name="propertyName"/>.
/// <remarks>
/// The setters for a <typeparamref name="TInstance"/> of <see lang="struct"/> are
/// intentionally not supported as changing the values of immutable types is a bad practice.
/// </remarks>
/// </summary>
public static Action<TInstance, TProperty> BuildSetter<TInstance, TProperty>(string propertyName, bool includePrivate = false) where TInstance : class
{
Ensure.NotNullOrEmptyOrWhiteSpace(propertyName);
if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
{
throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
}
return BuildSetter<TInstance, TProperty>(propInfo, includePrivate);
}
/// <summary>
/// Builds a property setter for a given instance type of <typeparamref name="TInstance"/>
/// and property type of <typeparamref name="TProperty"/>.
/// <remarks>
/// The setters for a <typeparamref name="TInstance"/> of <see lang="struct"/> are
/// intentionally not supported as changing the values of immutable types is a bad practice.
/// </remarks>
/// </summary>
public static Action<TInstance, TProperty> BuildSetter<TInstance, TProperty>(PropertyInfo propertyInfo, bool includePrivate = false) where TInstance : class
{
Ensure.NotNull(propertyInfo, nameof(propertyInfo));
if (!propertyInfo.CanWrite)
{
throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support writing.");
}
var setMethod = propertyInfo.GetSetMethod(includePrivate);
return (Action<TInstance, TProperty>)Delegate.CreateDelegate(typeof(Action<TInstance, TProperty>), setMethod);
}
/// <summary>
/// Builds a property getter for a given instance type of <typeparamref name="TInstance"/>
/// and property type of <typeparamref name="TProperty"/> with the name of <paramref name="propertyName"/>.
/// </summary>
public static Func<TInstance, TProperty> BuildGetter<TInstance, TProperty>(string propertyName, bool includePrivate = false) where TInstance : class
{
Ensure.NotNullOrEmptyOrWhiteSpace(propertyName);
if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
{
throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
}
return BuildGetter<TInstance, TProperty>(propInfo, includePrivate);
}
/// <summary>
/// Builds a property getter for a given instance type of <typeparamref name="TInstance"/>
/// and property type of <typeparamref name="TProperty"/>.
/// </summary>
public static Func<TInstance, TProperty> BuildGetter<TInstance, TProperty>(PropertyInfo propertyInfo, bool includePrivate = false) where TInstance : class
{
Ensure.NotNull(propertyInfo, nameof(propertyInfo));
if (!propertyInfo.CanRead)
{
throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support reading.");
}
var getMethod = propertyInfo.GetGetMethod(includePrivate);
return (Func<TInstance, TProperty>)Delegate.CreateDelegate(typeof(Func<TInstance, TProperty>), getMethod);
}
/// <summary>
/// Builds a property setter for when both the instance and property type are unknown.
/// </summary>
public static Action<object, object> BuildSetter(PropertyInfo propertyInfo, bool includePrivate = false)
{
Ensure.NotNull(propertyInfo, nameof(propertyInfo));
var instanceType = propertyInfo.ReflectedType;
if (!propertyInfo.CanWrite)
{
throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{instanceType?.FullName}` does not support writing.");
}
var setMethod = propertyInfo.GetSetMethod(includePrivate);
var typeofObject = typeof(object);
var instance = Expression.Parameter(typeofObject, "instance");
var value = Expression.Parameter(typeofObject, "value");
// value as T is slightly faster than (T)value, so if it's not a value type, use that
var instanceCast = !instanceType.GetTypeInfo().IsValueType
? Expression.TypeAs(instance, instanceType)
: Expression.Convert(instance, instanceType);
var valueCast = !propertyInfo.PropertyType.GetTypeInfo().IsValueType
? Expression.TypeAs(value, propertyInfo.PropertyType)
: Expression.Convert(value, propertyInfo.PropertyType);
return Expression.Lambda<Action<object, object>>(
Expression.Call(instanceCast, setMethod, valueCast), instance, value).Compile();
}
/// <summary>
/// Builds a property getter for when both the instance and property type are unknown.
/// </summary>
public static Func<object, object> BuildGetter(PropertyInfo propertyInfo, bool includePrivate = false)
{
Ensure.NotNull(propertyInfo, nameof(propertyInfo));
var instanceType = propertyInfo.ReflectedType;
if (!propertyInfo.CanRead)
{
throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{instanceType?.FullName}` does not support reading.");
}
var getMethod = propertyInfo.GetGetMethod(includePrivate);
var typeofObject = typeof(object);
var instance = Expression.Parameter(typeofObject, "instance");
var isValueType = instanceType.GetTypeInfo().IsValueType;
var instanceCast = !isValueType
? Expression.TypeAs(instance, instanceType)
: Expression.Convert(instance, instanceType);
return Expression.Lambda<Func<object, object>>(
Expression.TypeAs(Expression.Call(instanceCast, getMethod), typeofObject), instance).Compile();
}
/// <summary>
/// Builds a property setter for a given instance type of <typeparamref name="TInstance"/>
/// and property name of <paramref name="propertyName"/>.
/// <remarks>
/// The setters for a <typeparamref name="TInstance"/> of <see lang="struct"/> are
/// intentionally not supported as changing the values of immutable types is a bad practice.
/// </remarks>
/// </summary>
public static Action<TInstance, object> BuildSetter<TInstance>(string propertyName, bool includePrivate = false) where TInstance : class
{
Ensure.NotNullOrEmptyOrWhiteSpace(propertyName);
if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
{
throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
}
return BuildSetter<TInstance>(propInfo, includePrivate);
}
/// <summary>
/// Builds a property setter for a given instance type of <typeparamref name="TInstance"/>
/// and property of <paramref name="propertyInfo"/>.
/// <remarks>
/// The setters for a <typeparamref name="TInstance"/> of <see lang="struct"/> are
/// intentionally not supported as changing the values of immutable types is a bad practice.
/// </remarks>
/// </summary>
public static Action<TInstance, object> BuildSetter<TInstance>(PropertyInfo propertyInfo, bool includePrivate = false) where TInstance : class
{
Ensure.NotNull(propertyInfo, nameof(propertyInfo));
if (!propertyInfo.CanWrite)
{
throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support writing.");
}
var setMethod = propertyInfo.GetSetMethod(includePrivate);
var instance = Expression.Parameter(typeof(TInstance), "instance");
var value = Expression.Parameter(typeof(object), "value");
var isValueType = propertyInfo.PropertyType.GetTypeInfo().IsValueType;
var valueCast = !isValueType
? Expression.TypeAs(value, propertyInfo.PropertyType)
: Expression.Convert(value, propertyInfo.PropertyType);
return Expression.Lambda<Action<TInstance, object>>(
Expression.Call(instance, setMethod, valueCast), instance, value).Compile();
}
/// <summary>
/// Builds a property getter for a given instance type of <typeparamref name="TInstance"/>
/// and property name of <paramref name="propertyName"/>.
/// </summary>
public static Func<TInstance, object> BuildGetter<TInstance>(string propertyName, bool includePrivate = false)
{
Ensure.NotNullOrEmptyOrWhiteSpace(propertyName);
if (!typeof(TInstance).TryGetInstanceProperty(propertyName, out PropertyInfo propInfo))
{
throw new InvalidOperationException("Unable to find property: " + propertyName + ".");
}
return BuildGetter<TInstance>(propInfo, includePrivate);
}
/// <summary>
/// Builds a property getter for a given instance type of <typeparamref name="TInstance"/>
/// and property of <paramref name="propertyInfo"/>.
/// </summary>
public static Func<TInstance, object> BuildGetter<TInstance>(PropertyInfo propertyInfo, bool includePrivate = false)
{
Ensure.NotNull(propertyInfo, nameof(propertyInfo));
if (!propertyInfo.CanRead)
{
throw new ArgumentException($"Property: `{propertyInfo.Name}` of type: `{propertyInfo.ReflectedType?.FullName}` does not support reading.");
}
var getMethod = propertyInfo.GetGetMethod(includePrivate);
var instance = Expression.Parameter(typeof(TInstance), "instance");
return Expression.Lambda<Func<TInstance, object>>(
Expression.TypeAs(Expression.Call(instance, getMethod), typeof(object)), instance).Compile();
}
/// <summary>
/// Builds a delegate for creating an instance of the <typeparamref name="TInstance"/>.
/// </summary>
public static Func<TInstance> BuildInstanceCreator<TInstance>() where TInstance : new()
{
var type = typeof(TInstance);
var dynamicMethod = new DynamicMethod("Build_" + type.Name, type, new Type[0], typeof(AccessorBuilder).Module, true);
var ilGen = dynamicMethod.GetILGenerator();
var defaultCtor = type.GetConstructor(Type.EmptyTypes);
if (defaultCtor != null)
{
// Call the ctor, all values on the stack are passed to the ctor
ilGen.Emit(OpCodes.Newobj, defaultCtor);
}
else
{
var builder = ilGen.DeclareLocal(type);
ilGen.Emit(OpCodes.Ldloca, builder);
ilGen.Emit(OpCodes.Initobj, type);
ilGen.Emit(OpCodes.Ldloc, builder);
}
// Return the new object
ilGen.Emit(OpCodes.Ret);
return (Func<TInstance>)dynamicMethod.CreateDelegate(typeof(Func<TInstance>));
}
/// <summary>
/// Builds a delegate for creating an instance of the <typeparamref name="TInstance"/>
/// from its <paramref name="constructor"/>.
/// <remarks>
/// The order of arguments passed to the delegate should match the order set by the constructor.
/// </remarks>
/// <exception cref="IndexOutOfRangeException">
/// Thrown if the count parameters passed to the constructor does not match the required
/// constructor parameter count.
/// </exception>
/// <exception cref="InvalidCastException">
/// Thrown if parameters passed to the constructor are of invalid type.
/// </exception>
/// </summary>
public static Func<object[], TInstance> BuildInstanceCreator<TInstance>(ConstructorInfo constructor)
{
Ensure.NotNull(constructor, nameof(constructor));
var type = typeof(TInstance);
var ctroParams = constructor.GetParameters();
var dynamicMethod = new DynamicMethod("Build_" + type.Name, type, new[] { typeof(object[]) }, typeof(AccessorBuilder).Module, true);
var ilGen = dynamicMethod.GetILGenerator();
// Cast each argument of the input object array to the appropriate type.
for (var i = 0; i < ctroParams.Length; i++)
{
ilGen.Emit(OpCodes.Ldarg_0); // Push Object array
ilGen.Emit(OpCodes.Ldc_I4, i); // Push the index to access
ilGen.Emit(OpCodes.Ldelem_Ref); // Push the element at the previously loaded index
// Cast the object to the appropriate ctor Parameter Type
var paramType = ctroParams[i].ParameterType;
var isValueType = paramType.GetTypeInfo().IsValueType;
ilGen.Emit(isValueType ? OpCodes.Unbox_Any : OpCodes.Castclass, paramType);
}
// Call the ctor, all values on the stack are passed to the ctor
ilGen.Emit(OpCodes.Newobj, constructor);
// Return the new object
ilGen.Emit(OpCodes.Ret);
return (Func<object[], TInstance>)dynamicMethod.CreateDelegate(typeof(Func<object[], TInstance>));
}
}
}
| 47.679612 | 164 | 0.623295 | [
"MIT"
] | jimd-personal/Easy.Common | Easy.Common/Accessors/AccessorBuilder.cs | 14,735 | C# |
using System.Collections.Generic;
namespace MahApps.Metro.IconPacks
{
/// ******************************************
/// This code is auto generated. Do not amend.
/// ******************************************
public static class PackIconZondiconsDataFactory
{
public static IDictionary<PackIconZondiconsKind, string> Create()
{
return new Dictionary<PackIconZondiconsKind, string>
{
{PackIconZondiconsKind.None, ""},
{PackIconZondiconsKind.AddOutline, "M11 9h4v2h-4v4H9v-4H5V9h4V5h2v4zm-1 11a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16z"},
{PackIconZondiconsKind.AddSolid, "M11 9V5H9v4H5v2h4v4h2v-4h4V9h-4zm-1 11a10 10 0 1 1 0-20 10 10 0 0 1 0 20z"},
{PackIconZondiconsKind.Adjust, "M10 2v16a8 8 0 1 0 0-16zm0 18a10 10 0 1 1 0-20 10 10 0 0 1 0 20z"},
{PackIconZondiconsKind.Airplane, "M8.4 12H2.8L1 15H0V5h1l1.8 3h5.6L6 0h2l4.8 8H18a2 2 0 1 1 0 4h-5.2L8 20H6l2.4-8z"},
{PackIconZondiconsKind.Album, "M0 0h20v20H0V0zm10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-5a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"},
{PackIconZondiconsKind.AlignCenter, "M1 1h18v2H1V1zm0 8h18v2H1V9zm0 8h18v2H1v-2zM4 5h12v2H4V5zm0 8h12v2H4v-2z"},
{PackIconZondiconsKind.AlignJustified, "M1 1h18v2H1V1zm0 8h18v2H1V9zm0 8h18v2H1v-2zM1 5h18v2H1V5zm0 8h18v2H1v-2z"},
{PackIconZondiconsKind.AlignLeft, "M1 1h18v2H1V1zm0 8h18v2H1V9zm0 8h18v2H1v-2zM1 5h12v2H1V5zm0 8h12v2H1v-2z"},
{PackIconZondiconsKind.AlignRight, "M1 1h18v2H1V1zm0 8h18v2H1V9zm0 8h18v2H1v-2zM7 5h12v2H7V5zm0 8h12v2H7v-2z"},
{PackIconZondiconsKind.Anchor, "M4.34 15.66A7.97 7.97 0 0 0 9 17.94V10H5V8h4V5.83a3 3 0 1 1 2 0V8h4v2h-4v7.94a7.97 7.97 0 0 0 4.66-2.28l-1.42-1.42h5.66l-2.83 2.83a10 10 0 0 1-14.14 0L.1 14.24h5.66l-1.42 1.42zM10 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.Announcement, "M3 6c0-1.1.9-2 2-2h8l4-4h2v16h-2l-4-4H5a2 2 0 0 1-2-2H1V6h2zm8 9v5H8l-1.67-5H5v-2h8v2h-2z"},
{PackIconZondiconsKind.Apparel, "M7 0H6L0 3v6l4-1v12h12V8l4 1V3l-6-3h-1a3 3 0 0 1-6 0z"},
{PackIconZondiconsKind.ArrowDown, "M 9 0 L 9 16.171875 L 2.9296875 10.101562 L 1.515625 11.515625 L 10 20 L 10.707031 19.292969 L 18.484375 11.515625 L 17.070312 10.101562 L 11 16.171875 L 11 0 L 9 0 z "},
{PackIconZondiconsKind.ArrowLeft, "M 8.484375 1.515625 L 0 10 L 0.70703125 10.707031 L 8.484375 18.484375 L 9.8984375 17.070312 L 3.828125 11 L 20 11 L 20 9 L 3.828125 9 L 9.8984375 2.9296875 L 8.484375 1.515625 z "},
{PackIconZondiconsKind.ArrowOutlineDown, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-2-8V5h4v5h3l-5 5-5-5h3z"},
{PackIconZondiconsKind.ArrowOutlineLeft, "M0 10a10 10 0 1 1 20 0 10 10 0 0 1-20 0zm2 0a8 8 0 1 0 16 0 8 8 0 0 0-16 0zm8-2h5v4h-5v3l-5-5 5-5v3z"},
{PackIconZondiconsKind.ArrowOutlineRight, "M20 10a10 10 0 1 1-20 0 10 10 0 0 1 20 0zm-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0zm-8 2H5V8h5V5l5 5-5 5v-3z"},
{PackIconZondiconsKind.ArrowOutlineUp, "M10 0a10 10 0 1 1 0 20 10 10 0 0 1 0-20zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm2 8v5H8v-5H5l5-5 5 5h-3z"},
{PackIconZondiconsKind.ArrowRight, "M 11.515625 1.515625 L 10.101562 2.9296875 L 16.171875 9 L 0 9 L 0 11 L 16.171875 11 L 10.101562 17.070312 L 11.515625 18.484375 L 19.292969 10.707031 L 20 10 L 11.515625 1.515625 z "},
{PackIconZondiconsKind.ArrowThickDown, "M7 10V2h6v8h5l-8 8-8-8h5z"},
{PackIconZondiconsKind.ArrowThickLeft, "M10 13h8V7h-8V2l-8 8 8 8v-5z"},
{PackIconZondiconsKind.ArrowThickRight, "M10 7H2v6h8v5l8-8-8-8v5z"},
{PackIconZondiconsKind.ArrowThickUp, "M7 10v8h6v-8h5l-8-8-8 8h5z"},
{PackIconZondiconsKind.ArrowThinDown, "M9 16.172l-6.071-6.071-1.414 1.414L10 20l.707-.707 7.778-7.778-1.414-1.414L11 16.172V0H9z"},
{PackIconZondiconsKind.ArrowThinLeft, "M3.828 9l6.071-6.071-1.414-1.414L0 10l.707.707 7.778 7.778 1.414-1.414L3.828 11H20V9H3.828z"},
{PackIconZondiconsKind.ArrowThinRight, "M16.172 9l-6.071-6.071 1.414-1.414L20 10l-.707.707-7.778 7.778-1.414-1.414L16.172 11H0V9z"},
{PackIconZondiconsKind.ArrowThinUp, "M9 3.828L2.929 9.899 1.515 8.485 10 0l.707.707 7.778 7.778-1.414 1.414L11 3.828V20H9V3.828z"},
{PackIconZondiconsKind.ArrowUp, "M 10 0 L 1.515625 8.484375 L 2.9296875 9.8984375 L 9 3.828125 L 9 20 L 11 20 L 11 3.828125 L 17.070312 9.8984375 L 18.484375 8.484375 L 10.707031 0.70703125 L 10 0 z "},
{PackIconZondiconsKind.Artist, "M15.75 8l-3.74-3.75a3.99 3.99 0 0 1 6.82-3.08A4 4 0 0 1 15.75 8zM1.85 15.3l9.2-9.19 2.83 2.83-9.2 9.2-2.82-2.84zm-1.4 2.83l2.11-2.12 1.42 1.42-2.12 2.12-1.42-1.42zM10 15l2-2v7h-2v-5z"},
{PackIconZondiconsKind.AtSymbol, "M13.6 13.47A4.99 4.99 0 0 1 5 10a5 5 0 0 1 8-4V5h2v6.5a1.5 1.5 0 0 0 3 0V10a8 8 0 1 0-4.42 7.16l.9 1.79A10 10 0 1 1 20 10h-.18.17v1.5a3.5 3.5 0 0 1-6.4 1.97zM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"},
{PackIconZondiconsKind.Attachment, "M15 3H7a7 7 0 1 0 0 14h8v-2H7A5 5 0 0 1 7 5h8a3 3 0 0 1 0 6H7a1 1 0 0 1 0-2h8V7H7a3 3 0 1 0 0 6h8a5 5 0 0 0 0-10z"},
{PackIconZondiconsKind.Backspace, "M0 10l7-7h13v14H7l-7-7zm14.41 0l2.13-2.12-1.42-1.42L13 8.6l-2.12-2.13-1.42 1.42L11.6 10l-2.13 2.12 1.42 1.42L13 11.4l2.12 2.13 1.42-1.42L14.4 10z"},
{PackIconZondiconsKind.Backward, "M19 5v10l-9-5 9-5zm-9 0v10l-9-5 9-5z"},
{PackIconZondiconsKind.BackwardStep, "M4 5h3v10H4V5zm12 0v10l-9-5 9-5z"},
{PackIconZondiconsKind.Badge, "M10 12a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-3a3 3 0 1 0 0-6 3 3 0 0 0 0 6zm4 2.75V20l-4-4-4 4v-8.25a6.97 6.97 0 0 0 8 0z"},
{PackIconZondiconsKind.BatteryFull, "M0 6c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm2 0v8h16V6H2zm1 1h4v6H3V7zm5 0h4v6H8V7zm5 0h4v6h-4V7z"},
{PackIconZondiconsKind.BatteryHalf, "M0 6c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm2 0v8h16V6H2zm1 1h4v6H3V7zm5 0h4v6H8V7z"},
{PackIconZondiconsKind.BatteryLow, "M0 6c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm2 0v8h16V6H2zm1 1h4v6H3V7z"},
{PackIconZondiconsKind.Beverage, "M9 18v-7L0 2V0h20v2l-9 9v7l5 1v1H4v-1l5-1zm2-10a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"},
{PackIconZondiconsKind.Block, "M0 10a10 10 0 1 1 20 0 10 10 0 0 1-20 0zm16.32-4.9L5.09 16.31A8 8 0 0 0 16.32 5.09zm-1.41-1.42A8 8 0 0 0 3.68 14.91L14.91 3.68z"},
{PackIconZondiconsKind.Bluetooth, "M9.41 0l6 6-4 4 4 4-6 6H9v-7.59l-3.3 3.3-1.4-1.42L8.58 10l-4.3-4.3L5.7 4.3 9 7.58V0h.41zM11 4.41V7.6L12.59 6 11 4.41zM12.59 14L11 12.41v3.18L12.59 14z"},
{PackIconZondiconsKind.Bolt, "M13 8V0L8.11 5.87 3 12h4v8L17 8h-4z"},
{PackIconZondiconsKind.Bookmark, "M2 2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v18l-8-4-8 4V2z"},
{PackIconZondiconsKind.BookmarkCopy2, "M 16 2 L 16 11 L 8 11 L 8 6 L 2 12 L 8 18 L 8 13 L 18 13 L 18 12 L 18 2 L 16 2 z "},
{PackIconZondiconsKind.BookmarkCopy3, "M 2 2 L 2 13 L 3.5 13 L 12 13 L 12 18 L 18 12 L 12 6 L 12 11 L 4 11 L 4 2 L 2 2 z "},
{PackIconZondiconsKind.BookmarkOutline, "M2 2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v18l-8-4-8 4V2zm2 0v15l6-3 6 3V2H4z"},
{PackIconZondiconsKind.BookmarkOutlineAdd, "M2 2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v18l-8-4-8 4V2zm2 0v15l6-3 6 3V2H4zm5 5V5h2v2h2v2h-2v2H9V9H7V7h2z"},
{PackIconZondiconsKind.BookReference, "M6 4H5a1 1 0 1 1 0-2h11V1a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v16c0 1.1.9 2 2 2h12a2 2 0 0 0 2-2V5a1 1 0 0 0-1-1h-7v8l-2-2-2 2V4z"},
{PackIconZondiconsKind.BorderAll, "M11 11v6h6v-6h-6zm0-2h6V3h-6v6zm-2 2H3v6h6v-6zm0-2V3H3v6h6zm-8 9V1h18v18H1v-1z"},
{PackIconZondiconsKind.BorderBottom, "M1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm0 4h2v2H1v-2zm0 4h18v2H1v-2zM5 1h2v2H5V1zm0 8h2v2H5V9zm4-8h2v2H9V1zm0 4h2v2H9V5zm0 4h2v2H9V9zm0 4h2v2H9v-2zm4-12h2v2h-2V1zm0 8h2v2h-2V9zm4-8h2v2h-2V1zm0 4h2v2h-2V5zm0 4h2v2h-2V9zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.BorderHorizontal, "M1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h18v2H1V9zm0 4h2v2H1v-2zm0 4h2v2H1v-2zM5 1h2v2H5V1zm0 16h2v2H5v-2zM9 1h2v2H9V1zm0 4h2v2H9V5zm0 8h2v2H9v-2zm0 4h2v2H9v-2zm4-16h2v2h-2V1zm0 16h2v2h-2v-2zm4-16h2v2h-2V1zm0 4h2v2h-2V5zm0 8h2v2h-2v-2zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.BorderInner, "M9 9V1h2v8h8v2h-8v8H9v-8H1V9h8zM1 1h2v2H1V1zm0 4h2v2H1V5zm0 8h2v2H1v-2zm0 4h2v2H1v-2zM5 1h2v2H5V1zm0 16h2v2H5v-2zm8-16h2v2h-2V1zm0 16h2v2h-2v-2zm4-16h2v2h-2V1zm0 4h2v2h-2V5zm0 8h2v2h-2v-2zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.BorderLeft, "M1 1h2v18H1V1zm4 0h2v2H5V1zm0 8h2v2H5V9zm0 8h2v2H5v-2zM9 1h2v2H9V1zm0 4h2v2H9V5zm0 4h2v2H9V9zm0 4h2v2H9v-2zm0 4h2v2H9v-2zm4-16h2v2h-2V1zm0 8h2v2h-2V9zm0 8h2v2h-2v-2zm4-16h2v2h-2V1zm0 4h2v2h-2V5zm0 4h2v2h-2V9zm0 4h2v2h-2v-2zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.BorderNone, "M1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm0 4h2v2H1v-2zm0 4h2v2H1v-2zM5 1h2v2H5V1zm0 8h2v2H5V9zm0 8h2v2H5v-2zM9 1h2v2H9V1zm0 4h2v2H9V5zm0 4h2v2H9V9zm0 4h2v2H9v-2zm0 4h2v2H9v-2zm4-16h2v2h-2V1zm0 8h2v2h-2V9zm0 8h2v2h-2v-2zm4-16h2v2h-2V1zm0 4h2v2h-2V5zm0 4h2v2h-2V9zm0 4h2v2h-2v-2zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.BorderOuter, "M2 19H1V1h18v18H2zm1-2h14V3H3v14zm10-8h2v2h-2V9zM9 9h2v2H9V9zM5 9h2v2H5V9zm4-4h2v2H9V5zm0 8h2v2H9v-2z"},
{PackIconZondiconsKind.BorderRight, "M5 1h2v2H5V1zm0 8h2v2H5V9zm0 8h2v2H5v-2zM9 1h2v2H9V1zm0 4h2v2H9V5zm0 4h2v2H9V9zm0 4h2v2H9v-2zm0 4h2v2H9v-2zm4-16h2v2h-2V1zm0 8h2v2h-2V9zm0 8h2v2h-2v-2zM1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm0 4h2v2H1v-2zm0 4h2v2H1v-2zM17 1h2v18h-2V1z"},
{PackIconZondiconsKind.BorderTop, "M1 1h18v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm0 4h2v2H1v-2zm0 4h2v2H1v-2zm4-8h2v2H5V9zm0 8h2v2H5v-2zM9 5h2v2H9V5zm0 4h2v2H9V9zm0 4h2v2H9v-2zm0 4h2v2H9v-2zm4-8h2v2h-2V9zm0 8h2v2h-2v-2zm4-12h2v2h-2V5zm0 4h2v2h-2V9zm0 4h2v2h-2v-2zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.BorderVertical, "M1 1h2v2H1V1zm0 4h2v2H1V5zm0 4h2v2H1V9zm0 4h2v2H1v-2zm0 4h2v2H1v-2zM5 1h2v2H5V1zm0 8h2v2H5V9zm0 8h2v2H5v-2zM9 1h2v18H9V1zm4 0h2v2h-2V1zm0 8h2v2h-2V9zm0 8h2v2h-2v-2zm4-16h2v2h-2V1zm0 4h2v2h-2V5zm0 4h2v2h-2V9zm0 4h2v2h-2v-2zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.Box, "M0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v2H0V2zm1 3h18v13a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V5zm6 2v2h6V7H7z"},
{PackIconZondiconsKind.BrightnessDown, "M10 13a3 3 0 1 1 0-6 3 3 0 0 1 0 6zM9 4a1 1 0 1 1 2 0 1 1 0 1 1-2 0zm4.54 1.05a1 1 0 1 1 1.41 1.41 1 1 0 1 1-1.41-1.41zM16 9a1 1 0 1 1 0 2 1 1 0 1 1 0-2zm-1.05 4.54a1 1 0 1 1-1.41 1.41 1 1 0 1 1 1.41-1.41zM11 16a1 1 0 1 1-2 0 1 1 0 1 1 2 0zm-4.54-1.05a1 1 0 1 1-1.41-1.41 1 1 0 1 1 1.41 1.41zM4 11a1 1 0 1 1 0-2 1 1 0 1 1 0 2zm1.05-4.54a1 1 0 1 1 1.41-1.41 1 1 0 1 1-1.41 1.41z"},
{PackIconZondiconsKind.BrightnessUp, "M10 14a4 4 0 1 1 0-8 4 4 0 0 1 0 8zM9 1a1 1 0 1 1 2 0v2a1 1 0 1 1-2 0V1zm6.65 1.94a1 1 0 1 1 1.41 1.41l-1.4 1.4a1 1 0 1 1-1.41-1.41l1.4-1.4zM18.99 9a1 1 0 1 1 0 2h-1.98a1 1 0 1 1 0-2h1.98zm-1.93 6.65a1 1 0 1 1-1.41 1.41l-1.4-1.4a1 1 0 1 1 1.41-1.41l1.4 1.4zM11 18.99a1 1 0 1 1-2 0v-1.98a1 1 0 1 1 2 0v1.98zm-6.65-1.93a1 1 0 1 1-1.41-1.41l1.4-1.4a1 1 0 1 1 1.41 1.41l-1.4 1.4zM1.01 11a1 1 0 1 1 0-2h1.98a1 1 0 1 1 0 2H1.01zm1.93-6.65a1 1 0 1 1 1.41-1.41l1.4 1.4a1 1 0 1 1-1.41 1.41l-1.4-1.4z"},
{PackIconZondiconsKind.BrowserWindow, "M0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm2 2v12h16V5H2z"},
{PackIconZondiconsKind.BrowserWindowNew, "M9 10V8h2v2h2v2h-2v2H9v-2H7v-2h2zM0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm2 2v12h16V5H2z"},
{PackIconZondiconsKind.BrowserWindowOpen, "M0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm2 2v12h16V5H2zm8 3l4 5H6l4-5z"},
{PackIconZondiconsKind.Bug, "M15.3 14.89l2.77 2.77a1 1 0 0 1 0 1.41 1 1 0 0 1-1.41 0l-2.59-2.58A5.99 5.99 0 0 1 11 18V9.04a1 1 0 0 0-2 0V18a5.98 5.98 0 0 1-3.07-1.51l-2.59 2.58a1 1 0 0 1-1.41 0 1 1 0 0 1 0-1.41l2.77-2.77A5.95 5.95 0 0 1 4.07 13H1a1 1 0 1 1 0-2h3V8.41L.93 5.34a1 1 0 0 1 0-1.41 1 1 0 0 1 1.41 0l2.1 2.1h11.12l2.1-2.1a1 1 0 0 1 1.41 0 1 1 0 0 1 0 1.41L16 8.41V11h3a1 1 0 1 1 0 2h-3.07c-.1.67-.32 1.31-.63 1.89zM15 5H5a5 5 0 1 1 10 0z"},
{PackIconZondiconsKind.Buoy, "M17.16 6.42a8.03 8.03 0 0 0-3.58-3.58l-1.34 2.69a5.02 5.02 0 0 1 2.23 2.23l2.69-1.34zm0 7.16l-2.69-1.34a5.02 5.02 0 0 1-2.23 2.23l1.34 2.69a8.03 8.03 0 0 0 3.58-3.58zM6.42 2.84a8.03 8.03 0 0 0-3.58 3.58l2.69 1.34a5.02 5.02 0 0 1 2.23-2.23L6.42 2.84zM2.84 13.58a8.03 8.03 0 0 0 3.58 3.58l1.34-2.69a5.02 5.02 0 0 1-2.23-2.23l-2.69 1.34zM10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-7a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"},
{PackIconZondiconsKind.Calculator, "M2 2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm3 1v2h10V3H5zm0 4v2h2V7H5zm4 0v2h2V7H9zm4 0v2h2V7h-2zm-8 4v2h2v-2H5zm4 0v2h2v-2H9zm4 0v6h2v-6h-2zm-8 4v2h2v-2H5zm4 0v2h2v-2H9z"},
{PackIconZondiconsKind.Calendar, "M1 4c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V4zm2 2v12h14V6H3zm2-6h2v2H5V0zm8 0h2v2h-2V0zM5 9h2v2H5V9zm0 4h2v2H5v-2zm4-4h2v2H9V9zm0 4h2v2H9v-2zm4-4h2v2h-2V9zm0 4h2v2h-2v-2z"},
{PackIconZondiconsKind.Camera, "M0 6c0-1.1.9-2 2-2h3l2-2h6l2 2h3a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm10 10a5 5 0 1 0 0-10 5 5 0 0 0 0 10zm0-2a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"},
{PackIconZondiconsKind.Chart, "M4.13 12H4a2 2 0 1 0 1.8 1.11L7.86 10a2.03 2.03 0 0 0 .65-.07l1.55 1.55a2 2 0 1 0 3.72-.37L15.87 8H16a2 2 0 1 0-1.8-1.11L12.14 10a2.03 2.03 0 0 0-.65.07L9.93 8.52a2 2 0 1 0-3.72.37L4.13 12zM0 4c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4z"},
{PackIconZondiconsKind.ChartBar, "M1 10h3v10H1V10zM6 0h3v20H6V0zm5 8h3v12h-3V8zm5-4h3v16h-3V4z"},
{PackIconZondiconsKind.ChartPie, "M19.95 11A10 10 0 1 1 9 .05V11h10.95zm-.08-2.6H11.6V.13a10 10 0 0 1 8.27 8.27z"},
{PackIconZondiconsKind.ChatBubbleDots, "M10 15l-4 4v-4H2a2 2 0 0 1-2-2V3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-8zM5 7v2h2V7H5zm4 0v2h2V7H9zm4 0v2h2V7h-2z"},
{PackIconZondiconsKind.Checkmark, "M0 11l2-2 5 5L18 3l2 2L7 18z"},
{PackIconZondiconsKind.CheckmarkOutline, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM6.7 9.29L9 11.6l4.3-4.3 1.4 1.42L9 14.4l-3.7-3.7 1.4-1.42z"},
{PackIconZondiconsKind.CheveronDown, "M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"},
{PackIconZondiconsKind.CheveronLeft, "M7.05 9.293L6.343 10 12 15.657l1.414-1.414L9.172 10l4.242-4.243L12 4.343z"},
{PackIconZondiconsKind.CheveronOutlineDown, "M20 10a10 10 0 1 1-20 0 10 10 0 0 1 20 0zM10 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16zm-.7 10.54L5.75 9l1.41-1.41L10 10.4l2.83-2.82L14.24 9 10 13.24l-.7-.7z"},
{PackIconZondiconsKind.CheveronOutlineLeft, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm8-10a8 8 0 1 0-16 0 8 8 0 0 0 16 0zM7.46 9.3L11 5.75l1.41 1.41L9.6 10l2.82 2.83L11 14.24 6.76 10l.7-.7z"},
{PackIconZondiconsKind.CheveronOutlineRight, "M10 0a10 10 0 1 1 0 20 10 10 0 0 1 0-20zM2 10a8 8 0 1 0 16 0 8 8 0 0 0-16 0zm10.54.7L9 14.25l-1.41-1.41L10.4 10 7.6 7.17 9 5.76 13.24 10l-.7.7z"},
{PackIconZondiconsKind.CheveronOutlineUp, "M0 10a10 10 0 1 1 20 0 10 10 0 0 1-20 0zm10 8a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm.7-10.54L14.25 11l-1.41 1.41L10 9.6l-2.83 2.8L5.76 11 10 6.76l.7.7z"},
{PackIconZondiconsKind.CheveronRight, "M12.95 10.707l.707-.707L8 4.343 6.586 5.757 10.828 10l-4.242 4.243L8 15.657l4.95-4.95z"},
{PackIconZondiconsKind.CheveronUp, "M10.707 7.05L10 6.343 4.343 12l1.414 1.414L10 9.172l4.243 4.242L15.657 12z"},
{PackIconZondiconsKind.Clipboard, "M7.03 2.6a3 3 0 0 1 5.94 0L15 3v1h1a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h1V3l2.03-.4zM5 6H4v12h12V6h-1v1H5V6zm5-2a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.Close, "M10 8.586L2.929 1.515 1.515 2.929 8.586 10l-7.071 7.071 1.414 1.414L10 11.414l7.071 7.071 1.414-1.414L11.414 10l7.071-7.071-1.414-1.414L10 8.586z"},
{PackIconZondiconsKind.CloseOutline, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm1.41-1.41A8 8 0 1 0 15.66 4.34 8 8 0 0 0 4.34 15.66zm9.9-8.49L11.41 10l2.83 2.83-1.41 1.41L10 11.41l-2.83 2.83-1.41-1.41L8.59 10 5.76 7.17l1.41-1.41L10 8.59l2.83-2.83 1.41 1.41z"},
{PackIconZondiconsKind.CloseSolid, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zM11.4 10l2.83-2.83-1.41-1.41L10 8.59 7.17 5.76 5.76 7.17 8.59 10l-2.83 2.83 1.41 1.41L10 11.41l2.83 2.83 1.41-1.41L11.41 10z"},
{PackIconZondiconsKind.Cloud, "M16.88 9.1A4 4 0 0 1 16 17H5a5 5 0 0 1-1-9.9V7a3 3 0 0 1 4.52-2.59A4.98 4.98 0 0 1 17 8c0 .38-.04.74-.12 1.1z"},
{PackIconZondiconsKind.CloudUpload, "M16.88 9.1A4 4 0 0 1 16 17H5a5 5 0 0 1-1-9.9V7a3 3 0 0 1 4.52-2.59A4.98 4.98 0 0 1 17 8c0 .38-.04.74-.12 1.1zM11 11h3l-4-4-4 4h3v3h2v-3z"},
{PackIconZondiconsKind.Code, "M.7 9.3l4.8-4.8 1.4 1.42L2.84 10l4.07 4.07-1.41 1.42L0 10l.7-.7zm18.6 1.4l.7-.7-5.49-5.49-1.4 1.42L17.16 10l-4.07 4.07 1.41 1.42 4.78-4.78z"},
{PackIconZondiconsKind.Coffee, "M4 11H2a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h2V1h14v10a4 4 0 0 1-4 4H8a4 4 0 0 1-4-4zm0-2V5H2v4h2zm-2 8v-1h18v1l-4 2H6l-4-2z"},
{PackIconZondiconsKind.Cog, "M3.94 6.5L2.22 3.64l1.42-1.42L6.5 3.94c.52-.3 1.1-.54 1.7-.7L9 0h2l.8 3.24c.6.16 1.18.4 1.7.7l2.86-1.72 1.42 1.42-1.72 2.86c.3.52.54 1.1.7 1.7L20 9v2l-3.24.8c-.16.6-.4 1.18-.7 1.7l1.72 2.86-1.42 1.42-2.86-1.72c-.52.3-1.1.54-1.7.7L11 20H9l-.8-3.24c-.6-.16-1.18-.4-1.7-.7l-2.86 1.72-1.42-1.42 1.72-2.86c-.3-.52-.54-1.1-.7-1.7L0 11V9l3.24-.8c.16-.6.4-1.18.7-1.7zM10 13a3 3 0 1 0 0-6 3 3 0 0 0 0 6z"},
{PackIconZondiconsKind.ColorPalette, "M9 20v-1.7l.01-.24L15.07 12h2.94c1.1 0 1.99.89 1.99 2v4a2 2 0 0 1-2 2H9zm0-3.34V5.34l2.08-2.07a1.99 1.99 0 0 1 2.82 0l2.83 2.83a2 2 0 0 1 0 2.82L9 16.66zM0 1.99C0 .9.89 0 2 0h4a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zM4 17a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.Compose, "M2 4v14h14v-6l2-2v10H0V2h10L8 4H2zm10.3-.3l4 4L8 16H4v-4l8.3-8.3zm1.4-1.4L16 0l4 4-2.3 2.3-4-4z"},
{PackIconZondiconsKind.ComputerDesktop, "M7 17H2a2 2 0 0 1-2-2V2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v13a2 2 0 0 1-2 2h-5l4 2v1H3v-1l4-2zM2 2v11h16V2H2z"},
{PackIconZondiconsKind.ComputerLaptop, "M18 16h2v1a1 1 0 0 1-1 1H1a1 1 0 0 1-1-1v-1h2V4c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v12zM4 4v9h12V4H4zm4 11v1h4v-1H8z"},
{PackIconZondiconsKind.Conversation, "M17 11v3l-3-3H8a2 2 0 0 1-2-2V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2h-1zm-3 2v2a2 2 0 0 1-2 2H6l-3 3v-3H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h2v3a4 4 0 0 0 4 4h6z"},
{PackIconZondiconsKind.Copy, "M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h4zm2 0h4a2 2 0 0 1 2 2v4h4V2H8v4zM2 8v10h10V8H2z"},
{PackIconZondiconsKind.CreditCard, "M18 6V4H2v2h16zm0 4H2v6h16v-6zM0 4c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm4 8h4v2H4v-2z"},
{PackIconZondiconsKind.CurrencyDollar, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm1-5h1a3 3 0 0 0 0-6H7.99a1 1 0 0 1 0-2H14V5h-3V3H9v2H8a3 3 0 1 0 0 6h4a1 1 0 1 1 0 2H6v2h3v2h2v-2z"},
{PackIconZondiconsKind.Dashboard, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm-5.6-4.29a9.95 9.95 0 0 1 11.2 0 8 8 0 1 0-11.2 0zm6.12-7.64l3.02-3.02 1.41 1.41-3.02 3.02a2 2 0 1 1-1.41-1.41z"},
{PackIconZondiconsKind.DateAdd, "M15 2h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V4c0-1.1.9-2 2-2h2V0h2v2h6V0h2v2zM3 6v12h14V6H3zm6 5V9h2v2h2v2h-2v2H9v-2H7v-2h2z"},
{PackIconZondiconsKind.DialPad, "M5 4a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm5 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm5 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zM5 9a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm5 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm5 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zM5 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm5 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 6a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm5-6a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.Directions, "M10 0l10 10-10 10L0 10 10 0zM6 10v3h2v-3h3v3l4-4-4-4v3H8a2 2 0 0 0-2 2z"},
{PackIconZondiconsKind.Document, "M4 18h12V6h-4V2H4v16zm-2 1V0h12l4 4v16H2v-1z"},
{PackIconZondiconsKind.DocumentAdd, "M9 10V8h2v2h2v2h-2v2H9v-2H7v-2h2zm-5 8h12V6h-4V2H4v16zm-2 1V0h12l4 4v16H2v-1z"},
{PackIconZondiconsKind.DotsHorizontalDouble, "M10 9a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 6a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.DotsHorizontalTriple, "M10 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0-6a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm0 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.Download, "M13 8V2H7v6H2l8 8 8-8h-5zM0 18h20v2H0v-2z"},
{PackIconZondiconsKind.Duplicate, "M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h4zm2 0h4a2 2 0 0 1 2 2v4h4V2H8v4zM2 8v10h10V8H2zm4 4v-2h2v2h2v2H8v2H6v-2H4v-2h2z"},
{PackIconZondiconsKind.EditCopy, "M6 6V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-4v4a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h4zm2 0h4a2 2 0 0 1 2 2v4h4V2H8v4zM2 8v10h10V8H2z"},
{PackIconZondiconsKind.EditCrop, "M14 16H6a2 2 0 0 1-2-2V6H0V4h4V0h2v14h14v2h-4v4h-2v-4zm0-3V6H7V4h7a2 2 0 0 1 2 2v7h-2z"},
{PackIconZondiconsKind.EditCut, "M9.77 11.5l5.34 3.91c.44.33 1.24.59 1.79.59H20L6.89 6.38A3.5 3.5 0 1 0 5.5 8.37L7.73 10 5.5 11.63a3.5 3.5 0 1 0 1.38 1.99l2.9-2.12zM3.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM15.1 4.59A3.53 3.53 0 0 1 16.9 4H20l-7.5 5.5L10.45 8l4.65-3.41z"},
{PackIconZondiconsKind.EditPencil, "M12.3 3.7l4 4L4 20H0v-4L12.3 3.7zm1.4-1.4L16 0l4 4-2.3 2.3-4-4z"},
{PackIconZondiconsKind.Education, "M3.33 8L10 12l10-6-10-6L0 6h10v2H3.33zM0 8v8l2-2.22V9.2L0 8zm10 12l-5-3-2-1.2v-6l7 4.2 7-4.2v6L10 20z"},
{PackIconZondiconsKind.Envelope, "M18 2a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4c0-1.1.9-2 2-2h16zm-4.37 9.1L20 16v-2l-5.12-3.9L20 6V4l-10 8L0 4v2l5.12 4.1L0 14v2l6.37-4.9L10 14l3.63-2.9z"},
{PackIconZondiconsKind.ExclamationOutline, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 5h2v6H9V5zm0 8h2v2H9v-2z"},
{PackIconZondiconsKind.ExclamationSolid, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zM9 5v6h2V5H9zm0 8v2h2v-2H9z"},
{PackIconZondiconsKind.Explore, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM7.88 7.88l-3.54 7.78 7.78-3.54 3.54-7.78-7.78 3.54zM10 11a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"},
{PackIconZondiconsKind.Factory, "M10.5 20H0V7l5 3.33V7l5 3.33V7l5 3.33V0h5v20h-9.5z"},
{PackIconZondiconsKind.FastForward, "M1 5l9 5-9 5V5zm9 0l9 5-9 5V5z"},
{PackIconZondiconsKind.FastRewind, "M19 5v10l-9-5 9-5zm-9 0v10l-9-5 9-5z"},
{PackIconZondiconsKind.Film, "M0 4c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm6 0v12h8V4H6zM2 5v2h2V5H2zm0 4v2h2V9H2zm0 4v2h2v-2H2zm14-8v2h2V5h-2zm0 4v2h2V9h-2zm0 4v2h2v-2h-2zM8 7l5 3-5 3V7z"},
{PackIconZondiconsKind.Filter, "M12 12l8-8V0H0v4l8 8v8l4-4v-4z"},
{PackIconZondiconsKind.Flag, "M7.667 12H2v8H0V0h12l.333 2H20l-3 6 3 6H8l-.333-2z"},
{PackIconZondiconsKind.Flashlight, "M13 7v11a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V7L5 5V3h10v2l-2 2zM9 8v1a1 1 0 1 0 2 0V8a1 1 0 0 0-2 0zM5 0h10v2H5V0z"},
{PackIconZondiconsKind.Folder, "M0 4c0-1.1.9-2 2-2h7l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4z"},
{PackIconZondiconsKind.FolderOutline, "M0 4c0-1.1.9-2 2-2h7l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm2 2v10h16V6H2z"},
{PackIconZondiconsKind.FolderOutlineAdd, "M0 4c0-1.1.9-2 2-2h7l2 2h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm2 2v10h16V6H2zm7 4V8h2v2h2v2h-2v2H9v-2H7v-2h2z"},
{PackIconZondiconsKind.FormatBold, "M3 19V1h8a5 5 0 0 1 3.88 8.16A5.5 5.5 0 0 1 11.5 19H3zm7.5-8H7v5h3.5a2.5 2.5 0 1 0 0-5zM7 4v4h3a2 2 0 1 0 0-4H7z"},
{PackIconZondiconsKind.FormatFontSize, "M16 9v8h-2V9h-4V7h10v2h-4zM8 5v12H6V5H0V3h15v2H8z"},
{PackIconZondiconsKind.FormatItalic, "M8 1h9v2H8V1zm3 2h3L8 17H5l6-14zM2 17h9v2H2v-2z"},
{PackIconZondiconsKind.FormatTextSize, "M16 9v8h-2V9h-4V7h10v2h-4zM8 5v12H6V5H0V3h15v2H8z"},
{PackIconZondiconsKind.FormatUnderline, "M16 9A6 6 0 1 1 4 9V1h3v8a3 3 0 0 0 6 0V1h3v8zM2 17h16v2H2v-2z"},
{PackIconZondiconsKind.Forward, "M1 5l9 5-9 5V5zm9 0l9 5-9 5V5z"},
{PackIconZondiconsKind.ForwardStep, "M13 5h3v10h-3V5zM4 5l9 5-9 5V5z"},
{PackIconZondiconsKind.Gift, "M14.83 4H20v6h-1v10H1V10H0V4h5.17A3 3 0 0 1 10 .76 3 3 0 0 1 14.83 4zM8 10H3v8h5v-8zm4 0v8h5v-8h-5zM8 6H2v2h6V6zm4 0v2h6V6h-6zM8 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm4 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.Globe, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm2-2.25a8 8 0 0 0 4-2.46V9a2 2 0 0 1-2-2V3.07a7.95 7.95 0 0 0-3-1V3a2 2 0 0 1-2 2v1a2 2 0 0 1-2 2v2h3a2 2 0 0 1 2 2v5.75zm-4 0V15a2 2 0 0 1-2-2v-1h-.5A1.5 1.5 0 0 1 4 10.5V8H2.25A8.01 8.01 0 0 0 8 17.75z"},
{PackIconZondiconsKind.HandStop, "M17 16a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4.01V4a1 1 0 0 1 1-1 1 1 0 0 1 1 1v6h1V2a1 1 0 0 1 1-1 1 1 0 0 1 1 1v8h1V1a1 1 0 1 1 2 0v9h1V2a1 1 0 0 1 1-1 1 1 0 0 1 1 1v13h1V9a1 1 0 0 1 1-1h1v8z"},
{PackIconZondiconsKind.HardDrive, "M2 2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm10.4 5.6A5 5 0 1 0 15 12V5l-2.6 2.6zM10 14a2 2 0 1 1 0-4 2 2 0 0 1 0 4zM6 3v2h4V3H6zM4 3a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0 16a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm12 0a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0-16a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.Headphones, "M16 8A6 6 0 1 0 4 8v11H2a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2V8a8 8 0 1 1 16 0v3a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2V8zm-4 2h3v10h-3V10zm-7 0h3v10H5V10z"},
{PackIconZondiconsKind.Heart, "M10 3.22l-.61-.6a5.5 5.5 0 0 0-7.78 7.77L10 18.78l8.39-8.4a5.5 5.5 0 0 0-7.78-7.77l-.61.61z"},
{PackIconZondiconsKind.Home, "M8 20H3V10H0L10 0l10 10h-3v10h-5v-6H8v6z"},
{PackIconZondiconsKind.Hot, "M10 0s8 7.58 8 12a8 8 0 1 1-16 0c0-1.5.91-3.35 2.12-5.15A3 3 0 0 0 10 6V0zM8 0a3 3 0 1 0 0 6V0z"},
{PackIconZondiconsKind.HourGlass, "M3 18a7 7 0 0 1 4-6.33V8.33A7 7 0 0 1 3 2H1V0h18v2h-2a7 7 0 0 1-4 6.33v3.34A7 7 0 0 1 17 18h2v2H1v-2h2zM5 2a5 5 0 0 0 4 4.9V10h2V6.9A5 5 0 0 0 15 2H5z"},
{PackIconZondiconsKind.Inbox, "M0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm14 12h4V2H2v12h4c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2z"},
{PackIconZondiconsKind.InboxCheck, "M0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm14 12h4V2H2v12h4c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2zM5 9l2-2 2 2 4-4 2 2-6 6-4-4z"},
{PackIconZondiconsKind.InboxDownload, "M0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm14 12h4V2H2v12h4c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2zM9 8V5h2v3h3l-4 4-4-4h3z"},
{PackIconZondiconsKind.InboxFull, "M14 14h4V2H2v12h4c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2zM0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm4 2h12v2H4V4zm0 3h12v2H4V7zm0 3h12v2H4v-2z"},
{PackIconZondiconsKind.IndentDecrease, "M1 1h18v2H1V1zm6 8h12v2H7V9zm-6 8h18v2H1v-2zM7 5h12v2H7V5zm0 8h12v2H7v-2zM5 6v8l-4-4 4-4z"},
{PackIconZondiconsKind.IndentIncrease, "M1 1h18v2H1V1zm6 8h12v2H7V9zm-6 8h18v2H1v-2zM7 5h12v2H7V5zm0 8h12v2H7v-2zM1 6l4 4-4 4V6z"},
{PackIconZondiconsKind.InformationOutline, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM9 11V9h2v6H9v-4zm0-6h2v2H9V5z"},
{PackIconZondiconsKind.InformationSolid, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zM9 11v4h2V9H9v2zm0-6v2h2V5H9z"},
{PackIconZondiconsKind.Key, "M12.26 11.74L10 14H8v2H6v2l-2 2H0v-4l8.26-8.26a6 6 0 1 1 4 4zm4.86-4.62A3 3 0 0 0 15 2a3 3 0 0 0-2.12.88l4.24 4.24z"},
{PackIconZondiconsKind.Keyboard, "M0 6c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V6zm2 0v2h2V6H2zm1 3v2h2V9H3zm-1 3v2h2v-2H2zm3 0v2h10v-2H5zm11 0v2h2v-2h-2zM6 9v2h2V9H6zm3 0v2h2V9H9zm3 0v2h2V9h-2zm3 0v2h2V9h-2zM5 6v2h2V6H5zm3 0v2h2V6H8zm3 0v2h2V6h-2zm3 0v2h4V6h-4z"},
{PackIconZondiconsKind.Layers, "M10 1l10 6-10 6L0 7l10-6zm6.67 10L20 13l-10 6-10-6 3.33-2L10 15l6.67-4z"},
{PackIconZondiconsKind.Library, "M0 6l10-6 10 6v2H0V6zm0 12h20v2H0v-2zm2-2h16v2H2v-2zm0-8h4v8H2V8zm6 0h4v8H8V8zm6 0h4v8h-4V8z"},
{PackIconZondiconsKind.LightBulb, "M7 13.33a7 7 0 1 1 6 0V16H7v-2.67zM7 17h6v1.5c0 .83-.67 1.5-1.5 1.5h-3A1.5 1.5 0 0 1 7 18.5V17zm2-5.1V14h2v-2.1a5 5 0 1 0-2 0z"},
{PackIconZondiconsKind.Link, "M9.26 13a2 2 0 0 1 .01-2.01A3 3 0 0 0 9 5H5a3 3 0 0 0 0 6h.08a6.06 6.06 0 0 0 0 2H5A5 5 0 0 1 5 3h4a5 5 0 0 1 .26 10zm1.48-6a2 2 0 0 1-.01 2.01A3 3 0 0 0 11 15h4a3 3 0 0 0 0-6h-.08a6.06 6.06 0 0 0 0-2H15a5 5 0 0 1 0 10h-4a5 5 0 0 1-.26-10z"},
{PackIconZondiconsKind.List, "M1 4h2v2H1V4zm4 0h14v2H5V4zM1 9h2v2H1V9zm4 0h14v2H5V9zm-4 5h2v2H1v-2zm4 0h14v2H5v-2z"},
{PackIconZondiconsKind.ListAdd, "M15 9h-3v2h3v3h2v-3h3V9h-3V6h-2v3zM0 3h10v2H0V3zm0 8h10v2H0v-2zm0-4h10v2H0V7zm0 8h10v2H0v-2z"},
{PackIconZondiconsKind.ListBullet, "M1 4h2v2H1V4zm4 0h14v2H5V4zM1 9h2v2H1V9zm4 0h14v2H5V9zm-4 5h2v2H1v-2zm4 0h14v2H5v-2z"},
{PackIconZondiconsKind.LoadBalancer, "M17 12h-6v4h1v4H8v-4h1v-4H3v4h1v4H0v-4h1v-4a2 2 0 0 1 2-2h6V6H7V0h6v6h-2v4h6a2 2 0 0 1 2 2v4h1v4h-4v-4h1v-4z"},
{PackIconZondiconsKind.Location, "M10 20S3 10.87 3 7a7 7 0 1 1 14 0c0 3.87-7 13-7 13zm0-11a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"},
{PackIconZondiconsKind.LocationCurrent, "M0 0l20 8-8 4-2 8z"},
{PackIconZondiconsKind.LocationFood, "M18 11v7a2 2 0 0 1-4 0v-5h-2V3a3 3 0 0 1 3-3h3v11zM4 10a2 2 0 0 1-2-2V1a1 1 0 0 1 2 0v4h1V1a1 1 0 0 1 2 0v4h1V1a1 1 0 0 1 2 0v7a2 2 0 0 1-2 2v8a2 2 0 0 1-4 0v-8z"},
{PackIconZondiconsKind.LocationGasStation, "M13 18h1v2H0v-2h1V2c0-1.1.9-2 2-2h8a2 2 0 0 1 2 2v16zM3 2v6h8V2H3zm10 8h1a2 2 0 0 1 2 2v3a1 1 0 0 0 2 0v-5l-2-2V6l-2-2 1-1 5 5v7a3 3 0 0 1-6 0v-3h-1v-2z"},
{PackIconZondiconsKind.LocationHotel, "M2 12h18v6h-2v-2H2v2H0V2h2v10zm8-6h8a2 2 0 0 1 2 2v3H10V6zm-4 5a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"},
{PackIconZondiconsKind.LocationMarina, "M8 1.88V0h2v16h10l-4 4H2l-2-4h8v-2H0v-.26A24.03 24.03 0 0 0 8 1.88zM19.97 14H10v-.36A11.94 11.94 0 0 0 10 .36v-.2A16.01 16.01 0 0 1 19.97 14z"},
{PackIconZondiconsKind.LocationPark, "M5.33 12.77A4 4 0 1 1 3 5.13V5a4 4 0 0 1 5.71-3.62 3.5 3.5 0 0 1 6.26 1.66 2.5 2.5 0 0 1 2 2.08 4 4 0 1 1-2.7 7.49A5.02 5.02 0 0 1 12 14.58V18l2 1v1H6v-1l2-1v-3l-2.67-2.23zM5 10l3 3v-3H5z"},
{PackIconZondiconsKind.LocationRestroom, "M12 16H9l2-4.5V9c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v2.5l2 4.5h-3v4h-4v-4zm-5-3h2V9a2 2 0 0 0-2-2H3a2 2 0 0 0-2 2v4h2v7h4v-7zM5 6a3 3 0 1 1 0-6 3 3 0 0 1 0 6zm9 0a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"},
{PackIconZondiconsKind.LocationShopping, "M16 6v2h2l2 12H0L2 8h2V6a6 6 0 1 1 12 0zm-2 0a4 4 0 1 0-8 0v2h8V6zM4 10v2h2v-2H4zm10 0v2h2v-2h-2z"},
{PackIconZondiconsKind.LockClosed, "M4 8V6a6 6 0 1 1 12 0v2h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2h1zm5 6.73V17h2v-2.27a2 2 0 1 0-2 0zM7 6v2h6V6a3 3 0 0 0-6 0z"},
{PackIconZondiconsKind.LockOpen, "M4 8V6a6 6 0 1 1 12 0h-3v2h4a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2h1zm5 6.73V17h2v-2.27a2 2 0 1 0-2 0zM7 6v2h6V6a3 3 0 0 0-6 0z"},
{PackIconZondiconsKind.Map, "M0 0l6 4 8-4 6 4v16l-6-4-8 4-6-4V0zm7 6v11l6-3V3L7 6z"},
{PackIconZondiconsKind.Menu, "M0 3h20v2H0V3zm0 6h20v2H0V9zm0 6h20v2H0v-2z"},
{PackIconZondiconsKind.Mic, "M9 18v-1.06A8 8 0 0 1 2 9h2a6 6 0 1 0 12 0h2a8 8 0 0 1-7 7.94V18h3v2H6v-2h3zM6 4a4 4 0 1 1 8 0v5a4 4 0 1 1-8 0V4z"},
{PackIconZondiconsKind.MinusOutline, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm5-9v2H5V9h10z"},
{PackIconZondiconsKind.MinusSolid, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm5-11H5v2h10V9z"},
{PackIconZondiconsKind.MobileDevices, "M17 6V5h-2V2H3v14h5v4h3.25H11a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6zm-5.75 14H3a2 2 0 0 1-2-2V2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v4a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5.75zM11 8v8h6V8h-6zm3 11a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.MoodHappyOutline, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm7 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm2.16 3a6 6 0 0 1-11.32 0h11.32z"},
{PackIconZondiconsKind.MoodHappySolid, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM6.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm7 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm2.16 3H4.34a6 6 0 0 0 11.32 0z"},
{PackIconZondiconsKind.MoodNeutralOutline, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm7 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM7 13h6a1 1 0 0 1 0 2H7a1 1 0 0 1 0-2z"},
{PackIconZondiconsKind.MoodNeutralSolid, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM6.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm7 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM7 13a1 1 0 0 0 0 2h6a1 1 0 0 0 0-2H7z"},
{PackIconZondiconsKind.MoodSadOutline, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM6.5 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm7 0a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm2.16 6H4.34a6 6 0 0 1 11.32 0z"},
{PackIconZondiconsKind.MoodSadSolid, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM6.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm7 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm2.16 6a6 6 0 0 0-11.32 0h11.32z"},
{PackIconZondiconsKind.Mouse, "M4 9V6A6 6 0 0 1 9 .08V9H4zm0 2v3a6 6 0 1 0 12 0v-3H4zm12-2V6a6 6 0 0 0-5-5.92V9h5z"},
{PackIconZondiconsKind.MusicAlbum, "M0 0h20v20H0V0zm10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm0-5a3 3 0 1 1 0-6 3 3 0 0 1 0 6z"},
{PackIconZondiconsKind.MusicArtist, "M15.75 8l-3.74-3.75a3.99 3.99 0 0 1 6.82-3.08A4 4 0 0 1 15.75 8zm-13.9 7.3l9.2-9.19 2.83 2.83-9.2 9.2-2.82-2.84zm-1.4 2.83l2.11-2.12 1.42 1.42-2.12 2.12-1.42-1.42zM10 15l2-2v7h-2v-5z"},
{PackIconZondiconsKind.MusicNotes, "M20 2.5V0L6 2v12.17A3 3 0 0 0 5 14H3a3 3 0 0 0 0 6h2a3 3 0 0 0 3-3V5.71L18 4.3v7.88a3 3 0 0 0-1-.17h-2a3 3 0 0 0 0 6h2a3 3 0 0 0 3-3V2.5z"},
{PackIconZondiconsKind.MusicPlaylist, "M16 17a3 3 0 0 1-3 3h-2a3 3 0 0 1 0-6h2a3 3 0 0 1 1 .17V1l6-1v4l-4 .67V17zM0 3h12v2H0V3zm0 4h12v2H0V7zm0 4h12v2H0v-2zm0 4h6v2H0v-2z"},
{PackIconZondiconsKind.NavigationMore, "M4 12a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm6 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm6 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.Network, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm7.75-8a8.01 8.01 0 0 0 0-4h-3.82a28.81 28.81 0 0 1 0 4h3.82zm-.82 2h-3.22a14.44 14.44 0 0 1-.95 3.51A8.03 8.03 0 0 0 16.93 14zm-8.85-2h3.84a24.61 24.61 0 0 0 0-4H8.08a24.61 24.61 0 0 0 0 4zm.25 2c.41 2.4 1.13 4 1.67 4s1.26-1.6 1.67-4H8.33zm-6.08-2h3.82a28.81 28.81 0 0 1 0-4H2.25a8.01 8.01 0 0 0 0 4zm.82 2a8.03 8.03 0 0 0 4.17 3.51c-.42-.96-.74-2.16-.95-3.51H3.07zm13.86-8a8.03 8.03 0 0 0-4.17-3.51c.42.96.74 2.16.95 3.51h3.22zm-8.6 0h3.34c-.41-2.4-1.13-4-1.67-4S8.74 3.6 8.33 6zM3.07 6h3.22c.2-1.35.53-2.55.95-3.51A8.03 8.03 0 0 0 3.07 6z"},
{PackIconZondiconsKind.NewsPaper, "M16 2h4v15a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V0h16v2zm0 2v13a1 1 0 0 0 1 1 1 1 0 0 0 1-1V4h-2zM2 2v15a1 1 0 0 0 1 1h11.17a2.98 2.98 0 0 1-.17-1V2H2zm2 8h8v2H4v-2zm0 4h8v2H4v-2zM4 4h8v4H4V4z"},
{PackIconZondiconsKind.Notification, "M4 8a6 6 0 0 1 4.03-5.67 2 2 0 1 1 3.95 0A6 6 0 0 1 16 8v6l3 2v1H1v-1l3-2V8zm8 10a2 2 0 1 1-4 0h4z"},
{PackIconZondiconsKind.Notifications, "M4 8a6 6 0 0 1 4.03-5.67 2 2 0 1 1 3.95 0A6 6 0 0 1 16 8v6l3 2v1H1v-1l3-2V8zm8 10a2 2 0 1 1-4 0h4z"},
{PackIconZondiconsKind.NotificationsOutline, "M6 8v7h8V8a4 4 0 1 0-8 0zm2.03-5.67a2 2 0 1 1 3.95 0A6 6 0 0 1 16 8v6l3 2v1H1v-1l3-2V8a6 6 0 0 1 4.03-5.67zM12 18a2 2 0 1 1-4 0h4z"},
{PackIconZondiconsKind.Paste, "M10.5 20H2a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h1V3l2.03-.4a3 3 0 0 1 5.94 0L13 3v1h1a2 2 0 0 1 2 2v1h-2V6h-1v1H3V6H2v12h5v2h3.5zM8 4a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm2 4h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-8c0-1.1.9-2 2-2zm0 2v8h8v-8h-8z"},
{PackIconZondiconsKind.Pause, "M5 4h3v12H5V4zm7 0h3v12h-3V4z"},
{PackIconZondiconsKind.PauseOutline, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM7 6h2v8H7V6zm4 0h2v8h-2V6z"},
{PackIconZondiconsKind.PauseSolid, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zM7 6v8h2V6H7zm4 0v8h2V6h-2z"},
{PackIconZondiconsKind.PenTool, "M11 9.27V0l6 11-4 6H7l-4-6L9 0v9.27a2 2 0 1 0 2 0zM6 18h8v2H6v-2z"},
{PackIconZondiconsKind.Phone, "M20 18.35V19a1 1 0 0 1-1 1h-2A17 17 0 0 1 0 3V1a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4c0 .56-.31 1.31-.7 1.7L3.16 8.84c1.52 3.6 4.4 6.48 8 8l2.12-2.12c.4-.4 1.15-.71 1.7-.71H19a1 1 0 0 1 .99 1v3.35z"},
{PackIconZondiconsKind.Photo, "M0 4c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm11 9l-3-3-6 6h16l-5-5-2 2zm4-4a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"},
{PackIconZondiconsKind.PhpElephant, "M10 12v8A10 10 0 0 1 8.17.17L10 2h5a5 5 0 0 1 5 4.99v9.02A4 4 0 0 1 16 20v-2a2 2 0 1 0 0-4h-4l-2-2zm5.5-3a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"},
{PackIconZondiconsKind.Pin, "M11 12h6v-1l-3-1V2l3-1V0H3v1l3 1v8l-3 1v1h6v7l1 1 1-1v-7z"},
{PackIconZondiconsKind.Play, "M4 4l12 6-12 6z"},
{PackIconZondiconsKind.Playlist, "M16 17a3 3 0 0 1-3 3h-2a3 3 0 0 1 0-6h2a3 3 0 0 1 1 .17V1l6-1v4l-4 .67V17zM0 3h12v2H0V3zm0 4h12v2H0V7zm0 4h12v2H0v-2zm0 4h6v2H0v-2z"},
{PackIconZondiconsKind.PlayOutline, "M2.93 17.07A10 10 0 1 1 17.07 2.93 10 10 0 0 1 2.93 17.07zm12.73-1.41A8 8 0 1 0 4.34 4.34a8 8 0 0 0 11.32 11.32zM7 6l8 4-8 4V6z"},
{PackIconZondiconsKind.Plugin, "M20 14v4a2 2 0 0 1-2 2h-4v-2a2 2 0 0 0-2-2 2 2 0 0 0-2 2v2H6a2 2 0 0 1-2-2v-4H2a2 2 0 0 1-2-2 2 2 0 0 1 2-2h2V6c0-1.1.9-2 2-2h4V2a2 2 0 0 1 2-2 2 2 0 0 1 2 2v2h4a2 2 0 0 1 2 2v4h-2a2 2 0 0 0-2 2 2 2 0 0 0 2 2h2z"},
{PackIconZondiconsKind.Portfolio, "M9 12H1v6a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-6h-8v2H9v-2zm0-1H0V5c0-1.1.9-2 2-2h4V2a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1h4a2 2 0 0 1 2 2v6h-9V9H9v2zm3-8V2H8v1h4z"},
{PackIconZondiconsKind.Printer, "M4 16H0V6h20v10h-4v4H4v-4zm2-4v6h8v-6H6zM4 0h12v5H4V0zM2 8v2h2V8H2zm4 0v2h2V8H6z"},
{PackIconZondiconsKind.Pylon, "M17.4 18H20v2H0v-2h2.6L8 0h4l5.4 18zm-3.2-4H5.8l-1.2 4h10.8l-1.2-4zm-2.4-8H8.2L7 10h6l-1.2-4z"},
{PackIconZondiconsKind.Question, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm2-13c0 .28-.21.8-.42 1L10 9.58c-.57.58-1 1.6-1 2.42v1h2v-1c0-.29.21-.8.42-1L13 9.42c.57-.58 1-1.6 1-2.42a4 4 0 1 0-8 0h2a2 2 0 1 1 4 0zm-3 8v2h2v-2H9z"},
{PackIconZondiconsKind.Queue, "M0 2h20v4H0V2zm0 8h20v2H0v-2zm0 6h20v2H0v-2z"},
{PackIconZondiconsKind.Radar, "M12 10a2 2 0 0 1-3.41 1.41A2 2 0 0 1 10 8V0a9.97 9.97 0 0 1 10 10h-8zm7.9 1.41A10 10 0 1 1 8.59.1v2.03a8 8 0 1 0 9.29 9.29h2.02zm-4.07 0a6 6 0 1 1-7.25-7.25v2.1a3.99 3.99 0 0 0-1.4 6.57 4 4 0 0 0 6.56-1.42h2.1z"},
{PackIconZondiconsKind.RadarCopy2, "M12 10a2 2 0 0 1-3.41 1.41A2 2 0 0 1 10 8V0a9.97 9.97 0 0 1 10 10h-8zm7.9 1.41A10 10 0 1 1 8.59.1v2.03a8 8 0 1 0 9.29 9.29h2.02zm-4.07 0a6 6 0 1 1-7.25-7.25v2.1a3.99 3.99 0 0 0-1.4 6.57 4 4 0 0 0 6.56-1.42h2.1z"},
{PackIconZondiconsKind.Radio, "M20 9v9a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V8c0-1.1.9-2 2-2h13.8L.74 1.97 1.26.03 20 5.06V9zm-5 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM2 8v2h16V8H2zm1.5 10a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm5 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm6.5-1a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.Refresh, "M10 3v2a5 5 0 0 0-3.54 8.54l-1.41 1.41A7 7 0 0 1 10 3zm4.95 2.05A7 7 0 0 1 10 17v-2a5 5 0 0 0 3.54-8.54l1.41-1.41zM10 20l-4-4 4-4v8zm0-12V0l4 4-4 4z"},
{PackIconZondiconsKind.Reload, "M14.66 15.66A8 8 0 1 1 17 10h-2a6 6 0 1 0-1.76 4.24l1.42 1.42zM12 10h8l-4 4-4-4z"},
{PackIconZondiconsKind.Reply, "M15 17v-2.99A4 4 0 0 0 11 10H8v5L2 9l6-6v5h3a6 6 0 0 1 6 6v3h-2z"},
{PackIconZondiconsKind.ReplyAll, "M18 17v-2.99A4 4 0 0 0 14 10h-3v5L5 9l6-6v5h3a6 6 0 0 1 6 6v3h-2zM6 6V3L0 9l6 6v-3L3 9l3-3z"},
{PackIconZondiconsKind.Repost, "M5 4a2 2 0 0 0-2 2v6H0l4 4 4-4H5V6h7l2-2H5zm10 4h-3l4-4 4 4h-3v6a2 2 0 0 1-2 2H6l2-2h7V8z"},
{PackIconZondiconsKind.SaveDisk, "M0 2C0 .9.9 0 2 0h14l4 4v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm5 0v6h10V2H5zm6 1h3v4h-3V3z"},
{PackIconZondiconsKind.ScreenFull, "M2.8 15.8L0 13v7h7l-2.8-2.8 4.34-4.32-1.42-1.42L2.8 15.8zM17.2 4.2L20 7V0h-7l2.8 2.8-4.34 4.32 1.42 1.42L17.2 4.2zm-1.4 13L13 20h7v-7l-2.8 2.8-4.32-4.34-1.42 1.42 4.33 4.33zM4.2 2.8L7 0H0v7l2.8-2.8 4.32 4.34 1.42-1.42L4.2 2.8z"},
{PackIconZondiconsKind.Search, "M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12z"},
{PackIconZondiconsKind.Send, "M0 0l20 10L0 20V0zm0 8v4l10-2L0 8z"},
{PackIconZondiconsKind.Servers, "M0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm0 7c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V9zm0 7c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2v-2zM12 2v2h2V2h-2zm4 0v2h2V2h-2zm-4 7v2h2V9h-2zm4 0v2h2V9h-2zm-4 7v2h2v-2h-2zm4 0v2h2v-2h-2z"},
{PackIconZondiconsKind.Share, "M4 10c0-1.1.9-2 2-2h8c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2v-8zm2 0v8h8v-8h-2V8H8v2H6zm3-6.17V16h2V3.83l3.07 3.07 1.42-1.41L10 0l-.7.7-4.8 4.8 1.42 1.4L9 3.84z"},
{PackIconZondiconsKind.Share01, "M4 10c0-1.1.9-2 2-2h8c1.1 0 2 .9 2 2v8c0 1.1-.9 2-2 2H6c-1.1 0-2-.9-2-2v-8zm2 0v8h8v-8h-2V8H8v2H6zm3-6.17V16h2V3.83l3.07 3.07 1.42-1.41L10 0l-.7.7L4.5 5.5l1.42 1.4L9 3.84z"},
{PackIconZondiconsKind.ShareAlt, "M5.08 12.16A2.99 2.99 0 0 1 0 10a3 3 0 0 1 5.08-2.16l8.94-4.47a3 3 0 1 1 .9 1.79L5.98 9.63a3.03 3.03 0 0 1 0 .74l8.94 4.47A2.99 2.99 0 0 1 20 17a3 3 0 1 1-5.98-.37l-8.94-4.47z"},
{PackIconZondiconsKind.Shield, "M19 11a7.5 7.5 0 0 1-3.5 5.94L10 20l-5.5-3.06A7.5 7.5 0 0 1 1 11V3c3.38 0 6.5-1.12 9-3 2.5 1.89 5.62 3 9 3v8zm-9 1.08l2.92 2.04-1.03-3.41 2.84-2.15-3.56-.08L10 5.12 8.83 8.48l-3.56.08L8.1 10.7l-1.03 3.4L10 12.09z"},
{PackIconZondiconsKind.ShoppingCart, "M4 2h16l-3 9H4a1 1 0 1 0 0 2h13v2H4a3 3 0 0 1 0-6h.33L3 5 2 2H0V0h3a1 1 0 0 1 1 1v1zm1 18a2 2 0 1 1 0-4 2 2 0 0 1 0 4zm10 0a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.ShowSidebar, "M7 3H2v14h5V3zm2 0v14h9V3H9zM0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm3 1h3v2H3V4zm0 3h3v2H3V7zm0 3h3v2H3v-2z"},
{PackIconZondiconsKind.Shuffle, "M6.59 12.83L4.4 15c-.58.58-1.59 1-2.4 1H0v-2h2c.29 0 .8-.2 1-.41l2.17-2.18 1.42 1.42zM16 4V1l4 4-4 4V6h-2c-.29 0-.8.2-1 .41l-2.17 2.18L9.4 7.17 11.6 5c.58-.58 1.59-1 2.41-1h2zm0 10v-3l4 4-4 4v-3h-2c-.82 0-1.83-.42-2.41-1l-8.6-8.59C2.8 6.21 2.3 6 2 6H0V4h2c.82 0 1.83.42 2.41 1l8.6 8.59c.2.2.7.41.99.41h2z"},
{PackIconZondiconsKind.StandBy, "M4.16 4.16l1.42 1.42A6.99 6.99 0 0 0 10 18a7 7 0 0 0 4.42-12.42l1.42-1.42a9 9 0 1 1-11.69 0zM9 0h2v8H9V0z"},
{PackIconZondiconsKind.StarFull, "M10 15l-5.878 3.09 1.123-6.545L.489 6.91l6.572-.955L10 0l2.939 5.955 6.572.955-4.756 4.635 1.123 6.545z"},
{PackIconZondiconsKind.Station, "M9 11.73a2 2 0 1 1 2 0V20H9v-8.27zm5.24 2.51l-1.41-1.41A3.99 3.99 0 0 0 10 6a4 4 0 0 0-2.83 6.83l-1.41 1.41a6 6 0 1 1 8.49 0zm2.83 2.83l-1.41-1.41a8 8 0 1 0-11.31 0l-1.42 1.41a10 10 0 1 1 14.14 0z"},
{PackIconZondiconsKind.StepBackward, "M4 5h3v10H4V5zm12 0v10l-9-5 9-5z"},
{PackIconZondiconsKind.StepForward, "M13 5h3v10h-3V5zM4 5l9 5-9 5V5z"},
{PackIconZondiconsKind.Stethoscope, "M17 10.27V4.99a1 1 0 0 0-2 0V15a5 5 0 0 1-10 0v-1.08A6 6 0 0 1 0 8V2C0 .9.9 0 2 0h1a1 1 0 0 1 1 1 1 1 0 0 1-1 1H2v6a4 4 0 1 0 8 0V2H9a1 1 0 0 1-1-1 1 1 0 0 1 1-1h1a2 2 0 0 1 2 2v6a6 6 0 0 1-5 5.92V15a3 3 0 0 0 6 0V5a3 3 0 0 1 6 0v5.27a2 2 0 1 1-2 0z"},
{PackIconZondiconsKind.StoreFront, "M18 9.87V20H2V9.87a4.25 4.25 0 0 0 3-.38V14h10V9.5a4.26 4.26 0 0 0 3 .37zM3 0h4l-.67 6.03A3.43 3.43 0 0 1 3 9C1.34 9 .42 7.73.95 6.15L3 0zm5 0h4l.7 6.3c.17 1.5-.91 2.7-2.42 2.7h-.56A2.38 2.38 0 0 1 7.3 6.3L8 0zm5 0h4l2.05 6.15C19.58 7.73 18.65 9 17 9a3.42 3.42 0 0 1-3.33-2.97L13 0z"},
{PackIconZondiconsKind.StrokeWidth, "M0 0h20v5H0V0zm0 7h20v4H0V7zm0 6h20v3H0v-3zm0 5h20v2H0v-2z"},
{PackIconZondiconsKind.SubdirectoryLeft, "M18 12v1H8v5l-6-6 6-6v5h8V2h2z"},
{PackIconZondiconsKind.SubdirectoryRight, "M3.5 13H12v5l6-6-6-6v5H4V2H2v11z"},
{PackIconZondiconsKind.Swap, "M9 6a4 4 0 1 1 8 0v8h3l-4 4-4-4h3V6a2 2 0 0 0-2-2 2 2 0 0 0-2 2v8a4 4 0 1 1-8 0V6H0l4-4 4 4H5v8a2 2 0 0 0 2 2 2 2 0 0 0 2-2V6z"},
{PackIconZondiconsKind.Tablet, "M2 2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2zm2 0v14h12V2H4zm6 17a1 1 0 1 0 0-2 1 1 0 0 0 0 2z"},
{PackIconZondiconsKind.Tag, "M0 10V2l2-2h8l10 10-10 10L0 10zm4.5-4a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"},
{PackIconZondiconsKind.Target, "M17.94 11H13V9h4.94A8 8 0 0 0 11 2.06V7H9V2.06A8 8 0 0 0 2.06 9H7v2H2.06A8 8 0 0 0 9 17.94V13h2v4.94A8 8 0 0 0 17.94 11zM10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20z"},
{PackIconZondiconsKind.TextBox, "M0 0h6v6H0V0zm2 2v2h2V2H2zm12-2h6v6h-6V0zm2 2v2h2V2h-2zm-2 12h6v6h-6v-6zm2 2v2h2v-2h-2zM0 14h6v6H0v-6zm2 2v2h2v-2H2zM6 2h8v2H6V2zm0 14h8v2H6v-2zM16 6h2v8h-2V6zM2 6h2v8H2V6zm5 1h6v2H7V7zm2 2h2v4H9V9z"},
{PackIconZondiconsKind.TextDecoration, "M12 5h-2v12H8V3h8v2h-2v12h-2V5zM8 3a4 4 0 1 0 0 8V3z"},
{PackIconZondiconsKind.Thermometer, "M9 11.17V7h2v4.17a3 3 0 1 1-2 0zm-1-.63a4 4 0 1 0 4 0V4a2 2 0 1 0-4 0v6.53zM6 9.53V4a4 4 0 0 1 8 0v5.53A5.99 5.99 0 0 1 10 20 6 6 0 0 1 6 9.53z"},
{PackIconZondiconsKind.ThumbsDown, "M11 20a2 2 0 0 1-2-2v-6H2a2 2 0 0 1-2-2V8l2.3-6.12A3.11 3.11 0 0 1 5 0h8a2 2 0 0 1 2 2v8l-3 7v3h-1zm6-10V0h3v10h-3z"},
{PackIconZondiconsKind.ThumbsUp, "M11 0h1v3l3 7v8a2 2 0 0 1-2 2H5c-1.1 0-2.31-.84-2.7-1.88L0 12v-2a2 2 0 0 1 2-2h7V2a2 2 0 0 1 2-2zm6 10h3v10h-3V10z"},
{PackIconZondiconsKind.Ticket, "M20 12v5H0v-5a2 2 0 1 0 0-4V3h20v5a2 2 0 1 0 0 4zM3 5v10h14V5H3zm7 7.08l-2.92 2.04L8.1 10.7 5.27 8.56l3.56-.08L10 5.12l1.17 3.36 3.56.08-2.84 2.15 1.03 3.4L10 12.09z"},
{PackIconZondiconsKind.Time, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-2a8 8 0 1 0 0-16 8 8 0 0 0 0 16zm-1-7.59V4h2v5.59l3.95 3.95-1.41 1.41L9 10.41z"},
{PackIconZondiconsKind.Timer, "M16.32 7.1A8 8 0 1 1 9 4.06V2h2v2.06c1.46.18 2.8.76 3.9 1.62l1.46-1.46 1.42 1.42-1.46 1.45zM10 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12zM7 0h6v2H7V0zm5.12 8.46l1.42 1.42L10 13.4 8.59 12l3.53-3.54z"},
{PackIconZondiconsKind.ToolsCopy, "M10 0s8 7.58 8 12a8 8 0 1 1-16 0c0-1.5.91-3.35 2.12-5.15A3 3 0 0 0 10 6V0zM8 0a3 3 0 1 0 0 6V0z"},
{PackIconZondiconsKind.Translate, "M7.41 9l2.24 2.24-.83 2L6 10.4l-3.3 3.3-1.4-1.42L4.58 9l-.88-.88c-.53-.53-1-1.3-1.3-2.12h2.2c.15.28.33.53.51.7l.89.9.88-.88C7.48 6.1 8 4.84 8 4H0V2h5V0h2v2h5v2h-2c0 1.37-.74 3.15-1.7 4.12L7.4 9zm3.84 8L10 20H8l5-12h2l5 12h-2l-1.25-3h-5.5zm.83-2h3.84L14 10.4 12.08 15z"},
{PackIconZondiconsKind.Trash, "M6 2l2-2h4l2 2h4v2H2V2h4zM3 6h14l-1 14H4L3 6zm5 2v10h1V8H8zm3 0v10h1V8h-1z"},
{PackIconZondiconsKind.Travel, "M14 5h2v14H4V5h2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1zm3 0h1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1V5zM3 5v14H2a2 2 0 0 1-2-2V7c0-1.1.9-2 2-2h1zm5-1v1h4V4H8z"},
{PackIconZondiconsKind.TravelBus, "M13 18H7v1a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1v-1a2 2 0 0 1-2-2V2c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2v1a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1zM4 5v6h5V5H4zm7 0v6h5V5h-5zM5 2v1h10V2H5zm.5 14a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm9 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"},
{PackIconZondiconsKind.TravelCar, "M2 14v-3H1a1 1 0 0 1-1-1 1 1 0 0 1 1-1h1l4-7h8l4 7h1a1 1 0 0 1 1 1 1 1 0 0 1-1 1h-1v6a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1H5v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-3zm13.86-5L13 4H7L4.14 9h11.72zM5.5 14a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm9 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"},
{PackIconZondiconsKind.TravelCase, "M14 5h2v14H4V5h2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1zm3 0h1a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1V5zM3 5v14H2a2 2 0 0 1-2-2V7c0-1.1.9-2 2-2h1zm5-1v1h4V4H8z"},
{PackIconZondiconsKind.TravelTaxiCab, "M12 3h2l4 7h1a1 1 0 0 1 1 1 1 1 0 0 1-1 1h-1v6a1 1 0 0 1-1 1h-1a1 1 0 0 1-1-1v-1H5v1a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1v-6H1a1 1 0 0 1-1-1 1 1 0 0 1 1-1h1l4-7h2V1h4v2zm3.86 7L13 5H7l-2.86 5h11.72zM5.5 15a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm9 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"},
{PackIconZondiconsKind.TravelTrain, "M12 18H8l-2 2H3l2-2a2 2 0 0 1-2-2V2c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2l2 2h-3l-2-2zM5 5v6h10V5H5zm1.5 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm7 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM8 2v1h4V2H8z"},
{PackIconZondiconsKind.TravelWalk, "M11 7l1.44 2.16c.31.47 1.01.84 1.57.84H17V8h-3l-1.44-2.16a5.94 5.94 0 0 0-1.4-1.4l-1.32-.88a1.72 1.72 0 0 0-1.7-.04L4 6v5h2V7l2-1-3 14h2l2.35-7.65L11 14v6h2v-8l-2.7-2.7L11 7zm1-3a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"},
{PackIconZondiconsKind.Trophy, "M15 9a3 3 0 0 0 3-3h2a5 5 0 0 1-5.1 5 5 5 0 0 1-3.9 3.9V17l5 2v1H4v-1l5-2v-2.1A5 5 0 0 1 5.1 11H5a5 5 0 0 1-5-5h2a3 3 0 0 0 3 3V4H2v2H0V2h5V0h10v2h5v4h-2V4h-3v5z"},
{PackIconZondiconsKind.Tuning, "M17 16v4h-2v-4h-2v-3h6v3h-2zM1 9h6v3H1V9zm6-4h6v3H7V5zM3 0h2v8H3V0zm12 0h2v12h-2V0zM9 0h2v4H9V0zM3 12h2v8H3v-8zm6-4h2v12H9V8z"},
{PackIconZondiconsKind.Upload, "M13 10v6H7v-6H2l8-8 8 8h-5zM0 18h20v2H0v-2z"},
{PackIconZondiconsKind.Usb, "M15 8v2h-4V4h2l-3-4-3 4h2v8H5V9.73a2 2 0 1 0-2 0V12a2 2 0 0 0 2 2h4v2.27a2 2 0 1 0 2 0V12h4a2 2 0 0 0 2-2V8h1V4h-4v4h1z"},
{PackIconZondiconsKind.User, "M5 5a5 5 0 0 1 10 0v2A5 5 0 0 1 5 7V5zM0 16.68A19.9 19.9 0 0 1 10 14c3.64 0 7.06.97 10 2.68V20H0v-3.32z"},
{PackIconZondiconsKind.UserAdd, "M2 6H0v2h2v2h2V8h2V6H4V4H2v2zm7 0a3 3 0 0 1 6 0v2a3 3 0 0 1-6 0V6zm11 9.14A15.93 15.93 0 0 0 12 13c-2.91 0-5.65.78-8 2.14V18h16v-2.86z"},
{PackIconZondiconsKind.UserGroup, "M7 8a4 4 0 1 1 0-8 4 4 0 0 1 0 8zm0 1c2.15 0 4.2.4 6.1 1.09L12 16h-1.25L10 20H4l-.75-4H2L.9 10.09A17.93 17.93 0 0 1 7 9zm8.31.17c1.32.18 2.59.48 3.8.92L18 16h-1.25L16 20h-3.96l.37-2h1.25l1.65-8.83zM13 0a4 4 0 1 1-1.33 7.76 5.96 5.96 0 0 0 0-7.52C12.1.1 12.53 0 13 0z"},
{PackIconZondiconsKind.UserSolidCircle, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zM7 6v2a3 3 0 1 0 6 0V6a3 3 0 1 0-6 0zm-3.65 8.44a8 8 0 0 0 13.3 0 15.94 15.94 0 0 0-13.3 0z"},
{PackIconZondiconsKind.UserSolidSquare, "M0 2C0 .9.9 0 2 0h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2zm7 4v2a3 3 0 1 0 6 0V6a3 3 0 1 0-6 0zm11 9.14A15.93 15.93 0 0 0 10 13c-2.91 0-5.65.78-8 2.14V18h16v-2.86z"},
{PackIconZondiconsKind.Vector, "M12 4h4.27a2 2 0 1 1 0 2h-2.14a9 9 0 0 1 4.84 7.25 2 2 0 1 1-2 .04 7 7 0 0 0-4.97-6V8H8v-.71a7 7 0 0 0-4.96 6 2 2 0 1 1-2-.04A9 9 0 0 1 5.86 6H3.73a2 2 0 1 1 0-2H8V3h4v1z"},
{PackIconZondiconsKind.VideoCamera, "M16 7l4-4v14l-4-4v3a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4c0-1.1.9-2 2-2h12a2 2 0 0 1 2 2v3zm-8 7a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-2a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.ViewCarousel, "M16 16v2H4v-2H0V4h4V2h12v2h4v12h-4zM14 5.5V4H6v12h8V5.5zm2 .5v8h2V6h-2zM4 6H2v8h2V6z"},
{PackIconZondiconsKind.ViewColumn, "M12 4H8v12h4V4zm2 0v12h4V4h-4zM6 4H2v12h4V4zM0 2h20v16H0V2z"},
{PackIconZondiconsKind.ViewHide, "M12.81 4.36l-1.77 1.78a4 4 0 0 0-4.9 4.9l-2.76 2.75C2.06 12.79.96 11.49.2 10a11 11 0 0 1 12.6-5.64zm3.8 1.85c1.33 1 2.43 2.3 3.2 3.79a11 11 0 0 1-12.62 5.64l1.77-1.78a4 4 0 0 0 4.9-4.9l2.76-2.75zm-.25-3.99l1.42 1.42L3.64 17.78l-1.42-1.42L16.36 2.22z"},
{PackIconZondiconsKind.ViewList, "M0 3h20v2H0V3zm0 4h20v2H0V7zm0 4h20v2H0v-2zm0 4h20v2H0v-2z"},
{PackIconZondiconsKind.ViewShow, "M.2 10a11 11 0 0 1 19.6 0A11 11 0 0 1 .2 10zm9.8 4a4 4 0 1 0 0-8 4 4 0 0 0 0 8zm0-2a2 2 0 1 1 0-4 2 2 0 0 1 0 4z"},
{PackIconZondiconsKind.ViewTile, "M0 0h9v9H0V0zm2 2v5h5V2H2zm-2 9h9v9H0v-9zm2 2v5h5v-5H2zm9-13h9v9h-9V0zm2 2v5h5V2h-5zm-2 9h9v9h-9v-9zm2 2v5h5v-5h-5z"},
{PackIconZondiconsKind.VolumeDown, "M7 7H3v6h4l5 5V2L7 7zm8.54 6.54l-1.42-1.42a3 3 0 0 0 0-4.24l1.42-1.42a4.98 4.98 0 0 1 0 7.08z"},
{PackIconZondiconsKind.VolumeMute, "M9 7H5v6h4l5 5V2L9 7z"},
{PackIconZondiconsKind.VolumeOff, "M15 8.59l-2.12-2.13-1.42 1.42L13.6 10l-2.13 2.12 1.42 1.42L15 11.4l2.12 2.13 1.42-1.42L16.4 10l2.13-2.12-1.42-1.42L15 8.6zM4 7H0v6h4l5 5V2L4 7z"},
{PackIconZondiconsKind.VolumeUp, "M5 7H1v6h4l5 5V2L5 7zm11.36 9.36l-1.41-1.41a6.98 6.98 0 0 0 0-9.9l1.41-1.41a8.97 8.97 0 0 1 0 12.72zm-2.82-2.82l-1.42-1.42a3 3 0 0 0 0-4.24l1.42-1.42a4.98 4.98 0 0 1 0 7.08z"},
{PackIconZondiconsKind.Wallet, "M0 4c0-1.1.9-2 2-2h15a1 1 0 0 1 1 1v1H2v1h17a1 1 0 0 1 1 1v10a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V4zm16.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"},
{PackIconZondiconsKind.Watch, "M11 9h2v2H9V7h2v2zm-5.82 6.08a6.98 6.98 0 0 1 0-10.16L6 0h8l.82 4.92a6.98 6.98 0 0 1 0 10.16L14 20H6l-.82-4.92zM10 15a5 5 0 1 0 0-10 5 5 0 0 0 0 10z"},
{PackIconZondiconsKind.Window, "M0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm2 2v12h16V5H2z"},
{PackIconZondiconsKind.WindowNew, "M9 10V8h2v2h2v2h-2v2H9v-2H7v-2h2zM0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm2 2v12h16V5H2z"},
{PackIconZondiconsKind.WindowOpen, "M0 3c0-1.1.9-2 2-2h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3zm2 2v12h16V5H2zm8 3l4 5H6l4-5z"},
{PackIconZondiconsKind.Wrench, "M6.47 9.8A5 5 0 0 1 .2 3.22l3.95 3.95 2.82-2.83L3.03.41a5 5 0 0 1 6.4 6.68l10 10-2.83 2.83L6.47 9.8z"},
{PackIconZondiconsKind.YinYang, "M10 20a10 10 0 1 1 0-20 10 10 0 0 1 0 20zm0-18a8 8 0 1 0 0 16 4 4 0 1 1 0-8 4 4 0 1 0 0-8zm0 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2zm0-8a1 1 0 1 1 0-2 1 1 0 0 1 0 2z"},
{PackIconZondiconsKind.ZoomIn, "M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12zM7 7V5h2v2h2v2H9v2H7V9H5V7h2z"},
{PackIconZondiconsKind.ZoomOut, "M12.9 14.32a8 8 0 1 1 1.41-1.41l5.35 5.33-1.42 1.42-5.33-5.34zM8 14A6 6 0 1 0 8 2a6 6 0 0 0 0 12zM5 7h6v2H5V7z"},
};
}
}
} | 185.93038 | 641 | 0.629591 | [
"MIT"
] | michael-hawker/MahApps.Metro.IconPacks | src/MahApps.Metro.IconPacks/PackIconZondiconsDataFactory.cs | 58,756 | C# |
// // Copyright (c) Microsoft. All rights reserved.
// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Timers;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace PropertyChangeNotification //needs to match the .xaml page
{
public partial class Page1 : Page
{
private ToolTip _ttp;
// This function checks the language filter settings to see which code to filter and also grays out tabs with no content
public void CheckLang(object sender, EventArgs e)
{
if (xcsharpCheck.Content == null) // grays out xaml + c# tab
{
xamlcsharp.Background = Brushes.Gainsboro;
xamlcsharp.Foreground = Brushes.White;
_ttp = new ToolTip();
ToolTipService.SetShowOnDisabled(xamlcsharp, true);
_ttp.Content = "This sample is not available in XAML + C#.";
xamlcsharp.ToolTip = (_ttp);
xamlcsharp.IsEnabled = false;
}
else if (xcsharpCheck.Content != null)
{
xamlcsharp.IsEnabled = true;
}
if (xvbCheck.Content == null) // grays out xaml + vb tab
{
xamlvb.Background = Brushes.Gainsboro;
xamlvb.Foreground = Brushes.White;
_ttp = new ToolTip();
ToolTipService.SetShowOnDisabled(xamlvb, true);
_ttp.Content = "This sample is not available in XAML + Visual Basic.NET";
xamlvb.ToolTip = (_ttp);
xamlvb.IsEnabled = false;
}
else if (xvbCheck.Content != null)
{
xamlvb.IsEnabled = true;
}
if (xaml.Content == null) // grays out xaml
{
xaml.IsEnabled = false;
xaml.Background = Brushes.Gainsboro;
xaml.Foreground = Brushes.White;
_ttp = new ToolTip();
ToolTipService.SetShowOnDisabled(xaml, true);
_ttp.Content = "This sample is not available in XAML.";
xaml.ToolTip = (_ttp);
}
else if (xaml.Content != null)
{
xaml.IsEnabled = true;
}
if (csharp.Content == null) // grays out c#
{
csharp.IsEnabled = false;
csharp.Background = Brushes.Gainsboro;
csharp.Foreground = Brushes.White;
_ttp = new ToolTip();
ToolTipService.SetShowOnDisabled(csharp, true);
_ttp.Content = "This sample is not available in C#.";
csharp.ToolTip = (_ttp);
}
else if (csharp.Content != null)
{
csharp.IsEnabled = true;
}
if (vb.Content == null) // grays out vb
{
vb.IsEnabled = false;
vb.Background = Brushes.Gainsboro;
vb.Foreground = Brushes.White;
_ttp = new ToolTip();
ToolTipService.SetShowOnDisabled(vb, true);
_ttp.Content = "This sample is not available in Visual Basic.NET.";
vb.ToolTip = (_ttp);
}
else if (vb.Content != null)
{
vb.IsEnabled = true;
}
if (managedcpp.Content == null) // grays out cpp
{
managedcpp.IsEnabled = false;
managedcpp.Background = Brushes.Gainsboro;
managedcpp.Foreground = Brushes.White;
_ttp = new ToolTip();
ToolTipService.SetShowOnDisabled(managedcpp, true);
_ttp.Content = "This sample is not available in Managed C++.";
managedcpp.ToolTip = (_ttp);
}
else if (managedcpp.Content != null)
{
managedcpp.IsEnabled = true;
}
if (Welcome.Page1.MyDouble == 1) // XAML only
{
xaml.Visibility = Visibility.Visible;
csharp.Visibility = Visibility.Collapsed;
vb.Visibility = Visibility.Collapsed;
managedcpp.Visibility = Visibility.Collapsed;
xamlcsharp.Visibility = Visibility.Collapsed;
xamlvb.Visibility = Visibility.Collapsed;
}
else if (Welcome.Page1.MyDouble == 2) // CSharp
{
csharp.Visibility = Visibility.Visible;
xaml.Visibility = Visibility.Collapsed;
vb.Visibility = Visibility.Collapsed;
managedcpp.Visibility = Visibility.Collapsed;
xamlcsharp.Visibility = Visibility.Collapsed;
xamlvb.Visibility = Visibility.Collapsed;
}
else if (Welcome.Page1.MyDouble == 3) // Visual Basic
{
vb.Visibility = Visibility.Visible;
xaml.Visibility = Visibility.Collapsed;
csharp.Visibility = Visibility.Collapsed;
managedcpp.Visibility = Visibility.Collapsed;
xamlcsharp.Visibility = Visibility.Collapsed;
xamlvb.Visibility = Visibility.Collapsed;
}
else if (Welcome.Page1.MyDouble == 4) // Managed CPP
{
managedcpp.Visibility = Visibility.Visible;
xaml.Visibility = Visibility.Collapsed;
csharp.Visibility = Visibility.Collapsed;
vb.Visibility = Visibility.Collapsed;
xamlcsharp.Visibility = Visibility.Collapsed;
xamlvb.Visibility = Visibility.Collapsed;
}
else if (Welcome.Page1.MyDouble == 5) // No Filter
{
xaml.Visibility = Visibility.Visible;
csharp.Visibility = Visibility.Visible;
vb.Visibility = Visibility.Visible;
managedcpp.Visibility = Visibility.Visible;
xamlcsharp.Visibility = Visibility.Visible;
xamlvb.Visibility = Visibility.Visible;
}
else if (Welcome.Page1.MyDouble == 6) // XAML + CSharp
{
xaml.Visibility = Visibility.Collapsed;
csharp.Visibility = Visibility.Collapsed;
vb.Visibility = Visibility.Collapsed;
managedcpp.Visibility = Visibility.Collapsed;
xamlcsharp.Visibility = Visibility.Visible;
xamlvb.Visibility = Visibility.Collapsed;
}
else if (Welcome.Page1.MyDouble == 7) // XAML + VB
{
xaml.Visibility = Visibility.Collapsed;
csharp.Visibility = Visibility.Collapsed;
vb.Visibility = Visibility.Collapsed;
managedcpp.Visibility = Visibility.Collapsed;
xamlcsharp.Visibility = Visibility.Collapsed;
xamlvb.Visibility = Visibility.Visible;
}
}
}
public class Bid : INotifyPropertyChanged
{
private string _biditemname = "Unset";
private decimal _biditemprice;
public Bid(string newBidItemName, decimal newBidItemPrice)
{
_biditemname = newBidItemName;
_biditemprice = newBidItemPrice;
}
public string BidItemName
{
get { return _biditemname; }
set
{
if (_biditemname.Equals(value) == false)
{
_biditemname = value;
// Call OnPropertyChanged whenever the property is updated
OnPropertyChanged("BidItemName");
}
}
}
public decimal BidItemPrice
{
get { return _biditemprice; }
set
{
if (_biditemprice.Equals(value) == false)
{
_biditemprice = value;
// Call OnPropertyChanged whenever the property is updated
OnPropertyChanged("BidItemPrice");
}
}
}
// Declare event
public event PropertyChangedEventHandler PropertyChanged;
// OnPropertyChanged event handler to update property value in binding
private void OnPropertyChanged(string propName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
}
}
public class BidCollection : ObservableCollection<Bid>
{
private readonly Bid _item1 = new Bid("Perseus Vase", (decimal) 24.95);
private readonly Bid _item2 = new Bid("Hercules Statue", (decimal) 16.05);
private readonly Bid _item3 = new Bid("Odysseus Painting", (decimal) 100.0);
public BidCollection()
{
Add(_item1);
Add(_item2);
Add(_item3);
CreateTimer();
}
private void Timer1_Elapsed(object sender, ElapsedEventArgs e)
{
_item1.BidItemPrice += (decimal) 1.25;
_item2.BidItemPrice += (decimal) 2.45;
_item3.BidItemPrice += (decimal) 10.55;
}
private void CreateTimer()
{
var timer1 = new Timer
{
Enabled = true,
Interval = 2000
};
timer1.Elapsed += Timer1_Elapsed;
}
}
} | 37.988189 | 128 | 0.531869 | [
"MIT"
] | 21pages/WPF-Samples | Getting Started/Concepts/samps/propertychangenotification_samp.xaml.cs | 9,651 | C# |
#if !NETSTANDARD1_5
using MasterDevs.ChromeDevTools.Serialization;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using WebSocket4Net;
namespace MasterDevs.ChromeDevTools
{
public class ChromeSession : IChromeSession
{
private readonly string _endpoint;
private readonly ConcurrentDictionary<string, ConcurrentBag<Action<object>>> _handlers = new ConcurrentDictionary<string, ConcurrentBag<Action<object>>>();
private ICommandFactory _commandFactory;
private IEventFactory _eventFactory;
private ManualResetEvent _openEvent = new ManualResetEvent(false);
private ManualResetEvent _publishEvent = new ManualResetEvent(false);
private ConcurrentDictionary<long, ManualResetEventSlim> _requestWaitHandles = new ConcurrentDictionary<long, ManualResetEventSlim>();
private ICommandResponseFactory _responseFactory;
private ConcurrentDictionary<long, ICommandResponse> _responses = new ConcurrentDictionary<long, ICommandResponse>();
private WebSocket _webSocket;
private static object _Lock = new object();
public ChromeSession(string endpoint, ICommandFactory commandFactory, ICommandResponseFactory responseFactory, IEventFactory eventFactory)
{
_endpoint = endpoint;
_commandFactory = commandFactory;
_responseFactory = responseFactory;
_eventFactory = eventFactory;
}
public void Dispose()
{
if (null == _webSocket) return;
if (_webSocket.State == WebSocketState.Open)
{
_webSocket.Close();
}
_webSocket.Dispose();
}
private void EnsureInit()
{
if (null == _webSocket)
{
lock (_Lock)
{
if (null == _webSocket)
{
Init().Wait();
}
}
}
}
private Task Init()
{
_openEvent.Reset();
_webSocket = new WebSocket(_endpoint);
_webSocket.EnableAutoSendPing = false;
_webSocket.Opened += WebSocket_Opened;
_webSocket.MessageReceived += WebSocket_MessageReceived;
_webSocket.Error += WebSocket_Error;
_webSocket.Closed += WebSocket_Closed;
_webSocket.DataReceived += WebSocket_DataReceived;
_webSocket.Open();
return Task.Run(() =>
{
_openEvent.WaitOne();
});
}
public Task<ICommandResponse> SendAsync<T>(CancellationToken cancellationToken)
{
var command = _commandFactory.Create<T>();
return SendCommand(command, cancellationToken);
}
public Task<CommandResponse<T>> SendAsync<T>(ICommand<T> parameter, CancellationToken cancellationToken)
{
var command = _commandFactory.Create(parameter);
var task = SendCommand(command, cancellationToken);
return CastTaskResult<ICommandResponse, CommandResponse<T>>(task);
}
private Task<TDerived> CastTaskResult<TBase, TDerived>(Task<TBase> task) where TDerived: TBase
{
var tcs = new TaskCompletionSource<TDerived>();
task.ContinueWith(t => tcs.SetResult((TDerived)t.Result),
TaskContinuationOptions.OnlyOnRanToCompletion);
task.ContinueWith(t => tcs.SetException(t.Exception.InnerExceptions),
TaskContinuationOptions.OnlyOnFaulted);
task.ContinueWith(t => tcs.SetCanceled(),
TaskContinuationOptions.OnlyOnCanceled);
return tcs.Task;
}
public void Subscribe<T>(Action<T> handler) where T : class
{
var handlerType = typeof(T);
var handlerForBag = new Action<object>(obj => handler((T)obj));
_handlers.AddOrUpdate(handlerType.FullName,
(m) => new ConcurrentBag<Action<object>>(new [] { handlerForBag }),
(m, currentBag) =>
{
currentBag.Add(handlerForBag);
return currentBag;
});
}
private void HandleEvent(IEvent evnt)
{
if (null == evnt
|| null == evnt)
{
return;
}
var type = evnt.GetType().GetGenericArguments().FirstOrDefault();
if (null == type)
{
return;
}
var handlerKey = type.FullName;
ConcurrentBag<Action<object>> handlers = null;
if (_handlers.TryGetValue(handlerKey, out handlers))
{
var localHandlers = handlers.ToArray();
foreach (var handler in localHandlers)
{
ExecuteHandler(handler, evnt);
}
}
}
private void ExecuteHandler(Action<object> handler, dynamic evnt)
{
if (evnt.GetType().GetGenericTypeDefinition() == typeof(Event<>))
{
handler(evnt.Params);
} else
{
handler(evnt);
}
}
private void HandleResponse(ICommandResponse response)
{
if (null == response) return;
ManualResetEventSlim requestMre;
if (_requestWaitHandles.TryGetValue(response.Id, out requestMre))
{
_responses.AddOrUpdate(response.Id, id => response, (key, value) => response);
requestMre.Set();
}
else
{
// in the case of an error, we don't always get the request Id back :(
// if there is only one pending requests, we know what to do ... otherwise
if (1 == _requestWaitHandles.Count)
{
var requestId = _requestWaitHandles.Keys.First();
_requestWaitHandles.TryGetValue(requestId, out requestMre);
_responses.AddOrUpdate(requestId, id => response, (key, value) => response);
requestMre.Set();
}
}
}
private Task<ICommandResponse> SendCommand(Command command, CancellationToken cancellationToken)
{
var settings = new JsonSerializerSettings
{
ContractResolver = new MessageContractResolver(),
NullValueHandling = NullValueHandling.Ignore,
};
var requestString = JsonConvert.SerializeObject(command, settings);
var requestResetEvent = new ManualResetEventSlim(false);
_requestWaitHandles.AddOrUpdate(command.Id, requestResetEvent, (id, r) => requestResetEvent);
return Task.Run(() =>
{
EnsureInit();
_webSocket.Send(requestString);
requestResetEvent.Wait(cancellationToken);
ICommandResponse response = null;
_responses.TryRemove(command.Id, out response);
_requestWaitHandles.TryRemove(command.Id, out requestResetEvent);
return response;
});
}
private bool TryGetCommandResponse(byte[] data, out ICommandResponse response)
{
response = _responseFactory.Create(data);
return null != response;
}
private bool TryGetCommandResponse(string message, out ICommandResponse response)
{
response = _responseFactory.Create(message);
return null != response;
}
private bool TryGetEvent(byte[] data, out IEvent evnt)
{
evnt = _eventFactory.Create(data);
return null != evnt;
}
private bool TryGetEvent(string message, out IEvent evnt)
{
evnt = _eventFactory.Create(message);
return null != evnt;
}
private void WebSocket_Closed(object sender, EventArgs e)
{
}
private void WebSocket_DataReceived(object sender, DataReceivedEventArgs e)
{
ICommandResponse response;
if (TryGetCommandResponse(e.Data, out response))
{
HandleResponse(response);
return;
}
IEvent evnt;
if (TryGetEvent(e.Data, out evnt))
{
HandleEvent(evnt);
return;
}
throw new Exception("Don't know what to do with response: " + e.Data);
}
private void WebSocket_Error(object sender, SuperSocket.ClientEngine.ErrorEventArgs e)
{
throw e.Exception;
}
private void WebSocket_MessageReceived(object sender, MessageReceivedEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.Message);
ICommandResponse response;
if (TryGetCommandResponse(e.Message, out response))
{
HandleResponse(response);
return;
}
IEvent evnt;
if (TryGetEvent(e.Message, out evnt))
{
HandleEvent(evnt);
return;
}
//throw new Exception("Don't know what to do with response: " + e.Message);
}
private void WebSocket_Opened(object sender, EventArgs e)
{
_openEvent.Set();
}
}
}
#endif
| 35.676471 | 163 | 0.561727 | [
"MIT"
] | infiniteloopltd/ChromeDevTools | source/ChromeDevTools/ChromeSession.cs | 9,706 | C# |
using System;
using UnityEngine;
using System.Reflection;
namespace WorldStabilizer
{
public class HangarReconnector : GenericReconnector
{
private PartModule moduleHangar = null;
private bool collisionDetected = false;
public HangarReconnector ()
{
}
public override void OnAwake ()
{
base.OnAwake ();
if (moduleHangar != null)
return;
if (!part.Modules.Contains ("GroundAnchor"))
return;
moduleHangar = part.Modules ["GroundAnchor"];
WorldStabilizer.printDebug ("Hangar Module found for part " + part.name + " (" + moduleHangar + ")");
}
protected override void reattach() {
if (moduleHangar != null) {
if (!collisionDetected) {
WorldStabilizer.invokeAction (moduleHangar, "Attach anchor");
collisionDetected = true;
}
} else {
WorldStabilizer.printDebug ("Hangar module is null");
}
}
}
}
| 21.365854 | 104 | 0.679224 | [
"MIT"
] | whale2/WorldStabilizer | WorldStabilizer/HangarReconnector.cs | 878 | C# |
// Copyright 2021 Google LLC
//
// 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
//
// https://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.
// Generated code. DO NOT EDIT!
namespace Google.Apis.FirebaseHosting.v1beta1
{
/// <summary>The FirebaseHosting Service.</summary>
public class FirebaseHostingService : Google.Apis.Services.BaseClientService
{
/// <summary>The API version.</summary>
public const string Version = "v1beta1";
/// <summary>The discovery version used to generate this service.</summary>
public static Google.Apis.Discovery.DiscoveryVersion DiscoveryVersionUsed = Google.Apis.Discovery.DiscoveryVersion.Version_1_0;
/// <summary>Constructs a new service.</summary>
public FirebaseHostingService() : this(new Google.Apis.Services.BaseClientService.Initializer())
{
}
/// <summary>Constructs a new service.</summary>
/// <param name="initializer">The service initializer.</param>
public FirebaseHostingService(Google.Apis.Services.BaseClientService.Initializer initializer) : base(initializer)
{
Projects = new ProjectsResource(this);
Sites = new SitesResource(this);
}
/// <summary>Gets the service supported features.</summary>
public override System.Collections.Generic.IList<string> Features => new string[0];
/// <summary>Gets the service name.</summary>
public override string Name => "firebasehosting";
/// <summary>Gets the service base URI.</summary>
public override string BaseUri =>
#if NETSTANDARD1_3 || NETSTANDARD2_0 || NET45
BaseUriOverride ?? "https://firebasehosting.googleapis.com/";
#else
"https://firebasehosting.googleapis.com/";
#endif
/// <summary>Gets the service base path.</summary>
public override string BasePath => "";
#if !NET40
/// <summary>Gets the batch base URI; <c>null</c> if unspecified.</summary>
public override string BatchUri => "https://firebasehosting.googleapis.com/batch";
/// <summary>Gets the batch base path; <c>null</c> if unspecified.</summary>
public override string BatchPath => "batch";
#endif
/// <summary>Available OAuth 2.0 scopes for use with the Firebase Hosting API.</summary>
public class Scope
{
/// <summary>View and manage your data across Google Cloud Platform services</summary>
public static string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";
/// <summary>View your data across Google Cloud Platform services</summary>
public static string CloudPlatformReadOnly = "https://www.googleapis.com/auth/cloud-platform.read-only";
/// <summary>View and administer all your Firebase data and settings</summary>
public static string Firebase = "https://www.googleapis.com/auth/firebase";
/// <summary>View all your Firebase data and settings</summary>
public static string FirebaseReadonly = "https://www.googleapis.com/auth/firebase.readonly";
}
/// <summary>Available OAuth 2.0 scope constants for use with the Firebase Hosting API.</summary>
public static class ScopeConstants
{
/// <summary>View and manage your data across Google Cloud Platform services</summary>
public const string CloudPlatform = "https://www.googleapis.com/auth/cloud-platform";
/// <summary>View your data across Google Cloud Platform services</summary>
public const string CloudPlatformReadOnly = "https://www.googleapis.com/auth/cloud-platform.read-only";
/// <summary>View and administer all your Firebase data and settings</summary>
public const string Firebase = "https://www.googleapis.com/auth/firebase";
/// <summary>View all your Firebase data and settings</summary>
public const string FirebaseReadonly = "https://www.googleapis.com/auth/firebase.readonly";
}
/// <summary>Gets the Projects resource.</summary>
public virtual ProjectsResource Projects { get; }
/// <summary>Gets the Sites resource.</summary>
public virtual SitesResource Sites { get; }
}
/// <summary>A base abstract class for FirebaseHosting requests.</summary>
public abstract class FirebaseHostingBaseServiceRequest<TResponse> : Google.Apis.Requests.ClientServiceRequest<TResponse>
{
/// <summary>Constructs a new FirebaseHostingBaseServiceRequest instance.</summary>
protected FirebaseHostingBaseServiceRequest(Google.Apis.Services.IClientService service) : base(service)
{
}
/// <summary>V1 error format.</summary>
[Google.Apis.Util.RequestParameterAttribute("$.xgafv", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<XgafvEnum> Xgafv { get; set; }
/// <summary>V1 error format.</summary>
public enum XgafvEnum
{
/// <summary>v1 error format</summary>
[Google.Apis.Util.StringValueAttribute("1")]
Value1,
/// <summary>v2 error format</summary>
[Google.Apis.Util.StringValueAttribute("2")]
Value2,
}
/// <summary>OAuth access token.</summary>
[Google.Apis.Util.RequestParameterAttribute("access_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string AccessToken { get; set; }
/// <summary>Data format for response.</summary>
[Google.Apis.Util.RequestParameterAttribute("alt", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<AltEnum> Alt { get; set; }
/// <summary>Data format for response.</summary>
public enum AltEnum
{
/// <summary>Responses with Content-Type of application/json</summary>
[Google.Apis.Util.StringValueAttribute("json")]
Json,
/// <summary>Media download with context-dependent Content-Type</summary>
[Google.Apis.Util.StringValueAttribute("media")]
Media,
/// <summary>Responses with Content-Type of application/x-protobuf</summary>
[Google.Apis.Util.StringValueAttribute("proto")]
Proto,
}
/// <summary>JSONP</summary>
[Google.Apis.Util.RequestParameterAttribute("callback", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Callback { get; set; }
/// <summary>Selector specifying which fields to include in a partial response.</summary>
[Google.Apis.Util.RequestParameterAttribute("fields", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Fields { get; set; }
/// <summary>
/// API key. Your API key identifies your project and provides you with API access, quota, and reports. Required
/// unless you provide an OAuth 2.0 token.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("key", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Key { get; set; }
/// <summary>OAuth 2.0 token for the current user.</summary>
[Google.Apis.Util.RequestParameterAttribute("oauth_token", Google.Apis.Util.RequestParameterType.Query)]
public virtual string OauthToken { get; set; }
/// <summary>Returns response with indentations and line breaks.</summary>
[Google.Apis.Util.RequestParameterAttribute("prettyPrint", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<bool> PrettyPrint { get; set; }
/// <summary>
/// Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a
/// user, but should not exceed 40 characters.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("quotaUser", Google.Apis.Util.RequestParameterType.Query)]
public virtual string QuotaUser { get; set; }
/// <summary>Legacy upload protocol for media (e.g. "media", "multipart").</summary>
[Google.Apis.Util.RequestParameterAttribute("uploadType", Google.Apis.Util.RequestParameterType.Query)]
public virtual string UploadType { get; set; }
/// <summary>Upload protocol for media (e.g. "raw", "multipart").</summary>
[Google.Apis.Util.RequestParameterAttribute("upload_protocol", Google.Apis.Util.RequestParameterType.Query)]
public virtual string UploadProtocol { get; set; }
/// <summary>Initializes FirebaseHosting parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("$.xgafv", new Google.Apis.Discovery.Parameter
{
Name = "$.xgafv",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("access_token", new Google.Apis.Discovery.Parameter
{
Name = "access_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("alt", new Google.Apis.Discovery.Parameter
{
Name = "alt",
IsRequired = false,
ParameterType = "query",
DefaultValue = "json",
Pattern = null,
});
RequestParameters.Add("callback", new Google.Apis.Discovery.Parameter
{
Name = "callback",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("fields", new Google.Apis.Discovery.Parameter
{
Name = "fields",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("key", new Google.Apis.Discovery.Parameter
{
Name = "key",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("oauth_token", new Google.Apis.Discovery.Parameter
{
Name = "oauth_token",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("prettyPrint", new Google.Apis.Discovery.Parameter
{
Name = "prettyPrint",
IsRequired = false,
ParameterType = "query",
DefaultValue = "true",
Pattern = null,
});
RequestParameters.Add("quotaUser", new Google.Apis.Discovery.Parameter
{
Name = "quotaUser",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("uploadType", new Google.Apis.Discovery.Parameter
{
Name = "uploadType",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("upload_protocol", new Google.Apis.Discovery.Parameter
{
Name = "upload_protocol",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>The "projects" collection of methods.</summary>
public class ProjectsResource
{
private const string Resource = "projects";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ProjectsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Operations = new OperationsResource(service);
Sites = new SitesResource(service);
}
/// <summary>Gets the Operations resource.</summary>
public virtual OperationsResource Operations { get; }
/// <summary>The "operations" collection of methods.</summary>
public class OperationsResource
{
private const string Resource = "operations";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public OperationsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation
/// result at intervals as recommended by the API service.
/// </summary>
/// <param name="name">The name of the operation resource.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>
/// Gets the latest state of a long-running operation. Clients can use this method to poll the operation
/// result at intervals as recommended by the API service.
/// </summary>
public class GetRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Operation>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>The name of the operation resource.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/operations/[^/]+$",
});
}
}
}
/// <summary>Gets the Sites resource.</summary>
public virtual SitesResource Sites { get; }
/// <summary>The "sites" collection of methods.</summary>
public class SitesResource
{
private const string Resource = "sites";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public SitesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Channels = new ChannelsResource(service);
Domains = new DomainsResource(service);
Releases = new ReleasesResource(service);
Versions = new VersionsResource(service);
}
/// <summary>Gets the Channels resource.</summary>
public virtual ChannelsResource Channels { get; }
/// <summary>The "channels" collection of methods.</summary>
public class ChannelsResource
{
private const string Resource = "channels";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ChannelsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Releases = new ReleasesResource(service);
}
/// <summary>Gets the Releases resource.</summary>
public virtual ReleasesResource Releases { get; }
/// <summary>The "releases" collection of methods.</summary>
public class ReleasesResource
{
private const string Resource = "releases";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ReleasesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Release>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The unique identifier for a version, in the format: /sites/site-name /versions/versionID The
/// site-name in this version identifier must match the site-name in the `parent` parameter.
/// This query parameter must be empty if the `type` field in the request body is
/// `SITE_DISABLE`.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("versionName", Google.Apis.Util.RequestParameterType.Query)]
public virtual string VersionName { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Release Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/channels/[^/]+$",
});
RequestParameters.Add("versionName", new Google.Apis.Discovery.Parameter
{
Name = "versionName",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
/// <param name="parent">
/// Required. The parent for which to list files, in the format: sites/site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListReleasesResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>
/// Required. The parent for which to list files, in the format: sites/site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 100.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/channels/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Creates a new channel in the specified site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">Required. The site in which this channel should be created.</param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>Creates a new channel in the specified site.</summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Channel>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>Required. The site in which this channel should be created.</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Required. Immutable. A unique id within the site to identify the channel.</summary>
[Google.Apis.Util.RequestParameterAttribute("channelId", Google.Apis.Util.RequestParameterType.Query)]
public virtual string ChannelId { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Channel Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/channels";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("channelId", new Google.Apis.Discovery.Parameter
{
Name = "channelId",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Deletes a channel of a site. The `live` channel cannot be deleted.</summary>
/// <param name="name">Required. The fully-qualified identifier for the site.</param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes a channel of a site. The `live` channel cannot be deleted.</summary>
public class DeleteRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The fully-qualified identifier for the site.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/channels/[^/]+$",
});
}
}
/// <summary>Retrieves information for the specified channel of a site.</summary>
/// <param name="name">Required. The fully-qualified identifier for the channel.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>Retrieves information for the specified channel of a site.</summary>
public class GetRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Channel>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The fully-qualified identifier for the channel.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/channels/[^/]+$",
});
}
}
/// <summary>
/// Lists the channels for the specified site. All sites have a default "live" channel.
/// </summary>
/// <param name="parent">Required. The site from which to list channels.</param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>
/// Lists the channels for the specified site. All sites have a default "live" channel.
/// </summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListChannelsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The site from which to list channels.</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The maximum number of versions to return. The service may return fewer than this value. If
/// unspecified, at most 25 channels will be returned. The maximum value is 100; valuupdateses above
/// 100 will be coerced to 100
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/channels";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>
/// Updates information for the specified channel of a site. This method will implicitly create a
/// channel if it doesn't exist.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">The fully-qualified identifier of the Channel.</param>
public virtual PatchRequest Patch(Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string name)
{
return new PatchRequest(service, body, name);
}
/// <summary>
/// Updates information for the specified channel of a site. This method will implicitly create a
/// channel if it doesn't exist.
/// </summary>
public class PatchRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Channel>
{
/// <summary>Constructs a new Patch request.</summary>
public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>The fully-qualified identifier of the Channel.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>A comma-separated list of fields to be updated in this request.</summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Channel Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "patch";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Patch parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/channels/[^/]+$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Gets the Domains resource.</summary>
public virtual DomainsResource Domains { get; }
/// <summary>The "domains" collection of methods.</summary>
public class DomainsResource
{
private const string Resource = "domains";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public DomainsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Creates a domain mapping on the specified site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The parent to create the domain association for, in the format: sites/site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>Creates a domain mapping on the specified site.</summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Domain>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The parent to create the domain association for, in the format: sites/site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Domain Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/domains";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
}
}
/// <summary>Deletes the existing domain mapping on the specified site.</summary>
/// <param name="name">Required. The name of the domain association to delete.</param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes the existing domain mapping on the specified site.</summary>
public class DeleteRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The name of the domain association to delete.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/domains/[^/]+$",
});
}
}
/// <summary>Gets a domain mapping on the specified site.</summary>
/// <param name="name">Required. The name of the domain configuration to get.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>Gets a domain mapping on the specified site.</summary>
public class GetRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Domain>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The name of the domain configuration to get.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/domains/[^/]+$",
});
}
}
/// <summary>Lists the domains for the specified site.</summary>
/// <param name="parent">
/// Required. The parent for which to list domains, in the format: sites/ site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the domains for the specified site.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListDomainsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>
/// Required. The parent for which to list domains, in the format: sites/ site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 50.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/domains";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>
/// Updates the specified domain mapping, creating the mapping as if it does not exist.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// Required. The name of the domain association to update or create, if an association doesn't already
/// exist.
/// </param>
public virtual UpdateRequest Update(Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string name)
{
return new UpdateRequest(service, body, name);
}
/// <summary>
/// Updates the specified domain mapping, creating the mapping as if it does not exist.
/// </summary>
public class UpdateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Domain>
{
/// <summary>Constructs a new Update request.</summary>
public UpdateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The name of the domain association to update or create, if an association doesn't
/// already exist.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Domain Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "update";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PUT";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Update parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/domains/[^/]+$",
});
}
}
}
/// <summary>Gets the Releases resource.</summary>
public virtual ReleasesResource Releases { get; }
/// <summary>The "releases" collection of methods.</summary>
public class ReleasesResource
{
private const string Resource = "releases";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ReleasesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Release>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The unique identifier for a version, in the format: /sites/site-name /versions/versionID The
/// site-name in this version identifier must match the site-name in the `parent` parameter. This
/// query parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("versionName", Google.Apis.Util.RequestParameterType.Query)]
public virtual string VersionName { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Release Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("versionName", new Google.Apis.Discovery.Parameter
{
Name = "versionName",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
/// <param name="parent">
/// Required. The parent for which to list files, in the format: sites/site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListReleasesResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The parent for which to list files, in the format: sites/site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 100.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Gets the Versions resource.</summary>
public virtual VersionsResource Versions { get; }
/// <summary>The "versions" collection of methods.</summary>
public class VersionsResource
{
private const string Resource = "versions";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public VersionsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Files = new FilesResource(service);
}
/// <summary>Gets the Files resource.</summary>
public virtual FilesResource Files { get; }
/// <summary>The "files" collection of methods.</summary>
public class FilesResource
{
private const string Resource = "files";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public FilesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Lists the remaining files to be uploaded for the specified version.</summary>
/// <param name="parent">
/// Required. The parent to list files for, in the format: sites/site-name /versions/versionID
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the remaining files to be uploaded for the specified version.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListVersionFilesResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>
/// Required. The parent to list files for, in the format: sites/site-name /versions/versionID
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 1000.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>
/// The next_page_token from a previous request, if provided. This will be the encoded version
/// of a firebase.hosting.proto.metadata.ListFilesPageToken.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>The type of files in the version that should be listed.</summary>
[Google.Apis.Util.RequestParameterAttribute("status", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<StatusEnum> Status { get; set; }
/// <summary>The type of files in the version that should be listed.</summary>
public enum StatusEnum
{
/// <summary>The default status; should not be intentionally used.</summary>
[Google.Apis.Util.StringValueAttribute("STATUS_UNSPECIFIED")]
STATUSUNSPECIFIED,
/// <summary>
/// The file has been included in the version and is expected to be uploaded in the near
/// future.
/// </summary>
[Google.Apis.Util.StringValueAttribute("EXPECTED")]
EXPECTED,
/// <summary>The file has already been uploaded to Firebase Hosting.</summary>
[Google.Apis.Util.StringValueAttribute("ACTIVE")]
ACTIVE,
}
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/files";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/versions/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("status", new Google.Apis.Discovery.Parameter
{
Name = "status",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>
/// Creates a new version on the target site using the content of the specified version.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The target site where the cloned version will reside, in the format: `sites/{site}`
/// </param>
public virtual CloneRequest Clone(Google.Apis.FirebaseHosting.v1beta1.Data.CloneVersionRequest body, string parent)
{
return new CloneRequest(service, body, parent);
}
/// <summary>
/// Creates a new version on the target site using the content of the specified version.
/// </summary>
public class CloneRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Operation>
{
/// <summary>Constructs a new Clone request.</summary>
public CloneRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.CloneVersionRequest body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The target site where the cloned version will reside, in the format: `sites/{site}`
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.CloneVersionRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "clone";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/versions:clone";
/// <summary>Initializes Clone parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
}
}
/// <summary>Creates a new version for a site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The parent to create the version for, in the format: sites/ site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>Creates a new version for a site.</summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Version>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The parent to create the version for, in the format: sites/ site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The self-reported size of the version. This value is used for a pre-emptive quota check for
/// legacy version uploads.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("sizeBytes", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<long> SizeBytes { get; set; }
/// <summary>
/// A unique id for the new version. This is was only specified for legacy version creations, and
/// should be blank.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("versionId", Google.Apis.Util.RequestParameterType.Query)]
public virtual string VersionId { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Version Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/versions";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("sizeBytes", new Google.Apis.Discovery.Parameter
{
Name = "sizeBytes",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("versionId", new Google.Apis.Discovery.Parameter
{
Name = "versionId",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Deletes the specified version.</summary>
/// <param name="name">
/// Required. The name of the version to be deleted, in the format: sites/ site-name/versions/versionID
/// </param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes the specified version.</summary>
public class DeleteRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>
/// Required. The name of the version to be deleted, in the format: sites/
/// site-name/versions/versionID
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/versions/[^/]+$",
});
}
}
/// <summary>
/// Lists the versions that have been created on the specified site. Will include filtering in the
/// future.
/// </summary>
/// <param name="parent">
/// Required. The parent for which to list files, in the format: sites/site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>
/// Lists the versions that have been created on the specified site. Will include filtering in the
/// future.
/// </summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListVersionsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The parent for which to list files, in the format: sites/site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The filter string used to return a subset of versions in the response. Currently supported
/// fields for filtering are: name, status, and create_time. Filter processing will be implemented
/// in accordance with go/filtering.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("filter", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Filter { get; set; }
/// <summary>
/// The maximum number of versions to return. The service may return fewer than this value. If
/// unspecified, at most 25 versions will be returned. The maximum value is 100; values above 100
/// will be coerced to 100
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/versions";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+$",
});
RequestParameters.Add("filter", new Google.Apis.Discovery.Parameter
{
Name = "filter",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>
/// Updates the specified metadata for a version. Note that this method will fail with
/// `FAILED_PRECONDITION` in the event of an invalid state transition. The only valid transition for a
/// version is currently from a `CREATED` status to a `FINALIZED` status. Use
/// [`DeleteVersion`](../sites.versions/delete) to set the status of a version to `DELETED`.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// The unique identifier for a version, in the format: sites/site-name /versions/versionID This name is
/// provided in the response body when you call the [`CreateVersion`](../sites.versions/create)
/// endpoint.
/// </param>
public virtual PatchRequest Patch(Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string name)
{
return new PatchRequest(service, body, name);
}
/// <summary>
/// Updates the specified metadata for a version. Note that this method will fail with
/// `FAILED_PRECONDITION` in the event of an invalid state transition. The only valid transition for a
/// version is currently from a `CREATED` status to a `FINALIZED` status. Use
/// [`DeleteVersion`](../sites.versions/delete) to set the status of a version to `DELETED`.
/// </summary>
public class PatchRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Version>
{
/// <summary>Constructs a new Patch request.</summary>
public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// The unique identifier for a version, in the format: sites/site-name /versions/versionID This
/// name is provided in the response body when you call the
/// [`CreateVersion`](../sites.versions/create) endpoint.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>
/// A set of field names from your [version](../sites.versions) that you want to update. A field
/// will be overwritten if, and only if, it's in the mask. If a mask is not provided then a default
/// mask of only [`status`](../sites.versions#Version.FIELDS.status) will be used.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Version Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "patch";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Patch parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/versions/[^/]+$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Adds content files to a version. Each file must be under 2 GB.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The version to add files to, in the format: sites/site-name /versions/versionID
/// </param>
public virtual PopulateFilesRequest PopulateFiles(Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesRequest body, string parent)
{
return new PopulateFilesRequest(service, body, parent);
}
/// <summary>Adds content files to a version. Each file must be under 2 GB.</summary>
public class PopulateFilesRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesResponse>
{
/// <summary>Constructs a new PopulateFiles request.</summary>
public PopulateFilesRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesRequest body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The version to add files to, in the format: sites/site-name /versions/versionID
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "populateFiles";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}:populateFiles";
/// <summary>Initializes PopulateFiles parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/versions/[^/]+$",
});
}
}
}
/// <summary>Gets the Hosting metadata for a specific site.</summary>
/// <param name="name">
/// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
/// </param>
public virtual GetConfigRequest GetConfig(string name)
{
return new GetConfigRequest(service, name);
}
/// <summary>Gets the Hosting metadata for a specific site.</summary>
public class GetConfigRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig>
{
/// <summary>Constructs a new GetConfig request.</summary>
public GetConfigRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>
/// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "getConfig";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes GetConfig parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/config$",
});
}
}
/// <summary>Sets the Hosting metadata for a specific site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
/// </param>
public virtual UpdateConfigRequest UpdateConfig(Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig body, string name)
{
return new UpdateConfigRequest(service, body, name);
}
/// <summary>Sets the Hosting metadata for a specific site.</summary>
public class UpdateConfigRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig>
{
/// <summary>Constructs a new UpdateConfig request.</summary>
public UpdateConfigRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>
/// A set of field names from your [site configuration](../sites.SiteConfig) that you want to update. A
/// field will be overwritten if, and only if, it's in the mask. If a mask is not provided then a
/// default mask of only [`max_versions`](../sites.SiteConfig.max_versions) will be used.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "updateConfig";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes UpdateConfig parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^projects/[^/]+/sites/[^/]+/config$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
}
/// <summary>The "sites" collection of methods.</summary>
public class SitesResource
{
private const string Resource = "sites";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public SitesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Channels = new ChannelsResource(service);
Domains = new DomainsResource(service);
Releases = new ReleasesResource(service);
Versions = new VersionsResource(service);
}
/// <summary>Gets the Channels resource.</summary>
public virtual ChannelsResource Channels { get; }
/// <summary>The "channels" collection of methods.</summary>
public class ChannelsResource
{
private const string Resource = "channels";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ChannelsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Releases = new ReleasesResource(service);
}
/// <summary>Gets the Releases resource.</summary>
public virtual ReleasesResource Releases { get; }
/// <summary>The "releases" collection of methods.</summary>
public class ReleasesResource
{
private const string Resource = "releases";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ReleasesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Release>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The unique identifier for a version, in the format: /sites/site-name /versions/versionID The
/// site-name in this version identifier must match the site-name in the `parent` parameter. This
/// query parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("versionName", Google.Apis.Util.RequestParameterType.Query)]
public virtual string VersionName { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Release Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/channels/[^/]+$",
});
RequestParameters.Add("versionName", new Google.Apis.Discovery.Parameter
{
Name = "versionName",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
/// <param name="parent">
/// Required. The parent for which to list files, in the format: sites/site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListReleasesResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The parent for which to list files, in the format: sites/site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 100.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/channels/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Creates a new channel in the specified site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">Required. The site in which this channel should be created.</param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>Creates a new channel in the specified site.</summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Channel>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>Required. The site in which this channel should be created.</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Required. Immutable. A unique id within the site to identify the channel.</summary>
[Google.Apis.Util.RequestParameterAttribute("channelId", Google.Apis.Util.RequestParameterType.Query)]
public virtual string ChannelId { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Channel Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/channels";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("channelId", new Google.Apis.Discovery.Parameter
{
Name = "channelId",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Deletes a channel of a site. The `live` channel cannot be deleted.</summary>
/// <param name="name">Required. The fully-qualified identifier for the site.</param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes a channel of a site. The `live` channel cannot be deleted.</summary>
public class DeleteRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The fully-qualified identifier for the site.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/channels/[^/]+$",
});
}
}
/// <summary>Retrieves information for the specified channel of a site.</summary>
/// <param name="name">Required. The fully-qualified identifier for the channel.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>Retrieves information for the specified channel of a site.</summary>
public class GetRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Channel>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The fully-qualified identifier for the channel.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/channels/[^/]+$",
});
}
}
/// <summary>Lists the channels for the specified site. All sites have a default "live" channel.</summary>
/// <param name="parent">Required. The site from which to list channels.</param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the channels for the specified site. All sites have a default "live" channel.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListChannelsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The site from which to list channels.</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The maximum number of versions to return. The service may return fewer than this value. If
/// unspecified, at most 25 channels will be returned. The maximum value is 100; valuupdateses above 100
/// will be coerced to 100
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/channels";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>
/// Updates information for the specified channel of a site. This method will implicitly create a channel if
/// it doesn't exist.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">The fully-qualified identifier of the Channel.</param>
public virtual PatchRequest Patch(Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string name)
{
return new PatchRequest(service, body, name);
}
/// <summary>
/// Updates information for the specified channel of a site. This method will implicitly create a channel if
/// it doesn't exist.
/// </summary>
public class PatchRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Channel>
{
/// <summary>Constructs a new Patch request.</summary>
public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Channel body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>The fully-qualified identifier of the Channel.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>A comma-separated list of fields to be updated in this request.</summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Channel Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "patch";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Patch parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/channels/[^/]+$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Gets the Domains resource.</summary>
public virtual DomainsResource Domains { get; }
/// <summary>The "domains" collection of methods.</summary>
public class DomainsResource
{
private const string Resource = "domains";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public DomainsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Creates a domain mapping on the specified site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The parent to create the domain association for, in the format: sites/site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>Creates a domain mapping on the specified site.</summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Domain>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The parent to create the domain association for, in the format: sites/site-name
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Domain Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/domains";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
}
}
/// <summary>Deletes the existing domain mapping on the specified site.</summary>
/// <param name="name">Required. The name of the domain association to delete.</param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes the existing domain mapping on the specified site.</summary>
public class DeleteRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The name of the domain association to delete.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/domains/[^/]+$",
});
}
}
/// <summary>Gets a domain mapping on the specified site.</summary>
/// <param name="name">Required. The name of the domain configuration to get.</param>
public virtual GetRequest Get(string name)
{
return new GetRequest(service, name);
}
/// <summary>Gets a domain mapping on the specified site.</summary>
public class GetRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Domain>
{
/// <summary>Constructs a new Get request.</summary>
public GetRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>Required. The name of the domain configuration to get.</summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "get";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Get parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/domains/[^/]+$",
});
}
}
/// <summary>Lists the domains for the specified site.</summary>
/// <param name="parent">
/// Required. The parent for which to list domains, in the format: sites/ site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the domains for the specified site.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListDomainsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The parent for which to list domains, in the format: sites/ site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 50.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/domains";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Updates the specified domain mapping, creating the mapping as if it does not exist.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// Required. The name of the domain association to update or create, if an association doesn't already
/// exist.
/// </param>
public virtual UpdateRequest Update(Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string name)
{
return new UpdateRequest(service, body, name);
}
/// <summary>Updates the specified domain mapping, creating the mapping as if it does not exist.</summary>
public class UpdateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Domain>
{
/// <summary>Constructs a new Update request.</summary>
public UpdateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Domain body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The name of the domain association to update or create, if an association doesn't already
/// exist.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Domain Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "update";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PUT";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Update parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/domains/[^/]+$",
});
}
}
}
/// <summary>Gets the Releases resource.</summary>
public virtual ReleasesResource Releases { get; }
/// <summary>The "releases" collection of methods.</summary>
public class ReleasesResource
{
private const string Resource = "releases";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public ReleasesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The site that the release belongs to, in the format: sites/ site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>
/// Creates a new release which makes the content of the specified version actively display on the
/// appropriate URL(s).
/// </summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Release>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Release body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>Required. The site that the release belongs to, in the format: sites/ site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The unique identifier for a version, in the format: /sites/site-name /versions/versionID The
/// site-name in this version identifier must match the site-name in the `parent` parameter. This query
/// parameter must be empty if the `type` field in the request body is `SITE_DISABLE`.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("versionName", Google.Apis.Util.RequestParameterType.Query)]
public virtual string VersionName { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Release Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("versionName", new Google.Apis.Discovery.Parameter
{
Name = "versionName",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
/// <param name="parent">
/// Required. The parent for which to list files, in the format: sites/site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the releases that have been created on the specified site.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListReleasesResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The parent for which to list files, in the format: sites/site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 100.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/releases";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Gets the Versions resource.</summary>
public virtual VersionsResource Versions { get; }
/// <summary>The "versions" collection of methods.</summary>
public class VersionsResource
{
private const string Resource = "versions";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public VersionsResource(Google.Apis.Services.IClientService service)
{
this.service = service;
Files = new FilesResource(service);
}
/// <summary>Gets the Files resource.</summary>
public virtual FilesResource Files { get; }
/// <summary>The "files" collection of methods.</summary>
public class FilesResource
{
private const string Resource = "files";
/// <summary>The service which this resource belongs to.</summary>
private readonly Google.Apis.Services.IClientService service;
/// <summary>Constructs a new resource.</summary>
public FilesResource(Google.Apis.Services.IClientService service)
{
this.service = service;
}
/// <summary>Lists the remaining files to be uploaded for the specified version.</summary>
/// <param name="parent">
/// Required. The parent to list files for, in the format: sites/site-name /versions/versionID
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>Lists the remaining files to be uploaded for the specified version.</summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListVersionFilesResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>
/// Required. The parent to list files for, in the format: sites/site-name /versions/versionID
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>The page size to return. Defaults to 1000.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>
/// The next_page_token from a previous request, if provided. This will be the encoded version of a
/// firebase.hosting.proto.metadata.ListFilesPageToken.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>The type of files in the version that should be listed.</summary>
[Google.Apis.Util.RequestParameterAttribute("status", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<StatusEnum> Status { get; set; }
/// <summary>The type of files in the version that should be listed.</summary>
public enum StatusEnum
{
/// <summary>The default status; should not be intentionally used.</summary>
[Google.Apis.Util.StringValueAttribute("STATUS_UNSPECIFIED")]
STATUSUNSPECIFIED,
/// <summary>
/// The file has been included in the version and is expected to be uploaded in the near future.
/// </summary>
[Google.Apis.Util.StringValueAttribute("EXPECTED")]
EXPECTED,
/// <summary>The file has already been uploaded to Firebase Hosting.</summary>
[Google.Apis.Util.StringValueAttribute("ACTIVE")]
ACTIVE,
}
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/files";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/versions/[^/]+$",
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("status", new Google.Apis.Discovery.Parameter
{
Name = "status",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
/// <summary>Creates a new version on the target site using the content of the specified version.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The target site where the cloned version will reside, in the format: `sites/{site}`
/// </param>
public virtual CloneRequest Clone(Google.Apis.FirebaseHosting.v1beta1.Data.CloneVersionRequest body, string parent)
{
return new CloneRequest(service, body, parent);
}
/// <summary>Creates a new version on the target site using the content of the specified version.</summary>
public class CloneRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Operation>
{
/// <summary>Constructs a new Clone request.</summary>
public CloneRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.CloneVersionRequest body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The target site where the cloned version will reside, in the format: `sites/{site}`
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.CloneVersionRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "clone";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/versions:clone";
/// <summary>Initializes Clone parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
}
}
/// <summary>Creates a new version for a site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The parent to create the version for, in the format: sites/ site-name
/// </param>
public virtual CreateRequest Create(Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string parent)
{
return new CreateRequest(service, body, parent);
}
/// <summary>Creates a new version for a site.</summary>
public class CreateRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Version>
{
/// <summary>Constructs a new Create request.</summary>
public CreateRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>Required. The parent to create the version for, in the format: sites/ site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The self-reported size of the version. This value is used for a pre-emptive quota check for legacy
/// version uploads.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("sizeBytes", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<long> SizeBytes { get; set; }
/// <summary>
/// A unique id for the new version. This is was only specified for legacy version creations, and should
/// be blank.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("versionId", Google.Apis.Util.RequestParameterType.Query)]
public virtual string VersionId { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Version Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "create";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/versions";
/// <summary>Initializes Create parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("sizeBytes", new Google.Apis.Discovery.Parameter
{
Name = "sizeBytes",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("versionId", new Google.Apis.Discovery.Parameter
{
Name = "versionId",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Deletes the specified version.</summary>
/// <param name="name">
/// Required. The name of the version to be deleted, in the format: sites/ site-name/versions/versionID
/// </param>
public virtual DeleteRequest Delete(string name)
{
return new DeleteRequest(service, name);
}
/// <summary>Deletes the specified version.</summary>
public class DeleteRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Empty>
{
/// <summary>Constructs a new Delete request.</summary>
public DeleteRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>
/// Required. The name of the version to be deleted, in the format: sites/ site-name/versions/versionID
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "delete";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "DELETE";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Delete parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/versions/[^/]+$",
});
}
}
/// <summary>
/// Lists the versions that have been created on the specified site. Will include filtering in the future.
/// </summary>
/// <param name="parent">
/// Required. The parent for which to list files, in the format: sites/site-name
/// </param>
public virtual ListRequest List(string parent)
{
return new ListRequest(service, parent);
}
/// <summary>
/// Lists the versions that have been created on the specified site. Will include filtering in the future.
/// </summary>
public class ListRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.ListVersionsResponse>
{
/// <summary>Constructs a new List request.</summary>
public ListRequest(Google.Apis.Services.IClientService service, string parent) : base(service)
{
Parent = parent;
InitParameters();
}
/// <summary>Required. The parent for which to list files, in the format: sites/site-name</summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>
/// The filter string used to return a subset of versions in the response. Currently supported fields
/// for filtering are: name, status, and create_time. Filter processing will be implemented in
/// accordance with go/filtering.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("filter", Google.Apis.Util.RequestParameterType.Query)]
public virtual string Filter { get; set; }
/// <summary>
/// The maximum number of versions to return. The service may return fewer than this value. If
/// unspecified, at most 25 versions will be returned. The maximum value is 100; values above 100 will
/// be coerced to 100
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("pageSize", Google.Apis.Util.RequestParameterType.Query)]
public virtual System.Nullable<int> PageSize { get; set; }
/// <summary>The next_page_token from a previous request, if provided.</summary>
[Google.Apis.Util.RequestParameterAttribute("pageToken", Google.Apis.Util.RequestParameterType.Query)]
public virtual string PageToken { get; set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "list";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}/versions";
/// <summary>Initializes List parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+$",
});
RequestParameters.Add("filter", new Google.Apis.Discovery.Parameter
{
Name = "filter",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageSize", new Google.Apis.Discovery.Parameter
{
Name = "pageSize",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
RequestParameters.Add("pageToken", new Google.Apis.Discovery.Parameter
{
Name = "pageToken",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>
/// Updates the specified metadata for a version. Note that this method will fail with `FAILED_PRECONDITION`
/// in the event of an invalid state transition. The only valid transition for a version is currently from a
/// `CREATED` status to a `FINALIZED` status. Use [`DeleteVersion`](../sites.versions/delete) to set the
/// status of a version to `DELETED`.
/// </summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// The unique identifier for a version, in the format: sites/site-name /versions/versionID This name is
/// provided in the response body when you call the [`CreateVersion`](../sites.versions/create) endpoint.
/// </param>
public virtual PatchRequest Patch(Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string name)
{
return new PatchRequest(service, body, name);
}
/// <summary>
/// Updates the specified metadata for a version. Note that this method will fail with `FAILED_PRECONDITION`
/// in the event of an invalid state transition. The only valid transition for a version is currently from a
/// `CREATED` status to a `FINALIZED` status. Use [`DeleteVersion`](../sites.versions/delete) to set the
/// status of a version to `DELETED`.
/// </summary>
public class PatchRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.Version>
{
/// <summary>Constructs a new Patch request.</summary>
public PatchRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.Version body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// The unique identifier for a version, in the format: sites/site-name /versions/versionID This name is
/// provided in the response body when you call the [`CreateVersion`](../sites.versions/create)
/// endpoint.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>
/// A set of field names from your [version](../sites.versions) that you want to update. A field will be
/// overwritten if, and only if, it's in the mask. If a mask is not provided then a default mask of only
/// [`status`](../sites.versions#Version.FIELDS.status) will be used.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.Version Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "patch";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes Patch parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/versions/[^/]+$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
/// <summary>Adds content files to a version. Each file must be under 2 GB.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="parent">
/// Required. The version to add files to, in the format: sites/site-name /versions/versionID
/// </param>
public virtual PopulateFilesRequest PopulateFiles(Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesRequest body, string parent)
{
return new PopulateFilesRequest(service, body, parent);
}
/// <summary>Adds content files to a version. Each file must be under 2 GB.</summary>
public class PopulateFilesRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesResponse>
{
/// <summary>Constructs a new PopulateFiles request.</summary>
public PopulateFilesRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesRequest body, string parent) : base(service)
{
Parent = parent;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The version to add files to, in the format: sites/site-name /versions/versionID
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("parent", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Parent { get; private set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.PopulateVersionFilesRequest Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "populateFiles";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "POST";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+parent}:populateFiles";
/// <summary>Initializes PopulateFiles parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("parent", new Google.Apis.Discovery.Parameter
{
Name = "parent",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/versions/[^/]+$",
});
}
}
}
/// <summary>Gets the Hosting metadata for a specific site.</summary>
/// <param name="name">
/// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
/// </param>
public virtual GetConfigRequest GetConfig(string name)
{
return new GetConfigRequest(service, name);
}
/// <summary>Gets the Hosting metadata for a specific site.</summary>
public class GetConfigRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig>
{
/// <summary>Constructs a new GetConfig request.</summary>
public GetConfigRequest(Google.Apis.Services.IClientService service, string name) : base(service)
{
Name = name;
InitParameters();
}
/// <summary>
/// Required. The site for which to get the SiteConfig, in the format: sites/ site-name/config
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>Gets the method name.</summary>
public override string MethodName => "getConfig";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "GET";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes GetConfig parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/config$",
});
}
}
/// <summary>Sets the Hosting metadata for a specific site.</summary>
/// <param name="body">The body of the request.</param>
/// <param name="name">
/// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
/// </param>
public virtual UpdateConfigRequest UpdateConfig(Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig body, string name)
{
return new UpdateConfigRequest(service, body, name);
}
/// <summary>Sets the Hosting metadata for a specific site.</summary>
public class UpdateConfigRequest : FirebaseHostingBaseServiceRequest<Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig>
{
/// <summary>Constructs a new UpdateConfig request.</summary>
public UpdateConfigRequest(Google.Apis.Services.IClientService service, Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig body, string name) : base(service)
{
Name = name;
Body = body;
InitParameters();
}
/// <summary>
/// Required. The site for which to update the SiteConfig, in the format: sites/ site-name/config
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("name", Google.Apis.Util.RequestParameterType.Path)]
public virtual string Name { get; private set; }
/// <summary>
/// A set of field names from your [site configuration](../sites.SiteConfig) that you want to update. A
/// field will be overwritten if, and only if, it's in the mask. If a mask is not provided then a default
/// mask of only [`max_versions`](../sites.SiteConfig.max_versions) will be used.
/// </summary>
[Google.Apis.Util.RequestParameterAttribute("updateMask", Google.Apis.Util.RequestParameterType.Query)]
public virtual object UpdateMask { get; set; }
/// <summary>Gets or sets the body of this request.</summary>
Google.Apis.FirebaseHosting.v1beta1.Data.SiteConfig Body { get; set; }
/// <summary>Returns the body of the request.</summary>
protected override object GetBody() => Body;
/// <summary>Gets the method name.</summary>
public override string MethodName => "updateConfig";
/// <summary>Gets the HTTP method.</summary>
public override string HttpMethod => "PATCH";
/// <summary>Gets the REST path.</summary>
public override string RestPath => "v1beta1/{+name}";
/// <summary>Initializes UpdateConfig parameter list.</summary>
protected override void InitParameters()
{
base.InitParameters();
RequestParameters.Add("name", new Google.Apis.Discovery.Parameter
{
Name = "name",
IsRequired = true,
ParameterType = "path",
DefaultValue = null,
Pattern = @"^sites/[^/]+/config$",
});
RequestParameters.Add("updateMask", new Google.Apis.Discovery.Parameter
{
Name = "updateMask",
IsRequired = false,
ParameterType = "query",
DefaultValue = null,
Pattern = null,
});
}
}
}
}
namespace Google.Apis.FirebaseHosting.v1beta1.Data
{
/// <summary>
/// Contains metadata about the user who performed an action, such as creating a release or finalizing a version.
/// </summary>
public class ActingUser : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The email address of the user when the user performed the action.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("email")]
public virtual string Email { get; set; }
/// <summary>
/// A profile image URL for the user. May not be present if the user has changed their email address or deleted
/// their account.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("imageUrl")]
public virtual string ImageUrl { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Represents a DNS certificate challenge.</summary>
public class CertDnsChallenge : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The domain name upon which the DNS challenge must be satisfied.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("domainName")]
public virtual string DomainName { get; set; }
/// <summary>
/// The value that must be present as a TXT record on the domain name to satisfy the challenge.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("token")]
public virtual string Token { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>Represents an HTTP certificate challenge.</summary>
public class CertHttpChallenge : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The URL path on which to serve the specified token to satisfy the certificate challenge.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("path")]
public virtual string Path { get; set; }
/// <summary>The token to serve at the specified URL path to satisfy the certificate challenge.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("token")]
public virtual string Token { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A `Channel` represents a stream of releases for a site. All sites have a default `live` channel that serves
/// content to the live Firebase-provided domains and any connected custom domains.
/// </summary>
public class Channel : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Output only. The time at which the channel was created.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("createTime")]
public virtual object CreateTime { get; set; }
/// <summary>
/// The time at which the channel will be automatically deleted. If null, the channel will not be automatically
/// deleted. This field is present in output whether set directly or via the `ttl` field.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("expireTime")]
public virtual object ExpireTime { get; set; }
/// <summary>Text labels used for extra metadata and/or filtering.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("labels")]
public virtual System.Collections.Generic.IDictionary<string, string> Labels { get; set; }
/// <summary>The fully-qualified identifier of the Channel.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>Output only. The current release for the channel, if any.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("release")]
public virtual Release Release { get; set; }
/// <summary>
/// The number of previous releases to retain on the channel for rollback or other purposes. Must be a number
/// between 1-100. Defaults to 10 for new channels.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("retainedReleaseCount")]
public virtual System.Nullable<int> RetainedReleaseCount { get; set; }
/// <summary>
/// Input only. A time-to-live for this channel. Sets `expire_time` to the provided duration past the time of
/// the request.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("ttl")]
public virtual object Ttl { get; set; }
/// <summary>Output only. The time at which the channel was last updated.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("updateTime")]
public virtual object UpdateTime { get; set; }
/// <summary>
/// Output only. The URL at which the channel can be viewed. For the `live` channel, the content of the current
/// release may also be visible at other URLs.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("url")]
public virtual string Url { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The request sent to CloneVersion.</summary>
public class CloneVersionRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// If provided, only paths that do not match any of the regexes in this list will be included in the new
/// version.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("exclude")]
public virtual PathFilter Exclude { get; set; }
/// <summary>If true, immediately finalize the version after cloning is complete.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("finalize")]
public virtual System.Nullable<bool> Finalize { get; set; }
/// <summary>
/// If provided, only paths that match one or more regexes in this list will be included in the new version.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("include")]
public virtual PathFilter Include { get; set; }
/// <summary>
/// Required. The name of the version to be cloned, in the format: `sites/{site}/versions/{version}`
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("sourceVersion")]
public virtual string SourceVersion { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A configured rewrite that directs requests to a Cloud Run service. If the Cloud Run service does not exist when
/// setting or updating your Firebase Hosting configuration, then the request fails. Any errors from the Cloud Run
/// service are passed to the end user (for example, if you delete a service, any requests directed to that service
/// receive a `404` error).
/// </summary>
public class CloudRunRewrite : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Optional. User-provided region where the Cloud Run service is hosted. Defaults to `us-central1` if not
/// supplied.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("region")]
public virtual string Region { get; set; }
/// <summary>Required. User-defined ID of the Cloud Run service.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("serviceId")]
public virtual string ServiceId { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The intended behavior and status information of a domain.</summary>
public class Domain : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Required. The domain name of the association.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("domainName")]
public virtual string DomainName { get; set; }
/// <summary>If set, the domain should redirect with the provided parameters.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("domainRedirect")]
public virtual DomainRedirect DomainRedirect { get; set; }
/// <summary>
/// Output only. Information about the provisioning of certificates and the health of the DNS resolution for the
/// domain.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("provisioning")]
public virtual DomainProvisioning Provisioning { get; set; }
/// <summary>Required. The site name of the association.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("site")]
public virtual string Site { get; set; }
/// <summary>Output only. Additional status of the domain association.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("status")]
public virtual string Status { get; set; }
/// <summary>Output only. The time at which the domain was last updated.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("updateTime")]
public virtual object UpdateTime { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The current certificate provisioning status information for a domain.</summary>
public class DomainProvisioning : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The TXT records (for the certificate challenge) that were found at the last DNS fetch.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("certChallengeDiscoveredTxt")]
public virtual System.Collections.Generic.IList<string> CertChallengeDiscoveredTxt { get; set; }
/// <summary>The DNS challenge for generating a certificate.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("certChallengeDns")]
public virtual CertDnsChallenge CertChallengeDns { get; set; }
/// <summary>The HTTP challenge for generating a certificate.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("certChallengeHttp")]
public virtual CertHttpChallenge CertChallengeHttp { get; set; }
/// <summary>
/// The certificate provisioning status; updated when Firebase Hosting provisions an SSL certificate for the
/// domain.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("certStatus")]
public virtual string CertStatus { get; set; }
/// <summary>The IPs found at the last DNS fetch.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("discoveredIps")]
public virtual System.Collections.Generic.IList<string> DiscoveredIps { get; set; }
/// <summary>The time at which the last DNS fetch occurred.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("dnsFetchTime")]
public virtual object DnsFetchTime { get; set; }
/// <summary>The DNS record match status as of the last DNS fetch.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("dnsStatus")]
public virtual string DnsStatus { get; set; }
/// <summary>The list of IPs to which the domain is expected to resolve.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("expectedIps")]
public virtual System.Collections.Generic.IList<string> ExpectedIps { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Defines the behavior of a domain-level redirect. Domain redirects preserve the path of the redirect but replace
/// the requested domain with the one specified in the redirect configuration.
/// </summary>
public class DomainRedirect : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Required. The domain name to redirect to.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("domainName")]
public virtual string DomainName { get; set; }
/// <summary>Required. The redirect status code.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("type")]
public virtual string Type { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical
/// example is to use it as the request or the response type of an API method. For instance: service Foo { rpc
/// Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON representation for `Empty` is empty JSON
/// object `{}`.
/// </summary>
public class Empty : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A [`header`](/docs/hosting/full-config#headers) is an object that specifies a URL pattern that, if matched to
/// the request URL path, triggers Hosting to apply the specified custom response headers.
/// </summary>
public class Header : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The user-supplied [glob](/docs/hosting/full-config#glob_pattern_matching) to match against the request URL
/// path.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("glob")]
public virtual string Glob { get; set; }
/// <summary>Required. The additional headers to add to the response.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("headers")]
public virtual System.Collections.Generic.IDictionary<string, string> Headers { get; set; }
/// <summary>The user-supplied RE2 regular expression to match against the request URL path.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("regex")]
public virtual string Regex { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>If provided, i18n rewrites are enabled.</summary>
public class I18nConfig : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// Required. The user-supplied path where country and language specific content will be looked for within the
/// public directory.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("root")]
public virtual string Root { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The response returned by ListChannels.</summary>
public class ListChannelsResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The list of channels.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("channels")]
public virtual System.Collections.Generic.IList<Channel> Channels { get; set; }
/// <summary>
/// If there are additional releases remaining beyond the ones in this response, then supply this token in the
/// next [`list`](../sites.channels/list) call to continue with the next set of releases.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The response to listing Domains.</summary>
public class ListDomainsResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The list of domains, if any exist.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("domains")]
public virtual System.Collections.Generic.IList<Domain> Domains { get; set; }
/// <summary>The pagination token, if more results exist.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class ListReleasesResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// If there are additional releases remaining beyond the ones in this response, then supply this token in the
/// next [`list`](../sites.versions.files/list) call to continue with the next set of releases.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>The list of hashes of files that still need to be uploaded, if any exist.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("releases")]
public virtual System.Collections.Generic.IList<Release> Releases { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class ListVersionFilesResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The list path/hashes in the specified version.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("files")]
public virtual System.Collections.Generic.IList<VersionFile> Files { get; set; }
/// <summary>The pagination token, if more results exist.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class ListVersionsResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The pagination token, if more results exist</summary>
[Newtonsoft.Json.JsonPropertyAttribute("nextPageToken")]
public virtual string NextPageToken { get; set; }
/// <summary>The list of versions, if any exist.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("versions")]
public virtual System.Collections.Generic.IList<Version> Versions { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>This resource represents a long-running operation that is the result of a network API call.</summary>
public class Operation : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed,
/// and either `error` or `response` is available.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("done")]
public virtual System.Nullable<bool> Done { get; set; }
/// <summary>The error result of the operation in case of failure or cancellation.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("error")]
public virtual Status Error { get; set; }
/// <summary>
/// Service-specific metadata associated with the operation. It typically contains progress information and
/// common metadata such as create time. Some services might not provide such metadata. Any method that returns
/// a long-running operation should document the metadata type, if any.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("metadata")]
public virtual System.Collections.Generic.IDictionary<string, object> Metadata { get; set; }
/// <summary>
/// The server-assigned name, which is only unique within the same service that originally returns it. If you
/// use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>
/// The normal response of the operation in case of success. If the original method returns no data on success,
/// such as `Delete`, the response is `google.protobuf.Empty`. If the original method is standard
/// `Get`/`Create`/`Update`, the response should be the resource. For other methods, the response should have
/// the type `XxxResponse`, where `Xxx` is the original method name. For example, if the original method name is
/// `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("response")]
public virtual System.Collections.Generic.IDictionary<string, object> Response { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>A representation of filter path.</summary>
public class PathFilter : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>An array of regexes to filter by.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("regexes")]
public virtual System.Collections.Generic.IList<string> Regexes { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>The request to populate a Version's Files.</summary>
public class PopulateVersionFilesRequest : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// A set of file paths to the hashes corresponding to assets that should be added to the version. Note that a
/// file path to an empty hash will remove the path from the version. Calculate a hash by Gzipping the file then
/// taking the SHA256 hash of the newly compressed file.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("files")]
public virtual System.Collections.Generic.IDictionary<string, string> Files { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
public class PopulateVersionFilesResponse : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The content hashes of the specified files that need to be uploaded to the specified endpoint.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("uploadRequiredHashes")]
public virtual System.Collections.Generic.IList<string> UploadRequiredHashes { get; set; }
/// <summary>
/// The URL to which the files should be uploaded, in the format:
/// "https://upload-firebasehosting.googleapis.com/upload/sites/site-name /versions/versionID/files". Perform a
/// multipart `POST` of the Gzipped file contents to the URL using a forward slash and the hash of the file
/// appended to the end.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("uploadUrl")]
public virtual string UploadUrl { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// Version preview configuration. If active and unexpired, this version will be accessible via a custom URL even if
/// it is not the currently released version. Deprecated in favor of site channels.
/// </summary>
public class PreviewConfig : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>If true, preview URLs are enabled for this version.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("active")]
public virtual System.Nullable<bool> Active { get; set; }
/// <summary>
/// Indicates the expiration time for previewing this version; preview URL requests received after this time
/// will 404.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("expireTime")]
public virtual object ExpireTime { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A [`redirect`](/docs/hosting/full-config#redirects) object specifies a URL pattern that, if matched to the
/// request URL path, triggers Hosting to respond with a redirect to the specified destination path.
/// </summary>
public class Redirect : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The user-supplied [glob](/docs/hosting/full-config#glob_pattern_matching) to match against the request URL
/// path.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("glob")]
public virtual string Glob { get; set; }
/// <summary>
/// Required. The value to put in the HTTP location header of the response. The location can contain capture
/// group values from the pattern using a `:` prefix to identify the segment and an optional `*` to capture the
/// rest of the URL. For example: "glob": "/:capture*", "statusCode": 301, "location":
/// "https://example.com/foo/:capture"
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("location")]
public virtual string Location { get; set; }
/// <summary>The user-supplied RE2 regular expression to match against the request URL path.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("regex")]
public virtual string Regex { get; set; }
/// <summary>
/// Required. The status HTTP code to return in the response. It must be a valid 3xx status code.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("statusCode")]
public virtual System.Nullable<int> StatusCode { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A `Release` is a particular [collection of configurations and files](sites.versions) that is set to be public at
/// a particular time.
/// </summary>
public class Release : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The deploy description when the release was created. The value can be up to 512 characters.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("message")]
public virtual string Message { get; set; }
/// <summary>
/// Output only. The unique identifier for the release, in the format: sites/ site-name/releases/releaseID This
/// name is provided in the response body when you call the [`CreateRelease`](sites.releases/create) endpoint.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>Output only. The time at which the version is set to be public.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("releaseTime")]
public virtual object ReleaseTime { get; set; }
/// <summary>Output only. Identifies the user who created the release.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("releaseUser")]
public virtual ActingUser ReleaseUser { get; set; }
/// <summary>
/// Explains the reason for the release. Specify a value for this field only when creating a `SITE_DISABLE` type
/// release.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("type")]
public virtual string Type { get; set; }
/// <summary>Output only. The configuration and content that was released.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("version")]
public virtual Version Version { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A [`rewrite`](/docs/hosting/full-config#rewrites) object specifies a URL pattern that, if matched to the request
/// URL path, triggers Hosting to respond as if the service were given the specified destination URL.
/// </summary>
public class Rewrite : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The request will be forwarded to Firebase Dynamic Links.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("dynamicLinks")]
public virtual System.Nullable<bool> DynamicLinks { get; set; }
/// <summary>The function to proxy requests to. Must match the exported function name exactly.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("function")]
public virtual string Function { get; set; }
/// <summary>
/// The user-supplied [glob](/docs/hosting/full-config#glob_pattern_matching) to match against the request URL
/// path.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("glob")]
public virtual string Glob { get; set; }
/// <summary>The URL path to rewrite the request to.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("path")]
public virtual string Path { get; set; }
/// <summary>The user-supplied RE2 regular expression to match against the request URL path.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("regex")]
public virtual string Regex { get; set; }
/// <summary>The request will be forwarded to Cloud Run.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("run")]
public virtual CloudRunRewrite Run { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// The configuration for how incoming requests to a site should be routed and processed before serving content. The
/// URL request paths are matched against the specified URL patterns in the configuration, then Hosting applies the
/// applicable configuration according to a specific [priority
/// order](/docs/hosting/full-config#hosting_priority_order).
/// </summary>
public class ServingConfig : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>How to handle well known App Association files.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("appAssociation")]
public virtual string AppAssociation { get; set; }
/// <summary>Defines whether to drop the file extension from uploaded files.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("cleanUrls")]
public virtual System.Nullable<bool> CleanUrls { get; set; }
/// <summary>
/// An array of objects, where each object specifies a URL pattern that, if matched to the request URL path,
/// triggers Hosting to apply the specified custom response headers.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("headers")]
public virtual System.Collections.Generic.IList<Header> Headers { get; set; }
/// <summary>Optional. Defines i18n rewrite behavior.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("i18n")]
public virtual I18nConfig I18n { get; set; }
/// <summary>
/// An array of objects (called redirect rules), where each rule specifies a URL pattern that, if matched to the
/// request URL path, triggers Hosting to respond with a redirect to the specified destination path.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("redirects")]
public virtual System.Collections.Generic.IList<Redirect> Redirects { get; set; }
/// <summary>
/// An array of objects (called rewrite rules), where each rule specifies a URL pattern that, if matched to the
/// request URL path, triggers Hosting to respond as if the service were given the specified destination URL.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("rewrites")]
public virtual System.Collections.Generic.IList<Rewrite> Rewrites { get; set; }
/// <summary>Defines how to handle a trailing slash in the URL path.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("trailingSlashBehavior")]
public virtual string TrailingSlashBehavior { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A `SiteConfig` contains metadata associated with a specific site that controls Firebase Hosting serving behavior
/// </summary>
public class SiteConfig : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>Whether or not web requests made by site visitors are logged via Cloud Logging.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("cloudLoggingEnabled")]
public virtual System.Nullable<bool> CloudLoggingEnabled { get; set; }
/// <summary>
/// The number of FINALIZED versions that will be held for a site before automatic deletion. When a new version
/// is deployed, content for versions in storage in excess of this number will be deleted, and will no longer be
/// billed for storage usage. Oldest versions will be deleted first; sites are created with an unlimited number
/// of max_versions by default.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("maxVersions")]
public virtual System.Nullable<long> MaxVersions { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// The `Status` type defines a logical error model that is suitable for different programming environments,
/// including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains
/// three pieces of data: error code, error message, and error details. You can find out more about this error model
/// and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).
/// </summary>
public class Status : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The status code, which should be an enum value of google.rpc.Code.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("code")]
public virtual System.Nullable<int> Code { get; set; }
/// <summary>
/// A list of messages that carry the error details. There is a common set of message types for APIs to use.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("details")]
public virtual System.Collections.Generic.IList<System.Collections.Generic.IDictionary<string, object>> Details { get; set; }
/// <summary>
/// A developer-facing error message, which should be in English. Any user-facing error message should be
/// localized and sent in the google.rpc.Status.details field, or localized by the client.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("message")]
public virtual string Message { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>
/// A `Version` is the collection of configuration and [static files](sites.versions.files) that determine how a
/// site is displayed.
/// </summary>
public class Version : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>
/// The configuration for the behavior of the site. This configuration exists in the
/// [`firebase.json`](/docs/cli/#the_firebasejson_file) file.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("config")]
public virtual ServingConfig Config { get; set; }
/// <summary>Output only. The time at which the version was created.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("createTime")]
public virtual object CreateTime { get; set; }
/// <summary>Output only. Identifies the user who created the version.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("createUser")]
public virtual ActingUser CreateUser { get; set; }
/// <summary>Output only. The time at which the version was `DELETED`.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("deleteTime")]
public virtual object DeleteTime { get; set; }
/// <summary>Output only. Identifies the user who `DELETED` the version.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("deleteUser")]
public virtual ActingUser DeleteUser { get; set; }
/// <summary>
/// Output only. The total number of files associated with the version. This value is calculated after a version
/// is `FINALIZED`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("fileCount")]
public virtual System.Nullable<long> FileCount { get; set; }
/// <summary>Output only. The time at which the version was `FINALIZED`.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("finalizeTime")]
public virtual object FinalizeTime { get; set; }
/// <summary>Output only. Identifies the user who `FINALIZED` the version.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("finalizeUser")]
public virtual ActingUser FinalizeUser { get; set; }
/// <summary>The labels used for extra metadata and/or filtering.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("labels")]
public virtual System.Collections.Generic.IDictionary<string, string> Labels { get; set; }
/// <summary>
/// The unique identifier for a version, in the format: sites/site-name /versions/versionID This name is
/// provided in the response body when you call the [`CreateVersion`](../sites.versions/create) endpoint.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("name")]
public virtual string Name { get; set; }
/// <summary>
/// Deprecated in favor of site channels. Version preview configuration for the site version. This configuration
/// specifies whether previewing is enabled for this site version. Version previews allow you to preview your
/// site at a custom URL before releasing it as the live version.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("preview")]
public virtual PreviewConfig Preview { get; set; }
/// <summary>
/// The deploy status of a version. For a successful deploy, call the [`CreateVersion`](sites.versions/create)
/// endpoint to make a new version (`CREATED` status), [upload all desired files](sites.versions/populateFiles)
/// to the version, then [update](sites.versions/patch) the version to the `FINALIZED` status. Note that if you
/// leave the version in the `CREATED` state for more than 12 hours, the system will automatically mark the
/// version as `ABANDONED`. You can also change the status of a version to `DELETED` by calling the
/// [`DeleteVersion`](sites.versions/delete) endpoint.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("status")]
public virtual string Status { get; set; }
/// <summary>
/// Output only. The total stored bytesize of the version. This value is calculated after a version is
/// `FINALIZED`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("versionBytes")]
public virtual System.Nullable<long> VersionBytes { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
/// <summary>A static content file that is part of a version.</summary>
public class VersionFile : Google.Apis.Requests.IDirectResponseSchema
{
/// <summary>The SHA256 content hash of the file.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("hash")]
public virtual string Hash { get; set; }
/// <summary>The URI at which the file's content should display.</summary>
[Newtonsoft.Json.JsonPropertyAttribute("path")]
public virtual string Path { get; set; }
/// <summary>
/// Output only. The current status of a particular file in the specified version. The value will be either
/// `pending upload` or `uploaded`.
/// </summary>
[Newtonsoft.Json.JsonPropertyAttribute("status")]
public virtual string Status { get; set; }
/// <summary>The ETag of the item.</summary>
public virtual string ETag { get; set; }
}
}
| 49.660062 | 198 | 0.539968 | [
"Apache-2.0"
] | bsogulcan/google-api-dotnet-client | Src/Generated/Google.Apis.FirebaseHosting.v1beta1/Google.Apis.FirebaseHosting.v1beta1.cs | 225,556 | C# |
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Collections.Generic;
using System.Linq;
using Moq;
using NuGet.Services.Entities;
using Xunit;
namespace NuGetGallery.ViewModels
{
public class ListPackageItemViewModelFacts
{
// start with replicating the PackageViewModelFacts here since we shouldn't be breaking these
// ListPackageItemViewModel extends PackageViewModel
#region CopiedFromPackageViewModelFacts
[Fact]
public void UsesNormalizedVersionForDisplay()
{
var package = new Package()
{
Version = "01.02.00.00",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
NormalizedVersion = "1.3.0" // Different just to prove the View Model is using the DB column.
};
var packageViewModel = CreateListPackageItemViewModel(package);
Assert.Equal("1.3.0", packageViewModel.Version);
}
[Fact]
public void UsesNormalizedPackageVersionIfNormalizedVersionMissing()
{
var package = new Package()
{
Version = "01.02.00.00",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
};
var packageViewModel = CreateListPackageItemViewModel(package);
Assert.Equal("1.2.0", packageViewModel.Version);
}
#endregion
[Fact]
public void ShortDescriptionsNotTruncated()
{
var description = "A Short Description";
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
Description = description
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.Equal(description, listPackageItemViewModel.ShortDescription);
Assert.False(listPackageItemViewModel.IsDescriptionTruncated);
}
[Fact]
public void LongDescriptionsTruncated()
{
var omission = "...";
var description = @"A Longer description full of nonsense that will get truncated. Lorem ipsum dolor sit amet, ad nemore gubergren eam. Ea quaeque labores deseruisse his, eos munere convenire at, in eos audire persius corpora. Te his volumus detracto offendit, has ne illud choro. No illum quaestio mel, novum democritum te sea, et nam nisl officiis salutandi. Vis ut harum docendi incorrupte, nam affert putent sententiae id, mei cibo omnium id. Ea est falli graeci voluptatibus, est mollis denique ne.
An nec tempor cetero vituperata.Ius cu dicunt regione interpretaris, posse veniam facilisis ad vim, sit ei sale integre. Mel cu aliquid impedit scribentur.Nostro recusabo sea ei, nec habeo instructior no, saepe altera adversarium vel cu.Nonumes molestiae sit at, per enim necessitatibus cu.
At mei iriure dignissim theophrastus.Meis nostrud te sit, equidem maiorum pri ex.Vim dolorem fuisset an. At sit veri illum oratio, et per dicat contentiones. In eam tale tation, mei dicta labitur corpora ei, homero equidem suscipit ut eam.";
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
Description = description
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.NotEqual(description, listPackageItemViewModel.ShortDescription);
Assert.True(listPackageItemViewModel.IsDescriptionTruncated);
Assert.EndsWith(omission, listPackageItemViewModel.ShortDescription);
Assert.Contains(listPackageItemViewModel.ShortDescription.Substring(0, listPackageItemViewModel.ShortDescription.Length - 1 - omission.Length), description);
}
[Fact]
public void LongDescriptionsSingleWordTruncatedToLimit()
{
var charLimit = 300;
var omission = "...";
var description = @"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz";
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
Description = description
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.Equal(charLimit + omission.Length, listPackageItemViewModel.ShortDescription.Length);
Assert.True(listPackageItemViewModel.IsDescriptionTruncated);
Assert.EndsWith(omission, listPackageItemViewModel.ShortDescription);
}
[Fact]
public void EmptyTagsAreParsedEmpty()
{
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.Null(listPackageItemViewModel.Tags);
}
[Fact]
public void TagsAreParsed()
{
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
Tags = "tag1 tag2 tag3"
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.Equal(3, listPackageItemViewModel.Tags.Count());
Assert.Contains("tag1", listPackageItemViewModel.Tags);
Assert.Contains("tag2", listPackageItemViewModel.Tags);
Assert.Contains("tag3", listPackageItemViewModel.Tags);
}
[Fact]
public void AuthorsIsFlattenedAuthors()
{
var authors = new HashSet<PackageAuthor>();
var author1 = new PackageAuthor
{
Name = "author1"
};
var author2 = new PackageAuthor
{
Name = "author2"
};
authors.Add(author1);
authors.Add(author2);
var flattenedAuthors = "something Completely different";
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
#pragma warning disable 0618
Authors = authors,
#pragma warning restore 0618
FlattenedAuthors = flattenedAuthors
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.Equal(flattenedAuthors, listPackageItemViewModel.Authors);
}
[Fact]
public void UseVersionIfLatestAndStableNotSame()
{
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
IsLatest = true,
IsLatestStable = false
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.True(listPackageItemViewModel.UseVersion);
listPackageItemViewModel.LatestVersion = false;
listPackageItemViewModel.LatestStableVersion = true;
Assert.True(listPackageItemViewModel.UseVersion);
listPackageItemViewModel.LatestVersion = false;
listPackageItemViewModel.LatestStableVersion = false;
Assert.True(listPackageItemViewModel.UseVersion);
listPackageItemViewModel.LatestVersion = true;
listPackageItemViewModel.LatestStableVersion = true;
Assert.False(listPackageItemViewModel.UseVersion);
}
[Fact]
public void UseVersionIfLatestSemVer2AndStableSemVer2NotSame()
{
var package = new Package()
{
Version = "1.0.0",
PackageRegistration = new PackageRegistration { Id = "SomeId" },
SemVerLevelKey = SemVerLevelKey.SemVer2,
IsLatestSemVer2 = true,
IsLatestStableSemVer2 = false
};
var listPackageItemViewModel = CreateListPackageItemViewModel(package);
Assert.True(listPackageItemViewModel.UseVersion);
listPackageItemViewModel.LatestVersionSemVer2 = false;
listPackageItemViewModel.LatestStableVersionSemVer2 = true;
Assert.True(listPackageItemViewModel.UseVersion);
listPackageItemViewModel.LatestVersionSemVer2 = false;
listPackageItemViewModel.LatestStableVersionSemVer2 = false;
Assert.True(listPackageItemViewModel.UseVersion);
listPackageItemViewModel.LatestVersionSemVer2 = true;
listPackageItemViewModel.LatestStableVersionSemVer2 = true;
Assert.False(listPackageItemViewModel.UseVersion);
}
public class SignerInformation
{
private readonly User _user1;
private readonly User _user2;
private readonly User _user3;
private readonly Certificate _certificate;
private readonly PackageRegistration _packageRegistration;
private readonly Package _package;
public SignerInformation()
{
_user1 = new User()
{
Key = 1,
Username = "A"
};
_user2 = new User()
{
Key = 2,
Username = "B"
};
_user3 = new User()
{
Key = 3,
Username = "C"
};
_certificate = new Certificate()
{
Key = 4,
Thumbprint = "D",
Sha1Thumbprint = "E"
};
_packageRegistration = new PackageRegistration()
{
Key = 5,
Id = "F"
};
_package = new Package()
{
Key = 6,
Version = "1.0.0",
PackageRegistration = _packageRegistration
};
_packageRegistration.Packages.Add(_package);
}
[Fact]
public void WhenCannotDisplayPrivateMetadata_ReturnsNull()
{
var viewModel = CreateListPackageItemViewModel(_package, _user1);
Assert.False(viewModel.CanDisplayPrivateMetadata);
Assert.Null(viewModel.SignatureInformation);
}
[Fact]
public void WhenPackageCertificateIsNull_ReturnsNull()
{
_packageRegistration.Owners.Add(_user1);
var viewModel = CreateListPackageItemViewModel(_package, _user1);
Assert.True(viewModel.CanDisplayPrivateMetadata);
Assert.Null(viewModel.SignatureInformation);
}
[Fact]
public void WhenPackageCertificateIsNotNullAndNoOwners_ReturnsString()
{
SignPackage();
var viewModel = CreateListPackageItemViewModel(_package, _user1);
viewModel.CanDisplayPrivateMetadata = true;
Assert.Equal("Signed with certificate (E)", viewModel.SignatureInformation);
}
[Fact]
public void WhenPackageCertificateIsNotNullAndOneSigner_ReturnsString()
{
_packageRegistration.Owners.Add(_user1);
ActivateCertificate(_user1);
SignPackage();
var viewModel = CreateListPackageItemViewModel(_package, _user1);
Assert.True(viewModel.CanDisplayPrivateMetadata);
Assert.Equal("Signed with A's certificate (E)", viewModel.SignatureInformation);
}
[Fact]
public void WhenPackageCertificateIsNotNullAndTwoSigners_ReturnsString()
{
_packageRegistration.Owners.Add(_user1);
_packageRegistration.Owners.Add(_user2);
ActivateCertificate(_user1);
ActivateCertificate(_user2);
SignPackage();
var viewModel = CreateListPackageItemViewModel(_package, _user1);
Assert.True(viewModel.CanDisplayPrivateMetadata);
Assert.Equal("Signed with A and B's certificate (E)", viewModel.SignatureInformation);
}
[Fact]
public void WhenPackageCertificateIsNotNullAndThreeSigners_ReturnsString()
{
_packageRegistration.Owners.Add(_user1);
_packageRegistration.Owners.Add(_user2);
_packageRegistration.Owners.Add(_user3);
ActivateCertificate(_user1);
ActivateCertificate(_user2);
ActivateCertificate(_user3);
SignPackage();
var viewModel = CreateListPackageItemViewModel(_package, _user1);
Assert.True(viewModel.CanDisplayPrivateMetadata);
Assert.Equal("Signed with A, B, and C's certificate (E)", viewModel.SignatureInformation);
}
private void ActivateCertificate(User user)
{
var userCertificate = new UserCertificate()
{
Key = _certificate.UserCertificates.Count() + 1,
UserKey = user.Key,
User = user,
CertificateKey = _certificate.Key,
Certificate = _certificate
};
_certificate.UserCertificates.Add(userCertificate);
user.UserCertificates.Add(userCertificate);
}
private void SignPackage()
{
_package.CertificateKey = _certificate.Key;
_package.Certificate = _certificate;
}
}
private static ListPackageItemViewModel CreateListPackageItemViewModel(Package package, User user = null)
{
return new ListPackageItemViewModelFactory(Mock.Of<IIconUrlProvider>()).Create(package, currentUser: user);
}
}
} | 39.575916 | 554 | 0.602262 | [
"Apache-2.0"
] | 304NotModified/NuGetGallery | tests/NuGetGallery.Facts/ViewModels/ListPackageItemViewModelFacts.cs | 15,120 | C# |
namespace TextUml.Models
{
using System.ComponentModel.DataAnnotations;
public class ChangePassword
{
[Required]
public string OldPassword { get; set; }
[Required]
[StringLength(64, MinimumLength = 6)]
public string NewPassword { get; set; }
[Required]
[Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
public string ConfirmPassword { get; set; }
}
} | 26.888889 | 107 | 0.634298 | [
"MIT"
] | marufsiddiqui/textuml-dotnet | source/TextUml/Models/ChangePassword.cs | 486 | C# |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yoktorm.Compiler
{
public interface IModelCompiler
{
}
}
| 14.142857 | 35 | 0.747475 | [
"MIT"
] | simplic-systems/yoktorm | src/Yoktorm/Compiler/IModelCompiler.cs | 200 | C# |
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace TradeUnionCommittee.DAL.Entities
{
public class GiftEmployees
{
public long Id { get; set; }
public long IdEmployee { get; set; }
public string NameEvent { get; set; }
public string NameGift { get; set; }
public decimal Price { get; set; }
public decimal Discount { get; set; }
public DateTime DateGift { get; set; }
[Timestamp]
[DatabaseGenerated(DatabaseGeneratedOption.Computed)]
[Column("xmin", TypeName = "xid")]
public uint RowVersion { get; set; }
public Employee IdEmployeeNavigation { get; set; }
}
}
| 30.916667 | 61 | 0.6469 | [
"MIT"
] | zavada-sergey/TradeUnionCommittee.App | src/TradeUnionCommittee.Core/src/TradeUnionCommittee.DAL/Entities/GiftEmployees.cs | 744 | C# |
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace UE4.Native {
/// <summary>
///
/// </summary>
/// <remarks>
/// This struct must have the same layout as SharedDotNet in CLRHost.cpp
/// </remarks>
[StructLayout( LayoutKind.Sequential, Pack = 0 )]
struct Shared {
UInt32 StartGuardian;
UInt32 SizeOfShared;
IntPtr LogFunction;
IntPtr GetNameFunction;
IntPtr ProcessEventFunction;
IntPtr GetUFunctionFunction;
IntPtr GetUClassFunction;
IntPtr GetDefaultObjectFunction;
IntPtr GetBoolPropertyValueFunction;
IntPtr SetBoolPropertyValueFunction;
IntPtr GetMethodUFunctionFunction;
IntPtr NewObjectFunction;
IntPtr GetTransientPackageFunction;
IntPtr ShareObjectFunction;
IntPtr ReleaseObjectFunction;
IntPtr PushNameFunction;
IntPtr PushInterfaceFunction;
IntPtr PushUObjectFunction;
IntPtr TestFunction;
IntPtr DotNetCallFunction;
UInt32 EndGuardian;
internal LogDelegate Log =>
Marshal.GetDelegateForFunctionPointer<LogDelegate>( LogFunction );
internal GetNameDelegate GetName =>
Marshal.GetDelegateForFunctionPointer<GetNameDelegate>( GetNameFunction );
internal GetUFunctionDelegate GetUFunction =>
Marshal.GetDelegateForFunctionPointer<GetUFunctionDelegate>( GetUFunctionFunction );
internal GetUClassDelegate GetUClass =>
Marshal.GetDelegateForFunctionPointer<GetUClassDelegate>( GetUClassFunction );
internal GetDefaultObjectDelegate GetDefaultObject =>
Marshal.GetDelegateForFunctionPointer<GetDefaultObjectDelegate>( GetDefaultObjectFunction );
internal GetBoolPropertyByNameDelegate GetBoolPropertyByName =>
Marshal.GetDelegateForFunctionPointer<GetBoolPropertyByNameDelegate>( GetBoolPropertyValueFunction );
internal SetBoolPropertyByNameDelegate SetBoolPropertyByName =>
Marshal.GetDelegateForFunctionPointer<SetBoolPropertyByNameDelegate>( SetBoolPropertyValueFunction );
internal GetMethodUFunctionDelegate GetMethodUFunction =>
Marshal.GetDelegateForFunctionPointer<GetMethodUFunctionDelegate>( GetMethodUFunctionFunction );
internal NewObjectDelegate NewObject =>
Marshal.GetDelegateForFunctionPointer<NewObjectDelegate>( NewObjectFunction );
internal GetTransientPackageDelegate GetTransientPackage =>
Marshal.GetDelegateForFunctionPointer<GetTransientPackageDelegate>( GetTransientPackageFunction );
internal ProcessEventDelegate ProcessEvent =>
Marshal.GetDelegateForFunctionPointer<ProcessEventDelegate>( ProcessEventFunction );
internal ShareOjectDelegate ShareObject =>
Marshal.GetDelegateForFunctionPointer<ShareOjectDelegate>( ShareObjectFunction );
internal ReleaseObjectDelegate ReleaseObject =>
Marshal.GetDelegateForFunctionPointer<ReleaseObjectDelegate>( ReleaseObjectFunction );
internal void SetPushNameFunction( IntPtr funcPtr ) {
PushNameFunction = funcPtr;
}
internal void SetTestFunction( IntPtr funcPtr ) {
TestFunction = funcPtr;
}
internal void SetPushInterfaceFunction( IntPtr funcPtr ) {
PushInterfaceFunction = funcPtr;
}
internal void SetPushUObjectFunction( IntPtr funcPtr ) {
PushUObjectFunction = funcPtr;
}
internal void SetDotNetCallFunction( IntPtr funcPtr ) {
DotNetCallFunction = funcPtr;
}
internal void Validate() {
var size = Marshal.SizeOf<Shared>();
Debug.Assert( StartGuardian == 0x12345678 &&
EndGuardian == 0x87654321 &&
SizeOfShared == Marshal.SizeOf<Shared>() );
}
}
}
| 36.412844 | 113 | 0.700932 | [
"MIT"
] | UE4DotNet/Plugin | DotNet/DotNet/UE4/Native/Shared.cs | 3,971 | C# |
/***********************************************************************************************************************
Copyright (c) 2016, Imagination Technologies Limited and/or its affiliated group companies.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DTLS
{
public class SignatureHashAlgorithm
{
public THashAlgorithm Hash { get; set; }
public TSignatureAlgorithm Signature { get; set; }
}
}
| 55.894737 | 122 | 0.682203 | [
"BSD-3-Clause"
] | OpenRelayOSS/openrelay-cdk-unity | DTLS.Net/CipherSuite/SignatureHashAlgorithm.cs | 2,126 | C# |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.