content
stringlengths
23
1.05M
using Aqua.Data.Model; using Aqua.Library; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; namespace Aqua.Data { public class AnimalRepo : IAnimalRepo { private readonly DbContextOptions<AquaContext> _contextOptions; public AnimalRepo(DbContextOptions<AquaContext> contextOptions) { _contextOptions = contextOptions; } public List<Animal> GetAllAnimals() { using var context = new AquaContext(_contextOptions); var dbAnimals = context.Animals.Distinct().ToList(); var result = new List<Animal>(); foreach (var animal in dbAnimals) { var newAnimal = new Animal() { Id = animal.Id, Name = animal.Name, Price = animal.Price }; result.Add(newAnimal); }; return result; } public Animal GetAnimalByName(string name) { using var context = new AquaContext(_contextOptions); var dbAnimal = context.Animals .Where(a => a.Name == name) .FirstOrDefault(); if (dbAnimal == null) { return null; } else { var newAnimal = new Animal() { Id = dbAnimal.Id, Name = dbAnimal.Name, Price = dbAnimal.Price }; return newAnimal; } } public Animal GetAnimalById(int id) { using var context = new AquaContext(_contextOptions); var dbAnimal = context.Animals .Where(a => a.Id == id) .FirstOrDefault(); if (dbAnimal == null) { return null; } else { var newAnimal = new Animal() { Id = dbAnimal.Id, Name = dbAnimal.Name, Price = dbAnimal.Price }; return newAnimal; } } public void CreateAnimalEntity(Animal animal) { using var context = new AquaContext(_contextOptions); var newEntry = new AnimalEntity() { Name = animal.Name, Price = animal.Price }; context.Animals.Add(newEntry); context.SaveChanges(); } public void UpdateAnimalEntity(Animal animal) { using var context = new AquaContext(_contextOptions); var dbAnimal = context.Animals .Where(a => a.Id == animal.Id) .FirstOrDefault(); dbAnimal.Name = animal.Name; dbAnimal.Price = animal.Price; context.SaveChanges(); } } }
using System; using System.Linq; using ReMi.Commands.ReleasePlan; using ReMi.Contracts.Cqrs.Commands; using ReMi.Contracts.Cqrs.Events; using ReMi.DataAccess.BusinessEntityGateways.ReleasePlan; using ReMi.Events.ReleasePlan; namespace ReMi.CommandHandlers.ReleasePlan { public class UpdateReleaseTasksOrderCommandHandler : IHandleCommand<UpdateReleaseTasksOrderCommand> { public Func<IReleaseTaskGateway> ReleaseTaskGatewayFactory { get; set; } public IPublishEvent PublishEvent { get; set; } public void Handle(UpdateReleaseTasksOrderCommand command) { Guid releaseWindowId; using (var gateway = ReleaseTaskGatewayFactory()) { gateway.UpdateReleaseTasksOrder(command.ReleaseTasksOrder); releaseWindowId = gateway.GetReleaseTask(command.ReleaseTasksOrder.First().Key).ReleaseWindowId; } PublishEvent.Publish(new ReleaseTasksOrderUpdatedEvent { ReleaseWindowId = releaseWindowId }); } } }
namespace FantasySoccer.Schema.Models.CosmosDB { public class MatchFutbolPlayerPerformance : Models.GeneralModel { public string FutbolPlayerID { get; set; } public string MatchID { get; set; } public int Goals { get; set; } public int Faults { get; set; } public int YellowCards { get; set; } public int RedCards { get; set; } public int Saves { get; set; } public int OwnGoals { get; set; } public int PlayedMinutes { get; set; } public int Score { get; set; } public int Round { get; set; } public string TournamentId { get; set; } } }
using CreativeCoders.Core.SysEnvironment; using CreativeCoders.Git.Abstractions.Auth; using CreativeCoders.Git.Abstractions.Exceptions; namespace CreativeCoders.Git; internal class DefaultGitRepositoryFactory : IGitRepositoryFactory { private readonly IGitCredentialProviders _credentialProviders; private readonly IGitRepositoryUtils _repositoryUtils; public DefaultGitRepositoryFactory(IGitCredentialProviders credentialProviders, IGitRepositoryUtils repositoryUtils) { _credentialProviders = Ensure.NotNull(credentialProviders, nameof(credentialProviders)); _repositoryUtils = Ensure.NotNull(repositoryUtils, nameof(repositoryUtils)); } public IGitRepository OpenRepository(string? path) { var repo = path == null ? new Repository() : new Repository(_repositoryUtils.DiscoverGitPath(path) ?? throw new GitNoRepositoryPathException(path)); return new DefaultGitRepository(repo, _credentialProviders); } public IGitRepository OpenRepositoryFromCurrentDir() { return OpenRepository(Env.CurrentDirectory); } }
using Acme.Domain; using System; using System.Collections.Generic; using System.Data.Entity; using System.Linq; using System.Linq.Expressions; namespace Acme.Data.Repo { public class RiskRepository : Repository<Risk> { public Risk FecthById(int id, bool include) { return _context.Risks.Include(c => c.Customer).Where(r => r.Id == id).FirstOrDefault(); } public IEnumerable<Risk> FetchAllWithRefs() { return _context.Risks.Include(c => c.Customer).ToList(); } } }
namespace PSake.TaskRunner.Helpers.TaskRunner { public interface ITextUtil { Range CurrentLineRange { get; } bool Delete(Range range); bool Insert(Range position, string text, bool addNewline); bool TryReadLine(out string line); string ReadAllText(); void Reset(); void FormatRange(LineRange range); } }
using System; using System.Collections.Generic; using System.Text; namespace Doms.HttpService { /// <summary> /// Session work status, use to remember what is the session doing now /// </summary> enum SessionWorkStatus { Idle, //session has nothing to do Busy, //processing the request SendingRequestHeader, SendingRequestBody, SendingResponseHeader, SendingResponseBody, ReceivingRequestHeader, ReceivingRequestBody, ReceivingResponseHeader, ReceivingResponseBody, } }
using Atc.Cosmos.EventStore.Streams.Validators; using Atc.Test; using FluentAssertions; using NSubstitute; using Xunit; namespace Atc.Cosmos.EventStore.Tests.Streams.Validators { public class StreamNotEmptyValidatorValidatorTests { [Theory] [InlineAutoNSubstituteData(1, StreamState.Active)] [InlineAutoNSubstituteData(10, StreamState.Active)] [InlineAutoNSubstituteData(StreamVersion.AnyValue, StreamState.Active)] [InlineAutoNSubstituteData(1, StreamState.Closed)] [InlineAutoNSubstituteData(10, StreamState.Closed)] [InlineAutoNSubstituteData(StreamVersion.AnyValue, StreamState.Closed)] [InlineAutoNSubstituteData(1, StreamState.New)] [InlineAutoNSubstituteData(10, StreamState.New)] [InlineAutoNSubstituteData(StreamVersion.AnyValue, StreamState.New)] internal void Should_Validate( long version, StreamState state, IStreamMetadata metadata, StreamNotEmptyValidator sut) { metadata .State .Returns(state); metadata .Version .Returns(version); FluentActions.Invoking( () => sut.Validate(metadata, StreamVersion.NotEmptyValue)) .Should() .NotThrow(); } [Theory] [InlineAutoNSubstituteData(StreamVersion.StartOfStreamValue, StreamState.Active)] [InlineAutoNSubstituteData(StreamVersion.StartOfStreamValue, StreamState.Closed)] [InlineAutoNSubstituteData(StreamVersion.StartOfStreamValue, StreamState.New)] internal void Should_Throw_When_StreamVersion_Is_Not_StartOfStream( long version, StreamState state, IStreamMetadata metadata, StreamNotEmptyValidator sut) { metadata .State .Returns(state); metadata .Version .Returns(version); FluentActions.Invoking( () => sut.Validate(metadata, StreamVersion.NotEmptyValue)) .Should() .Throw<StreamVersionConflictException>(); } } }
/* * This file is automatically generated; any changes will be lost. */ #nullable enable #pragma warning disable using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Azure.Cosmos; using Beef; using Beef.Business; using Beef.Data.Cosmos; using Beef.Entities; using Beef.Mapper; using Beef.Mapper.Converters; using Cdr.Banking.Common.Entities; using RefDataNamespace = Cdr.Banking.Common.Entities; namespace Cdr.Banking.Business.Data { /// <summary> /// Provides the <see cref="Account"/> data access. /// </summary> public partial class AccountData : IAccountData { private readonly ICosmosDb _cosmos; private readonly AutoMapper.IMapper _mapper; private Action<CosmosDbArgs>? _onDataArgsCreate; private Func<IQueryable<Model.Account>, AccountArgs?, CosmosDbArgs, IQueryable<Model.Account>>? _getAccountsOnQuery; /// <summary> /// Initializes a new instance of the <see cref="AccountData"/> class. /// </summary> /// <param name="cosmos">The <see cref="ICosmosDb"/>.</param> /// <param name="mapper">The <see cref="AutoMapper.IMapper"/>.</param> public AccountData(ICosmosDb cosmos, AutoMapper.IMapper mapper) { _cosmos = Check.NotNull(cosmos, nameof(cosmos)); _mapper = Check.NotNull(mapper, nameof(mapper)); AccountDataCtor(); } partial void AccountDataCtor(); // Enables additional functionality to be added to the constructor. /// <summary> /// Get all accounts. /// </summary> /// <param name="args">The Args (see <see cref="Entities.AccountArgs"/>).</param> /// <param name="paging">The <see cref="PagingArgs"/>.</param> /// <returns>The <see cref="AccountCollectionResult"/>.</returns> public Task<AccountCollectionResult> GetAccountsAsync(AccountArgs? args, PagingArgs? paging) => DataInvoker.Current.InvokeAsync(this, async () => { AccountCollectionResult __result = new AccountCollectionResult(paging); var __dataArgs = CosmosDbArgs.Create(_mapper, "Account", __result.Paging!, PartitionKey.None, onCreate: _onDataArgsCreate); __result.Result = _cosmos.Container<Account, Model.Account>(__dataArgs).Query(q => _getAccountsOnQuery?.Invoke(q, args, __dataArgs) ?? q).SelectQuery<AccountCollection>(); return await Task.FromResult(__result).ConfigureAwait(false); }); /// <summary> /// Get <see cref="AccountDetail"/>. /// </summary> /// <param name="accountId">The <see cref="Account"/> identifier.</param> /// <returns>The selected <see cref="AccountDetail"/> where found.</returns> public Task<AccountDetail?> GetDetailAsync(string? accountId) => DataInvoker.Current.InvokeAsync(this, async () => { var __dataArgs = CosmosDbArgs.Create(_mapper, "Account", PartitionKey.None, onCreate: _onDataArgsCreate); return await _cosmos.Container<AccountDetail, Model.Account>(__dataArgs).GetAsync(accountId).ConfigureAwait(false); }); /// <summary> /// Get <see cref="Account"/> <see cref="Balance"/>. /// </summary> /// <param name="accountId">The <see cref="Account"/> identifier.</param> /// <returns>The selected <see cref="Balance"/> where found.</returns> public Task<Balance?> GetBalanceAsync(string? accountId) => DataInvoker.Current.InvokeAsync(this, () => GetBalanceOnImplementationAsync(accountId)); /// <summary> /// Provides the <see cref="Account"/> and Entity Framework <see cref="Model.Account"/> <i>AutoMapper</i> mapping. /// </summary> public partial class CosmosMapperProfile : AutoMapper.Profile { /// <summary> /// Initializes a new instance of the <see cref="CosmosMapperProfile"/> class. /// </summary> public CosmosMapperProfile() { var s2d = CreateMap<Account, Model.Account>(); s2d.ForMember(d => d.Id, o => o.MapFrom(s => s.Id)); s2d.ForMember(d => d.CreationDate, o => o.MapFrom(s => s.CreationDate)); s2d.ForMember(d => d.DisplayName, o => o.MapFrom(s => s.DisplayName)); s2d.ForMember(d => d.Nickname, o => o.MapFrom(s => s.Nickname)); s2d.ForMember(d => d.OpenStatus, o => o.MapFrom(s => s.OpenStatusSid)); s2d.ForMember(d => d.IsOwned, o => o.MapFrom(s => s.IsOwned)); s2d.ForMember(d => d.MaskedNumber, o => o.MapFrom(s => s.MaskedNumber)); s2d.ForMember(d => d.ProductCategory, o => o.MapFrom(s => s.ProductCategorySid)); s2d.ForMember(d => d.ProductName, o => o.MapFrom(s => s.ProductName)); var d2s = CreateMap<Model.Account, Account>(); d2s.ForMember(s => s.Id, o => o.MapFrom(d => d.Id)); d2s.ForMember(s => s.CreationDate, o => o.MapFrom(d => d.CreationDate)); d2s.ForMember(s => s.DisplayName, o => o.MapFrom(d => d.DisplayName)); d2s.ForMember(s => s.Nickname, o => o.MapFrom(d => d.Nickname)); d2s.ForMember(s => s.OpenStatusSid, o => o.MapFrom(d => d.OpenStatus)); d2s.ForMember(s => s.IsOwned, o => o.MapFrom(d => d.IsOwned)); d2s.ForMember(s => s.MaskedNumber, o => o.MapFrom(d => d.MaskedNumber)); d2s.ForMember(s => s.ProductCategorySid, o => o.MapFrom(d => d.ProductCategory)); d2s.ForMember(s => s.ProductName, o => o.MapFrom(d => d.ProductName)); CosmosMapperProfileCtor(s2d, d2s); } partial void CosmosMapperProfileCtor(AutoMapper.IMappingExpression<Account, Model.Account> s2d, AutoMapper.IMappingExpression<Model.Account, Account> d2s); // Enables the constructor to be extended. } } } #pragma warning restore #nullable restore
using JetBrains.Annotations; using Lykke.Service.BlockchainApi.Contract.Common; namespace Lykke.Service.BlockchainApi.Client.Models { /// <summary> /// Blockchain public address extension constants /// </summary> [PublicAPI] public class PublicAddressExtensionConstants { /// <summary> /// Separator character of the main part and extension /// part of the wallet public address. /// Should be a single character. /// Implementation of the Blockchain.SignService and /// the Blockchain.API should return main and extension /// parts of the public address separated by this /// character as atomic address. /// Lykke platform will pass atomic public address /// consisted of the main and extension parts separated /// by this character where applicable. Extension part /// can be omitted, for example to represent Hot Wallet /// address, if applicable. /// Example: /// separator: ‘$’ /// main public address: “Zgu2QfU9PDyvySPm” /// public address extension: “180468” /// atomic public address: “Zgu2QfU9PDyvySPm$180468” /// </summary> public char Separator { get; } /// <summary> /// Public address extension part name, which will /// displayed to the user whenever public address /// will be displayed or entered by the client. /// </summary> public string DisplayName { get; } /// <summary> /// Public address main part name, which will /// displayed to the user whenever public address /// will be displayed or entered by the client. /// If this field is empty, then default name /// will be used. /// Can be Empty. /// </summary> public string BaseDisplayName { get; } public PublicAddressExtensionConstants(PublicAddressExtensionConstantsContract contract) { if (contract == null) { throw new ResultValidationException("Transaction not found"); } if (char.IsControl(contract.Separator)) { throw new ResultValidationException("Separator can't be control character", (int)contract.Separator); } if (string.IsNullOrWhiteSpace(contract.DisplayName)) { throw new ResultValidationException("Display name can't be empty", contract.DisplayName); } Separator = contract.Separator; DisplayName = contract.DisplayName; BaseDisplayName = contract.BaseDisplayName; } } }
using GeneralExtensions; using System; using System.Windows; namespace ViSo.Dialogs.Input { public static class InputBox { private static ViewerWindow viewer; private static InputBoxModel InputModel { get; set; } public static bool? ShowDialog(string windowTitle, string fieldCaption) { try { InputBox.InputModel = new InputBoxModel(); InputBox.viewer = new ViewerWindow(windowTitle, fieldCaption, InputBox.InputModel); return InputBox.viewer.ShowDialog(); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } finally { InputBox.viewer = null; } return null; } public static bool? ShowDialog(Window owner, bool topMost, string windowTitle, string fieldCaption) { try { InputBox.InputModel = new InputBoxModel(); InputBox.viewer = new ViewerWindow(windowTitle, fieldCaption, InputBox.InputModel); InputBox.viewer.Owner = owner; InputBox.viewer.Topmost = topMost; return InputBox.viewer.ShowDialog(); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } finally { InputBox.viewer = null; } return null; } public static string Result { get { return InputBox.InputModel.Value; } } } }
using System; namespace Flickey.Models.PInvokeComponents { [Flags] public enum KeyboardInputFlag : uint { KEYEVENTF_NONE = 0x0000, KEYEVENTF_EXTENDEDKEY = 0x0001, KEYEVENTF_KEYUP = 0x0002, KEYEVENTF_UNICODE = 0x0004, KEYEVENTF_SCANCODE = 0x0008 } }
#region License // Copyright (c) 2011, ClearCanvas Inc. // All rights reserved. // http://www.clearcanvas.ca // // This software is licensed under the Open Software License v3.0. // For the complete license, see http://www.clearcanvas.ca/OSLv3.0 #endregion using System.Collections.Generic; using ClearCanvas.Common; using ClearCanvas.Common.Utilities; namespace ClearCanvas.ImageViewer.Annotations { [Cloneable] internal sealed class StoredAnnotationBoxGroup { private readonly string _identifier; private readonly AnnotationBox _defaultBoxSettings; private readonly AnnotationBoxList _annotationBoxes; public StoredAnnotationBoxGroup(string identifier) { Platform.CheckForEmptyString(identifier, "identifier"); _identifier = identifier; _defaultBoxSettings = new AnnotationBox(); _annotationBoxes = new AnnotationBoxList(); } /// <summary> /// Cloning constructor. /// </summary> /// <param name="source">The source object from which to clone.</param> /// <param name="context">This parameter is unused.</param> private StoredAnnotationBoxGroup(StoredAnnotationBoxGroup source, ICloningContext context) { this._identifier = source._identifier; this._defaultBoxSettings = source._defaultBoxSettings.Clone(); this._annotationBoxes = source._annotationBoxes.Clone(); } public string Identifier { get { return _identifier; } } public AnnotationBox DefaultBoxSettings { get { return _defaultBoxSettings; } } public IList<AnnotationBox> AnnotationBoxes { get { return _annotationBoxes; } } public StoredAnnotationBoxGroup Clone() { return new StoredAnnotationBoxGroup(this, null); } } }
using DotKcp; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; namespace ConsoleAppUdpServer { public class HostedUdpService : IHostedService { private UdpServer _server; private ILogger _logger; public HostedUdpService(UdpServer server, ILogger<HostedUdpService> logger) { _server = server; _logger = logger; } public Task StartAsync(CancellationToken cancellationToken) { _server.NewSessionConnect += (session) => { _logger.LogInformation($"[新连接进入] conv:{session.Conv}, 当前连接数:{_server.SessionCount}"); }; _server.SessionDisconnect += (session, reason) => { _logger.LogInformation($"[旧连接断开] conv:{session.Conv}, 当前连接数:{_server.SessionCount}"); }; int port = 2020; _server.Start(port); _logger.LogInformation($"开始监听UDP端口: {port}"); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) { return Task.CompletedTask; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; // Added for Stopwatch using System.Diagnostics; // Added for Tasks using System.Threading.Tasks; // Added for Concurrent Collections using System.Collections.Concurrent; namespace Listing4_11 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private ConcurrentDictionary<string, RectangleInfo> _rectanglesDict; private const int MAX_RECTANGLES = 20000; private void GenerateRectangles() { Parallel.For(1, MAX_RECTANGLES + 1, (i) => { for (int j = 0; j < 50; j++) { var newKey = String.Format("Rectangle {0}", i % 5000); var newRect = new RectangleInfo( String.Format("Rectangle {0}", i), new Point(j, j * i), new Size(j * i, i / 2)); _rectanglesDict.AddOrUpdate( newKey, newRect, (key, existingRect) => { // The key already exists if (existingRect != newRect) { // The rectangles are different // It is necessary to update the existing rectangle // to update the existing rectangle // AddOrUpdate doesn’t run // the add or update delegates // while holding a lock // Lock existingRect before calling // the Update method lock (existingRect) { // Call the Update method within // a critical section existingRect.Update(newRect.Location, newRect.Size); } return existingRect; } else { // The rectangles are the same // No need to update the existing one return existingRect; } }); } }); } private void butTest_Click(object sender, RoutedEventArgs e) { var sw = Stopwatch.StartNew(); _rectanglesDict = new ConcurrentDictionary<string, RectangleInfo>(); GenerateRectangles(); foreach (var keyValuePair in _rectanglesDict) { listRectangles.Items.Add( String.Format("{0}, {1}. Updated {2} times.", keyValuePair.Key, keyValuePair.Value.Size, keyValuePair.Value.UpdatedTimes)); } Debug.WriteLine(sw.Elapsed.ToString()); } } class RectangleInfo : IEqualityComparer<RectangleInfo> { // Name property has private set because you use it in a hash code // You don’t want to be able to change the Name // If you change the name, you may never be able // to find the object again in the dictionary public string Name { get; private set; } public Point Location { get; set; } public Size Size { get; set; } public DateTime LastUpdate { get; set; } public int UpdatedTimes { get; private set; } public RectangleInfo(string name, Point location, Size size) { Name = name; Location = location; Size = size; LastUpdate = DateTime.Now; UpdatedTimes = 0; } public RectangleInfo(string key) { Name = key; Location = new Point(); Size = new Size(); LastUpdate = DateTime.Now; UpdatedTimes = 0; } public void Update(Point location, Size size) { Location = location; Size = size; UpdatedTimes++; } public bool Equals(RectangleInfo rectA, RectangleInfo rectB) { return ((rectA.Name == rectB.Name) && (rectA.Size == rectB.Size) && (rectA.Location == rectB.Location)); } public int GetHashCode(RectangleInfo obj) { RectangleInfo rectInfo = (RectangleInfo)obj; return rectInfo.Name.GetHashCode(); } } }
using System.Linq; using System.Threading.Tasks; using GeraFin.DAL.DataAccess; using Microsoft.AspNetCore.Mvc; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.AspNetCore.Authorization; using GeraFin.Models.ViewModels.Syncfusion; using GeraFin.Models.ViewModels.GeraFinWeb; namespace GeraFin.Controllers.Api { [Authorize] [Produces("application/json")] [Route("api/Branches")] public class MyBranchesController : Controller { private readonly ApplicationDbContext _context; public MyBranchesController(ApplicationDbContext context) { _context = context; } [HttpGet] public async Task<IActionResult> GetBranch() { List<Branch> Items = await _context.Branch.ToListAsync(); int Count = Items.Count(); return Ok(new { Items, Count }); } [HttpPost("[action]")] public IActionResult Insert([FromBody]Crud<Branch> payload) { Branch branch = payload.value; _context.Branch.Add(branch); _context.SaveChanges(); return Ok(branch); } [HttpPost("[action]")] public IActionResult Update([FromBody]Crud<Branch> payload) { Branch branch = payload.value; branch.RegionalEmail = User.Identity.Name; branch.LoginRequired = true; _context.Branch.Update(branch); _context.SaveChanges(); return Ok(branch); } [HttpPost("[action]")] public IActionResult Remove([FromBody]Crud<Branch> payload) { Branch branch = _context.Branch.Where(x => x.BranchId == (int)payload.key).FirstOrDefault(); _context.Branch.Remove(branch); _context.SaveChanges(); return Ok(branch); } } }
using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; public class AsciiLevelLoader : MonoBehaviour { // Start is called before the first frame update void Start() { string filePath = Application.dataPath + "/level0.txt"; if (!File.Exists(filePath)) { File.WriteAllText(filePath, "X"); } string[] inputLines = File.ReadAllLines(filePath); for (int y = 0; y < inputLines.Length; y++) { string line = inputLines[y]; for (int x = 0; x < line.Length; x++) { /* if (line[x] == 'X') { //make a wall GameObject newWall = Instantiate(Resources.Load("Prefabs/Wall")) as GameObject; newWall.transform.position = new Vector2(x - line.Length/2f, inputLines.Length/2f - y); } else if (line[x] == 'P') { //make a wall GameObject newPlayer = Instantiate(Resources.Load("Prefabs/Player")) as GameObject; newPlayer.transform.position = new Vector2(x - line.Length/2f, inputLines.Length/2f - y); } else if (line[x] == 'G') { //make a wall GameObject newGold = Instantiate(Resources.Load("Prefabs/Gold")) as GameObject; newGold.transform.position = new Vector2(x - line.Length/2f, inputLines.Length/2f - y); } else if (line[x] == 'T') { //make a wall GameObject newTrap = Instantiate(Resources.Load("Prefabs/Trap")) as GameObject; newTrap.transform.position = new Vector2(x - line.Length/2f, inputLines.Length/2f - y); }*/ GameObject tile = null; switch (line[x]) { case 'X': tile = Instantiate(Resources.Load("Prefabs/Wall")) as GameObject; break; case 'P': tile = Instantiate(Resources.Load("Prefabs/Player")) as GameObject; break; case 'G': tile = Instantiate(Resources.Load("Prefabs/Gold")) as GameObject; break; case 'T': tile = Instantiate(Resources.Load("Prefabs/Trap")) as GameObject; break; default: tile = null; break; } if (tile != null) { tile.transform.position = new Vector2(x - line.Length/2f, inputLines.Length/2f - y); } } } } // Update is called once per frame void Update() { } }
using System.Data.Entity; namespace SoftServe.ITA.PrompterPro.Domain.Models { public class BaseModel : IStateModel { public EntityState EntityState { get; set; } public BaseModel() { EntityState = EntityState.Unchanged; } } }
using System; using System.Collections.Generic; using System.Text; namespace _01._Logger.Common { public static class GlobalConstants { public static string DateTimeFormat = "M/d/yyyy h:mm:ss tt"; public const string INVALID_LEVEL_TYPE = "Invalid level provided!"; public const string INVALID_LAYOUT_TYPE = "Invalid layout provided!"; public const string INVALID_APPENDER_TYPE = "Invalid appender provided!"; public const string INVALID_DATETIME_FORMAT = "Invalid DateTime Format!"; } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; namespace SampleStore.Domain.SharedKernel.Abstractions.TypedIds { // https://thomaslevesque.com/2020/10/30/using-csharp-9-records-as-strongly-typed-ids/ // the type converter will allow for mvc model binding to happen between a string and our strongly-typed Id // this will also tell Newtonsoft.Json to serialize the stongly-typed id to a string. // Newtonsoft looks for a JsonConverter, and if it can't find one for the type it uses the TypeConverter [TypeConverter(typeof(StronglyTypedIdConverter))] public abstract record StronglyTypedId<TValue>(TValue Value) where TValue : notnull { public override string ToString() => Value.ToString(); } }
using Microsoft.WindowsAzure.Storage.Table; using Nethereum.BlockchainProcessing.Processing.Logs; using Nethereum.LogProcessing.Dynamic.Configuration; using System; using System.Collections.Generic; using System.Linq; namespace Nethereum.LogProcessing.Dynamic.Db.Azure.Entities { public class EventSubscriptionEntity : TableEntity, IEventSubscriptionDto { public bool CatchAllContractEvents {get;set; } public long? ContractId { get; set; } public bool Disabled { get; set; } public List<string> EventSignatures { get; set; } /// <summary> /// Azure Table Storage does not allow storage of generic lists /// This property allows the list to be stored and retrieved as a delimeted string /// </summary> public string EventSignaturesCsv { get { return EventSignatures == null ? string.Empty : string.Join(",", EventSignatures); } set { EventSignatures = value.Split(new []{',' }).ToList(); } } public long Id { get => this.RowKeyToLong(); set => RowKey = value.ToString(); } public long SubscriberId { get => this.PartionKeyToLong(); set => PartitionKey = value.ToString(); } } }
namespace EventDriven.Sagas.Configuration.Abstractions.DTO; /// <summary> /// A command performed by a saga action. /// </summary> /// <typeparam name="TExpectedResult">Expected result type.</typeparam> public record SagaCommandDto<TExpectedResult> { /// <summary> /// Optional command name. /// </summary> public string? Name { get; set; } /// <summary> /// Command expected result. /// </summary> public TExpectedResult? ExpectedResult { get; set; } }
using System; using System.ComponentModel; using sd = System.Drawing; using swf = System.Windows.Forms; using Eto.Drawing; using Eto.Forms; using System.Linq; namespace Eto.Platform.Windows { public interface IWindowHandler { swf.ToolTip ToolTips { get; } } public abstract class WindowHandler<T, W> : WindowsContainer<T, W>, IWindow, IWindowHandler where T: swf.Form where W: Window { MenuBar menu; Icon icon; ToolBar toolBar; swf.Panel menuHolder; swf.Panel content; swf.Panel toolbarHolder; swf.ToolTip tooltips = new swf.ToolTip(); public swf.ToolTip ToolTips { get { return tooltips; } } public override object ContainerObject { get { return content; } } public override Size ClientSize { get { return Generator.Convert (Widget.Loaded ? content.MinimumSize : content.Size); } set { content.MinimumSize = Generator.Convert (value); } } public override void Initialize () { base.Initialize (); content = new swf.Panel { AutoSize = true, AutoSizeMode = swf.AutoSizeMode.GrowAndShrink, Dock = swf.DockStyle.Fill }; Control.Controls.Add (content); toolbarHolder = new swf.Panel { Dock = swf.DockStyle.Top, AutoSizeMode = swf.AutoSizeMode.GrowAndShrink, AutoSize = true }; Control.Controls.Add (toolbarHolder); menuHolder = new swf.Panel { AutoSizeMode = swf.AutoSizeMode.GrowAndShrink, AutoSize = true, Dock = swf.DockStyle.Top }; Control.Controls.Add (menuHolder); // Always handle closing because we want to send Application.Terminating event HandleEvent (Window.ClosingEvent); } public override void AttachEvent (string handler) { switch (handler) { case Window.ClosedEvent: Control.FormClosed += delegate { Widget.OnClosed (EventArgs.Empty); }; break; case Window.ClosingEvent: Control.FormClosing += delegate(object sender, swf.FormClosingEventArgs e) { var args = new CancelEventArgs(e.Cancel); Widget.OnClosing (args); if (!e.Cancel && swf.Application.OpenForms.Count <= 1 || e.CloseReason == swf.CloseReason.ApplicationExitCall || e.CloseReason == swf.CloseReason.WindowsShutDown) { Application.Instance.OnTerminating (args); } e.Cancel = args.Cancel; }; break; case Window.ShownEvent: Control.Shown += delegate { Widget.OnShown (EventArgs.Empty); }; break; case Window.MaximizedEvent: Control.Resize += delegate { if (Control.WindowState == swf.FormWindowState.Maximized) { Widget.OnMaximized (EventArgs.Empty); } }; break; case Window.MinimizedEvent: Control.Resize += delegate { if (Control.WindowState == swf.FormWindowState.Minimized) { Widget.OnMaximized (EventArgs.Empty); } }; break; default: base.AttachEvent (handler); break; } } public MenuBar Menu { get { return menu; } set { this.Control.SuspendLayout (); menuHolder.SuspendLayout (); if (menu != null) menuHolder.Controls.Remove ((swf.MenuStrip)menu.ControlObject); if (value == null) { Control.MainMenuStrip = null; } else { var c = (swf.MenuStrip)value.ControlObject; c.Dock = swf.DockStyle.Top; c.ResumeLayout (); menuHolder.Controls.Add (c); Control.MainMenuStrip = c; } menuHolder.ResumeLayout (); this.Control.ResumeLayout (); menuHolder.Update (); menu = value; } } public bool Resizable { get { if (Control.FormBorderStyle == swf.FormBorderStyle.Sizable) return true; else return false; } set { if (value) { Control.FormBorderStyle = swf.FormBorderStyle.Sizable; } else { Control.FormBorderStyle = swf.FormBorderStyle.FixedDialog; } } } public ToolBar ToolBar { get { return this.toolBar; } set { this.Control.SuspendLayout (); toolbarHolder.SuspendLayout(); if (toolBar != null) toolbarHolder.Controls.Remove ((swf.Control)toolBar.ControlObject); toolBar = value; if (toolBar != null) { var c = ((swf.Control)toolBar.ControlObject); c.Dock = swf.DockStyle.Top; c.ResumeLayout (); toolbarHolder.Controls.Add (c); } toolbarHolder.ResumeLayout (); this.Control.ResumeLayout (); toolbarHolder.Update (); } } public void AddToolbar (ToolBar toolBar) { Control.Controls.Add ((swf.Control)toolBar.ControlObject); } public void RemoveToolbar (ToolBar toolBar) { Control.Controls.Remove ((swf.Control)toolBar.ControlObject); } public void ClearToolbars () { foreach (swf.Control c in Control.Controls) { if (c is swf.ToolBar) Control.Controls.Remove (c); } } public void Close () { Control.Close (); } public Icon Icon { get { return icon; } set { icon = value; Control.Icon = (sd.Icon)icon.ControlObject; } } public Point Location { get { return Generator.Convert (Control.Location); } set { Control.Location = Generator.Convert (value); Control.StartPosition = swf.FormStartPosition.Manual; } } public WindowState State { get { switch (Control.WindowState) { case swf.FormWindowState.Maximized: return WindowState.Maximized; case swf.FormWindowState.Minimized: return WindowState.Minimized; case swf.FormWindowState.Normal: return WindowState.Normal; default: throw new NotSupportedException (); } } set { switch (value) { case WindowState.Maximized: Control.WindowState = System.Windows.Forms.FormWindowState.Maximized; break; case WindowState.Minimized: Control.WindowState = System.Windows.Forms.FormWindowState.Minimized; break; case WindowState.Normal: Control.WindowState = System.Windows.Forms.FormWindowState.Normal; break; default: throw new NotSupportedException (); } } } public Rectangle? RestoreBounds { get { if (this.State == WindowState.Normal || Control.RestoreBounds.IsEmpty) return null; else return Generator.Convert (Control.RestoreBounds); } } public double Opacity { get { return Control.AllowTransparency ? Control.Opacity : 1.0; } set { Control.AllowTransparency = value != 1.0; Control.Opacity = value; } } } }
using UnityEngine; using UnityEngine.InputSystem; using static UnityEngine.Vector2; public class Input : MonoBehaviour { public bool Active { get; private set; } private Pointer _pointer; private TouchInfo _info; private void Start() { _pointer = Pointer.current; _info = new TouchInfo(); } private void Update() { CheckPointer(); if (Active) { _info.Pressed = _pointer.press.isPressed; if (_info.Pressed) { if (_info.InitPos == zero) _info.InitPos = _pointer.position.ReadValue(); _info.CurrentPos = _pointer.position.ReadValue(); } else { _info.InitPos = zero; } } } private void CheckPointer() { if (_pointer.enabled) { Active = true; } else { Active = false; } } public TouchInfo GetInput() { return _info; } }
using ComposableAsync; using System; using System.Net.Http; using System.Threading.Tasks; namespace RateLimiter.Example { public class OpenWeatherMapClient { private readonly HttpClient _Client; private readonly string _ApiKey; public OpenWeatherMapClient(string apiKey) { _ApiKey = apiKey; var handler = TimeLimiter .GetFromMaxCountByInterval(60, TimeSpan.FromMinutes(1)) .AsDelegatingHandler(); _Client = new HttpClient(handler) { BaseAddress = new Uri("https://api.openweathermap.org/data/2.5/") }; } public async Task<WeatherDto> GetWeather(string city, string countryCode = null) { var query = $"weather?q={city}{(countryCode == null ? "" : $",{countryCode}")}&appid={_ApiKey}"; var response = await _Client.GetAsync(query); if (!response.IsSuccessStatusCode) return null; return await response.Content.ReadAsAsync<WeatherDto>(); } } }
using Newtonsoft.Json; namespace PodioAPI.Models { public class QuestionAnswer { [JsonProperty("question_option_id")] public int QuestionOptionId { get; set; } [JsonProperty("user")] public Contact User { get; set; } } }
using System; using System.Threading.Tasks; using VTS.DAL.Entities; using VTS.Repos.Generic; namespace VTS.Repos.UsersVacationInfo { /// <summary> /// Interface for UserVacationInfo Repository. /// </summary> public interface IUserVacationInfoRepository : IGenericRepository<UserVacationInfo, Guid> { /// <summary> /// Find UserVacationInfo by User Id. /// </summary> /// <param name="id">User id.</param> /// <returns>UserVacationInfo.</returns> Task<UserVacationInfo> FindByUserId(int id); } }
using System; using System.Collections.Generic; namespace KellermanSoftware.CompareNetObjectsTests.TestClasses { [Serializable] public class EntityWithEquality : Entity { public override int GetHashCode() { if (null != this.Description) return this.Description.GetHashCode(); return base.GetHashCode(); } public override bool Equals(object obj) { var realObj = obj as Entity; if (null == realObj) return false; return realObj.Description.Equals(this.Description); } } }
using System; using System.Dynamic; namespace NConstrictor { public class PyDynamic : DynamicObject { private PyObject _pyObject; public PyDynamic(PyObject pyObject) { _pyObject = pyObject; } // メンバ呼び出し public override bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { PyObject tuppleArgs = PyTuple.New(args.Length); for (int i = 0; i < args.Length; i++) { if (args[i] is int[] intArray) { PyTuple.SetItem(tuppleArgs, i, (PyArray<int>)intArray); } else if (args[i] is float[] floatArray) { PyTuple.SetItem(tuppleArgs, i, (PyArray<float>)floatArray); } else if (args[i] is double[] doubleArray) { PyTuple.SetItem(tuppleArgs, i, (PyArray<double>)doubleArray); } else if (args[i] is PyArray<float> floatPyArray) { PyTuple.SetItem(tuppleArgs, i, floatPyArray); } else if (args[i] is PyArray<double> doublePyArray) { PyTuple.SetItem(tuppleArgs, i, doublePyArray); } else if (args[i] is PyArray<int> intPyArray) { PyTuple.SetItem(tuppleArgs, i, intPyArray); } else { PyTuple.SetItem(tuppleArgs, i, (PyObject)args[i]); } } result = PyObject.CallObject(_pyObject[binder.Name], tuppleArgs); return true; } // プロパティに値を設定しようとしたときに呼ばれる public override bool TrySetMember(SetMemberBinder binder, object value) { Py.IncRef(_pyObject); if (value is int[] intArray) { _pyObject[binder.Name] = (PyArray<int>)intArray; } else if (value is float[] floatArray) { _pyObject[binder.Name] = (PyArray<float>)floatArray; } else if (value is double[] doubleArray) { _pyObject[binder.Name] = (PyArray<double>)doubleArray; } else if (value is PyArray<float> floatPyArray) { _pyObject[binder.Name] = floatPyArray; } else if (value is PyArray<double> doublePyArray) { _pyObject[binder.Name] = doublePyArray; } else if (value is PyArray<int> intPyArray) { _pyObject[binder.Name] = intPyArray; } else { _pyObject[binder.Name] = (PyObject)value; } return true; } // プロパティから値を取得しようとしたときに呼ばれる public override bool TryGetMember(GetMemberBinder binder, out object result) { Py.IncRef(_pyObject); result = _pyObject[binder.Name]; return true; } public static implicit operator PyObject(PyDynamic main) { return main._pyObject; } } }
using System.Collections.Generic; using System.IO.Abstractions; using System.Text.RegularExpressions; namespace FluentTc.Engine { internal interface IPropertiesFileParser { Dictionary<string, string> ParsePropertiesFile(string teamCityBuildPropertiesFile); } internal class PropertiesFileParser : IPropertiesFileParser { private readonly IFileSystem m_FileSystem; private static readonly Regex ParsingRegex = new Regex(@"^(?<Name>(\w+\.)*\w+)=(?<Value>.*)$", RegexOptions.Compiled | RegexOptions.Multiline); public PropertiesFileParser(IFileSystem fileSystem) { m_FileSystem = fileSystem; } public Dictionary<string, string> ParsePropertiesFile(string teamCityBuildPropertiesFile) { Dictionary<string, string> parameters = new Dictionary<string, string>(); var allLines = m_FileSystem.File.ReadAllLines(teamCityBuildPropertiesFile); foreach (var line in allLines) { var match = ParsingRegex.Match(line); if (!match.Success) continue; parameters.Add(match.Groups["Name"].Value, DecodeValue(match.Groups["Value"].Value)); } return parameters; } private static string DecodeValue(string parameterValue) { return parameterValue.Replace(@"\:",@":").Replace(@"\\", @"\").Replace(@"\=", @"="); } } }
using System; using System.Collections.Generic; using System.Text; public class ConsoleAppender : Appender { public ConsoleAppender(ILayout layout) :base(layout) { } public override void Append(string date, ReportLevel level, string message) { if(level >= ReportLevel) { Console.WriteLine(String.Format(Layout.Format, date, level, message)); this.MessagesCount++; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Snoop.DebugListenerTab { public enum FilterType { StartsWith, EndsWith, Contains, RegularExpression } }
//----------------------------------------------------------------------- // <copyright file="IDataPortalProxy.cs" company="Marimer LLC"> // Copyright (c) Marimer LLC. All rights reserved. // Website: https://cslanet.com // </copyright> // <summary>Interface implemented by client-side </summary> //----------------------------------------------------------------------- using System; namespace Csla.DataPortalClient { /// <summary> /// Interface implemented by client-side /// data portal proxy objects. /// </summary> public interface IDataPortalProxy : Server.IDataPortalServer { /// <summary> /// Get a value indicating whether this proxy will invoke /// a remote data portal server, or run the "server-side" /// data portal in the caller's process and AppDomain. /// </summary> bool IsServerRemote { get; } } }
using UnityEngine; using System.Collections; public class DisableDebug : MonoBehaviour { void Start () { #if UNITY_EDITOR Debug.unityLogger.logEnabled = true; #else Debug.logger.logEnabled = false; #endif } }
using System; using System.Collections.Generic; namespace backend.Models { public partial class TbAdministrador { public int CodAdministrador { get; set; } public int? EstadoActivo { get; set; } public DateTime? FechaCreacion { get; set; } public int CodUsuario { get; set; } public int CodInformacionPersonal { get; set; } public virtual TbInformacionPersonal CodInformacionPersonalNavigation { get; set; } public virtual Usuario CodUsuarioNavigation { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reactive; using System.Reactive.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using ReactiveUI; using ReactiveUI.Mobile; using MobileSample_WinRT.Views; using Splat; namespace MobileSample_WinRT.ViewModels { [DataContract] public class AppBootstrapper : ReactiveObject, IApplicationRootState { [DataMember] RoutingState _Router; public RoutingState Router { get { return _Router; } set { _Router = value; } } public AppBootstrapper() { Router = new RoutingState(); var resolver = Locator.CurrentMutable; resolver.Register(() => new TestPage1View(), typeof(IViewFor<TestPage1ViewModel>), "FullScreenLandscape"); resolver.Register(() => new TestPage2View(), typeof(IViewFor<TestPage2ViewModel>), "FullScreenLandscape"); resolver.Register(() => new TestPage3View(), typeof(IViewFor<TestPage3ViewModel>), "FullScreenLandscape"); resolver.Register(() => new TestPage1ViewModel(), typeof(TestPage1ViewModel)); resolver.Register(() => new TestPage2ViewModel(), typeof(TestPage2ViewModel)); resolver.Register(() => new TestPage3ViewModel(), typeof(TestPage3ViewModel)); resolver.RegisterConstant(this, typeof(IApplicationRootState)); resolver.RegisterConstant(this, typeof(IScreen)); resolver.RegisterConstant(new MainPage(), typeof(IViewFor), "InitialPage"); Router.Navigate.Execute(new TestPage1ViewModel(this)); } } }
using System.Text.Json.Serialization; namespace XUMM.NET.SDK.Webhooks.Models; public class XummUserToken { [JsonPropertyName("user_token")] public string UserToken { get; set; } = default!; [JsonPropertyName("token_issued")] public int TokenIssued { get; set; } [JsonPropertyName("token_expiration")] public int TokenExpiration { get; set; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Task08CaloriesCounter { static void Main(string[] args) { var linesNumber = int.Parse(Console.ReadLine()); string[] ingradients = new string[] { "cheese", "domato sauce", "salami", "pepper" }; int[] prices = new int[] { 500, 150, 600, 50 }; int allCalories = 0; for (int i = 0; i < linesNumber; i++) { var currentIngredient = Console.ReadLine().ToLower(); switch (currentIngredient) { case "cheese": allCalories += prices[0]; break; case "tomato sauce": allCalories += prices[1]; break; case "salami": allCalories += prices[2]; break; case "pepper": allCalories += prices[3]; break; default: break; } } Console.WriteLine($"Total calories: { allCalories}"); } }
using MessagePack; namespace MotionGenerator.Serialization { [MessagePackObject] public sealed class ActionBaseSaveData : IActionSaveData, IMotionGeneratorSerializable<ActionBaseSaveData> { [Key(0)] public string Name { get; set; } public ActionBaseSaveData() { } public ActionBaseSaveData(string name) { Name = name; } public IAction Instantiate() { throw new System.NotImplementedException(); } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Linq; using System.Xml; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using RepoTasks.Utilities; namespace RepoTasks { public class AddMetapackageReferences : Task { [Required] public string ReferencePackagePath { get; set; } [Required] public string MetapackageReferenceType { get; set; } [Required] public bool LockToExactVersions { get; set; } [Required] public ITaskItem[] BuildArtifacts { get; set; } [Required] public ITaskItem[] PackageArtifacts { get; set; } [Required] public ITaskItem[] ExternalDependencies { get; set; } public override bool Execute() { // Parse input var metapackageArtifacts = PackageArtifacts.Where(p => p.GetMetadata(MetapackageReferenceType) == "true"); var externalArtifacts = ExternalDependencies.Where(p => p.GetMetadata(MetapackageReferenceType) == "true"); var buildArtifacts = BuildArtifacts.Select(ArtifactInfo.Parse) .OfType<ArtifactInfo.Package>() .Where(p => !p.IsSymbolsArtifact); var xmlDoc = new XmlDocument(); xmlDoc.Load(ReferencePackagePath); // Project var projectElement = xmlDoc.FirstChild; // Items var itemGroupElement = xmlDoc.CreateElement("ItemGroup"); Log.LogMessage(MessageImportance.High, $"{MetapackageReferenceType} will include the following packages"); foreach (var package in metapackageArtifacts) { var packageName = package.ItemSpec; string packageVersion; try { packageVersion = buildArtifacts .Single(p => string.Equals(p.PackageInfo.Id, packageName, StringComparison.OrdinalIgnoreCase)) .PackageInfo.Version.ToString(); } catch (InvalidOperationException) { Log.LogError($"Missing Package: {packageName} from build artifacts"); throw; } var packageVersionValue = LockToExactVersions ? $"[{packageVersion}]" : packageVersion; Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersionValue}"); var packageReferenceElement = xmlDoc.CreateElement("PackageReference"); packageReferenceElement.SetAttribute("Include", packageName); packageReferenceElement.SetAttribute("Version", packageVersionValue); packageReferenceElement.SetAttribute("PrivateAssets", "None"); itemGroupElement.AppendChild(packageReferenceElement); } foreach (var package in externalArtifacts) { var packageName = package.ItemSpec; var packageVersion = package.GetMetadata("Version"); var packageVersionValue = LockToExactVersions ? $"[{packageVersion}]" : packageVersion; Log.LogMessage(MessageImportance.High, $" - Package: {packageName} Version: {packageVersionValue}"); var packageReferenceElement = xmlDoc.CreateElement("PackageReference"); packageReferenceElement.SetAttribute("Include", packageName); packageReferenceElement.SetAttribute("Version", packageVersionValue); packageReferenceElement.SetAttribute("PrivateAssets", "None"); itemGroupElement.AppendChild(packageReferenceElement); } projectElement.AppendChild(itemGroupElement); // Save updated file xmlDoc.AppendChild(projectElement); xmlDoc.Save(ReferencePackagePath); return true; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace HallOfBeorn.Models.LotR.ProductGroups { public class AgainstTheShadowNightmareProductGroup : ProductGroup { public AgainstTheShadowNightmareProductGroup() : base("Against the Shadow Nightmare Decks") { AddMainProduct(Product.HeirsOfNumenorNightmare); AddChildProduct(Product.TheStewardsFearNightmare); AddChildProduct(Product.TheDruadanForestNightmare); AddChildProduct(Product.EncounterAtAmonDinNightmare); AddChildProduct(Product.AssaultOnOsgiliathNightmare); AddChildProduct(Product.TheBloodOfGondorNightmare); AddChildProduct(Product.TheMorgulValeNightmare); } } }
using System; namespace Juice.Collections { [Serializable] public class IntFloatDictionary : SerializableDictionary<int, float> { } }
using System.Collections; using System.Collections.Generic; using UnityEngine; namespace TinyFactory.Common { public class EditorTouchEvent : TouchEvent { private const float TOUCH_SENSETIVE = 1.0f; private bool m_bIsPressed = false; private Vector3 m_vCurrentTouchPosition; private Vector3 m_vPrevTouchPosition; public override void OnTouch() { if(Input.GetMouseButtonDown(0)) { m_vCurrentTouchPosition = Input.mousePosition; m_vPrevTouchPosition = Input.mousePosition; m_bIsPressed = true; if(onPressAction != null) { onPressAction(m_vCurrentTouchPosition); } } else if(Input.GetMouseButtonUp(0)) { m_bIsPressed = false; m_vCurrentTouchPosition = Input.mousePosition; m_vPrevTouchPosition = Input.mousePosition; if(onReleaseAction != null) { onReleaseAction(m_vCurrentTouchPosition); } TouchPositionInit(); } else if(Input.GetMouseButton(0) && m_bIsPressed) { m_vPrevTouchPosition = m_vCurrentTouchPosition; m_vCurrentTouchPosition = Input.mousePosition; float distance = Vector3.Distance(m_vCurrentTouchPosition, m_vPrevTouchPosition); if(distance > TOUCH_SENSETIVE) { if(onMoveAction != null) { onMoveAction(m_vCurrentTouchPosition, m_vPrevTouchPosition); } } else { if(onStationaryAction != null) { onStationaryAction(m_vCurrentTouchPosition); } } } } private void TouchPositionInit() { m_vCurrentTouchPosition = Vector3.zero; m_vPrevTouchPosition = Vector3.zero; } } }
using System.Threading.Tasks; using Mandarin.Commissions; namespace Mandarin.Emails { /// <summary> /// Represents a service that can send emails. /// </summary> public interface IEmailService { /// <summary> /// Sends the <see cref="RecordOfSales"/> to the attached email address. /// </summary> /// <param name="recordOfSales">The artist commission breakdown.</param> /// <returns>SendGrid's API response.</returns> Task<EmailResponse> SendRecordOfSalesEmailAsync(RecordOfSales recordOfSales); } }
namespace VoiceAssistant.Server.Server { public class WebSocketClient<TBag> { public string Ip { get; private set; } public TBag Bag { get; set; } public WebSocketClient(string ip) { Ip = ip; } } }
using System; namespace SocketIOClient.Packgers { public class PingPackger : IUnpackable { public void Unpack(SocketIO client, string text) { if (client.Options.EIO == 4) { client.InvokePingV4(DateTime.Now); } } } }
namespace StackExchange.Profiling.Helpers { using System.Text.RegularExpressions; using System.Web.Script.Serialization; /// <summary> /// Common extension methods to use only in this project /// </summary> internal static class ExtensionMethods { /// <summary> /// Answers true if this String is either null or empty. /// </summary> /// <param name="value"> /// The string value. /// </param> /// <returns>true if the string is null or white space</returns> internal static bool IsNullOrWhiteSpace(this string value) { return string.IsNullOrWhiteSpace(value); } /// <summary> /// Answers true if this String is neither null or empty. /// </summary> /// <param name="value">The string value.</param> /// <returns>The <see cref="bool"/>.</returns> internal static bool HasValue(this string value) { return !string.IsNullOrWhiteSpace(value); } /// <summary> /// truncate the string. /// </summary> /// <param name="s">The string.</param> /// <param name="maxLength">The max length.</param> /// <returns>The <see cref="string"/>.</returns> internal static string Truncate(this string s, int maxLength) { return s != null && s.Length > maxLength ? s.Substring(0, maxLength) : s; } /// <summary> /// Removes trailing / characters from a path and leaves just one /// </summary> /// <param name="input"> /// The input. /// </param> /// <returns>the input string with a trailing slash</returns> internal static string EnsureTrailingSlash(this string input) { if (string.IsNullOrEmpty(input)) return string.Empty; return Regex.Replace(input, "/+$", string.Empty) + "/"; } /// <summary> /// Removes any leading / characters from a path /// </summary> /// <param name="input">The input string.</param> /// <returns>the input string without a leading slash</returns> internal static string RemoveLeadingSlash(this string input) { if (string.IsNullOrEmpty(input)) return string.Empty; return Regex.Replace(input, "^/+", string.Empty); } /// <summary> /// Removes any leading / characters from a path /// </summary> /// <param name="input">The input.</param> /// <returns>the input string without a trailing slash</returns> internal static string RemoveTrailingSlash(this string input) { if (string.IsNullOrEmpty(input)) return string.Empty; return Regex.Replace(input, "/+$", string.Empty); } /// <summary> /// Serializes <paramref name="o"/> to a JSON string. /// </summary> /// <param name="o">the instance to serialise</param> /// <returns>the resulting JSON object as a string</returns> internal static string ToJson(this object o) { return o == null ? null : new JavaScriptSerializer().Serialize(o); } /// <summary> /// Returns a lowercase string of <paramref name="b"/> suitable for use in javascript. /// </summary> internal static string ToJs(this bool b) { return b ? "true" : "false"; } } }
/* Ben Scott * bescott@andrew.cmu.edu * 2015-07-07 * Backpack */ using UnityEngine; using System.Collections; using System.Collections.Generic; //using static PathwaysEngine.Literature.Terminal; using lit=PathwaysEngine.Literature; namespace PathwaysEngine.Inventory { /** `Backpack` : **`Bag`** * * Acts as the main holdall for the `Player`, and cannot be * stored, as `Take()`/`Drop()`-ing the backpack will also * `Wear()`/`Stow()` it, so it can only act as a container * for the `Player`. **/ class Backpack : Bag, IWearable { public bool Worn {get;set;} public override bool Take() { base.Take(); return Player.Current.Wear(this); } public override bool Drop() { base.Drop(); return Player.Current.Stow(this); } public bool Wear() { Worn = true; gameObject.SetActive(true); Literature.Terminal.Log( $"<cmd>You put on the</cmd> {Name.ToLower()}<cmd>.</cmd>"); return false; } public bool Stow() { Worn = false; Literature.Terminal.Log( $"<cmd>You take off the</cmd> {Name.ToLower()}<cmd>.</cmd>"); gameObject.SetActive(false); return false; } public override void Deserialize() => Pathways.Deserialize<Backpack,Backpack_yml>(this); } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace ExampleProject.Models { public class ExampleViewModel { public ExampleViewModel(string name, ICollection<string> friends) { this.Name = name; this.Friends = new List<string>(friends); } public string Name { get; set; } public ICollection<string> Friends { get; set; } } }
public class Meta { public string customerReference { get; set; } public JobValid jobValid { get; set; } }
using Newtonsoft.Json; namespace Cinema.DataProcessor.ExportDto { public class ExportCustomerByMovieDto { [JsonProperty("FirstName")] public string FirstName { get; set; } [JsonProperty("LastName")] public string LastName { get; set; } [JsonProperty("Balance")] public string Balance { get; set; } } }
using Microsoft.AspNetCore.Mvc.Filters; namespace TEAMModelOS.SDK.Context.Attributes.AllowCors { /// <summary> /// 跨域处理 /// </summary> public class AllowCorsAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { var context = filterContext.HttpContext; //context.Response.Headers.Add("Access-Control-Allow-Origin", "*"); context.Response.Headers.Add("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS, POST, PUT"); context.Response.Headers.Add("Access-Control-Allow-Headers", "Access-Control-Allow-Headers," + " Origin,Accept, X-Requested-With, Content-Type, " + "Access-Control-Request-Method, Access-Control-Request-Headers," + "Content-Type,Accept,access_token,token,Authorization"); base.OnActionExecuting(filterContext); } } }
using McMaster.Extensions.CommandLineUtils; using System; using System.Reflection; namespace VersionGenerator.Tool { internal static class Program { public static int Main(string[] args) { var now = DateTimeOffset.Now; var app = new CommandLineApplication(); app.Name = "VersionGenerator.exe"; app.FullName = "Version Generator"; app.ValueParsers.AddOrReplace(new DateTimeOffsetValueParser()); app.HelpOption(); app.VersionOption("-v|--version", ThisAssembly.GetName().Version.ToString()); app.Command("A", command => { command.Description = "Generate a type-A version"; command.HelpOption(); var optionTimestamp = command.OptionTimestamp(); var optionMajor = command.OptionMajorVersion(); var optionMinor = command.OptionMinorVersion(); command.OnExecute(() => { var version = VersionTypeA.GenerateFromTimestamp( timestamp: optionTimestamp.ParsedValue ?? now, major: optionMajor.ParsedValue ?? 1, minor: optionMinor.ParsedValue ?? 0); Console.WriteLine(version); return 0; }); }); app.Command("B", command => { command.Description = "Generate a type-B version"; command.HelpOption(); var optionTimestamp = command.OptionTimestamp(); var optionMajor = command.OptionMajorVersion(); var optionMinor = command.OptionMinorVersion(); command.OnExecute(() => { var version = VersionTypeB.GenerateFromTimestamp( timestamp: optionTimestamp.ParsedValue ?? now); Console.WriteLine(version); return 0; }); }); app.Command("C", command => { command.Description = "Generate a type-C version"; command.HelpOption(); var optionTimestamp = command.OptionTimestamp(); var optionMajor = command.OptionMajorVersion(); command.OnExecute(() => { var version = VersionTypeC.GenerateFromTimestamp( timestamp: optionTimestamp.ParsedValue ?? now, major: optionMajor.ParsedValue ?? 1); Console.WriteLine(version); return 0; }); }); // When executing without a command, just show the help. app.OnExecute(() => { app.ShowHelp(); }); // Run the app. try { return app.Execute(args); } catch (Exception) { app.ShowHelp(); return -1; } } /// <summary> /// Gets this assembly. /// </summary> private static Assembly ThisAssembly { get; } = typeof(Program).GetTypeInfo().Assembly; } }
using System; using System.Threading.Tasks; using P42.Utils; namespace Forms9Patch { /// <summary> /// Print service. /// </summary> public interface IPrintService { /// <summary> /// Print the specified webView and jobName. /// </summary> /// <param name="webView">Web view.</param> /// <param name="jobName">Job name.</param> /// <param name="failAction">What to do if the method fails</param> Task PrintAsync(Xamarin.Forms.WebView webView, string jobName, FailAction failAction = FailAction.ShowAlert); /// <summary> /// Print the specified HTML with jobName /// </summary> /// <param name="html"></param> /// <param name="jobName"></param> /// <param name="failAction">What to do if the method fails</param> Task PrintAsync(string html, string jobName, FailAction failAction = FailAction.ShowAlert); /// <summary> /// Cans the print. /// </summary> /// <returns><c>true</c>, if print was caned, <c>false</c> otherwise.</returns> bool CanPrint(); } }
//*************************************************** //* This file was generated by tool //* SharpKit //*************************************************** using System; using System.Collections.Generic; using SharpKit.JavaScript; namespace Y_.DataSource_ { /// <summary> /// Get Utility subclass for the DataSource Utility. /// </summary> public partial class Get : Local { [JsMethod(JsonInitializers=true)] public Get(){} /// <summary> /// Passes query string to Get Utility. Fires <code>response</code> event when /// response is received asynchronously. /// </summary> protected void _defRequestFn(object e){} /// <summary> /// Default method for adding callback param to url. See /// generateRequestCallback attribute. /// </summary> protected void _generateRequest(object guid){} /// <summary> /// Accepts the DataSource instance and a callback ID, and returns a callback /// param/value string that gets appended to the script URI. Implementers /// can customize this string to match their server's query syntax. /// </summary> public JsAction generateRequestCallback{get;set;} } }
namespace FoxTunes { /// <summary> /// Interaction logic for StreamPosition.xaml /// </summary> [UIComponent("9C2BD136-A337-448C-906B-7317C43990B6", role: UIComponentRole.Playback)] public partial class StreamPosition : UIComponentBase { public StreamPosition() { this.InitializeComponent(); } } }
using DataAccess; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Repositories { public class UnitOfWork { private OnlineShopEntities Context = new OnlineShopEntities(); private CategoryRepository categoryRepository; private CityRepository cityRepository; private PCsRepository pcsRepository; private ProductRepository productRepository; private SalesRepository salesRepository; private SmartphonesRepository smartphonesRepository; private UserRepository userRepository; public CategoryRepository CategoryRepository { get { if (this.categoryRepository == null) { this.categoryRepository = new CategoryRepository(Context); } return categoryRepository; } } public CityRepository CityRepository { get { if (this.cityRepository == null) { this.cityRepository = new CityRepository(Context); } return cityRepository; } } public PCsRepository PCsRepository { get { if (this.pcsRepository == null) { this.pcsRepository = new PCsRepository(Context); } return pcsRepository; } } public ProductRepository ProductRepository { get { if (this.productRepository == null) { this.productRepository = new ProductRepository(Context); } return productRepository; } } public SalesRepository SalesRepository { get { if (this.salesRepository == null) { this.salesRepository = new SalesRepository(Context); } return salesRepository; } } public SmartphonesRepository SmartphonesRepository { get { if (this.smartphonesRepository == null) { this.smartphonesRepository = new SmartphonesRepository(Context); } return smartphonesRepository; } } public UserRepository UserRepository { get { if (this.userRepository == null) { this.userRepository = new UserRepository(Context); } return userRepository; } } public int Save() { return Context.SaveChanges(); } } }
/* * Firebird ADO.NET Data provider for .NET and Mono * * The contents of this file are subject to the Initial * Developer's Public License Version 1.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.firebirdsql.org/index.php?op=doc&id=idpl * * Software distributed under the License is distributed on * an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either * express or implied. See the License for the specific * language governing rights and limitations under the License. * * Copyright (c) 2002, 2004 Carlos Guzman Alvarez * All Rights Reserved. */ using System; using System.Data; using System.Collections; using FirebirdSql.Data.Firebird; using FirebirdSql.Data.Firebird.Isql; using NUnit.Framework; namespace FirebirdSql.Data.Firebird.Tests { [TestFixture] public class FbDatabaseSchemaTest : BaseTest { public FbDatabaseSchemaTest() : base(false) { } [Test] public void CharacterSets() { Connection.GetSchema("CharacterSets"); } [Test] public void CheckConstraints() { Connection.GetSchema("CheckConstraints"); } [Test] public void CheckConstraintsByTable() { Connection.GetSchema("CheckConstraintsByTable"); } [Test] public void Collations() { Connection.GetSchema("Collations"); } [Test] public void Columns() { DataTable columns = Connection.GetSchema("Columns"); columns = Connection.GetSchema( "Columns", new string[] { null, null, "TEST", "INT_FIELD" }); Assert.AreEqual(1, columns.Rows.Count); } [Test] public void ColumnPrivileges() { Connection.GetSchema("ColumnPrivileges"); } [Test] public void Domains() { Connection.GetSchema("Domains"); } [Test] public void ForeignKeys() { Connection.GetSchema("ForeignKeys"); } [Test] public void Functions() { Connection.GetSchema("Functions"); } [Test] public void Generators() { Connection.GetSchema("Generators"); } [Test] public void Indexes() { Connection.GetSchema("Indexes"); } [Test] public void PrimaryKeys() { DataTable primaryKeys = Connection.GetSchema("PrimaryKeys"); primaryKeys = Connection.GetSchema( "PrimaryKeys", new string[] { null, null, "TEST" }); Assert.AreEqual(1, primaryKeys.Rows.Count); } [Test] public void ProcedureParameters() { Connection.GetSchema("ProcedureParameters"); DataTable procedureParameters = Connection.GetSchema( "ProcedureParameters", new string[] { null, null, "SELECT_DATA" }); Assert.AreEqual(3, procedureParameters.Rows.Count); } [Test] public void ProcedurePrivileges() { Connection.GetSchema("ProcedurePrivileges"); } [Test] public void Procedures() { DataTable procedures = Connection.GetSchema("Procedures"); procedures = Connection.GetSchema( "Procedures", new string[] { null, null, "SELECT_DATA" }); Assert.AreEqual(1, procedures.Rows.Count); } [Test] public void DataTypes() { Connection.GetSchema("DataTypes"); } [Test] public void Roles() { Connection.GetSchema("Roles"); } [Test] public void Tables() { DataTable tables = Connection.GetSchema("Tables"); tables = Connection.GetSchema( "Tables", new string[] { null, null, "TEST" }); Assert.AreEqual(tables.Rows.Count, 1); tables = Connection.GetSchema( "Tables", new string[] { null, null, null, "TABLE" }); Assert.AreEqual(tables.Rows.Count, 1); } [Test] public void TableConstraints() { Connection.GetSchema("TableConstraints"); } [Test] public void TablePrivileges() { Connection.GetSchema("TablePrivileges"); } [Test] public void Triggers() { Connection.GetSchema("Triggers"); } [Test] public void UniqueKeys() { Connection.GetSchema("UniqueKeys"); } [Test] public void ViewColumnUsage() { Connection.GetSchema("ViewColumnUsage"); } [Test] public void Views() { Connection.GetSchema("Views"); } [Test] public void ViewPrivileges() { Connection.GetSchema("ViewPrivileges"); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class HealBuff : Buff { [SerializeField] private int _healAmount; public override IEnumerator Feedback() { throw new System.NotImplementedException(); } public override void OnPickUp(Collider other) { var e = other.GetComponent<IEntity<AlliedEntity>>(); if (e != null) { e.TakeHeal(_healAmount); ReturnToPool(); } } public override void OnReset() { Debug.Log("Heal"); } public override void ReturnToPool() { BuffPoolManager.Instance.healPool.ReturnObject(this); } public override void TurnOff(Buff type) { type.gameObject.SetActive(false); } public override void TurnOn(Buff type) { type.OnReset(); type.gameObject.SetActive(true); } public void Update() { MoveTowardDirection(Vector3.down * Time.deltaTime * speedTowardsPlayer); } private void OnTriggerEnter(Collider other) { OnPickUp(other); } }
using NBitcoin; using System.Collections; using System.Collections.Generic; using UnityEngine; [System.Serializable] public class MultiWalletInfo { public List<string> pubstr; public List<string> btcAddress; //地址 public List<string> walletName; //钱包名称 public int MultiSig_M; public int MultiSig_N; public string Multi_walletName; public string Multi_btcAddress; // Use this for initialization void Start () { pubstr = new List<string>(); btcAddress = new List<string>(); walletName = new List<string>(); } public List<PubKey> GetPukList() { List<PubKey> pubList = new List<PubKey>(); for (int i = 0; i < pubstr.Count; i++) { PubKey pubKey = new PubKey(pubstr[i]); pubList.Add(pubKey); } return pubList; } public PubKey GetPuk(string addr) { for (int i = 0; i < btcAddress.Count; i++) { if (addr== btcAddress[i]) { PubKey pubKey = new PubKey(pubstr[i]); return pubKey; } } return null; } public string GetAddress(PubKey puk) { List<PubKey> pubList = GetPukList(); for (int i = 0; i < pubList.Count; i++) { if (puk == pubList[i]) { return btcAddress[i]; } } return null; } }
namespace DotaESport.Web.ViewModels.Teams { using System; using System.Collections.Generic; using System.Text; using DotaESport.Data.Models; using DotaESport.Services.Mapping; using DotaESport.Web.ViewModels.Players; public class TeamViewModel : IMapFrom<Team> { public int Id { get; set; } public string Name { get; set; } public string Logo { get; set; } public string Location { get; set; } public string Region { get; set; } public string Coach { get; set; } public decimal? TotalEarnings { get; set; } public string TeamCaptain { get; set; } public IEnumerable<PlayerViewModel> Players { get; set; } } }
using System; namespace Project0.StoreApplication.Domain.Models { public class Product { string productName1; string productName2; string productName3; decimal burritoPrice; decimal saladPrice; decimal quesadillaPrice; public string ProductBurrito() { productName1 = "burrito"; burritoPrice = 14.95m; string productChoice1 = Console.ReadLine(); return productName1; } public decimal DisplayBurritoPrice() { burritoPrice = 14.95m; Console.WriteLine(burritoPrice); return burritoPrice; } public string ProductSalad() { productName2 = "salad"; saladPrice = 12.95m; string productChoice4 = Console.ReadLine(); return productName2; } public decimal DisplaySaladPrice() { saladPrice = 12.95m; Console.WriteLine(saladPrice); return saladPrice; } public string ProductQuesadilla() { productName3 = "quesadilla"; quesadillaPrice = 10.95m; string productChoice3 = Console.ReadLine(); return productName3; } public decimal DisplayQuesadillaPrice() { quesadillaPrice = 10.95m; Console.WriteLine(quesadillaPrice); return quesadillaPrice; } public string DisplayProducts() //edit to display price { //this is where they view what is available string displayedProduct = "View products: \n Burrito \n Salad \n Quesadilla"; Console.WriteLine(displayedProduct); return displayedProduct; } public int ProductId { get; set; } public string Name { get; set; } public decimal Price { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using AecCloud.Core.Domain.Projects; namespace AecCloud.Data.Mapping.Projects { public class SharedFileMap : EntityMap<SharedFile> { public SharedFileMap() { ToTable("SharedFile"); HasKey(c => c.Id); Property(c => c.UrlPart).IsRequired(); Property(c => c.Password).IsRequired(); Property(c => c.UrlKey).IsRequired(); } } }
#pragma warning disable IDE1006 // Naming Styles using Microsoft.AspNetCore.Components; namespace ServiceStack.Blazor.Components; /// <summary> /// The Base class for all ServiceStack.Blazor Components /// </summary> public abstract class UiComponentBase : ComponentBase { /// <summary> /// Optional user defined classes for this component /// </summary> [Parameter] public string? @class { get; set; } /// <summary> /// Return any user-defined classes along with optional classes for when component is in a `valid` or `invalid` state /// </summary> /// <param name="valid">css classes to include when valid</param> /// <param name="invalid">css classes to include when invalid</param> /// <returns></returns> protected virtual string CssClass(string? valid = null, string? invalid = null) => CssUtils.ClassNames(@class); /// <summary> /// Helper to combine multiple css classes. Strings can contain multiple classes, empty strings are ignored. /// </summary> /// <param name="classes"></param> /// <returns></returns> protected virtual string ClassNames(params string?[] classes) => CssUtils.ClassNames(classes); }
using System; namespace SEDC.Class04.Strings { class Program { static void Main(string[] args) { string str = "Trajan"; string emtpyString = "Stevkovski"; string concatString = str + " " + emtpyString; string text = "Program: Hello {0}, Program: How are you today? {1}: Im good. "; string textFormated = string.Format(text, str, str); int phoneNumber = 078270396; // 078-270-396 string formatedPhoneNumber = FormatPhoneNumber(phoneNumber); string str2 = $"Program: Hello {str}, Program: How are you today? {str}: Im good. "; string str3 = "C:\\SEDC"; string str4 = @"C:\SEDC"; string str5 = "Hello \"World\" !!"; string str6 = @"Hello ""World"" !!"; string path = "SEDC"; string str7 = @$"C:\{path}"; int stringLength = str7.Length; string toLower = str2.ToLower(); bool startsWith = str2.StartsWith("Program"); bool startsWithCaseInsensitive = str2.ToUpper().StartsWith("Program".ToUpper()); //string fullName = string.Format("{0} {1} {2} {3} {4}", str, emtpyString, str, str, emtpyString); string str111 = $"Program: Hello {str}, Program: How are you today? {str}: Im good. "; string today = "good"; int indexOf = str2.IndexOf(today); string substr = str2.Substring(44, 5); int strLength = "asdasddasdasd".Length; string subStr = str2.Substring(indexOf, today.Length); string trimedString = str2.Trim(); string[] splitedString = trimedString.Split(' '); //foreach (string item in splitedString) //{ // Console.WriteLine(item); //} string str02 = $"Program: Hello {str}, Program: How are you today? {str}: Im good. "; char[] charArray = str02.ToCharArray(); //foreach (char item in charArray) //{ // if(item == 'a') // { // Console.Write(item.ToString().ToUpper()); // continue; // } // Console.Write(item); //} string joinedString = string.Join(':', splitedString); string str03 = "Program: Hello {{name}}, Program: How are you today? {{name}}: Im good. "; string replacedString = str03.Replace("{{name}}", str).Replace("Program", "Toshe"); string notTrimedString = " Trajan "; string trimedString1 = "+" + notTrimedString.Trim() + "+"; string testString = "+" + notTrimedString + "+"; Console.WriteLine(testString); Console.ReadLine(); } public static string FormatPhoneNumber(int phoneNumber) { return string.Format("{0:0##-###-###}", phoneNumber); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class DepthCamera : MonoBehaviour { private RenderTexture m_colorTex; private RenderTexture m_depthTex; private Material m_postRenderMat; void Start () { Camera cam = GetComponent<Camera>(); cam.depthTextureMode = DepthTextureMode.Depth; // カラーバッファ用 RenderTexture m_colorTex = new RenderTexture(Screen.width, Screen.height, 0, RenderTextureFormat.Default); m_colorTex.Create(); // デプスバッファ用 RenderTexture m_depthTex = new RenderTexture(Screen.width, Screen.height, 24, RenderTextureFormat.Depth); m_depthTex.Create(); // cameraにカラーバッファとデプスバッファをセットする cam.SetTargetBuffers(m_colorTex.colorBuffer, m_depthTex.depthBuffer); m_postRenderMat = new Material(Shader.Find("Unilt/Texture")); m_postRenderMat.hideFlags = HideFlags.HideAndDontSave; } void OnPostRender() { // RenderTarget無し:画面に出力される Graphics.SetRenderTarget(null); // デプスバッファを描画する(m_postRenderMatはテクスチャ画像をそのまま描画するマテリアル) Graphics.Blit(m_depthTex, m_postRenderMat); } }
using System; using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; /* * Cinema4Dのキーフレームjsonデータをアニメーションカーブに変換する */ namespace GarageKit { [Serializable] public class AnimationTrack { // C4Dでのアニメ―ショントラックタイプ public enum TRACK_TYPE { POS_X = 0, POS_Y, POS_Z, ROT_X, ROT_Y, ROT_Z }; public TRACK_TYPE type = TRACK_TYPE.POS_X; // キーフレームから変換されるアニメカーブ public AnimationCurve curve; public AnimationTrack() { } // C4Dでのトラック名の取得 public string GetTrackName() { string name = ""; switch(this.type) { case TRACK_TYPE.POS_X: name = "Position . X"; break; case TRACK_TYPE.POS_Y: name = "Position . Y"; break; case TRACK_TYPE.POS_Z: name = "Position . Z"; break; case TRACK_TYPE.ROT_X: name = "Rotation . P"; break; case TRACK_TYPE.ROT_Y: name = "Rotation . H"; break; case TRACK_TYPE.ROT_Z: name = "Rotation . B"; break; default: break; } return name; } } public class AnimDataApply : MonoBehaviour { // 参照ファイル(json) public string filePath = "animdata.txt"; // アニメーションデータ反映トラック public AnimationTrack[] animTracks; private Dictionary<string, List<float>> data; public Dictionary<string, List<float>> Data { get{ return data; } } void Awake() { // ファイルの読み込み data = JsonUtility.FromJson<Dictionary<string, List<float>>>(File.ReadAllText(filePath)); } void Start() { // アニメーションカーブを初期化 InitAnimCurve(); } void Update() { } // アニメーションカーブを初期化 private void InitAnimCurve() { foreach(AnimationTrack track in animTracks) { if(data.ContainsKey(track.GetTrackName())) { List<float> keyframes = new List<float>(); //C4Dの座標系を変換してキーフレームを取得 foreach(float keyframe in data[track.GetTrackName()]) keyframes.Add(ConvertC4DSpace(track.type, keyframe)); //アニメーションカーブに反映 track.curve = new AnimationCurve(); for(int i = 0; i < keyframes.Count; i++) track.curve.AddKey((float)i / (float)keyframes.Count, keyframes[i]); } } } // カーブを選択取得 public AnimationCurve GetCurve(AnimationTrack.TRACK_TYPE type) { AnimationCurve curve = null; AnimationTrack track = Array.Find(animTracks, t => (t.type == type)); if(track != null) curve = track.curve; return curve; } // キーフレーム最大値を取得 public int GetTotalFrame() { int totalFrame = 0; foreach(AnimationTrack track in animTracks) { if(totalFrame < track.curve.keys.Length) totalFrame = track.curve.keys.Length; } return totalFrame; } // C4Dの座標系を変換 private float ConvertC4DSpace(AnimationTrack.TRACK_TYPE type, float keyValue) { switch(type) { case AnimationTrack.TRACK_TYPE.POS_X: keyValue = keyValue / 100.0f * -1.0f; break; case AnimationTrack.TRACK_TYPE.POS_Y: keyValue = keyValue / 100.0f; break; case AnimationTrack.TRACK_TYPE.POS_Z: keyValue = keyValue / 100.0f * -1.0f; break; case AnimationTrack.TRACK_TYPE.ROT_X: keyValue = keyValue * Mathf.Rad2Deg * -1.0f; break; case AnimationTrack.TRACK_TYPE.ROT_Y: keyValue = (keyValue < 0.0f) ? 180.0f - (keyValue * Mathf.Rad2Deg) : (keyValue * Mathf.Rad2Deg) + 180.0f; break; case AnimationTrack.TRACK_TYPE.ROT_Z: keyValue = keyValue * Mathf.Rad2Deg * -1.0f; break; default: break; } return keyValue; } } }
using System; using Kameffee.AudioPlayer; using UnityEngine; namespace Samples.Scripts { public class AudioDemo : MonoBehaviour { private void Start() { AudioPlayer.Instance.Initialize(); } public void Play(int id) { AudioPlayer.Instance.Bgm.Play(id); } public void CrossFade(int id) { AudioPlayer.Instance.Bgm.CrossFade(id, 3f); } public void Stop() { AudioPlayer.Instance.Bgm.Stop(); } } }
using System.ComponentModel.DataAnnotations; namespace RentalData.Models { public abstract class RentalAsset { public int Id { get; set; } [Required] public string Brand { get; set; } [Required] public string Name { get; set; } [Required] public int Available { get; set; } public string Description { get; set; } public float Rating { get; set; } public string ImageUrl { get; set; } public string AltImgUrl1 { get; set; } public string AltImgUrl2 { get; set; } public string AltImgUrl3 { get; set; } public string AltImgUrl4 { get; set; } public string AltImgUrl5 { get; set; } } }
using System.Threading.Tasks; using TechTalk.SpecFlow; using NServiceBus.Transport; using SFA.DAS.EmployerIncentives.Api.AcceptanceTests.Hooks; namespace SFA.DAS.EmployerIncentives.Api.AcceptanceTests.Bindings { [Binding] [Scope(Tag = "messageBus")] public class MessageBus { private readonly TestContext _context; public MessageBus(TestContext context) { _context = context; } [BeforeScenario(Order = 2)] public Task InitialiseMessageBus() { _context.MessageBus = new TestMessageBus(_context); _context.Hooks.Add(new Hook<MessageContext>()); return _context.MessageBus.Start(); } [AfterScenario()] public async Task CleanUp() { if (_context.MessageBus != null && _context.MessageBus.IsRunning) { await _context.MessageBus.Stop(); } } } }
using System.Windows.Controls; namespace PostprocessEditor.Views; /// <summary> /// Interaction logic for PointListUserControl.xaml /// </summary> public partial class PointListUserControl : UserControl { public PointListUserControl() { InitializeComponent(); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class Menu : MonoBehaviour { //armazenadno o nome do player [SerializeField] private GameObject nameDB; public void StartGame() { //comando para fazer cm q esse nome seja mantido em todas as cenas do projeto PlayerPrefs.SetString("PlayerName", nameDB.GetComponent<Text>().text); SceneManager.LoadScene(0); } }
using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using System; using System.Collections.Generic; using System.Linq; using System.Net.Mail; using System.Threading.Tasks; namespace AdvertismentPlatform.Handlers { public class EmailHandler : IEmailSender { private IConfiguration Configuration { get; } private SmtpClient client; private MailAddress mailFrom; public EmailHandler(IConfiguration configuration) { Configuration = configuration; string username = Configuration.GetConnectionString("address"); string password = Configuration.GetConnectionString("password"); client = new SmtpClient("smtp.gmail.com"); client.Credentials = new System.Net.NetworkCredential(username, password); client.Port = 587; client.EnableSsl = true; mailFrom = new MailAddress("advertismentplatform@gmail.com"); } public async Task<bool> SendEmail(string receiver, string subject, string message) { MailAddress mailTo = new MailAddress(receiver); MailMessage mailMessage = new MailMessage(mailFrom, mailTo); mailMessage.Body = message; mailMessage.Subject = subject; try { await client.SendMailAsync(mailMessage); } catch(Exception ex) { Console.WriteLine(ex.StackTrace); return false; } return true; } } }
using System; using System.Collections.Generic; using System.Text; namespace UserManagement.Entity { public class Device:BaseEntity { public string DeviceName { get; set; } public string DeviceDes { get; set; } public string COM { get; set; } public int BaudRate { get; set; } = 9600; public System.IO.Ports.Parity Parity { get; set; } = System.IO.Ports.Parity.None; public int DataBits { get; set; } = 8; public System.IO.Ports.StopBits StopBits { get; set; } = System.IO.Ports.StopBits.One; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Sandbox; namespace PerfectHunter { public class PlayerWeapon : BaseWeapon { public override void Spawn() { SetModel( "weapons/jpumper.vmdl" ); Log.Info( "Weapon spawned" ); } [Event.Tick] public void Attack() { if ( IsServer ) return; if ( !Input.Pressed( InputButton.Attack1 ) ) return; Log.Info( "Shooting!" ); SetAnimBool( "fire", true ); CalculateShoot( Input.Cursor.Origin, Input.Cursor.Direction ); } [ServerCmd] public static void CalculateShoot(Vector3 origin, Vector3 dir) { var result = Trace.Ray( new Ray(origin, dir), 100000 ).Run(); Log.Info( result.Hit ); if ( !result.Hit || result.Entity == null ) { HunterGame.Score--; HunterGame.SetLocalScore( HunterGame.Score ); return; } Log.Info( "Hit!" ); DeleteTarget( result.Entity ); } [ServerCmd] public static void DeleteTarget(Entity ent) { ent.Delete(); HunterGame.Score++; HunterGame.SetLocalScore( HunterGame.Score ); } } }
using Moq.Modules; using OwinFramework.Pages.Core.Interfaces.Managers; namespace OwinFramework.Pages.Mocks.Managers { public class MockIdManager: MockImplementationProvider<IIdManager> { private int _next = 1; protected override void SetupMock(IMockProducer mockProducer, Moq.Mock<IIdManager> mock) { mock.Setup(m => m.GetUniqueId()).Returns(() => _next++); } } }
using Domain.Framework.Constants; using FluentMigrator; namespace Migrations { [Migration(202007202040)] public class _202007202040_add_isenabledforbanners_to_users_table : Migration { public override void Down() { Delete.Column("IsEnabledForBanners").FromTable(TableConstants.Users); } public override void Up() { Alter.Table(TableConstants.Users).AddColumn("IsEnabledForBanners") .AsBoolean().NotNullable().WithDefaultValue(false); } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using UnityEngine; namespace Microsoft.MixedReality.Toolkit.Utilities { /// <summary> /// Component to animate and visualize a sphere that can be used with /// per pixel based clipping. /// </summary> [ExecuteInEditMode] public class ClippingSphere : ClippingPrimitive { /// <summary> /// The radius of the clipping sphere, which is determined by the largest axis of the transform's scale. /// </summary> public float Radius { get { Vector3 lossyScale = transform.lossyScale * 0.5f; return Mathf.Max(Mathf.Max(lossyScale.x, lossyScale.y), lossyScale.z); } } private int clipSphereID; protected override string Keyword { get { return "_CLIPPING_SPHERE"; } } protected override string ClippingSideProperty { get { return "_ClipSphereSide"; } } private void OnDrawGizmosSelected() { if (enabled) { Gizmos.DrawWireSphere(transform.position, Radius); } } protected override void Initialize() { base.Initialize(); clipSphereID = Shader.PropertyToID("_ClipSphere"); } protected override void UpdateShaderProperties(MaterialPropertyBlock materialPropertyBlock) { Vector3 position = transform.position; Vector4 sphere = new Vector4(position.x, position.y, position.z, Radius); materialPropertyBlock.SetVector(clipSphereID, sphere); } } }
using static System.Console; /// <summary> /// https://youtu.be/ZGHBGFLuvmg /// </summary> namespace Delegados1 { //Desarrollo 1 //public delegate void Delegado(); //Desarrollo 2 //public delegate void Delegado(int x); //Desarrollo 3 //public delegate int Delegado(int numero); //Desarrollo 4 public delegate void Delegado(int numero); class Program { static void Main(string[] args) { //Desarrollo 1 //Delegado delegado1 = Método; //Desarrollo 2 //Delegado delegado2 = Método; // Desarrollo 3 //Delegado cuadrado = delegate (int n) { return n * n; }; //WriteLine(cuadrado(5)); //Desarrollo 4 Delegado delegado4a, delegado4b, delegado4c, delegado4d; delegado4a = Metodo1; delegado4b = Metodo2; delegado4c = delegado4a + delegado4b; delegado4d = Metodo1; delegado4d += Metodo2; /*==================================================================*/ //Desarrrollo 1 //delegado1(); //Desarrollo 2 //delegado2(100); //Desarrollo 4 delegado4c(5); delegado4c -= delegado4b; delegado4c(7); delegado4d(9); ReadKey(); } //Desarrollo 1 //public static void Método() { WriteLine("Método"); } //Desarrollo 2 //public static void Método(int numero) { WriteLine($"Número {numero}"); } //Desarrollo 4 public static void Metodo1(int i) { WriteLine($"\nMétodo 1: {i}"); } public static void Metodo2(int i) { WriteLine($"Método 2: {i}"); } } }
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ using System; using System.Collections.Generic; using Aliyun.Acs.Core.Transform; using Aliyun.Acs.LinkWAN.Model.V20190301; namespace Aliyun.Acs.LinkWAN.Transform.V20190301 { public class ListNodeGroupsResponseUnmarshaller { public static ListNodeGroupsResponse Unmarshall(UnmarshallerContext _ctx) { ListNodeGroupsResponse listNodeGroupsResponse = new ListNodeGroupsResponse(); listNodeGroupsResponse.HttpResponse = _ctx.HttpResponse; listNodeGroupsResponse.RequestId = _ctx.StringValue("ListNodeGroups.RequestId"); listNodeGroupsResponse.Success = _ctx.BooleanValue("ListNodeGroups.Success"); ListNodeGroupsResponse.ListNodeGroups_Data data = new ListNodeGroupsResponse.ListNodeGroups_Data(); data.TotalCount = _ctx.LongValue("ListNodeGroups.Data.TotalCount"); List<ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup> data_list = new List<ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup>(); for (int i = 0; i < _ctx.Length("ListNodeGroups.Data.List.Length"); i++) { ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup nodeGroup = new ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup(); nodeGroup.NodeGroupId = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].NodeGroupId"); nodeGroup.NodeGroupName = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].NodeGroupName"); nodeGroup.NodesCnt = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].NodesCnt"); nodeGroup.DataDispatchEnabled = _ctx.BooleanValue("ListNodeGroups.Data.List["+ i +"].DataDispatchEnabled"); nodeGroup.JoinPermissionId = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].JoinPermissionId"); nodeGroup.JoinPermissionOwnerAliyunId = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].JoinPermissionOwnerAliyunId"); nodeGroup.JoinEui = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].JoinEui"); nodeGroup.FreqBandPlanGroupId = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].FreqBandPlanGroupId"); nodeGroup.ClassMode = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].ClassMode"); nodeGroup.JoinPermissionType = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].JoinPermissionType"); nodeGroup.JoinPermissionEnabled = _ctx.BooleanValue("ListNodeGroups.Data.List["+ i +"].JoinPermissionEnabled"); nodeGroup.RxDailySum = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].RxDailySum"); nodeGroup.RxMonthSum = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].RxMonthSum"); nodeGroup.TxDailySum = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].TxDailySum"); nodeGroup.TxMonthSum = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].TxMonthSum"); nodeGroup.CreateMillis = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].CreateMillis"); nodeGroup.JoinPermissionName = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].JoinPermissionName"); ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups_DataDispatchConfig dataDispatchConfig = new ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups_DataDispatchConfig(); dataDispatchConfig.Destination = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.Destination"); ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups_DataDispatchConfig.ListNodeGroups_IotProduct iotProduct = new ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups_DataDispatchConfig.ListNodeGroups_IotProduct(); iotProduct.ProductName = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.IotProduct.ProductName"); iotProduct.ProductKey = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.IotProduct.ProductKey"); iotProduct.ProductType = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.IotProduct.ProductType"); iotProduct.DebugSwitch = _ctx.BooleanValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.IotProduct.DebugSwitch"); dataDispatchConfig.IotProduct = iotProduct; ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups_DataDispatchConfig.ListNodeGroups_OnsTopics onsTopics = new ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups_DataDispatchConfig.ListNodeGroups_OnsTopics(); onsTopics.DownlinkRegionName = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.OnsTopics.DownlinkRegionName"); onsTopics.DownlinkTopic = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.OnsTopics.DownlinkTopic"); onsTopics.UplinkRegionName = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.OnsTopics.UplinkRegionName"); onsTopics.UplinkTopic = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].DataDispatchConfig.OnsTopics.UplinkTopic"); dataDispatchConfig.OnsTopics = onsTopics; nodeGroup.DataDispatchConfig = dataDispatchConfig; List<ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups__Lock> nodeGroup_locks = new List<ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups__Lock>(); for (int j = 0; j < _ctx.Length("ListNodeGroups.Data.List["+ i +"].Locks.Length"); j++) { ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups__Lock _lock = new ListNodeGroupsResponse.ListNodeGroups_Data.ListNodeGroups_NodeGroup.ListNodeGroups__Lock(); _lock.LockId = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].Locks["+ j +"].LockId"); _lock.LockType = _ctx.StringValue("ListNodeGroups.Data.List["+ i +"].Locks["+ j +"].LockType"); _lock.Enabled = _ctx.BooleanValue("ListNodeGroups.Data.List["+ i +"].Locks["+ j +"].Enabled"); _lock.CreateMillis = _ctx.LongValue("ListNodeGroups.Data.List["+ i +"].Locks["+ j +"].CreateMillis"); nodeGroup_locks.Add(_lock); } nodeGroup.Locks = nodeGroup_locks; data_list.Add(nodeGroup); } data.List = data_list; listNodeGroupsResponse.Data = data; return listNodeGroupsResponse; } } }
#region headers // Copyright (c) 2017 Matthias Jansen // See the LICENSE file in the project root for more information. #endregion #region imports #endregion using System; namespace ExceptionShield.Terminators { public abstract class TerminatorBase<TEnd> where TEnd : Exception { /// <summary> /// The terminate method is guaranteed to never throw. /// Any exception thrown by TerminateInner will be swallowed. /// </summary> /// <param name="exception"></param> public void Terminate(TEnd exception) { try { TerminateInner(exception); } catch (Exception) { // ignored } } protected abstract void TerminateInner(TEnd exception); } }
using System; using System.Collections.Generic; using System.Linq; using Xms.Core.Context; using Xms.Data.Provider; using Xms.Organization.Data; using Xms.Organization.Domain; namespace Xms.Organization { /// <summary> /// 团队成员服务 /// </summary> public class TeamMembershipService { public readonly ITeamMembershipRepository _teamMembershipRepository; public TeamMembershipService(ITeamMembershipRepository teamMembershipRepository) { _teamMembershipRepository = teamMembershipRepository; } public bool Create(TeamMembership entity) { return _teamMembershipRepository.Create(entity); } public bool Update(TeamMembership entity) { return _teamMembershipRepository.Update(entity); } public bool Update(Func<UpdateContext<TeamMembership>, UpdateContext<TeamMembership>> context) { var ctx = context(UpdateContextBuilder.Build<TeamMembership>()); return _teamMembershipRepository.Update(ctx); } public TeamMembership FindById(Guid id) { return _teamMembershipRepository.FindById(id); } public bool DeleteById(Guid id) { var deletedRecord = this.FindById(id); if (deletedRecord != null) { return _teamMembershipRepository.DeleteById(id); } return false; } public bool DeleteById(List<Guid> ids) { foreach (var id in ids) { this.DeleteById(id); } return true; } public PagedList<TeamMembership> QueryPaged(Func<QueryDescriptor<TeamMembership>, QueryDescriptor<TeamMembership>> container) { QueryDescriptor<TeamMembership> q = container(QueryDescriptorBuilder.Build<TeamMembership>()); return _teamMembershipRepository.QueryPaged(q); } public List<TeamMembership> Query(Func<QueryDescriptor<TeamMembership>, QueryDescriptor<TeamMembership>> container) { QueryDescriptor<TeamMembership> q = container(QueryDescriptorBuilder.Build<TeamMembership>()); return _teamMembershipRepository.Query(q)?.ToList(); } } }
using UnityEngine; using Ink.Runtime; public class InkStoryScript : MonoBehaviour { public TextAsset InkJSONFile; Story InkStory; void Start() { InkStory = new Story(InkJSONFile.text); if (InkStory.variablesState.GlobalVariableExistsWithName("steps")) { InkStory.ObserveVariable("steps", (variableName, newValue) => { Debug.Log(newValue); }); } Debug.Log(InkStory.ContinueMaximally()); InkStory.ChooseChoiceIndex(0); Debug.Log(InkStory.ContinueMaximally()); InkStory.ChooseChoiceIndex(0); } }
using System; using System.Text.Json; using System.Text.Json.Serialization; namespace Map.Project.Serialization { public partial class RangeConverter : JsonConverter<Range> { /// <inheritdoc/> public override Range Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { Int32 mini = Int32.MinValue; Int32 max = Int32.MaxValue; //Array [Min, Max] if (reader.TokenType == JsonTokenType.StartArray) { reader.Read(); if (reader.TokenType == JsonTokenType.Number) { mini = reader.GetInt32(); reader.Read(); } if (reader.TokenType == JsonTokenType.Number) { max = reader.GetInt32(); reader.Read(); } //Make sure we have read the array while (reader.TokenType != JsonTokenType.EndArray) { reader.Read(); } return new Range(mini, max); } //Object { "min": 0, "max": 1 } else if (reader.TokenType == JsonTokenType.StartObject) { while (reader.TokenType != JsonTokenType.EndObject) { if (reader.TokenType == JsonTokenType.PropertyName) { String prop = reader.GetString(); reader.Read(); switch (prop) { case "min": case "minimum": mini = reader.GetInt32(); break; case "max": case "maximum": mini = reader.GetInt32(); break; } reader.Read(); } } return new Range(mini, max); } //Single number else if (reader.TokenType == JsonTokenType.Number) { Int32 R = reader.GetInt32(); return new Range(R, R); } throw new JsonException("unknown data type"); } /// <inheritdoc/> public override void Write(Utf8JsonWriter writer, Range value, JsonSerializerOptions options) { writer.WriteStartArray(); writer.WriteNumberValue(value.Minimum); writer.WriteNumberValue(value.Maximum); writer.WriteEndArray(); } } }
using System; using DeviceHive.WebSockets.Core.ActionsFramework; using Ninject; namespace DeviceHive.WebSockets.API.Core { public class NinjectRouter : Router { private readonly IKernel _kernel; public NinjectRouter(IKernel kernel) { _kernel = kernel; } protected override object CreateController(Type type) { return _kernel.Get(type); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class playerController3D : MonoBehaviour { [SerializeField] private GameObject player; private Rigidbody e_rb; public Vector3 move; public bool isDashing; public float e_speed = 10; // Start is called before the first frame update void Start() { player = this.GetComponent<GameObject>(); e_rb = this.GetComponent<Rigidbody>(); } void Update(){ UpdateMovement(); } // Update is called once per frame void UpdateMovement() { move.x=Input.GetAxisRaw("Horizontal"); move.z=Input.GetAxisRaw("Vertical"); //Debug.Log(isDashing); } //animator.SetFloat("X",move.x);animator.SetFloat("Y",move.y); /* CheckDirection(); if (move.x!=0 || move.y!=0) move0= move; else {animator.SetFloat("LastX",move0.x);animator.SetFloat("LastY",move0.y);} //*/ //else movingDashing.enabled = false; void FixedUpdate(){ e_rb.MovePosition(e_rb.position + move*Time.fixedDeltaTime*e_speed); } }
namespace Owin.Scim.Configuration { using System.Security.Cryptography; using Model; using NContext.Security.Cryptography; public class DefaultResourceVersionProvider : IResourceVersionProvider { private readonly IProvideHashing _HashProvider; public DefaultResourceVersionProvider(IProvideHashing hashProvider) { _HashProvider = hashProvider; } protected IProvideHashing HashProvider { get { return _HashProvider; } } public virtual string GenerateVersion(Resource resource) { return HashProvider.CreateHash<SHA1Cng>(resource.CalculateVersion().ToString(), 0); } } }
using System; using FluentAssertions; using NUnit.Framework; namespace BddPipe.UnitTests.F { [TestFixture] public class SomeTests { [Test] public void Value_Struct_Ok() { var some = new Some<int>(5); some.Value.Should().Be(5); } [Test] public void Value_Reference_Ok() { var instance = new Scenario("test"); var some = new Some<Scenario>(instance); some.Value.Should().Be(instance); } [Test] public void Value_OnDefault_ThrowsNotInitializedException() { Some<Scenario> some = default; Func<Scenario> call = () => some.Value; call.Should().ThrowExactly<NotInitializedException>(); } [Test] public void ToString_OnDefault_ThrowsNotInitializedException() { Some<Scenario> some = default; Func<string> call = () => some.ToString(); call.Should().ThrowExactly<NotInitializedException>(); } [Test] public void ToString_OfInstance_ReturnsInstanceToString() { var instance = new Scenario("test"); Some<Scenario> some = instance; var asString = some.ToString(); asString.Should().Be(instance.ToString()); } [Test] public void GetHashCode_OnDefault_ThrowsNotInitializedException() { Some<Scenario> some = default; Func<int> call = () => some.GetHashCode(); call.Should().ThrowExactly<NotInitializedException>(); } [Test] public void GetHashCode_OfInstance_ReturnsInstanceHashCode() { var instance = new Scenario("test"); Some<Scenario> some = instance; var hashCode = some.GetHashCode(); hashCode.Should().Be(instance.GetHashCode()); } [Test] public void Ctor_ReferenceNull_ThrowsArgNullException() { Action call = () => new Some<Scenario>(null); call.Should().ThrowExactly<ArgumentNullException>() .Which .ParamName.Should().Be("value"); } [Test] public void Implicit_Ctor_CreatesInstance() { var instance = new Scenario("test"); Some<Scenario> some = instance; some.Value.Should().Be(instance); } [Test] public void Implicit_Assign_AssignsInstance() { var instance = new Scenario("test"); Some<Scenario> some = instance; Scenario result = some; result.Should().NotBeNull(); result.Should().Be(instance); } [Test] public void GetUnderlyingType_OfSomeT_ReturnsTypeT() { var type = new Some<int>(5).GetUnderlyingType(); type.Should().Be(typeof(int)); } [TestCase(5, 5, true)] [TestCase(5, 6, false)] public void EqualsOperator_InnerValues_ReturnsExpected(int a, int b, bool expected) { Some<int> someA = a; Some<int> someB = b; var result = someA == someB; result.Should().Be(expected); } [TestCase(5, 5, false)] [TestCase(5, 6, true)] public void NotEqualsOperator_InnerValues_ReturnsExpected(int a, int b, bool expected) { Some<int> someA = a; Some<int> someB = b; var result = someA != someB; result.Should().Be(expected); } [TestCase(5, 5, true)] [TestCase(5, 6, false)] public void Equals_SomeAgainstInnerValue_ReturnsExpected(int a, int b, bool expected) { Some<int> someA = a; var result = someA.Equals(b); result.Should().Be(expected); } [TestCase(5, 5, true)] [TestCase(5, 6, false)] public void Equals_SomeAgainstSome_ReturnsExpected(int a, int b, bool expected) { Some<int> someA = a; Some<int> someB = b; var result = someA.Equals(someB); result.Should().Be(expected); } [Test] public void Equals_SourceSomeDefault_ThrowsNotInitializedException() { Some<int> someA = default; Some<int> someB = 5; Func<bool> call = () => someA.Equals(someB); call.Should().ThrowExactly<NotInitializedException>(); } [Test] public void Equals_ComparisonSomeDefault_ThrowsNotInitializedException() { Some<int> someA = 5; Some<int> someB = default; Func<bool> call = () => someA.Equals(someB); call.Should().ThrowExactly<NotInitializedException>(); } [Test] public void Map_ConvertSome_ReturnsNewValue() { Some<int> someA = 5; var mapped = someA.Map(val => val.ToString()); mapped.Value.Should().Be("5"); } [Test] public void Map_MapFnNull_ThrowArgNullException() { Some<int> someA = 5; Action call = () => someA.Map((Func<int, string>)null); call.Should().ThrowExactly<ArgumentNullException>() .Which .ParamName.Should().Be("map"); } } }
// Read start arguments var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); var verbosity = Argument("verbosity", "Diagnostic"); // Paths to the root directories var sourceDirectory = Directory("../.Src"); var toolDirectory = Directory("../.Tools"); var buildDirectory = Directory("../.Build"); var outputDirectory = Directory("../.Output"); // The path to the solution file var solution = sourceDirectory + File("Stomp.Net.sln"); var libDirectory = sourceDirectory + Directory("Stomp.Net"); var libBinDirectory = libDirectory + Directory("bin") + Directory(configuration); // Executables var nuGet = toolDirectory + File("NuGet/nuget.exe"); // Clean all build output Task("Clean") .Does(() => { CleanDirectory( sourceDirectory + Directory("Stomp.Net/bin") ); CleanDirectory( outputDirectory ); }); // Restore all NuGet packages Task("Restore") .IsDependentOn("Clean") .Does(() => { DotNetCoreRestore(solution); }); // Patches the version of the library Task("PatchVersion") .IsDependentOn("Restore") .Does(() => { // Get the current version => null on local system var currentVersion = GetBuildVersion(); Information("Current version is: '" + currentVersion + "'"); var projects = GetFiles(libDirectory.ToString() + "/**/*.csproj"); foreach (var project in GetFiles(libDirectory.ToString() + "/**/*.csproj")) { var x = new System.Xml.XmlDocument(); using ( var fs = System.IO.File.OpenRead( project.ToString() ) ) x.Load( fs ); var fileVersion = x.GetElementsByTagName( "FileVersion" ); if(currentVersion == null) currentVersion = fileVersion[0].InnerText; fileVersion[0].InnerText = currentVersion; var version = x.GetElementsByTagName( "Version" ); version[0].InnerText = currentVersion; var assemblyVersion = x.GetElementsByTagName( "AssemblyVersion" ); assemblyVersion[0].InnerText = currentVersion; using ( var fs = System.IO.File.Open( project.ToString(), FileMode.Create) ) x.Save( fs ); } }); // Build the solution Task("Build") .IsDependentOn("PatchVersion") .Does(() => { DotNetCoreBuild( solution, new DotNetCoreBuildSettings() { Configuration = configuration }); }); // Build NuGet package Task("Pack") .IsDependentOn("Build") .Does(() => { foreach (var project in GetFiles(libDirectory.ToString() + "/**/*.csproj")) { DotNetCorePack( project.ToString(), new DotNetCorePackSettings() { Configuration = configuration, OutputDirectory = outputDirectory }); } CopyDirectory(libBinDirectory, outputDirectory); }); // Default task Task("Default") .IsDependentOn("Pack") .Does(() => { Information("Default task started"); }); // Run the target task RunTarget(target); /// <summary> /// Gets the version of the current build. /// </summary> /// <returns>Returns the version of the current build.</returns> private String GetBuildVersion() { var version = String.Empty; // Try to get the version from AppVeyor var appVeyorProvider = BuildSystem.AppVeyor; if( appVeyorProvider.IsRunningOnAppVeyor ) return appVeyorProvider.Environment.Build.Version; //+ "-alpha"; return null; }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; using System.Threading.Tasks; using System.Text.RegularExpressions; namespace Itlezy.App.Network.UI { public partial class PortScannerUserControl : UserControl { private PortScannerTarget[] itemsToScan; private readonly ParallelOptions parallelOptions = new ParallelOptions(); private readonly CancellationTokenSource cancellationToken = new CancellationTokenSource(); private readonly ScanPort scanPort = new ScanPort(); public PortScannerUserControl() { InitializeComponent(); parallelOptions.CancellationToken = cancellationToken.Token; parallelOptions.MaxDegreeOfParallelism = System.Environment.ProcessorCount * 8; } private void btnScan_Click(object sender, EventArgs e) { txtHostStart.BackColor = SystemColors.Window; txtPortStart.BackColor = SystemColors.Window; txtPortEnd.BackColor = SystemColors.Window; if (!Regex.IsMatch(txtPortStart.Text, "^\\d{1,5}$")) { txtPortStart.BackColor = Color.LightCoral; return; } if (String.IsNullOrWhiteSpace(txtHostStart.Text)) { txtHostStart.BackColor = Color.LightCoral; return; } int startPort = int.Parse(txtPortStart.Text); int endPort = startPort; if (!String.IsNullOrWhiteSpace(txtPortEnd.Text)) { if (Regex.IsMatch(txtPortEnd.Text, "^\\d{1,5}$")) { endPort = int.Parse(txtPortEnd.Text); } else { txtPortEnd.BackColor = Color.LightCoral; } if (endPort < startPort) { endPort = startPort; } } if (startPort <= 0 || startPort >= 65536) { txtPortStart.BackColor = Color.LightCoral; return; } if (endPort <= 0 || endPort >= 65536) { txtPortEnd.BackColor = Color.LightCoral; return; } itemsToScan = new PortScannerTarget[endPort - startPort + 1]; for (int port = startPort, i = 0; port <= endPort; port++, i++) { itemsToScan[i] = new PortScannerTarget() { Host = txtHostStart.Text, Port = port }; } timUpdateResults.Start(); bkgScan.RunWorkerAsync(); } private void timUpdateResults_Tick(object sender, EventArgs e) { UpdateResults(); } private void UpdateResults() { lstScanResult.Items.Clear(); if (itemsToScan != null && itemsToScan.Length > 0) { var itemsToAdd = ckOpenOnly.Checked ? itemsToScan.Where(p => p.Open).ToArray() : itemsToScan; ListViewItem[] listViewItems = new ListViewItem[itemsToAdd.Length]; for (int i = 0; i < itemsToAdd.Length; i++) { var p = itemsToAdd[i]; ListViewItem li = new ListViewItem(p.Host); li.SubItems.Add(p.Port.ToString()); li.SubItems.Add(p.Open.ToString()); li.SubItems.Add(p.Probed.ToString()); if (p.Probed) { if (p.Open) { li.BackColor = Color.LightGreen; } else { li.BackColor = Color.LightCoral; } } listViewItems[i] = li; } lstScanResult.Items.AddRange(listViewItems); } } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Escape) { cancellationToken.Cancel(); } return base.ProcessCmdKey(ref msg, keyData); } private void bkgScan_DoWork(object sender, DoWorkEventArgs e) { UpdateResults(); grpScan.Enabled = false; try { Parallel.ForEach(itemsToScan, parallelOptions, o => { scanPort.Scan(o); parallelOptions.CancellationToken.ThrowIfCancellationRequested(); }); } catch (OperationCanceledException) { // no action } } private void bkgScan_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { grpScan.Enabled = true; timUpdateResults.Stop(); UpdateResults(); } private void PortScannerUserControl_Load(object sender, EventArgs e) { txtHostStart.Select(); } private void ckOpenOnly_CheckedChanged(object sender, EventArgs e) { UpdateResults(); } } }
using System; using Watchster.Domain.Common; namespace Watchster.Domain.Entities { public class ResetPasswordCode : BaseEntity { public string Code { get; set; } public DateTime expirationDate { get; set; } public string Email { get; set; } } }
using io.odysz.semantic.jprotocol; using System.Collections.Generic; namespace io.odysz.semantic.tier.docs { /**This structure is recommend used as Parcel between Android activities. * @author ody * */ public class DocsResp : AnsonResp { long size; long Size() { return size; } public DocsResp() : base() { map = new Dictionary<string, object>(); } SyncingPage syncing; public SyncingPage Syncing() { return syncing; } public DocsResp Syncing(SyncingPage page) { syncing = page; return this; } string recId; public string RecId() { return recId; } public DocsResp RecId(string recid) { recId = recid; return this; } string fullpath; public string Fullpath() { return fullpath; } public DocsResp Fullpath(string fullpath) { this.fullpath = fullpath; return this; } string filename; public string clientname() { return filename; } public DocsResp clientname(string clientname) { this.filename = clientname; return this; } public long blockSeqReply; public long blockSeq() { return blockSeqReply; } public DocsResp blockSeq(long seq) { blockSeqReply = seq; return this; } string cdate; public string Cdate() { return cdate; } public DocsResp Cdate(string cdate) { this.cdate = cdate; return this; } } }
using Serenity; using Serenity.ComponentModel; using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; namespace SimpleFeedly { public partial class StaticTextBlockAttribute : CustomEditorAttribute { public const string Key = "SimpleFeedly.StaticTextBlock"; public StaticTextBlockAttribute() : base(Key) { } public Boolean HideLabel { get { return GetOption<Boolean>("hideLabel"); } set { SetOption("hideLabel", value); } } public Boolean IsHtml { get { return GetOption<Boolean>("isHtml"); } set { SetOption("isHtml", value); } } public Boolean IsLocalText { get { return GetOption<Boolean>("isLocalText"); } set { SetOption("isLocalText", value); } } public String Text { get { return GetOption<String>("text"); } set { SetOption("text", value); } } } }
namespace RepoDb { /// <summary> /// A class that contains all the constant strings. /// </summary> internal static class StringConstant { public const string Period = "."; } }
using System; namespace YuKu.Dxf { internal static class Extensions { public static Boolean IsInRange(this Int16 number, Int16 from, Int16 to) { return from <= number && number <= to; } } }
using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; using SG1.UtilityTypes.Transformations; namespace SG1.UtilityTypes { internal sealed class TransformInformation { public ITypeSymbol InputType { get; } public IList<ITransformation> Transformations { get; } = new List<ITransformation>(); public TransformInformation(ITypeSymbol inputType) { InputType = inputType; } public TransformInformation(ITypeSymbol inputType, IList<ITransformation> transformations) : this(inputType) { Transformations = transformations; } } }
#if LOBBY using System; using UnityEngine; using System.Collections; using UnityEngine.Networking; using UnityEngine.Networking.Types; using UnityEngine.Networking.NetworkSystem; using System.Linq; public class LobbyServer : MonoBehaviour { public static LobbyServer instance { get { if(_instance == null) { CreateInstance(); } return _instance; } } private static LobbyServer _instance; public event Action OnInitialized; public event Action<NetworkConnection> OnClientConnected; public event Action<NetworkConnection> OnClientDisconnected; static private void CreateInstance() { GameObject lobby = new GameObject("lobby"); lobby.hideFlags = HideFlags.HideAndDontSave; DontDestroyOnLoad(lobby); _instance = lobby.AddComponent<LobbyServer>(); lobby.AddComponent<ServerList>(); lobby.AddComponent<PlayerManager>(); lobby.AddComponent<AccountManager>(); } /// <summary> /// Initializes the lobby /// </summary> /// <param name="port">The port to listen to</param> /// <param name="maxPlayers">Maximum number of allowed players</param> public void Initialize(int port,int maxPlayers) { ConnectionConfig cc = new ConnectionConfig(); cc.AddChannel(QosType.Reliable); cc.AddChannel(QosType.ReliableFragmented); NetworkServer.Configure(cc, maxPlayers); NetworkServer.RegisterHandler(MsgType.Connect, netMsg => { if (OnClientConnected != null) OnClientConnected(netMsg.conn); }); NetworkServer.RegisterHandler(MsgType.Disconnect, netMsg => { if (OnClientConnected != null) OnClientConnected(netMsg.conn); }); if (NetworkServer.Listen(port)) { if (OnInitialized != null) OnInitialized(); } } public void ShutDown() { NetworkServer.Shutdown(); } public void CloseConnection(int connectionID) { var con = NetworkServer.connections.FirstOrDefault(x => x.connectionId == connectionID); if (con != null) con.Disconnect(); } } #endif
using System; using System.Collections.Generic; namespace Elasticsearch.Net { public interface IConnectionPool : IDisposable { /// <summary> /// Returns a read only view of all the nodes in the cluster, which might involve creating copies of nodes e.g /// if you are using <see cref="SniffingConnectionPool"/>. /// If you do not need an isolated copy of the nodes, please read <see cref="CreateView"/> to completion /// </summary> IReadOnlyCollection<Node> Nodes { get; } /// <summary> /// Returns the default maximum retries for the connection pool implementation. /// Most implementation default to number of nodes, note that this can be overidden /// in the connection settings /// </summary> int MaxRetries { get; } /// <summary> /// Whether reseeding with new nodes is supported /// </summary> bool SupportsReseeding { get; } /// <summary> /// Whether pinging is supported /// </summary> bool SupportsPinging { get; } /// <summary> /// The last time that this instance was updated /// </summary> DateTime LastUpdate { get; } /// <summary> /// Whether SSL/TLS is being used /// </summary> bool UsingSsl { get; } /// <summary> /// Whether a sniff is seen on startup. The implementation is /// responsible for setting this in a thread safe fashion. /// </summary> bool SniffedOnStartup { get; set; } /// <summary> /// Creates a view over the nodes, with changing starting positions, that wraps over on each call /// e.g Thread A might get 1,2,3,4,5 and thread B will get 2,3,4,5,1. /// if there are no live nodes yields a different dead node to try once /// </summary> IEnumerable<Node> CreateView(Action<AuditEvent, Node> audit = null); /// <summary> /// Reseeds the nodes. The implementation is responsible for thread safety /// </summary> void Reseed(IEnumerable<Node> nodes); } }
namespace Obsidize.FastNoise { public class FastNoiseTransformationContext : FastNoiseContext { private readonly IFastNoiseContext _source; private readonly IFastNoiseTransformationContextOperator _transformationOperator; public IFastNoiseContext Source => _source; public IFastNoiseTransformationContextOperator TransformationOperator => _transformationOperator; public FastNoiseTransformationContext( IFastNoiseContext source, IFastNoiseTransformationContextOperator transformationOperator ) { _source = source; _transformationOperator = transformationOperator; } public override void SetSeed(int seed) { Source.SetSeed(seed); } public override float GetNoise(float x, float y) { return TransformationOperator.TransformNoise2D(Source.GetNoise(x, y), x, y); } public override float GetNoise(float x, float y, float z) { return TransformationOperator.TransformNoise3D(Source.GetNoise(x, y, z), x, y, z); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace dix_nez_lande.Implem { public class HistoryFactory { #region Singleton private static HistoryFactory _instance = null; private HistoryFactory() { } public static HistoryFactory getHistoryFactory() { if (_instance == null) _instance = new HistoryFactory(); return _instance; } #endregion public History createHistory() { History h = new HistoryImpl(); h.states = new List<GameState>(); return h; } } }