text
stringlengths
13
6.01M
// Copyright (c) MOSA Project. Licensed under the New BSD License. using Mosa.Runtime.x86; namespace Mosa.Kernel.x86 { /// <summary> /// Screen /// </summary> public static class Console { private static uint column = 0; private static uint row = 0; private static byte color = 0; /// <summary> /// The columns /// </summary> public const uint Columns = 80; /// <summary> /// The rows /// </summary> public const uint Rows = 25; /// <summary> /// Gets or sets the column. /// </summary> /// <value> /// The column. /// </value> public static uint CursorLeft { get { return column; } private set { column = value; } } /// <summary> /// Gets or sets the row. /// </summary> /// <value> /// The row. /// </value> public static uint CursorTop { get { return row; } private set { row = value; } } public static byte Color { get { return (byte)(color & 0x0F); } set { color &= 0xF0; color |= (byte)(value & 0x0F); } } public static byte BackgroundColor { get { return (byte)(color >> 4); } set { color &= 0x0F; color |= (byte)((value & 0x0F) << 4); } } public static void Setup() { BackgroundColor = ConsoleColor.Black; Clear(); SetCursorPosition(0, 0); Color = ConsoleColor.White; } /// <summary> /// Next Column /// </summary> private static void Next() { CursorLeft++; if (CursorLeft >= Columns) { CursorLeft = 0; CursorTop++; } } private static void Previous() { if (CursorLeft >= 0 && CursorTop >= 0) { if (CursorLeft == 0 && CursorTop == 0) { return; } if (CursorLeft != 0) { CursorLeft--; } } } public static void RemovePreviousOne() { Previous(); UpdateCursor(); } /// <summary> /// Skips the specified skip. /// </summary> /// <param name="skip">The skip.</param> private static void Skip(uint skip) { for (uint i = 0; i < skip; i++) Next(); } /// <summary> /// Writes the character. /// </summary> /// <param name="chr">The character.</param> private static void Write(char chr) { MoveUpPrevious(); Native.Set8(0x0B8000 + ((CursorTop * Columns + CursorLeft) * 2), (byte)chr); Native.Set8(0x0B8000 + ((CursorTop * Columns + CursorLeft) * 2) + 1, color); Next(); UpdateCursor(); } private static void MoveUpPrevious() { if (CursorTop == Rows) { Native.Memory_Copy(0x0B8000, 0x0B80A0, 0xF00); Native.Memory_ZeroFill(0xB8F00, 0xA0); SetCursorPosition(0, Rows - 1); } } /// <summary> /// Writes the string to the screen. /// </summary> /// <param name="value">The string value to write to the screen.</param> public static void Write(string value) { for (int index = 0; index < value.Length; index++) { char chr = value[index]; Write(chr); } } /// <summary> /// Goto the top. /// </summary> private static void GotoTop() { CursorLeft = 0; CursorTop = 0; UpdateCursor(); } /// <summary> /// Writes the line. /// </summary> public static void WriteLine() { NextLine(); } /// <summary> /// Goto the next line. /// </summary> private static void NextLine() { CursorLeft = 0; CursorTop++; MoveUpPrevious(); UpdateCursor(); } /// <summary> /// Writes the line. /// </summary> /// <param name="line">The line.</param> public static void WriteLine(string line) { Write(line); NextLine(); } /// <summary> /// Clears this instance. /// </summary> public static void Clear() { GotoTop(); byte c = Color; Color = 0x0; for (int i = 0; i < Columns * Rows; i++) Write(' '); Color = c; GotoTop(); } /// <summary> /// Goto the specified row and column. /// </summary> /// <param name="row">The row.</param> /// <param name="col">The col.</param> public static void SetCursorPosition(uint left, uint top) { CursorTop = top; CursorLeft = left; UpdateCursor(); } /// <summary> /// Sets the cursor. /// </summary> /// <param name="row">The row.</param> /// <param name="column">The column.</param> private static void SetCursor(uint row, uint column) { uint location = (row * Columns) + column; Native.Out8(0x3D4, 0x0F); Native.Out8(0x3D5, (byte)(location & 0xFF)); Native.Out8(0x3D4, 0x0E); Native.Out8(0x3D5, (byte)((location >> 8) & 0xFF)); } private static void UpdateCursor() { Native.Set8(0x0B8000 + ((CursorTop * Columns + CursorLeft) * 2), (byte)' '); Native.Set8(0x0B8000 + ((CursorTop * Columns + CursorLeft) * 2) + 1, color); SetCursor(CursorTop, CursorLeft); } } }
// // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // using System; using System.Collections.Generic; using Dnn.ExportImport.Components.Common; using Dnn.ExportImport.Components.Entities; using Dnn.ExportImport.Dto.Pages; using DotNetNuke.Security.Permissions; namespace Dnn.ExportImport.Components.Interfaces { public interface IEntitiesController { ExportImportJob GetFirstActiveJob(); ExportImportJob GetJobById(int jobId); IList<ExportImportJobLog> GetJobSummaryLog(int jobId); IList<ExportImportJobLog> GetJobFullLog(int jobId); int GetAllJobsCount(int? portalId, int? jobType, string keywords); IList<ExportImportJob> GetAllJobs(int? portalId, int? pageSize, int? pageIndex, int? jobType, string keywords); DateTime? GetLastJobTime(int portalId, JobType jobType); void UpdateJobInfo(ExportImportJob job); void UpdateJobStatus(ExportImportJob job); void SetJobCancelled(ExportImportJob job); void RemoveJob(ExportImportJob job); IList<ExportImportChekpoint> GetJobChekpoints(int jobId); void UpdateJobChekpoint(ExportImportChekpoint checkpoint); IList<ExportTabInfo> GetPortalTabs(int portalId, bool includeDeleted, bool includeSystem, DateTime toDate, DateTime? fromDate); IList<ExportTabSetting> GetTabSettings(int tabId, DateTime toDate, DateTime? fromDate); IList<ExportTabPermission> GetTabPermissions(int tabId, DateTime toDate, DateTime? fromDate); IList<ExportTabUrl> GetTabUrls(int tabId, DateTime toDate, DateTime? fromDate); IList<ExportModule> GetModules(int tabId, bool includeDeleted, DateTime toDate, DateTime? fromDate); IList<ExportModuleSetting> GetModuleSettings(int moduleId, DateTime toDate, DateTime? fromDate); IList<ExportModulePermission> GetModulePermissions(int moduleId, DateTime toDate, DateTime? fromDate); IList<ExportTabModule> GetTabModules(int tabId, bool includeDeleted, DateTime toDate, DateTime? fromDate); IList<ExportTabModuleSetting> GetTabModuleSettings(int tabId, DateTime toDate, DateTime? fromDate); IList<ExportTabModuleSetting> GetTabModuleSettings(int tabId, bool includeDeleted, DateTime toDate, DateTime? fromDate); PermissionInfo GetPermissionInfo(string permissionCode, string permissionKey, string permissionName); void SetTabSpecificData(int tabId, bool isDeleted, bool isVisible); void SetTabModuleDeleted(int tabModuleId, bool isDeleted); void SetUserDeleted(int portalId, int userId, bool isDeleted); void RunSchedule(); } }
using System; using System.Collections.Generic; using System.Text; namespace OCP.AppFramework { public class QueryException : System.Exception { } }
namespace Triton.Common { using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [StructLayout(LayoutKind.Sequential)] public struct WpfVector2i : IEquatable<WpfVector2i> { [CompilerGenerated] private int int_0; [CompilerGenerated] private int int_1; public int X { [CompilerGenerated] get { return this.int_0; } [CompilerGenerated] set { this.int_0 = value; } } public int Y { [CompilerGenerated] get { return this.int_1; } [CompilerGenerated] set { this.int_1 = value; } } public bool Equals(WpfVector2i other) { return Equals(ref this, ref other); } public bool Equals(ref WpfVector2i other) { return Equals(ref this, ref other); } public static bool Equals(ref WpfVector2i v1, ref WpfVector2i v2) { return ((v1.X == v2.X) && (v1.Y == v2.Y)); } public static bool operator ==(WpfVector2i ls, WpfVector2i rs) { return Equals(ref ls, ref rs); } public static bool operator !=(WpfVector2i ls, WpfVector2i rs) { return !Equals(ref ls, ref rs); } public override bool Equals(object obj) { if (obj == null) { return false; } try { return this.Equals((WpfVector2i) obj); } catch (InvalidCastException) { return false; } } public override int GetHashCode() { return ((this.X.GetHashCode() * 0x18d) ^ this.Y.GetHashCode()); } } }
namespace WMaper.Meta { /// <summary> /// 瓦片信息类 /// </summary> public sealed class Patch { #region 变量 // 瓦片级数 private int num; // 瓦片所在行 private int row; // 瓦片所在列 private int col; // 瓦片标识 private string uid; #endregion #region 属性 public string Uid { get { return this.uid; } } public int Num { get { return this.num; } } public int Row { get { return this.row; } } public int Col { get { return this.col; } } #endregion #region 构造函数 public Patch(string uid, int num, int row, int col) { this.uid = uid; this.num = num; this.row = row; this.col = col; } #endregion } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SidescrollCamera2 : MonoBehaviour { public GameObject enemy; PlayerController player; private void Start() { player = FindObjectOfType<PlayerController>(); } public void SpawnEnemy() { enemy.SetActive(true); BGMManager.instance.PlayBGM("EnemyAppears"); player.SetSpeed(11f); player.freeze = true; player.lastLevel = true; } public void UnfreezePlayer() { player.freeze = false; } public void IncreaseEnemySpeed() { enemy.GetComponent<EnemyController>().IncSpeed(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; using Async_Inn.Data; using Async_Inn.Models; namespace Async_Inn.Controllers { public class RoomsController : Controller { private readonly IRooms _rooms; public RoomsController(IRooms rooms) { _rooms = rooms; } // GET: Rooms public async Task<IActionResult> Index() { return View(await _rooms.GetRooms()); } [HttpPost] public async Task<IActionResult> Index(string searchString) { var rooms = await _rooms.GetRooms(); rooms = rooms.Where(r => r.Name.Contains(searchString)).ToList<Room>(); return View(rooms); } // GET: Rooms/Details/5 public async Task<IActionResult> Details(int? id) { if (id == null) { return NotFound(); } Room room = await _rooms.GetRoom(id); if (room == null) { return NotFound(); } return View(room); } // GET: Rooms/Create public IActionResult Create() { return View(); } // POST: Rooms/Create // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see http://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Create([Bind("RoomID,Name,Layout")] Room room) { if (ModelState.IsValid) { await _rooms.CreateRoom(room); return RedirectToAction(nameof(Index)); } return View(room); } // GET: Rooms/Edit/5 public async Task<IActionResult> Edit(int? id) { if (id == null) { return NotFound(); } var room = await _rooms.GetRoom(id); if (room == null) { return NotFound(); } return View(room); } // POST: Rooms/Edit/5 // To protect from overposting attacks, please enable the specific properties you want to bind to, for // more details see http://go.microsoft.com/fwlink/?LinkId=317598. [HttpPost] [ValidateAntiForgeryToken] public async Task<IActionResult> Edit(int id, [Bind("RoomID,Name,Layout")] Room room) { if (id != room.RoomID) { return NotFound(); } if (ModelState.IsValid) { try { await _rooms.UpdateRoom(room); } catch (DbUpdateConcurrencyException) { if (!RoomExists(room.RoomID)) { return NotFound(); } else { throw; } } return RedirectToAction(nameof(Index)); } return View(room); } // GET: Rooms/Delete/5 public async Task<IActionResult> Delete(int? id) { if (id == null) { return NotFound(); } var room = await _rooms.GetRoom(id); if (room == null) { return NotFound(); } return View(room); } // POST: Rooms/Delete/5 [HttpPost, ActionName("Delete")] [ValidateAntiForgeryToken] public async Task<IActionResult> DeleteConfirmed(int id) { await _rooms.DeleteRoom(id); return RedirectToAction(nameof(Index)); } private bool RoomExists(int id) { return _rooms.GetRoom(id) != null; } } }
using System; using SLua; using System.Collections.Generic; [UnityEngine.Scripting.Preserve] public class Lua_UnityEngine_ParticleSystem_VelocityOverLifetimeModule : LuaObject { [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule o; o=new UnityEngine.ParticleSystem.VelocityOverLifetimeModule(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_enabled(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.enabled); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_enabled(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); bool v; checkType(l,2,out v); self.enabled=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_x(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.x); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_x(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.x=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_y(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.y); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_y(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.y=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_z(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.z); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_z(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.z=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_xMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.xMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_xMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.xMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_yMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.yMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_yMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.yMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_zMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.zMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_zMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.zMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalX(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalX); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalX(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.orbitalX=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalY(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalY); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalY(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.orbitalY=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalZ(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalZ); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalZ(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.orbitalZ=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalXMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalXMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalXMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.orbitalXMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalYMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalYMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalYMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.orbitalYMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalZMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalZMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalZMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.orbitalZMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalOffsetX(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalOffsetX); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalOffsetX(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.orbitalOffsetX=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalOffsetY(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalOffsetY); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalOffsetY(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.orbitalOffsetY=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalOffsetZ(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalOffsetZ); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalOffsetZ(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.orbitalOffsetZ=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalOffsetXMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalOffsetXMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalOffsetXMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.orbitalOffsetXMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalOffsetYMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalOffsetYMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalOffsetYMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.orbitalOffsetYMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_orbitalOffsetZMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.orbitalOffsetZMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_orbitalOffsetZMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.orbitalOffsetZMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_radial(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.radial); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_radial(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.radial=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_radialMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.radialMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_radialMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.radialMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_speedModifier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.speedModifier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_speedModifier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystem.MinMaxCurve v; checkValueType(l,2,out v); self.speedModifier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_speedModifierMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushValue(l,self.speedModifierMultiplier); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_speedModifierMultiplier(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); float v; checkType(l,2,out v); self.speedModifierMultiplier=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int get_space(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); pushValue(l,true); pushEnum(l,(int)self.space); return 2; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [SLua.MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))] [UnityEngine.Scripting.Preserve] static public int set_space(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.ParticleSystem.VelocityOverLifetimeModule self; checkValueType(l,1,out self); UnityEngine.ParticleSystemSimulationSpace v; v = (UnityEngine.ParticleSystemSimulationSpace)LuaDLL.luaL_checkinteger(l, 2); self.space=v; setBack(l,self); pushValue(l,true); return 1; } catch(Exception e) { return error(l,e); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif } [UnityEngine.Scripting.Preserve] static public void reg(IntPtr l) { getTypeTable(l,"UnityEngine.ParticleSystem.VelocityOverLifetimeModule"); addMember(l,"enabled",get_enabled,set_enabled,true); addMember(l,"x",get_x,set_x,true); addMember(l,"y",get_y,set_y,true); addMember(l,"z",get_z,set_z,true); addMember(l,"xMultiplier",get_xMultiplier,set_xMultiplier,true); addMember(l,"yMultiplier",get_yMultiplier,set_yMultiplier,true); addMember(l,"zMultiplier",get_zMultiplier,set_zMultiplier,true); addMember(l,"orbitalX",get_orbitalX,set_orbitalX,true); addMember(l,"orbitalY",get_orbitalY,set_orbitalY,true); addMember(l,"orbitalZ",get_orbitalZ,set_orbitalZ,true); addMember(l,"orbitalXMultiplier",get_orbitalXMultiplier,set_orbitalXMultiplier,true); addMember(l,"orbitalYMultiplier",get_orbitalYMultiplier,set_orbitalYMultiplier,true); addMember(l,"orbitalZMultiplier",get_orbitalZMultiplier,set_orbitalZMultiplier,true); addMember(l,"orbitalOffsetX",get_orbitalOffsetX,set_orbitalOffsetX,true); addMember(l,"orbitalOffsetY",get_orbitalOffsetY,set_orbitalOffsetY,true); addMember(l,"orbitalOffsetZ",get_orbitalOffsetZ,set_orbitalOffsetZ,true); addMember(l,"orbitalOffsetXMultiplier",get_orbitalOffsetXMultiplier,set_orbitalOffsetXMultiplier,true); addMember(l,"orbitalOffsetYMultiplier",get_orbitalOffsetYMultiplier,set_orbitalOffsetYMultiplier,true); addMember(l,"orbitalOffsetZMultiplier",get_orbitalOffsetZMultiplier,set_orbitalOffsetZMultiplier,true); addMember(l,"radial",get_radial,set_radial,true); addMember(l,"radialMultiplier",get_radialMultiplier,set_radialMultiplier,true); addMember(l,"speedModifier",get_speedModifier,set_speedModifier,true); addMember(l,"speedModifierMultiplier",get_speedModifierMultiplier,set_speedModifierMultiplier,true); addMember(l,"space",get_space,set_space,true); createTypeMetatable(l,constructor, typeof(UnityEngine.ParticleSystem.VelocityOverLifetimeModule),typeof(System.ValueType)); } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using SprintFour.Commands; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SprintFour.Controllers { public class LevelSelectGamePadController { private readonly IDictionary<Buttons, ICommand> commandDictionary; private bool nothingPressed; public LevelSelectGamePadController() { commandDictionary = new Dictionary<Buttons, ICommand> { {Buttons.LeftThumbstickUp, new CursorUpCommand()}, {Buttons.DPadUp, new CursorUpCommand()}, {Buttons.LeftThumbstickDown, new CursorDownCommand()}, {Buttons.DPadDown, new CursorDownCommand()}, {Buttons.A, new CursorSelectCommand()}, {Buttons.Start, new CursorSelectCommand()} }; } public void Update() { nothingPressed = true; foreach (Buttons b in commandDictionary.Keys.Where(b => GamePad.GetState(PlayerIndex.Two).IsButtonDown(b))) { nothingPressed = false; commandDictionary[b].Execute(); } if(nothingPressed) new NothingPressedCommand().Execute(); } } }
using UnityEngine; using System.Collections; #if UNITY_IPHONE using UWAPlatform = UWA.IOS; #elif UNITY_ANDROID using UWAPlatform = UWA.Android; #elif UNITY_STANDALONE_WIN using UWAPlatform = UWA.Windows; #else using UWAPlatform = UWA; #endif using System.Diagnostics; [ExecuteInEditMode] public class UWA_Launcher : MonoBehaviour { void Awake () { UWAPlatform.GUIWrapper wrapper = gameObject.GetComponent<UWAPlatform.GUIWrapper>(); if (wrapper == null) wrapper = gameObject.AddComponent<UWAPlatform.GUIWrapper>(); #if UNITY_EDITOR Component[] coms = gameObject.GetComponents<Component>(); for (int i = 0; i < coms.Length; i++) { if (coms[i] != null && coms[i] != this && coms[i] != wrapper && coms[i].GetType() != typeof(Transform)) DestroyImmediate(coms[i]); } #endif } } public class UWAEngine { /// <summary> /// This api can be used to initialize the UWA SDK, instead of draging the UWA_Launcher.prefab into your scene. /// </summary> [Conditional("ENABLE_PROFILER")] public static void StaticInit() { UWAPlatform.UWAEngine.StaticInit(); } /// <summary> /// The recorded frame count /// </summary> public static int FrameId { get { return UWAPlatform.UWAEngine.FrameId; } } /// <summary> /// The profiling mode /// </summary> public enum Mode { Overview = 0, Mono = 1, Assets = 2, Lua = 3, Unset = 4, } /// <summary> /// This api can be used to start the test with the given mode, instead of pressing the button in GUI panel. /// Test can be started only once. /// </summary> /// <param name="mode"> the profiling mode to be started</param> [Conditional("ENABLE_PROFILER")] public static void Start(Mode mode) { UWAPlatform.UWAEngine.Start((UWAPlatform.UWAEngine.Mode)mode); } /// <summary> /// This api can be used to stop the test, instead of pressing the button in GUI panel. /// Test can be stopped only once. /// </summary> [Conditional("ENABLE_PROFILER")] public static void Stop() { UWAPlatform.UWAEngine.Stop(); } /// <summary> /// Add a sample into the function lists in the UWAEngine, so the performance /// between a Push and a Pop will be recorded with the given name. /// It is supported to call the PushSample and PopSample recursively, and they must be called in pairs. /// </summary> /// <param name="sampleName"></param> [Conditional("ENABLE_PROFILER")] public static void PushSample(string sampleName) { UWAPlatform.UWAEngine.PushSample(sampleName); } /// <summary> /// Add a sample into the function lists in the UWAEngine, so the performance /// between a Push and a Pop will be recorded with the given name. /// It is supported to call the PushSample and PopSample recursively, and they must be called in pairs. /// </summary> [Conditional("ENABLE_PROFILER")] public static void PopSample() { UWAPlatform.UWAEngine.PopSample(); } [Conditional("ENABLE_PROFILER")] public static void LogValue(string valueName, float value) { UWAPlatform.UWAEngine.LogValue(valueName, value); } [Conditional("ENABLE_PROFILER")] public static void LogValue(string valueName, int value) { UWAPlatform.UWAEngine.LogValue(valueName, value); } [Conditional("ENABLE_PROFILER")] public static void LogValue(string valueName, Vector3 value) { UWAPlatform.UWAEngine.LogValue(valueName, value); } [Conditional("ENABLE_PROFILER")] public static void LogValue(string valueName, bool value) { UWAPlatform.UWAEngine.LogValue(valueName, value); } [Conditional("ENABLE_PROFILER")] public static void AddMarker(string valueName) { UWAPlatform.UWAEngine.AddMarker(valueName); } /// <summary> /// Change the lua lib to a custom name, e.g. 'libgamex.so'. /// There is no need to call it when you use the default ulua/tolua/slua/xlua lib. /// </summary> [Conditional("ENABLE_PROFILER")] public static void SetOverrideLuaLib(string luaLib) { #if !UNITY_IPHONE UWAPlatform.UWAEngine.SetOverrideLuaLib(luaLib); #endif } }
namespace Triton.Game.Mapping { using ns25; using ns26; using System; using System.Collections.Generic; [Attribute38("CollectibleCardClassFilter")] public class CollectibleCardClassFilter : CollectibleCardFilter { public CollectibleCardClassFilter(IntPtr address) : this(address, "CollectibleCardClassFilter") { } public CollectibleCardClassFilter(IntPtr address, string className) : base(address, className) { } public int GetNumNewCardsForClass(TAG_CLASS cardClass) { object[] objArray1 = new object[] { cardClass }; return base.method_11<int>("GetNumNewCardsForClass", objArray1); } public int GetNumPagesForClass(TAG_CLASS cardClass) { object[] objArray1 = new object[] { cardClass }; return base.method_11<int>("GetNumPagesForClass", objArray1); } public List<CollectibleCard> GetPageContents(int page) { object[] objArray1 = new object[] { page }; Class267<CollectibleCard> class2 = base.method_14<Class267<CollectibleCard>>("GetPageContents", objArray1); if (class2 != null) { return class2.method_25(); } return null; } public int GetTotalNumPages() { return base.method_11<int>("GetTotalNumPages", Array.Empty<object>()); } public void UpdateResults() { base.method_8("UpdateResults", Array.Empty<object>()); } public int m_cardsPerPage { get { return base.method_2<int>("m_cardsPerPage"); } } public List<TAG_CLASS> m_classTabOrder { get { Class246<TAG_CLASS> class2 = base.method_3<Class246<TAG_CLASS>>("m_classTabOrder"); if (class2 != null) { return class2.method_25(); } return null; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace aoc2019 { public class Day16 { public string Solve(string input, int phases) { var nums = input.ToCharArray().Select(c => int.Parse(c.ToString())).ToList(); for (var phase = 0; phase < phases; phase++) { var newNums = new List<int>(); for (var position = 0; position < nums.Count; position++) { var pattern = GetPattern(position, nums.Count); var product = Multiply(nums, pattern); newNums.Add(product); } nums = newNums; } return string.Join("", nums).Substring(0, 8); } public string Solve2(string input) { var sb = new StringBuilder(); for (var i = 0; i < 1000; i++) { sb.Append(input); } var fullInput = sb.ToString(); var output = Solve(fullInput, 100); var offset = int.Parse(input.Substring(0, 7)); var result = output.Substring(offset, 8); return result; } public List<int> GetPattern(int position, int length) { var basePattern = new[] { 0, 1, 0, -1 }; var positionAdjusted = new List<int>(); var done = false; while (!done) { foreach (var t in basePattern) { for (var j = 0; j <= position; j++) { positionAdjusted.Add(t); } } if (positionAdjusted.Count > length) { done = true; } } positionAdjusted.RemoveAt(0); return positionAdjusted.Take(length).ToList(); } public int Multiply(List<int> a, List<int> b) { if (a.Count != b.Count) { throw new ArgumentException(); } var sum = 0; for (var i = 0; i < a.Count; i++) { sum += a[i] * b[i]; } return Math.Abs(sum) % 10; } } }
using System.Linq; using System.Web.Mvc; using testxueji.Models; using vuexueji.DAL; namespace vuexueji.Controllers { public class UserController : Controller { // GET: User public ActionResult Index() { return View(); } public ActionResult Register() { return View(); } [HttpPost] public ActionResult Register(string name, string username, string telephone, string power, string password) { return Content(UserDal.Register(name,username,telephone,power,password)); } public ActionResult List(string username,string password) { return Content(UserDal.UserPower(username, password)); } [HttpPost] public ContentResult AddSession(string power,string username) { string temp = "0"; using (var db = new XuejiContext()) { switch (power) { case "1": case "t": var teachers = db.Teacherses.SingleOrDefault(t => t.UserName == username); Session["Power"] = power; if (teachers != null) { Session["Id"] = teachers.Id; Session["Name"] = teachers.Name; } temp = power == "1" ? "1" : "t"; break;; case "l": var lecturer = db.Lectureres.SingleOrDefault(l=>l.UserName==username); Session["Power"] = power; if (lecturer != null) { Session["Id"] = lecturer.Id; Session["Name"] = lecturer.Name; } temp = "l"; break; case "s": var student = db.Studentses.SingleOrDefault(l => l.Number == username); Session["Power"] = power; if (student != null) { Session["Id"] = student.Id; Session["Name"] = student.Name; } temp = "s"; break; default: break; } return Content(temp); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using IES.G2S.Resource.DAL; using IES.Resource.Model; using IES.AOP.G2S; using IES.G2S.Resource.IBLL; namespace IES.G2S.Resource.BLL { public class ChapterBLL:IChapterBLL { #region 列表 public List<Chapter> Chapter_List(int OCID) { return ChapterDAL.Chapter_List(new Chapter() { OCID = OCID }); } public List<Ken> Chapter_Ken_List(Chapter model) { return ChapterDAL.Chapter_Ken_List(model); } public IList<Chapter> Chapter_List(Chapter model) { return ChapterDAL.Chapter_List(model); } public List<IES.Resource.Model.File> File_ChapterID_KenID_List(Chapter chapter, Ken ken) { return ChapterDAL.File_ChapterID_KenID_List(chapter, ken); } public List<IES.Resource.Model.Exercise> Exercise_ChapterID_KenID_List(Chapter chapter, Ken ken) { return ChapterDAL.Exercise_ChapterID_KenID_List(chapter, ken); } public IList<Exercise> Chapter_Exercise_List(Chapter chapter, Ken ken) { return ChapterDAL.Chapter_Exercise_List(chapter, ken); } public List<Chapter> Chapter_ExerciseCount_List(int OCID, int UserID, int ExerciseType, int Diffcult) { return ChapterDAL.Chapter_ExerciseCount_List(OCID, UserID, ExerciseType, Diffcult); } #endregion #region 新增 public Chapter Chapter_ADD(Chapter model) { return ChapterDAL.Chapter_ADD(model); } #endregion #region 移动 public bool Chapter_Move(int chapterID, string direction) { return ChapterDAL.Chapter_Move(chapterID, direction); } #endregion #region 更新 public bool Chapter_Upd(Chapter model) { return ChapterDAL.Chapter_Upd(model); } #endregion #region 删除 public bool Chapter_Del(Chapter model) { return ChapterDAL.Chapter_Del(model); } #endregion } }
using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; namespace Fundamentals { public class Program { public static void Main(string[] args) { CreateHostBuilder(args).Build().Run(); // methods start the service, then wait for it to stop before returning } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); }); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CarritoDeCompras { class CarritoCompra { private List<Camisa> Camisas = new List<Camisa>(); public void AgregarCamisa() { Camisas.Add(new Camisa()); } public void EliminarCamisa() { if (Camisas.Count > 0) Camisas.RemoveAt(Camisas.Count - 1); } public int CantidadCamisas() { var cantidad = Camisas.Count(); return cantidad; } public double PrecioCamisa() { if (CantidadCamisas() > 0) return Camisa.Precio; return 0.0; } public double Descuento() { int cantidad = CantidadCamisas(); return Camisa.Descuento(cantidad); } public double PrecioTotal() { int cantidad = CantidadCamisas(); return Camisa.PrecioTotal(cantidad); } public double PrecioTotalConDescuento() { int cantidad = CantidadCamisas(); return Camisa.PrecioTotalConDescuento(cantidad); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using A2CourseWork.Classes; using A2CourseWork.Objects; namespace A2CourseWork.Gui.ViewBooking { public partial class ByDate : Default { List<int> mondays = new List<int>(); List<int> fridays = new List<int>(); List<string> months = new List<string>() { "January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; DateTime current; double revenue; private DataTable table; private Database db; public ByDate() { InitializeComponent(); titlelbl.Text = "Woodside Community - creche - View"; db = new Database(); db.connect(); panel2.BringToFront(); } private void btnsearch_Click(object sender, EventArgs e) { //if() } //populate the years combo box with 5 years private void populateyearscbx() { yearcbx.Items.Clear(); for (int i = 0; i < 5; i++) { yearcbx.Items.Add(DateTime.Now.Year + i -1); } yearcbx.SelectedIndex = 1; } //populate months combo with all 12 months private void populatemonthscbx(bool currentyear) { monthscbx.Items.Clear(); for (int i = 0; i < 12; i++) { monthscbx.Items.Add(months[i]); } monthscbx.SelectedIndex = 0; } //populate week buttons depending on the amount of weeks in the months private void populateweekbtns(DateTime now) { DateTime startdate = new DateTime(now.Year, now.Month, 1); DateTime enddate = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month)); mondays = new List<int>(); fridays = new List<int>(); for (DateTime date = startdate; date <= enddate; date = date.AddDays(1)) { if (date.DayOfWeek == DayOfWeek.Monday) { mondays.Add(date.Day);//grab monday dates for viewing } } if (mondays.Count <= 4) { week5rbtn.Visible = false; week5rbtn.Enabled = false; } else { week5rbtn.Visible = true; week5rbtn.Enabled = true; } int selected = 1; if (week2rbtn.Checked) { selected = 2; } else if (week3rbtn.Checked) { selected = 3; } else if (week4rbtn.Checked) { selected = 4; } else if (week5rbtn.Checked) { selected = 5; } weeklbl.Text = "Week: " + selected.ToString(); current = new DateTime(now.Year, now.Month, mondays[selected-1]); cancel_checked(); } //on index change update months/weeks accordingly private void yearcbx_SelectedIndexChanged(object sender, EventArgs e) { if (yearcbx.Text == DateTime.Now.Year.ToString()) { populatemonthscbx(true); } else { populatemonthscbx(false); } populateweekbtns(new DateTime(yearcbx.SelectedIndex + DateTime.Now.Year - 1, monthscbx.SelectedIndex + 1, 1)); } //on month change update weeks accordingly private void monthscbx_SelectedIndexChanged(object sender, EventArgs e) { int x = monthscbx.SelectedIndex + 1; populateweekbtns(new DateTime(yearcbx.SelectedIndex + DateTime.Now.Year - 1, x, 1)); } private void ByDate_Load(object sender, EventArgs e) { populateyearscbx(); if (DateTime.Now.Year.ToString() == yearcbx.Text) { populatemonthscbx(true); } else { populatemonthscbx(false); } populateweekbtns(DateTime.Now); monthscbx.SelectedIndex = DateTime.Now.Month - 1; } //create a table for the details about kids/parents booked in that week private void createTableforKids(DateTime now,bool cancel) { table = new DataTable(); table.Columns.Add("Parent Name"); table.Columns.Add("Kid Name"); table.Columns.Add("Kid DOB"); table.Columns.Add("Kid Group"); table.Columns.Add("Tele No"); MiscDB miscdb = new MiscDB(db); List<List<string>> data = miscdb.BookingDetails(now,cancel); foreach(List<string> current in data) { table.Rows.Add(current[0] + " " + current[1],current[2] + " " + current[3],current[4],MiscFunctions.getgroupfromage(current[4]),current[5]); } KidsView.DataSource = table; } //create table to show the bookings for that week private void createTableforBooking(DateTime now,bool cancel) { table = new DataTable(); table.Columns.Add("Kid Name"); table.Columns.Add("Mon"); table.Columns.Add("Tues"); table.Columns.Add("Weds"); table.Columns.Add("Thurs"); table.Columns.Add("Friday"); MiscDB miscdb = new MiscDB(db); List<List<string>> data = miscdb.BookingDays(now,cancel); foreach (List<string> current in data) { table.Rows.Add(current[0] + " " + current[1]); } amountlbl.Text = "Booking amount: " + data.Count.ToString(); WeekView.DataSource = table; WeekView.AllowUserToAddRows = false; int x = 0; int daysbooked = 0; foreach(DataGridViewRow row in WeekView.Rows) //need to loop through the rows in order to color the cells accordingly { List<string> current = data[x]; for (int i = 0; i <5; i++) { if (current[i + 2] == "1") { row.Cells[i+1].Style.BackColor = Color.LimeGreen;//green for booked daysbooked++;//count the number of days booked } else { row.Cells[i+1].Style.BackColor = Color.Red;//red for not booked } } x++; } PricesDB pdb = new PricesDB(db); revenue = data.Count * pdb.getBase(); revenuelbl.Text = "Estimated revenue: £" + ((data.Count * pdb.getBase())* daysbooked).ToString(); //not including discounts WeekView.Enabled = false; } private void week2rbtn_CheckedChanged(object sender, EventArgs e) { int x = monthscbx.SelectedIndex + 1; populateweekbtns(new DateTime(yearcbx.SelectedIndex + DateTime.Now.Year - 1, x, 1)); } private void btnback_Click(object sender, EventArgs e) { ViewMenu menu = new ViewMenu(); this.Hide(); menu.Show(); } private void btnreport_Click(object sender, EventArgs e) { GeneratedReport form = new GeneratedReport(current,revenue); form.Show(); } private void cancel_checked() { if (Canceled.Checked) { createTableforKids(current, true); createTableforBooking(current, true); } else { createTableforKids(current, false); createTableforBooking(current, false); } } private void Canceled_CheckedChanged(object sender, EventArgs e) { cancel_checked(); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class LastSceneActivator : MonoBehaviour { public GameObject toActivate; public GameObject GM; public float timetospawn; private float count; public float endScene; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { count += Time.deltaTime; if (timetospawn < count) { toActivate.SetActive(true); } if (endScene < count) { GM.GetComponent<SceneSwitcher>().NextLevel(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using SolrNet.Attributes; namespace TxHumor.Solr.Models { public class SolrHumorModel { [SolrUniqueKey("id")] public string Id { get; set; } [SolrField("humorid")] public int HumorId { get; set; } //[Attr_MatchField("guid")] //[Attr_GuidCachePrimaryKey] //[SolrField("guid")] //public Guid Uinonkey { get; set; } [SolrField("username")] public string UserName { get; set; } [SolrField("title")] public string HumorTitle { get; set; } [SolrField("supportnum")] public int SupportNum { get; set; } [SolrField("opposenum")] public int OpposeNum { get; set; } [SolrField("commentnum")] public int CommentNum { get; set; } [SolrField("humorscore")] public double Score { get; set; } [SolrField("tags")] public List<string> Tags { get; set; } [SolrField("showtime")] public DateTime ShowTime { get; set; } [SolrField("userid")] public int CreateUserId { get; set; } [SolrField("isdelete")] public int IsDelete { get; set; } /// <summary> /// 口碑内容 /// </summary> [SolrField("content")] public string HumorContent { get; set; } } }
namespace CloneDeploy_Entities.DTOs.ImageSchemaBE { public class ImageSchema { public HardDrive[] HardDrives { get; set; } } }
using Autofac; using Autofac.Extensions.DependencyInjection; using CryptoInvestor.Api.Framework; using CryptoInvestor.Infrastructure.IoC; using CryptoInvestor.Infrastructure.Mongo; using CryptoInvestor.Infrastructure.Services.Interfaces; using CryptoInvestor.Infrastructure.Settings; using Hangfire; using Hangfire.Mongo; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.IdentityModel.Tokens; using NLog.Extensions.Logging; using NLog.Web; using Swashbuckle.AspNetCore.Swagger; using System; using System.Text; namespace CryptoInvestor.Api { public class Startup { public IConfiguration Configuration { get; } public IContainer ApplicationContainer { get; private set; } public Startup(IConfiguration configuration) { Configuration = configuration; } public IServiceProvider ConfigureServices(IServiceCollection services) { var issuer = Configuration["Jwt:Issuer"]; services.AddMvc(); services.AddCors(); services.AddMemoryCache(); services.AddAuthentication(o => { o.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; o.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; }).AddJwtBearer(o => { o.TokenValidationParameters = new TokenValidationParameters { ValidIssuer = Configuration["Jwt:Issuer"], ValidateAudience = false, IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])), }; }); services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new Info { Title = "CryptoInvestor API", Version = "v1" }); }); JobStorage.Current = new MongoStorage(Configuration["Mongo:ConnectionString"], Configuration["Mongo:Database"], new MongoStorageOptions { Prefix = "Hg" }); services.AddHangfire(c => c.UseStorage(JobStorage.Current)); var builder = new ContainerBuilder(); builder.Populate(services); builder.RegisterModule(new ContainerModule(Configuration)); ApplicationContainer = builder.Build(); return new AutofacServiceProvider(ApplicationContainer); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IApplicationLifetime appLifetime) { loggerFactory.AddNLog(); app.AddNLogWeb(); env.ConfigureNLog("nlog.config"); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseSwagger(); app.UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", "CryptoInvestor API V1"); }); app.UseCors(builder => builder .AllowAnyHeader() .AllowAnyMethod() .AllowAnyOrigin() ); app.UseAuthentication(); app.UseExceptionsHandler(); app.UseMvc(); MongoConfigurator.Initialize(); app.UseHangfireDashboard(); app.UseHangfireServer(); var generalSettings = app.ApplicationServices.GetService<GeneralSettings>(); if (generalSettings.SeedData) { var dataInitializer = app.ApplicationServices.GetService<IDataInitializer>(); dataInitializer.SeedAsync(); } var coinsProvider = app.ApplicationServices.GetService<ICoinsProvider>(); RecurringJob.AddOrUpdate(() => coinsProvider.Provide(), Cron.MinuteInterval(15)); appLifetime.ApplicationStopped.Register(() => ApplicationContainer.Dispose()); } } }
using System; namespace Simon.Pattern.Library { public abstract class CashBase { public abstract double AcceptCash(double money); } public class CashNormal : CashBase { public override double AcceptCash(double money) { return money; } } public class CashRebate : CashBase { private double mMoneyRebate = 1d; public CashRebate(double moneyRebate) { this.mMoneyRebate = moneyRebate; } public override double AcceptCash(double money) { return money * this.mMoneyRebate; } } public class CashReturn : CashBase { private double mMoneyCondition = 0.0d; private double mMoneyReturn = 0.0d; public CashReturn(double moneyCondition, double moneyReturn) { this.mMoneyCondition = moneyCondition; this.mMoneyReturn = moneyReturn; } public override double AcceptCash(double money) { double result = money; if (money >= this.mMoneyCondition) result = money - Math.Floor(money / this.mMoneyCondition) * mMoneyReturn; return result; } } }
using System; using System.Diagnostics; using CallCenter.Client.Communication; using CallCenter.Client.ViewModel.Helpers; using CallCenter.Common; using CallCenter.Common.Entities; namespace CallCenter.Client.ViewModel.ViewModels { public class LoginWindowViewModel : OkCancelViewModel { private readonly IConnection connection; private string operatorNumber; private readonly ISettings settings; private readonly IViewModelFactory viewModelFactory; public LoginWindowViewModel(IViewModelFactory viewModelFactory, IWindowService windowService, ISettings settings, IConnection connection) : base(windowService) { if (viewModelFactory == null) throw new ArgumentNullException("viewModelFactory"); if (windowService == null) throw new ArgumentNullException("windowService"); if (settings == null) throw new ArgumentNullException("settings"); if (connection == null) throw new ArgumentNullException("connection"); this.viewModelFactory = viewModelFactory; this.settings = settings; this.connection = connection; } public Command<string> LoginCommand { get { return new Command<string>(this.Login); } } public SimpleCommand SettingsCommand { get { return new SimpleCommand(this.OpenSetings); } } public string OperatorNumber { get { return this.operatorNumber; } set { if (this.operatorNumber == value) return; this.operatorNumber = value; this.RaisePropertyChanged(); } } public override ViewModelType Type { get { return ViewModelType.LoginWindow; } } private void OpenSetings(object parameter) { IViewModel settingsViewModel = this.viewModelFactory.GetSettingsViewModel(this.WindowService, this.settings); settingsViewModel.ShowDialog(); } private void Login(string agentNumber) { if(string.IsNullOrWhiteSpace(agentNumber)) return; IOperator @operator; try { @operator = this.connection.OperatorEventProcessorService.ChangeOperatorState(new OperatorEventInfo(agentNumber, EventReason.Login, "ws78")); } catch (Exception) { return; } IViewModel mainViewModel = this.viewModelFactory.GetMainViewModel(this.WindowService, this.settings, this.connection, @operator); mainViewModel.Init(); mainViewModel.Show(); this.Close(); } protected override void OnCancelExecuted(object parameter) { this.Close(); } } }
using WorkerService.Entities.Concrete; using WorkerService.Entities.Dtos; using System; using System.Collections.Generic; using System.Text; namespace WorkerService.Business.Abstract { public interface IExamService { Exam GetById(int examId); Exam GetByTitle(string examTitle); Exam GetByCourseName(string courseName); List<Exam> GetList(); void Add(ExamDto examDto); void Delete(int examId); void Update(int examId); } }
using DynamicsExtensions.Dynamics; using DynamicsExtensions.Extensions; using DynamicsExtensions.Models.Core; using DynamicsExtensions.Models.View; using Microsoft.Xrm.Sdk.Query; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Web; using System.Web.Mvc; namespace DynamicsExtensions.Controllers { public class InQueryController : BaseController { private readonly IDynamicsOperations _dynamicsOperations; public InQueryController() { _dynamicsOperations = new DynamicsOperations((AuthCredentials)System.Web.HttpContext.Current.Session["AuthCredentials"]); } public ActionResult Index() { var entitiesMetaData = _dynamicsOperations.GetEntities() .Where(x => x.DisplayName.UserLocalizedLabel != null) .OrderBy(x => x.DisplayName.UserLocalizedLabel.Label); var model = new InQueryModel() { Entities = entitiesMetaData.Select(x => new SelectListItem() { Text = x.DisplayName.UserLocalizedLabel.Label, Value = x.LogicalName }), EntitiesMetaData = entitiesMetaData }; return View(model); } [HttpPost] public ActionResult Index(InQueryModel model) { var qe = new QueryExpression(model.EntityName); qe.ColumnSet.AddColumn(model.AttributeName); qe.Criteria = new FilterExpression(LogicalOperator.Or); var attributeValues = model.InputFile.InputStream.ReadAllLines(); foreach (var value in attributeValues) { qe.Criteria.AddCondition(model.AttributeName, ConditionOperator.Equal, value); } _dynamicsOperations.CreatePersonalView($"In Query - {DateTime.Now:yyyy-MM-dd}", qe); return RedirectToAction("Success"); } public ActionResult Success() { return View(); } public JsonResult GetAttributes(string entity) { var attributesMetaData = _dynamicsOperations.GetAttributes(entity) .Where(x => x.AttributeOf == null) .Where(x => x.DisplayName.UserLocalizedLabel != null) .OrderBy(x => x.DisplayName.UserLocalizedLabel.Label); return Json(attributesMetaData.Select(x => new { DisplayName = x.DisplayName.UserLocalizedLabel.Label, LogicalName = x.LogicalName }), JsonRequestBehavior.AllowGet); } } }
using System; using ReadyGamerOne.Data; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; namespace ReadyGamerOne.Rougelike.Item { public abstract class Slot<T,DataType> : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler where T:Slot<T,DataType> where DataType :CsvMgr { public DataType ItemData; public Image icon; public Text countText; public event Action<T> onPointerEnter; public event Action<T> onPointerExit; public event Action<T> onPointerClick; private Action<string> onDelete; public int Count => int.Parse(countText.text); public void Init(string itemId, int count = 1,Action<string> ondelete=null) { this.onDelete = ondelete; ItemData = CsvMgr.GetData<DataType>(itemId); countText.text = count.ToString(); UseItemData(); } protected abstract void UseItemData(); public void Add(int count) { countText.text = (Count + count).ToString(); } public int Remove(int amount) { var count = Count; if (count <= amount) { onDelete?.Invoke(ItemData.ID); Destroy(gameObject); return count; } countText.text = (Count - amount).ToString(); return amount; } public void OnPointerEnter(PointerEventData eventData) { onPointerEnter?.Invoke(this as T); } public void OnPointerExit(PointerEventData eventData) { onPointerExit?.Invoke(this as T); } public void OnPointerClick(PointerEventData eventData) { onPointerClick?.Invoke(this as T); } } }
using System; using System.Collections; using BehaviorScripts; using BehaviorScripts.ProjectileBehaviors; using ManagerScripts; using UnityEngine; using Utilities; namespace BehaviorScripts { public class PlayerScript : Entity { public static int absorbDuration = 2; public static int absorbCooldown = 15; public static double absorbUsageRatio = 1; //This should always be between 0 and 1; private static bool absorbReady; private static bool absorbCooling; public override float healthMultiplier => 1; private static PlayerScript _player; public static ShooterBehavior ShooterComponent => _player.shooterComponent; [SerializeField] private PlayerMovement movementComponent; public override bool isFriendly => true; public override bool IsAttacking => !DirectorScript.Director.paused && aim.magnitude > 0.9; private Rigidbody2D _Rb; public override float BulletForceMultiplier => shooterComponent.bulletSpeedMultiplier; //These attributes persists across levels, and are modified by upgrades [SerializeField] private float attackSpeedMultiplier = 1; public override float AttackSpeedMultiplier { get => attackSpeedMultiplier; set => attackSpeedMultiplier = value; } //Following are all properties used to create the interface that the components and other entities use to communicate with others. public override Vector3 Position => model.transform.position; public Vector2 velocity => movementComponent.velocity; public Vector2 aim { set => movementComponent.aim = value; get => movementComponent.aim; } private ControlsManager _controlsManager; private bool _isMovementCoroutineRunning; private new void Awake() { if (DirectorScript.Player) { Destroy(gameObject); return; } //shooterComponent.Owner = this; _Rb = model.GetComponent<Rigidbody2D>(); _controlsManager = new ControlsManager(this); //ControlsManager.AssignAbility("LeftShoulder", AbilityName.Guard); DirectorScript.Player = this; _player = this; DirectorScript.SetDontDestroyOnLoad(gameObject); base.Awake(); } private void FixedUpdate() { movementComponent.Move(Time.deltaTime); } public override void OnCollision(Collision2D other) { var g = other.gameObject; switch (g.GetComponent<MonoBehaviour>()) { case ProjectileScript bullet: if (bullet is LandmineExplosion e) { int layerMask = ~LayerMask.GetMask("unfriendly_bullet", "unfriendly_combatant", "friendly_bullet", "friendly_combatant"); var vecExplosionToPlayer = Position - e.position; if (Physics2D.Raycast(e.position, vecExplosionToPlayer, vecExplosionToPlayer.magnitude, layerMask)) { break; } } //Landmines do not hurt entities; only their explosions do. if (bullet is LandmineBehavior) { break; } combatantComponent.HandleHit(bullet); //Determine if the player is being damge or healed var value = (int)(bullet.damage * combatantComponent.damageIntakeMultiplier); if (value > 0) { OnHit(value); absorbUsageRatio += Math.Pow(0.5, 10*combatantComponent.healthRatio)/2; } else { OnHeal(value); } if (!_isMovementCoroutineRunning) { StartCoroutine(UpdatePositionUntilStill()); } break; case MacGuffinScript _: DirectorScript.MacGuffinObtained(); SoundScript.PlaySound(SoundScript.Sound.ACK); Destroy(g); break; case ExitScript _: DirectorScript.OnExit(); break; case PickupScript pickupScript: Destroy(shooterComponent.gameObject); shooterComponent = pickupScript.ConsumePickup(); shooterComponent.transform.parent = gameObject.transform; shooterComponent.transform.localScale = new Vector3(1, 1, 1); shooterComponent.Refresh(); break; case UpgradeScript upgradeScript: shooterComponent.HandleUpgrade(upgradeScript); combatantComponent.HandleUpgrade(upgradeScript); upgradeScript.ConsumePickup(); break; default: if (g.CompareTag("boundary")) { foreach (Transform b in shooterComponent.transform) { Destroy(b.gameObject); } //Determine direction of boundary from player angle //The + Math.PI/8 is added so that an angle slightly less than 90 degrees, which should result in up, doesn't result in a right direction. var d = (int)Math.Floor((Math.Atan2(Position.y, Position.x) + Math.PI/8)/(Math.PI/2)); //Add 4 and mod 4 in case Atan2 provides a negative, in the case of bottom facing angles transform.position = new Vector3((int) -Math.Cos(Math.PI / 2 * d) * 18, (int) -Math.Sin(Math.PI / 2 * d) * 8, 0); model.transform.localPosition = new Vector3(0, 0, 0); DirectorScript.HandleBoundaryCollision((DirectorScript.Direction)((d + 4) % 4)); } break; } } private void OnEnable() { _controlsManager.EnableControls(); } public void OnDisable() { _controlsManager?.DisableControls(); } public void SetMove(Vector2 vec) { if (DirectorScript.Director.paused) return; movementComponent.move = vec; if (vec != Vector2.zero) { DirectorScript.OnPlayerMove(); } else if (!_isMovementCoroutineRunning) { StartCoroutine(nameof(UpdatePositionUntilStill)); } } public void SetAim(Vector2 vec) { if (DirectorScript.Director.paused) return; aim = vec; TryLock(); if (aim != Vector2.zero) { var angleVector = IsTargetLocked() ? GetTargetAngle() : vec; var angleDegrees = UtilityFunctions.ToAngle(angleVector); SetRotation(angleDegrees); } } public void SetRotation(float zAngle) { var e = model.transform.rotation.eulerAngles; model.transform.eulerAngles = new Vector3(e.x, e.y, Mathf.Rad2Deg * (zAngle - (float)Math.PI/2)); } public void AddVelocity(Vector2 velocity) { if (_Rb.velocity.magnitude > 100) { var vec = _Rb.velocity.normalized; _Rb.velocity = vec * 100; } else { _Rb.AddForce(velocity); } } public static bool IsTargetLocked() { try { return _player.HasTarget;//shooterComponent.HasTarget(); } catch (NullReferenceException e) { //Determine why a NullReference is ever thrown Console.WriteLine(e); return false; } } public static Entity GetLockedTarget() { return _player.Target; } public static Vector2 GetTargetAngle() { return _player.TargetPosition; //shooterComponent.GetTargetVector(); } public override void TryLock() { var oldTarget = Target; Target = null; foreach (var e in DirectorScript.GetEnemyList()) { if (aim == Vector2.zero) { break; //Don't bother looking for locks if the player isn't aiming } var relativePosition = e.Position - Position; var distance = relativePosition.magnitude; var dot = Vector2.Dot(aim.normalized, relativePosition.normalized); if (dot > 0.85 && shooterComponent.MinimumLockingRange < distance && distance < shooterComponent.lockingRange) { //Assign target if no current target exists or if new target is closer than current target if (!Target || distance < TargetDistance) { Target = e; TargetPosition = relativePosition; TargetDistance = distance; } } } //Check if target changed if (oldTarget != Target) { CanvasScript.UpdatePlayerTarget(); } } //This is called when the button associated with absorb, (as of now, left shoulder) is pressed or released. public static void OnAbsorbInteraction(bool pressed) { if (pressed && absorbUsageRatio >= 0.5f) { _player.StopCoroutine(nameof(AbsorbCooldownCoroutine)); absorbCooling = false; _player.StartCoroutine(nameof(AbsorbCoroutine)); }else if (!pressed) { _player.StopCoroutine(nameof(AbsorbCoroutine)); _player.damageIntakeMultiplier = 1; //Start cooling coroutine only if it isn't already active if (!absorbCooling) { _player.StartCoroutine(nameof(AbsorbCooldownCoroutine)); } } } public override void OnDeath() { DirectorScript.OnPlayerDeath(); } //This coroutine is called when the player let's go of the movement control and it becomes (0,0) //It broadcasts the fact that the player is moving (despite the player letting go of the stick, because of inertia) //until the velocity is 0. This is to avoid putting if checks in the update method instead. private IEnumerator UpdatePositionUntilStill() { _isMovementCoroutineRunning = true; while (_Rb.velocity.magnitude > 1) { TryLock(); DirectorScript.OnPlayerMove(); yield return null; } _isMovementCoroutineRunning = false; } private IEnumerator AbsorbCoroutine() { _player.damageIntakeMultiplier = -1; while (absorbUsageRatio > 0f) { absorbUsageRatio -= Time.deltaTime/absorbDuration; CanvasScript.UpdatePlayerAbsorbSlider(); yield return null; } _player.damageIntakeMultiplier = 1; _player.StartCoroutine(nameof(AbsorbCooldownCoroutine)); } private IEnumerator AbsorbCooldownCoroutine() { absorbCooling = true; while (absorbUsageRatio <= 1) { absorbUsageRatio += Time.deltaTime/absorbCooldown; CanvasScript.UpdatePlayerAbsorbSlider(); yield return null; } absorbCooling = false; } } }
using IES.Resource.Model; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IES.G2S.Resource.IBLL { public interface IKeyBLL { List<Key> ExerciseOrFile_Key_List(string SearchKey, string Source, int UserID, int TopNum,int OCID); List<IES.Resource.Model.Key> Resource_Key_List(int ocid, string searchKey, string source, int userId, int topNum); } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; namespace Praestigia { /// <summary> /// This is the main type for your game. /// </summary> public partial class GameClass : Game { public bool Drawing { get; set; } public MouseState PraestMouse { get; set; } public KeyboardState PraestKeyboard { get; set; } public GraphicsDeviceManager graphics { get; set; } public SpriteBatch spriteBatch { get; set; } //custom variables private Texture2D background; private Texture2D shuttle; private Texture2D earth; private SpriteFont Arial; public GameClass() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; Drawing = false; } /// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); } /// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // TODO: use this.Content to load your game content here background = Content.Load<Texture2D>("stars"); shuttle = Content.Load<Texture2D>("shuttle"); earth = Content.Load<Texture2D>("earth"); Arial = Content.Load<SpriteFont>("Praestigia"); } /// <summary> /// UnloadContent will be called once per game and is the place to unload /// game-specific content. /// </summary> protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } /// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> ///<param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { //State Object Updating PraestKeyboard = Keyboard.GetState(); PraestMouse = Mouse.GetState(); //Input Handling if (PraestKeyboard.IsKeyDown(Keys.Escape)) { Content.Unload(); Exit(); } //Update Logic base.Update(gameTime); } /// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.CornflowerBlue); // TODO: Add your drawing code here spriteBatch.Begin(); Drawing = true; spriteBatch.Draw(background, new Rectangle(0, 0, 800, 480), Color.White); spriteBatch.Draw(earth, new Vector2(400, 240), Color.White); spriteBatch.Draw(shuttle, new Vector2(450, 240), Color.White); spriteBatch.DrawString(Arial, "Praestigia", new Vector2(0, 0), Color.White); spriteBatch.End(); Drawing = false; base.Draw(gameTime); } } }
using System.Data; using TruongDuongKhang_1811546141.BussinessLayer.Entity; using TruongDuongKhang_1811546141.DataAccessLayer; using System.Data.SqlClient; using TruongDuongKhang_1811546141.Lib; using System; namespace TruongDuongKhang_1811546141.BussinessLayer.Workflow { class BusProduct { public ProductEntity productInfo { get; set; } // default contructor public BusProduct() { this.productInfo = new ProductEntity(); } // contructor with one parameter public BusProduct(ProductEntity entity) { this.productInfo = entity; } // lấy dữ liệu về mã SP, mã loại SP, tên SP, nhà sản xuất, số lượng, ngày nhập hàng, tài khoản phê duyệt, giá SP, giảm giá, chú thích, hình của SP private string selectSql(bool isActive, int cateId) { return string.Format("Select ProductId, ProductName, Manufactur, Quantity, UnitPrice, Discount, Description " + "from TblProduct prod where Status = " + (isActive ? "1" : "0") + (cateId > 0 ? " And prod.CategoryId = " + cateId.ToString() : "") + " Order by ProductName"); } // lấy dữ liệu về mã SP, mã loại SP, tên SP, nhà sản xuất, số lượng, ngày nhập hàng, tài khoản phê duyệt, giá SP, giảm giá, chú thích, hình của SP private string selectSql(string likename) { return string.Format("Select ProductId, ProductName, Manufactur, Quantity, UnitPrice, Discount, cast(UnitPrice * Discount / 100 as int) DiscountPrice, Description " + "from TblProduct where Status = 1 " + (likename.Trim().Length > 0 ? " And ProductName like N'%" + likename.Trim() + "%'" : "") + " Order by ProductId"); } // lấy dữ liệu về mã SP, mã loại SP, tên SP, nhà sản xuất, số lượng, ngày nhập hàng, tài khoản phê duyệt, giá SP, // giảm giá, chú thích, hình của SP private string selectSql() { return string.Format("Select ProductId, ProductName, CategoryId, Image, Manufactur, FORMAT(EnteredDate, 'dd/MM/yyyy') as EnteredDate, " + "Account, iif(Status=1,N'Đã phê duyệt', N'Chưa phê duyệt') as Status, Quantity, UnitPrice, Discount, Description " + "from TblProduct " + " Order by ProductId"); } // lấy dữ liệu về mã SP, mã loại SP, tên SP, nhà sản xuất, số lượng, ngày nhập hàng, tài khoản phê duyệt, giá SP, // giảm giá, chú thích, hình ứng với mã SP private string getInfoSql(string productId) { return string.Format("Select " + "ProductId, ProductName, CategoryId, Image, Manufactur, EnteredDate, Account, Status, Quantity, UnitPrice, Discount, Description " + "from TblProduct where ProductId = '" + productId + "'"); } // trả về câu SQL insert dữ liệu vào bảng TblProduct ( mssql server ) private string insertSql() { return string.Format( "set dateformat dmy;" + "Insert Into TblProduct" + "(ProductId, ProductName, CategoryId, Image, Manufactur, EnteredDate, Account, Status, Quantity, UnitPrice, Discount, Description )" + " Values (N'{0}', N'{1}', {2}, '{3}', N'{4}', '{5}', N'{6}', {7}, {8}, {9}, {10}, N'{11}');", this.productInfo.ProductId, this.productInfo.ProductName, this.productInfo.CategoryId.ToString(), Tools.imageToString(this.productInfo.Image), this.productInfo.Manufactur, string.Format("{0:dd/MM/yyyy hh:mm:ss}", DateTime.Now), this.productInfo.Account, "0", this.productInfo.Quantity.ToString(), this.productInfo.UnitPrice.ToString(), this.productInfo.Discount.ToString(), this.productInfo.Description); ; } // trả về câu SQL update dữ liệu vào bảng TblProduct ( mssql server ) private string updateSql() { return string.Format( "Update TblProduct set ProductName =N'{0}', CategoryId ={1}, Manufactur =N'{2}', Status ={3}, " + "Quantity ={4}, UnitPrice ={5}, Discount ={6}, Description =N'{7}' Where ProductId=N'{8}' ;", this.productInfo.ProductName, this.productInfo.CategoryId, this.productInfo.Manufactur, (this.productInfo.Status ? 1 : 0), this.productInfo.Quantity, this.productInfo.UnitPrice, this.productInfo.Discount, this.productInfo.Description, this.productInfo.ProductId); ; } // trả về câu SQL xóa dữ liệu vào bảng TblProduct ( mssql server ) private string deleteSql() { return string.Format("Delete TblProduct where ProductId='{0}'", this.productInfo.ProductId); } // thêm thông tin địa chỉ vào database public int addProduct() { return new DaoMsSqlServer().executeNonQuery(insertSql()); } // cập nhật thông tin địa chỉ vào database public int updateProduct() { return new DaoMsSqlServer().executeNonQuery(updateSql()); } // xóa thông tin địa chỉ vào database public int deleteProduct() { return new DaoMsSqlServer().executeNonQuery(deleteSql()); } // đọc thông tin khách hàng từ database theo mã khách hàng và trả về ProductEntity object cho nơi gọi // ProductId: mã khách hàng muốn lấy dữ liệu public ProductEntity getInfo(string productId) { ProductEntity ProductEntity = new ProductEntity(); SqlDataReader reader = new DaoMsSqlServer().getDataReader(getInfoSql(productId)); while (reader.Read()) { ProductEntity.ProductId = reader.GetString(0); ProductEntity.ProductName = reader.GetString(1); ProductEntity.CategoryId = reader.GetInt32(2); ProductEntity.Image = Tools.stringToImage(reader.GetString(3)); ProductEntity.Manufactur = reader.GetString(4); ProductEntity.EnteredDate = reader.GetDateTime(5); ProductEntity.Account = reader.GetString(6); ProductEntity.Status = reader.GetBoolean(7); ProductEntity.Quantity = reader.GetByte(8); ProductEntity.UnitPrice = (int)reader.GetDouble(9); ProductEntity.Discount = (int)reader.GetDouble(10); ProductEntity.Description = reader.GetString(11); } return ProductEntity; } // lấy thông tin khách hàng từ database và trả về dataset object cho nơi gọi public DataSet getData() { return new DaoMsSqlServer().getData(selectSql(), "TblProduct"); } // lấy thông tin sản phẩm từ database và trả về dataset object cho nơi gọi // dựa vào trạng thái isActive để chọn ds : true - đã kích hoạt, false - chưa kích hoạt // dựa vào giá trị cateId để lọc [nếu là 0 thì không lọc ] public DataSet getData(bool isActive, int cateId) { return new DaoMsSqlServer().getData(selectSql(isActive, cateId), "TblProduct"); } // lấy thông tin sản phẩm từ database và trả về dataset object cho nơi gọi // dựa vào tên sản phẩm truyền vào để chọn ds public DataSet getData(string likename) { return new DaoMsSqlServer().getData(selectSql(likename), "TblProduct"); } } }
using HCL.Academy.Model; using System; using System.Collections.Generic; using System.Web.Mvc; using System.Net.Http; using System.Threading.Tasks; using HCLAcademy.Util; using Microsoft.ApplicationInsights; using System.Diagnostics; namespace HCLAcademy.Controllers { public class SkillMasterController : BaseController { // GET: SkillMaster public async Task<ActionResult> Index() { InitializeServiceClient(); List<SkillMaster> lstSkillMaster = new List<SkillMaster>(); try { HttpResponseMessage response = await client.PostAsJsonAsync("Skill/GetAllSkillMaster", req); lstSkillMaster = await response.Content.ReadAsAsync<List<SkillMaster>>(); } catch (Exception ex) { //LogHelper.AddLog("SkillMasterController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID); TelemetryClient telemetry = new TelemetryClient(); telemetry.TrackException(ex); } return View(lstSkillMaster); } // GET: SkillMaster/Create public ActionResult Create() { return View(); } // POST: SkillMaster/Create [HttpPost] public async Task<ActionResult> Create(FormCollection collection) { InitializeServiceClient(); try { SkillRequest skillReq = new SkillRequest(); skillReq.ClientInfo = req.ClientInfo; skillReq.SkillDetails = new SkillMaster(); if (collection["IsDefault"] == "true") skillReq.SkillDetails.IsDefault = true; else skillReq.SkillDetails.IsDefault = false; skillReq.SkillDetails.Title = collection["Title"].ToString(); HttpResponseMessage response = await client.PostAsJsonAsync("Skill/AddSkillDetail", skillReq); bool result= await response.Content.ReadAsAsync<bool>(); TempData["SkillCreateSuccess"] = true; TempData.Keep(); return RedirectToAction("Index"); } catch { return View(); } } // GET: SkillMaster/Edit/5 public async Task<ActionResult> Edit(int Id) { InitializeServiceClient(); SkillMaster skillmaster = new SkillMaster(); try { HttpResponseMessage response = await client.PostAsJsonAsync("Skill/GetSkillById/"+Id.ToString(), req); skillmaster = await response.Content.ReadAsAsync<SkillMaster>(); } catch (Exception ex) { // LogHelper.AddLog("SkillMasterController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID); TelemetryClient telemetry = new TelemetryClient(); telemetry.TrackException(ex); } return View(skillmaster); } // POST: SkillMaster/Edit/5 [HttpPost] public async Task<ActionResult> Edit(SkillMaster skillmaster) { InitializeServiceClient(); try { if (ModelState.IsValid) { SkillRequest skillReq = new SkillRequest(); skillReq.ClientInfo = req.ClientInfo; skillReq.SkillDetails = skillmaster; HttpResponseMessage response = await client.PostAsJsonAsync("Skill/UpdateSkill", skillReq); bool result = await response.Content.ReadAsAsync<bool>(); ViewBag.Success = true; } } catch (Exception ex) { //UserManager user = (UserManager)Session["CurrentUser"]; //LogHelper.AddLog("SkillMasterController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID); TelemetryClient telemetry = new TelemetryClient(); telemetry.TrackException(ex); } return View(skillmaster); } // GET: SkillMaster/Delete/5 public async Task<ActionResult> Delete(int id) { try { InitializeServiceClient(); HttpResponseMessage response = await client.PostAsJsonAsync("Skill/RemoveSkill/"+id.ToString(), req); int ErrorNumber = await response.Content.ReadAsAsync<int>(); if (ErrorNumber == 50000) { TempData["SkillDeleteFailMessage"] = "Record cannot be deleted because it has child record/records"; TempData.Keep("SkillDeleteFailMessage"); TempData.Remove("SkillDeleteSuccessMessage"); } else { TempData["SkillDeleteSuccessMessage"] = "Record deleted successfully"; TempData.Keep("SkillDeleteSuccessMessage"); TempData.Remove("SkillDeleteFailMessage"); } } catch(Exception ex) { //LogHelper.AddLog("SkillMasterController", ex.Message, ex.StackTrace, "HCL.Academy.Web", user.EmailID); TelemetryClient telemetry = new TelemetryClient(); telemetry.TrackException(ex); } TempData.Remove("SkillCreateSuccess"); return RedirectToAction("Index"); } } }
using System; using System.Linq; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ApplicationParts; using Microsoft.AspNetCore.Mvc.Razor; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages.Compilation; using Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure; using Microsoft.AspNetCore.Mvc.RazorPages.Internal; using Microsoft.AspNetCore.Mvc.RazorPages.ModelBinding; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Options; namespace Microsoft.Extensions.DependencyInjection { public static class RazorPagesMvcCoreBuilderExtensions { public static IMvcCoreBuilder AddRazorPages(this IMvcCoreBuilder builder) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } RegisterFeatures(builder.PartManager); RegisterServices(builder.Services); return builder; } public static IMvcCoreBuilder AddRazorPages(this IMvcCoreBuilder builder, Action<RazorPagesOptions> setupAction) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (setupAction == null) { throw new ArgumentNullException(nameof(setupAction)); } RegisterFeatures(builder.PartManager); RegisterServices(builder.Services); builder.Services.Configure(setupAction); return builder; } private static void RegisterFeatures(ApplicationPartManager partManager) { partManager.FeatureProviders.Add(new MetadataReferenceFeatureProvider()); } private static void RegisterServices(IServiceCollection services) { services.TryAddEnumerable(ServiceDescriptor.Singleton<IActionDescriptorProvider, PageActionDescriptorProvider>()); services.TryAddEnumerable(ServiceDescriptor.Singleton<IActionInvokerProvider, PageActionInvokerProvider>()); services.TryAddSingleton<IPageFactory, DefaultPageFactory>(); services.TryAddSingleton<IPageActivator, DefaultPageActivator>(); services.TryAddSingleton<IPageFileProviderAccessor, DefaultPageFileProviderAccessor>(); services.TryAddSingleton<IPageCompilationService, DefaultPageCompilationService>(); services.TryAddSingleton<PageRazorEngineHost>(); services.Replace(ServiceDescriptor.Singleton<IRazorPageActivator, HackedRazorPageActivator>()); // Awful Hack services.TryAddSingleton<IPageArgumentBinder, DefaultPageArgumentBinder>(); services.TryAddSingleton<PageResultExecutor>(); services.TryAddEnumerable(ServiceDescriptor.Transient<IConfigureOptions<RazorPagesOptions>, DefaultRazorPagesOptionsSetup>()); } } }
using Android.App; using Android.Content; using Android.Content.PM; using Android.OS; using Android.Support.Design.Widget; using Android.Support.V7.App; using Android.Support.V7.Widget; using Android.Views; using Android.Widget; using Firebase.Analytics; using GabberPCL; using GabberPCL.Resources; using Android.Text.Util; namespace Gabber { [Activity(ScreenOrientation = ScreenOrientation.Portrait)] public class RegisterActivity : AppCompatActivity { FirebaseAnalytics firebaseAnalytics; protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(this); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.register); SetSupportActionBar(FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar)); SupportActionBar.Title = StringResources.register_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var submit = FindViewById<AppCompatButton>(Resource.Id.submit); submit.Text = StringResources.register_ui_submit_button; var _name = FindViewById<TextInputLayout>(Resource.Id.nameLayout); _name.Hint = StringResources.register_ui_fullname_label; var _email = FindViewById<TextInputLayout>(Resource.Id.emailLayout); _email.Hint = StringResources.common_ui_forms_email_label; var _password = FindViewById<TextInputLayout>(Resource.Id.passwordLayout); _password.Hint = StringResources.common_ui_forms_password_label; var terms = FindViewById<TextView>(Resource.Id.Terms); var termsContent = string.Format(StringResources.register_ui_terms_label, Config.WEB_URL); terms.TextFormatted = Android.Text.Html.FromHtml(termsContent); terms.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance; FindViewById<TextInputEditText>(Resource.Id.password).EditorAction += (_, e) => { e.Handled = false; if (e.ActionId == Android.Views.InputMethods.ImeAction.Done) { FindViewById<AppCompatButton>(Resource.Id.submit).PerformClick(); e.Handled = true; } }; submit.Click += async delegate { var imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(InputMethodService); imm.HideSoftInputFromWindow(FindViewById<TextInputEditText>(Resource.Id.password).WindowToken, 0); var fname = FindViewById<AppCompatEditText>(Resource.Id.name); var email = FindViewById<AppCompatEditText>(Resource.Id.email); var passw = FindViewById<AppCompatEditText>(Resource.Id.password); if (string.IsNullOrWhiteSpace(fname.Text)) { fname.Error = StringResources.register_ui_fullname_validate_empty; fname.RequestFocus(); } else if (string.IsNullOrWhiteSpace(email.Text)) { email.Error = StringResources.common_ui_forms_email_validate_empty; email.RequestFocus(); } else if (string.IsNullOrWhiteSpace(passw.Text)) { passw.Error = StringResources.common_ui_forms_password_validate_empty; passw.RequestFocus(); } else if (!Android.Util.Patterns.EmailAddress.Matcher(email.Text).Matches()) { email.Error = StringResources.common_ui_forms_email_validate_invalid; email.RequestFocus(); } else { FindViewById<ProgressBar>(Resource.Id.progressBar).Visibility = ViewStates.Visible; FindViewById<AppCompatButton>(Resource.Id.submit).Enabled = false; var api = new RestClient(); LOG_EVENT_WITH_ACTION("REGISTER", "ATTEMPT"); var response = await api.Register(fname.Text, email.Text.ToLower(), passw.Text); if (response.Meta.Success) { LOG_EVENT_WITH_ACTION("REGISTER", "SUCCESS"); var intent = new Intent(this, typeof(Activities.RegisterVerification)); intent.PutExtra("EMAIL_USED_TO_REGISTER", email.Text); intent.SetFlags(ActivityFlags.ClearTop | ActivityFlags.ClearTask | ActivityFlags.NewTask); StartActivity(intent); Finish(); } else { RunOnUiThread(() => { if (response.Meta.Messages.Count > 0) { LOG_EVENT_WITH_ACTION("REGISTER", "ERROR"); response.Meta.Messages.ForEach(MakeError); } FindViewById<AppCompatButton>(Resource.Id.submit).Enabled = true; FindViewById<ProgressBar>(Resource.Id.progressBar).Visibility = ViewStates.Gone; fname.RequestFocus(); }); } } }; _name.RequestFocus(); Window.SetSoftInputMode(SoftInput.StateAlwaysVisible); } public override bool OnOptionsItemSelected(IMenuItem item) { LOG_EVENT_WITH_ACTION("BACK_BUTTON", "PRESSED"); OnBackPressed(); return true; } void MakeError(string errorMessage) { var email = FindViewById<AppCompatEditText>(Resource.Id.email); // Using login string lookup as there are no different error messages between login/register, only general. var message = StringResources.ResourceManager.GetString($"login.api.error.{errorMessage}"); Snackbar.Make(email, message, Snackbar.LengthLong).Show(); } void LOG_EVENT_WITH_ACTION(string eventName, string action) { var bundle = new Bundle(); bundle.PutString("ACTION", action); bundle.PutString("TIMESTAMP", System.DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString()); firebaseAnalytics.LogEvent(eventName, bundle); } } }
using HomeAutomationLibrary; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GUI_PRJ2_WINFORMS { public class AppAction { private bool onOffIsSelected_; private bool dimmerIsSelected_; /// <summary> /// Bool to set if dimmer is selected /// </summary> public bool DimmerIsSelected { get => dimmerIsSelected_; set => dimmerIsSelected_ = value;} public bool OnOffIsSelected{ get => onOffIsSelected_; set => onOffIsSelected_ = value; } public AppAction(Apparat selected) { if ((selected.Functionality_ & Func.OnOff) == Func.OnOff) { onOffIsSelected_ = true; } if((selected.Functionality_ & Func.Dimmer) == Func.Dimmer) { dimmerIsSelected_ = true; } } } }
using System; using System.Collections.Generic; using System.Text; namespace HackerRank_HomeCode { //https://www.ideserve.co.in/learn/maximum-subarray-sum public class MaximumSubArraySum { public void findMaxSuminSubArray() { int[] input = { 2, -9, 5, 1, -4, 6, 0, -7, 8 }; int maxSum = 0; int maxnegsum = Int16.MinValue; int curSum = 0; bool hasallnegnumbers = true; for(int i = 0;i<input.Length;i++) { if(hasallnegnumbers && input[i] > 0) { hasallnegnumbers = false; } else if(hasallnegnumbers && input[i] < 0 && maxnegsum < input[i]) { maxnegsum = input[i]; } curSum += input[i]; if(curSum < 0) { curSum = 0; } if(maxSum < curSum) { maxSum = curSum; } } var res = hasallnegnumbers ? maxnegsum : maxSum; Console.WriteLine($"max sum in subarray is {res}"); } } } //Given an array of unordered positive and negative integers, find the maximum subarray sum in the array. //For example: //Array: { 2, -9, 5, 1, -4, 6, 0, -7, 8} //Output: //Maximum subarray sum is 9
using System.Collections; using System.Collections.Generic; using UnityEngine; public class HoverGroup : MonoBehaviour { private List<CanvasGroup> cGroups; private int hoveredIndex = -1; // Use this for initialization void Start () { cGroups = new List<CanvasGroup>(); for (int i = 0; i < transform.childCount; i++) { CanvasGroup cGroup = transform.GetChild(i).gameObject.AddComponent<CanvasGroup>(); cGroups.Add(cGroup); } } void Update() { if(hoveredIndex != -1) { for (int i = 0; i < cGroups.Count; i++) { if(i != hoveredIndex) { cGroups[i].alpha = Mathf.Lerp(cGroups[i].alpha, 0.5f, Time.deltaTime*10f); } else { cGroups[i].alpha = Mathf.Lerp(cGroups[i].alpha, 1f, Time.deltaTime*10f); } } } else { for (int i = 0; i < cGroups.Count; i++) { cGroups[i].alpha = Mathf.Lerp(cGroups[i].alpha, 1f, Time.deltaTime*10f); } } } public void ButtonHovered(int index) { hoveredIndex = index; // cGroups[index].alpha = 1f; // for (int i = 0; i < cGroups.Count; i++) { // if(i != index) { // cGroups[i].alpha = 0.5f; // } // } } public void ButtonExit(int index) { hoveredIndex = -1; // for (int i = 0; i < cGroups.Count; i++) { // if(i != index) { // cGroups[i].alpha = 1f; // } // } } }
using System.Data.Entity.ModelConfiguration; using RMAT3.Models; namespace RMAT3.Data.Mapping { public class TaskTypeMap : EntityTypeConfiguration<TaskType> { public TaskTypeMap() { // Primary Key HasKey(t => t.TaskTypeId); // Properties Property(t => t.AddedByUserId) .IsRequired() .HasMaxLength(20); Property(t => t.UpdatedByUserId) .IsRequired() .HasMaxLength(20); Property(t => t.UpdatedCommentTxt) .HasMaxLength(500); Property(t => t.TaskTypeCd) .IsRequired() .HasMaxLength(50); Property(t => t.TaskTypeLTxt) .HasMaxLength(500); Property(t => t.TaskTypeTxt) .HasMaxLength(200); // Table & Column Mappings ToTable("TaskType", "OLTP"); Property(t => t.TaskTypeId).HasColumnName("TaskTypeId"); Property(t => t.AddedByUserId).HasColumnName("AddedByUserId"); Property(t => t.AddTs).HasColumnName("AddTs"); Property(t => t.UpdatedByUserId).HasColumnName("UpdatedByUserId"); Property(t => t.UpdatedCommentTxt).HasColumnName("UpdatedCommentTxt"); Property(t => t.UpdatedTs).HasColumnName("UpdatedTs"); Property(t => t.IsActiveInd).HasColumnName("IsActiveInd"); Property(t => t.EffectiveFromDt).HasColumnName("EffectiveFromDt"); Property(t => t.EffectiveToDt).HasColumnName("EffectiveToDt"); Property(t => t.TaskTypeCd).HasColumnName("TaskTypeCd"); Property(t => t.TaskTypeLTxt).HasColumnName("TaskTypeLTxt"); Property(t => t.TaskTypeTxt).HasColumnName("TaskTypeTxt"); } } }
using EmployeeStorage.DataAccess.Configuration; using EmployeeStorage.DataAccess.Entities; using EmployeeStorage.DataAccess.Interfaces; using System; namespace EmployeeStorage.DataAccess.Repositories { public class UnitOfWork : IUnitOfWork { private readonly EmployeeStorageContext db; private IEmployeeRepository employeeRepository; private IPositionRepository positionRepository; public UnitOfWork(EmployeeStorageContext db) { this.db = db; } public IRepository<Employee> Employees { get { if (employeeRepository == null) employeeRepository = new EmployeeRepository(db); return employeeRepository; } } public IRepository<Position> Positions { get { if (positionRepository == null) positionRepository = new PositionRepository(db); return positionRepository; } } private bool disposed = false; public virtual void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { db.Dispose(); } this.disposed = true; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } public void Save() { db.SaveChanges(); } } }
using System; using System.Collections.Generic; using System.Data.SqlClient; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CSharpToSQL { public class User { private static string CONNECT_STRING = @"server = STUDENT-FLEX\SQLEXPRESS; database = prsdb; trusted_connection = true"; public int Id { get; set; } public string Username { get; set; } public string Password { get; set; } public string Firstname { get; set; } public string Lastname { get; set; } public string Phone { get; set; } public string Email { get; set; } private static SqlConnection CreatAndCheckConnection() { var Connection = new SqlConnection(CONNECT_STRING); Connection.Open(); if (Connection.State != System.Data.ConnectionState.Open) { Console.WriteLine("Connection did not open."); return null; // return false because method is a bool } return Connection; } private static SqlDataReader CheckSQLForRows(string sql, SqlConnection Connection) { var cmd = new SqlCommand(sql, Connection); var reader = cmd.ExecuteReader(); if (!reader.HasRows) // (reader.HasRows == false) { Console.WriteLine("Result set has no rows."); Connection.Close(); return null; } return reader; } public static bool UpdateUser( User user) { var Connection = CreatAndCheckConnection(); if (Connection == null) { return false; } var sql = "Update Users set "; sql += "UserName = '" + user.Username + "',"; sql += "Password = '" + user.Password + "',"; sql += "First_Name = '" + user.Firstname + "',"; sql += "Last_Name = '" + user.Lastname + "',"; sql += "Phone = '" + user.Phone + "',"; sql += "Email = '" + user.Email + "'"; // sql += "IsReviewer = " + (user.isreviewer ? 1:0) + ","; // ? is an if statement, so if user is a reviewer, true pass a 1, false pass a 0 sql += $" Where id = {user.Id}"; var cmd = new SqlCommand(sql, Connection); var recsAfected = cmd.ExecuteNonQuery(); Connection.Close(); return recsAfected == 1; } public static bool DeleteUser(int Id) { var Connection = CreatAndCheckConnection(); if (Connection == null) { return false; } var sql = $"Delete From Users where id = {Id}"; var cmd = new SqlCommand(sql, Connection); var recsAfected = cmd.ExecuteNonQuery(); Connection.Close(); return recsAfected == 1; } public static bool InsertUser(User user) { var Connection = CreatAndCheckConnection(); if (Connection == null) { return false; } var sql = $"Insert into Users (Username, Password, First_name, Last_Name, Phone, Email)" + $" Values ('{user.Username}', '{user.Password}', '{user.Firstname}','{user.Lastname}', '{user.Phone}','{user.Email}')"; var cmd = new SqlCommand(sql, Connection); var recsAfected = cmd.ExecuteNonQuery(); Connection.Close(); return recsAfected == 1; } public User() { } public static User GetUserByPrimaryKey(int Id) { var Connection = CreatAndCheckConnection(); if (Connection == null) { return null; } var sql = $"select * from users where id = {Id} ;"; var reader = CheckSQLForRows(sql, Connection); reader.Read(); var user = new User(); user.Id = (int)reader["Id"]; user.Username = (string)reader["Username"]; user.Firstname = (string)reader["First_Name"]; user.Lastname = (string)reader["Last_Name"]; //var Fullname = $"{Firstname} {Lastname}"; user.Phone = reader["Phone"] == DBNull.Value ? null : (string)reader["Phone"]; user.Email = reader["Email"] == DBNull.Value ? null : (string)reader["Email"]; // read email col in sql == check for Null ? if true set null in C# : if false (not null) set data to variable Connection.Close(); return user; } public static User[] GetAllUsers() { var Connection = CreatAndCheckConnection(); if (Connection == null) { return null; } var sql = "select * from users;"; var reader = CheckSQLForRows(sql, Connection); var users = new User[20]; // create an array to hold the user data were pulling from SQL var index = 0; while (reader.Read()) { var user = new User(); user.Id = (int)reader["Id"]; user.Username = (string)reader["Username"]; user.Firstname = (string)reader["First_Name"]; user.Lastname = (string)reader["Last_Name"]; //var Fullname = $"{Firstname} {Lastname}"; user.Phone = reader["Phone"] == DBNull.Value ? null : (string)reader["Phone"]; user.Email = reader["Email"] == DBNull.Value ? null : (string)reader["Email"]; // read email col in sql == check for Null ? if true set null in C# : if false (not null) set data to variable users[index++] = user; } Connection.Close(); return users; } public User(int id, string username, string password, string firstname, string lastname, string phone, string email) { Id = id; Username = username; Password = password; Firstname = firstname; Lastname = lastname; Phone = phone; Email = email; } public override string ToString() // default print method to use { return $" [ToPrint()] Id = {Id}, user name = {Username}, Name = {Firstname} {Lastname}"; } } }
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; using System.Windows.Controls.Primitives; using System.Threading; using Microsoft.Kinect; using System.IO; using System.IO.Ports; using Coding4Fun.Kinect.Wpf; using Microsoft.Expression.Drawing; using System.ComponentModel; using System.Windows.Threading; using System.Windows.Media.Animation; namespace ArduinoController { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { #region Arduino instance vars /// <summary> Arduino's serial port </summary> private SerialPort serialPort; /// <summary> Boolean indicating whether there is an Arduino/serial device plugged in to write to </summary> private Boolean noArduino = false; /// <summary> Arduino's serial port number </summary> private String ComPortNum = "7"; #endregion #region Window instance vars /// <summary> Width of the main window </summary> private int ScreenMaxX; /// <summary> Height of the main window </summary> private int ScreenMaxY; /// <summary> Tracks what mode the main window is in </summary> private Mode currentMode; /// <summary> Boolean indicating whether the main window is closing </summary> private static bool _isClosing = false; #endregion #region Kinect instance vars /// <summary> Array of all skeletons detected by the Kinect </summary> private Skeleton[] allSkeletons = new Skeleton[6]; /// <summary> The voice recognizer object </summary> private VoiceCommands vc; #endregion /// <summary> /// The main window where all the action happens /// </summary> public MainWindow() { // init GUI InitializeComponent(); // init Menu components menuButtons = new List<Button> { steeringButton, precisionButton, podButton }; currentMode = Mode.MENU; ScreenMaxX = (int)this.Width; ScreenMaxY = (int)this.Height; // init other components initCommonComponents(); initSteeringComponents(); initPrecisionComponents(); initPodRacingComponents(); } #region Window Events /// <summary> /// Event handler called when the window has loaded. /// Adds the kinect detection event handler and opens the serial port /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The "window loaded" event</param> private void Window_Loaded(object sender, RoutedEventArgs e) { // start up the kinect if it has been detected kinectSensorChooser1.KinectSensorChanged += new DependencyPropertyChangedEventHandler(kinectSensorChooser1_KinectSensorChanged); // open up the serial port for communication if an arduino is connected if (!noArduino) { ArduinoSetSerial(); ArduinoOpenSerial(); ArduinoSendLeftRight(ArduinoStop, ArduinoStop); } } /// <summary> /// Event handler called when the window is closing. /// Stops the kinect. /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The "window closed" event</param> private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { StopKinect(kinectSensorChooser1.Kinect); } #endregion #region Kinect Events /// <summary> /// Event handler called when a new Kinect has been connected. /// Stops old Kinect, starts new Kinect, and starts voice recognition. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void kinectSensorChooser1_KinectSensorChanged(object sender, DependencyPropertyChangedEventArgs e) { // kill the old kinect KinectSensor oldSensor = (KinectSensor)e.OldValue; StopKinect(oldSensor); // get the new kinect KinectSensor newSensor = (KinectSensor)e.NewValue; if (newSensor == null) return; // smooth out movements var parameters = new TransformSmoothParameters { Smoothing = 0.3f, Correction = 0.0f, Prediction = 0.0f, JitterRadius = 1.0f, MaxDeviationRadius = 0.5f }; newSensor.ColorStream.Enable(); // IS THIS LINE NEEDED??? newSensor.DepthStream.Enable(); // IS THIS LINE NEEDED??? // enable all streams and add the event handler called on each frame newSensor.SkeletonStream.Enable(parameters); newSensor.SkeletonStream.Enable(); newSensor.AllFramesReady += new EventHandler<AllFramesReadyEventArgs>(sensor_AllFramesReady); // start the sensor and the voice recognizer try { newSensor.Start(); } catch (System.IO.IOException) { kinectSensorChooser1.AppConflictOccurred(); } vc = new VoiceCommands(newSensor, this); vc.startRecognizer(); } /// <summary> /// Event handler called on every frame. /// Updates the hands on the GUI, does some computation depending on the current mode, /// and updates coordinate text boxes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sensor_AllFramesReady(object sender, AllFramesReadyEventArgs e) { // grab the skeleton and set the positions of the left and right hands Skeleton first = GetFirstSkeleton(e); if (first != null) { ScaleAndSetPosition(kinectHand, first.Joints[JointType.HandRight]); if (currentMode != Mode.MENU) ScaleAndSetPosition(kinectHandL, first.Joints[JointType.HandLeft]); // update the GUI and compute data to send to the Arduino, depending on the current mode compute(); // update the coordinates in the text boxes UpdateBoxesWithCoords(first.Joints[JointType.HandLeft], JointType.HandLeft); UpdateBoxesWithCoords(first.Joints[JointType.HandRight], JointType.HandRight); } } /// <summary> /// Stops the kinect and voice recognition /// </summary> /// <param name="s">The Kinect to be stopped</param> private void StopKinect(KinectSensor s) { if (s != null) { if (s.IsRunning) { s.Stop(); if (s.AudioSource != null) { vc.stopRecognizer(); s.AudioSource.Stop(); } } } } #endregion #region Kinect Helpers /// <summary> /// Helper to get the first skeleton that the Kinect senses /// </summary> /// <param name="e">The current frame</param> /// <returns>The first skeleton sensed by the Kinect</returns> private Skeleton GetFirstSkeleton(AllFramesReadyEventArgs e) { using (SkeletonFrame skeletonFrameData = e.OpenSkeletonFrame()) { if (skeletonFrameData == null) return null; skeletonFrameData.CopySkeletonDataTo(allSkeletons); //get the first tracked skeleton Skeleton first = (from s in allSkeletons where s.TrackingState == SkeletonTrackingState.Tracked select s).FirstOrDefault(); return first; } } /// <summary> /// Updates the GUI with the position of the hands, scaled to fit the window /// </summary> /// <param name="element">The left or right hand element in the GUI</param> /// <param name="joint">This parameter is used to compute the scaled position for the element</param> private void ScaleAndSetPosition(FrameworkElement element, Joint joint) { //convert & scale (.5 = means 1/2 of joint distance) Joint scaledJoint = joint.ScaleTo(ScreenMaxX, ScreenMaxY, .5f, .5f); // set the position of the element in the canvas Canvas.SetLeft(element, scaledJoint.Position.X); Canvas.SetTop(element, scaledJoint.Position.Y); } /// <summary> /// Is the right hand in one of the menu buttons? /// </summary> /// <param name="hand">The right hand</param> /// <param name="buttons">The menu buttons</param> /// <returns></returns> /// <seealso cref="IsRHandOverObject">For the more general method, check out IsRHandOverObject</seealso> /// <seealso cref="IsLHandOverObject">For the more general method for the left hand, check out IsLHandOverObject</seealso> public static bool IsHandOverMenuButtons(FrameworkElement hand, List<Button> buttons) { if (_isClosing || !Window.GetWindow(hand).IsActive) return false; // get the location of the top left of the hand and then use it to find the middle of the hand var handTopLeft = new Point(Canvas.GetLeft(hand), Canvas.GetTop(hand)); _handX = handTopLeft.X + (hand.ActualWidth / 2); _handY = handTopLeft.Y + (hand.ActualHeight / 2); // is the hand "in" or over a button/target? foreach (Button target in buttons) { if (isHandInButton(_handX, _handY, target, true)) return true; } return false; } /// <summary> /// A method that checks if a hand's coordinates are within the coordinate rectangle of the given button (target). /// </summary> /// <param name="handx">X coordinate of the hand</param> /// <param name="handy">Y coordinate of the hand</param> /// <param name="target">The button that the hand may be over</param> /// <param name="isRightHand">True if the hand is the right hand, false if it's the left</param> /// <returns></returns> private static bool isHandInButton(double handx, double handy, Button target, bool isRightHand) { System.Windows.Point targetTopLeft = new System.Windows.Point(Canvas.GetLeft(target), Canvas.GetTop(target)); if (handx > targetTopLeft.X && handx < targetTopLeft.X + target.Width && handy > targetTopLeft.Y && handy < targetTopLeft.Y + target.Height) { if (isRightHand) _selectedButton = target; else _selectedLButton = target; return true; } return false; } #endregion #region Serial Methods /// <summary> /// Sets up the serial port for the Arduino /// </summary> private void ArduinoSetSerial() { String ArduinoCom = ComPortNum; serialPort = new SerialPort(); serialPort.PortName = "COM" + ComPortNum; serialPort.BaudRate = 9600; serialPort.DataBits = 8; serialPort.Handshake = 0; serialPort.ReadTimeout = 500; serialPort.WriteTimeout = 500; } /// <summary> /// Opens the serial port for the Arduino /// </summary> private void ArduinoOpenSerial() { if (!serialPort.IsOpen) serialPort.Open(); else System.Console.WriteLine("Serial port cannot be opened"); } /// <summary> /// Closes the serial port for the Arduino /// </summary> private void ArduinoCloseSerial() { if (serialPort.IsOpen) serialPort.Close(); } #endregion #region Arduino Methods /// <summary> /// Sends the left and right servos speeds to the Arduino /// </summary> /// <param name="lspeed">The speed of the left servo</param> /// <param name="rspeed">The speed of the right servo</param> private void ArduinoSendLeftRight(float lspeed, float rspeed) { Byte ls, rs; ls = (byte)lspeed; rs = (byte)rspeed; byte[] ArduinoBuffer = { ls, rs }; if (!noArduino && serialPort.IsOpen) serialPort.Write(ArduinoBuffer, 0, ArduinoBuffer.Length); } #endregion } }
using Lab12_HotelDataBase.Data; using Lab12_HotelDataBase.Data.Repositories; using Lab12_HotelDataBase.Models; using Lab12_HotelDataBase.Models.Api; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Lab12_HotelDataBase.Controllers { [Route("api/[controller]")] [ApiController] public class AmenitiesController : ControllerBase { IAmenitiesRepository amenitiesRepository; public AmenitiesController(IAmenitiesRepository amenitiesRepository) { this.amenitiesRepository = amenitiesRepository; } // GET: api/Amenities [HttpGet] public async Task<ActionResult<IEnumerable<AmenitiesDTO>>> GetAmenities() { return Ok(await amenitiesRepository.GetAllAmenities()); } // GET: api/Amenities/5 [HttpGet("{id}")] public async Task<ActionResult<AmenitiesDTO>> GetAmenities(int id) { AmenitiesDTO amenity = await amenitiesRepository.GetOneAmenity(id); if (amenity == null) { return NotFound(); } return amenity; } // PUT: api/Amenities/5 // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPut("{id}")] public async Task<IActionResult> PutAmenities(int id, Amenities amenities) { amenities.Id = id; if (id != amenities.Id) { return BadRequest(); } bool amenityUpdated = await amenitiesRepository.UpdateAmenity(id, amenities); if (!amenityUpdated) { return NotFound(); } return NoContent(); } // POST: api/Amenities // To protect from overposting attacks, enable the specific properties you want to bind to, for // more details, see https://go.microsoft.com/fwlink/?linkid=2123754. [HttpPost] public async Task<ActionResult<AmenitiesDTO>> PostAmenities(Amenities amenities) { await amenitiesRepository.SaveNewAmenity(amenities); return CreatedAtAction("GetAmenities", new { id = amenities.Id }, amenities); } // DELETE: api/Amenities/5 [HttpDelete("{id}")] public async Task<ActionResult<Amenities>> DeleteAmenities(int id) { var amenities = await amenitiesRepository.DeleteAmenity(id); if (amenities == null) { return NotFound(); } return amenities; } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using MySql.Data.MySqlClient; namespace RMS { public partial class PassDetails : Form { String date, src, dest, train_name,email; public PassDetails() { InitializeComponent(); } public PassDetails(String a,String b,String c,String d,String e) { InitializeComponent(); comboBox1.Items.Add("Male"); comboBox1.Items.Add("Female"); comboBox1.Items.Add("Others"); train_name = a; src = b; dest = c; date = d; email = e; } private void button1_Click(object sender, EventArgs e) { create_passenger(); this.Hide(); new Payement(train_name,src,dest,date,email,textBox4.Text).Show(); } private void Booking_Load(object sender, EventArgs e) { } public void create_passenger() { MySqlConnection con = new MySqlConnection("Data Source = localhost; user = root; password = lol; database = rms"); con.Open(); MySqlCommand cmd = new MySqlCommand(); cmd.Connection = con; cmd.CommandText = "Insert into passenger values ('" + email + "','" + textBox1.Text + "'," + int.Parse(textBox2.Text) + ",'" + this.comboBox1.GetItemText(this.comboBox1.SelectedItem).ToString() + "','" + textBox4.Text + "')"; cmd.CommandType = CommandType.Text; try { cmd.ExecuteNonQuery(); } catch (Exception e) { MessageBox.Show("Please check entered data"); } con.Close(); } } }
using Newtonsoft.Json; using System; using System.IO; using System.Net; using System.Text; namespace UpdateExecutableCommon.Utilities { public static class HttpHelper { ///// <summary> ///// Send a GET request to the specified resource URL and return and object of type T ///// </summary> public static T SendGetRequest<T>(string url) { WebClient wc = new WebClient(); wc.UseDefaultCredentials = true; string response = wc.DownloadString(url); return JsonConvert.DeserializeObject<T>(response); } /// <summary> /// Download a binary file at the specified URL and return a byte array /// </summary> public static byte[] DownloadBinaryFile(string resourceUrl) { var filePath = string.Format("{0}", DateTime.Now.ToString("yyyy.MM.dd.hh.mm.ss.ff")); DownloadBinaryFile(resourceUrl, filePath); byte[] file = File.ReadAllBytes(filePath); File.Delete(filePath); return file; } /// <summary> /// Download a binary file at the specified URL and save it to the destination path /// </summary> public static void DownloadBinaryFile(string resourceUrl, string destinationFilePath) { using (var client = new WebClient()) { client.DownloadFile(resourceUrl, destinationFilePath); } } /// <summary> /// Send a POST request with object of type T in the body and return true if response status code = 200 /// </summary> public static bool SendPostRequest<T>(string resourceUrl, T objectToPost) { HttpWebRequest http = (HttpWebRequest)WebRequest.Create(new Uri(resourceUrl)); http.Accept = "application/json"; http.ContentType = "application/json"; http.Method = "POST"; string parsedContent = JsonConvert.SerializeObject(objectToPost); ASCIIEncoding encoding = new ASCIIEncoding(); Byte[] bytes = encoding.GetBytes(parsedContent); Stream newStream = http.GetRequestStream(); newStream.Write(bytes, 0, bytes.Length); newStream.Close(); HttpWebResponse response = (HttpWebResponse)http.GetResponse(); return response.StatusCode == HttpStatusCode.OK; } /// <summary> /// Send a POST request with object of type J in the body and return and object of type T /// </summary> public static T SendPostRequest<T, J>(string resourceUrl, J objectToPost) { var http = (HttpWebRequest)WebRequest.Create(new Uri(resourceUrl)); http.Accept = "application/json"; http.ContentType = "application/json"; http.Method = "POST"; string parsedContent = JsonConvert.SerializeObject(objectToPost); ASCIIEncoding encoding = new ASCIIEncoding(); Byte[] bytes = encoding.GetBytes(parsedContent); Stream newStream = http.GetRequestStream(); newStream.Write(bytes, 0, bytes.Length); newStream.Close(); var response = http.GetResponse(); var stream = response.GetResponseStream(); var sr = new StreamReader(stream); var content = sr.ReadToEnd(); return JsonConvert.DeserializeObject<T>(content); } /// <summary> /// Get a valid url for the provided base url and query string. Prevents issues when the trailing slash is missing. /// </summary> public static string GetUrl(string baseUrl, string queryString) { if (string.IsNullOrEmpty(baseUrl)) return string.Empty; var uriBuilder = new UriBuilder(baseUrl); uriBuilder.Query = queryString; return uriBuilder.ToString(); } /// <summary> /// Get a valid url for the provided base url, path, and query string. Prevents issues when the trailing slash is missing. /// </summary> public static string GetUrl(string baseUrl, string path, string queryString) { if (string.IsNullOrEmpty(baseUrl)) return string.Empty; var uriBuilder = new UriBuilder(baseUrl); uriBuilder.Path = path; uriBuilder.Query = queryString; return uriBuilder.ToString(); } } }
using System; using System.Collections.Generic; namespace Degree.Models.Dto { public class TweetDto { public long Id { get; set; } public DateTime CreatedAt { get; set; } public string Text { get; set; } public long? InReplyToStatusId { get; set; } public string InReplyToScreenName { get; set; } public bool IsRetweetStatus { get; set; } public bool IsQuoteStatus { get; set; } public long QuoteCount { get; set; } public long ReplyCount { get; set; } public long RetweetCount { get; set; } public long FavoriteCount { get; set; } public long UserId { get; set; } public string UserName { get; set; } public string UserScreenName { get; set; } public bool UserVerified { get; set; } public int UserFollowers { get; set; } public int UserFollowing { get; set; } public string UserProfileImage { get; set; } public string UserProfileBanner { get; set; } public bool UserDefaultProfile { get; set; } public bool UserDefaultProfileImage { get; set; } public string Sentiment { get; set; } public double PositiveScore { get; set; } public double NeutralScore { get; set; } public double NegativeScore { get; set; } public GeoCoordinateDto GeoCoordinate { get; set; } public List<SentimentSentenceDto> SentimentSentence { get; set; } public List<EntityRecognizedDto> EntityRecognizeds { get; set; } public List<string> Hashtags { get; set; } } public class GeoCoordinateDto { public double Lat { get; set; } public double Lon { get; set; } public string GeoName { get; set; } } public class EntityRecognizedDto { public string EntityName { get; set; } public string EntityType { get; set; } public int Offset { get; set; } public int Length { get; set; } } public class SentimentSentenceDto { public string Sentiment { get; set; } public double PositiveScore { get; set; } public double NeutralScore { get; set; } public double NegativeScore { get; set; } public int Offset { get; set; } public int Length { get; set; } } public class HashtagsCount { public string Hashtags { get; set; } public int Count { get; set; } } }
using Java.Lang.Annotation; using System; using System.Collections.Generic; using System.Text; using Test2project.Models; namespace Test2project.ViewModels { class ChartMainViewModel { public List<ChartMain> ChartsData { get; set; } public ChartMainViewModel() { ChartsData = new List<ChartMain>(); ChartsData.Add(new ChartMain { Year = "2014", Target = 500, Sale=342}); ChartsData.Add(new ChartMain { Year = "2020", Target = 200, Sale=300}); ChartsData.Add(new ChartMain { Year = "2016", Target = 600, Sale=100}); ChartsData.Add(new ChartMain { Year = "2017", Target = 250, Sale=342}); ChartsData.Add(new ChartMain { Year = "2014", Target = 350, Sale=342}); } } }
/************************************ ** Created by Wizcas (wizcas.me) ************************************/ using System.Collections; using System.Collections.Generic; using UnityEngine; public class CatAction : MonoBehaviour { public float pickUpDistance = .4f; public float stashDistance = 1.2f; public AudioClip meowClip; [SerializeField] private Transform _mouth; [SerializeField] private Animator _anim; [SerializeField] private AudioSource _audioSrc; public HideSpot hideSpot; public bool isHiding; private bool _isMeowing; private Treasure _holdingTreasure; public Treasure HoldingTreasure { get { return _holdingTreasure; } } public bool IsHoldingTreasure { get { return _holdingTreasure != null; } } void Awake() { Messenger.AddListener<Treasure>("PickUp", PickUp); Messenger.AddListener<Stash>("Store", Store); Messenger.AddListener<HideSpot>("ToHideSpot", ToHideSpot); Messenger.AddListener("EnterHideSpot", EnterHideSpot); } void Start() { } public void PickUp(Treasure treasure) { Messenger.Broadcast("CatMoveTo", treasure.transform.position); StopAllCoroutines(); StartCoroutine(PickUpCo(treasure)); } private IEnumerator PickUpCo(Treasure treasure) { while (VectorUtils.SqrDistance(transform.position, treasure.transform.position) > pickUpDistance * pickUpDistance) { yield return null; } PutDown(); treasure.transform.SetParent(_mouth, true); treasure.transform.localPosition = Vector3.zero; _holdingTreasure = treasure; _holdingTreasure.IsPickedUp = true; } public void PutDown() { if (!ValidateHolding()) return; //StopAllCoroutines(); _holdingTreasure.transform.SetParent(null); _holdingTreasure.IsPickedUp = false; _holdingTreasure = null; } public void Store(Stash stash) { Messenger.Broadcast("CatMoveTo", stash.transform.position); if (!ValidateHolding()) return; StopAllCoroutines(); StartCoroutine(StoreCo(stash)); } private IEnumerator StoreCo(Stash stash) { while (VectorUtils.SqrDistance(transform.position, stash.transform.position) > stashDistance * stashDistance) { yield return null; } stash.Store(_holdingTreasure); _holdingTreasure = null; } private bool ValidateHolding() { if (!IsHoldingTreasure) { Debug.LogError("You're not holding any treasure."); return false; } return true; } private void ToHideSpot(HideSpot spot) { if (hideSpot != null) { hideSpot.Disable(); } hideSpot = spot; Messenger.Broadcast("CatMoveTo", spot.EntrancePos); } private void EnterHideSpot() { Messenger.Broadcast("CatStop"); _anim.gameObject.SetActive(false); isHiding = true; } public void ExitHideSpot() { _anim.gameObject.SetActive(true); if (hideSpot != null) { transform.position = hideSpot.EntrancePos; hideSpot.Disable(); } hideSpot = null; isHiding = false; } void Update() { if (Input.GetKeyDown(KeyCode.F)) { StartCoroutine(Meow()); } } private IEnumerator Meow() { if (_isMeowing) yield break; _anim.SetTrigger("Sound"); while (!_anim.IsInTransition(1)) { yield return null; } var clipInfos = _anim.GetNextAnimatorClipInfo(1); var clip = clipInfos[0].clip; _isMeowing = true; var soundSource = new GameObject("Meow"); soundSource.transform.position = transform.position; Messenger.Broadcast("SoundMade", soundSource.transform); _audioSrc.PlayOneShot(meowClip); yield return new WaitForSeconds(meowClip.length); _isMeowing = false; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace YzkSoftWare.DataModel { /// <summary> /// 数据字段引用表中的Id字段信息 /// </summary> public interface IDataIdRefence { /// <summary> /// 引用的数据模型类型 /// 对应该类型的字段名称是Id /// 如果为null,则引用自身 /// </summary> Type RefenceModalType { get; } /// <summary> /// 引用RefenceModalType数据模型Id字段的字段名称 /// </summary> string SourceFieldName { get; } /// <summary> /// 引用RefenceModalType数据模型Id字段是否是父级 /// </summary> bool RefenceIsParent { get; } } internal class DataIdRefence : IDataIdRefence { public Type RefenceModalType { get; set; } public string SourceFieldName { get; set; } public bool RefenceIsParent { get; set; } } }
using System.IO; using System.Net.Http; using Newtonsoft.Json.Linq; namespace Indico.Storage { public class Blob { Stream _data = null; /// <summary> /// Blob constructor /// </summary> /// <param name="data"></param> public Blob(Stream data) { this._data = data; } public Blob(HttpResponseMessage response) { this._data = response.Content.ReadAsStreamAsync().Result; } /// <summary> /// Returns Blob as Stream /// </summary> /// <returns>Stream</returns> public Stream AsStream() { return this._data; } /// <summary> /// Returns Blob as string /// </summary> /// <returns>string</returns> public string AsString() { StreamReader reader = new StreamReader(this._data); return reader.ReadToEndAsync().Result; } /// <summary> /// Returns Blob as JSONObject /// </summary> /// <returns>JObject</returns> public JObject AsJSONObject() { string jsonString = this.AsString(); return JObject.Parse(jsonString); } /// <summary> /// Returns Blob as JSONArray /// </summary> /// <returns>JArray</returns> public JArray AsJSONArray() { string jsonString = this.AsString(); return JArray.Parse(jsonString); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WordCount.Utils { public static class Instrument { private static IInstrumentationWriter _writer; public static void Initialize(IInstrumentationWriter writer) { _writer = writer; } public static void This(Action action, string operation) { var sw = Stopwatch.StartNew(); action(); sw.Stop(); if (_writer != null) { _writer.Write(operation, sw.Elapsed); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using CTCT.Util; using System.Collections.Specialized; using System.Web; namespace CTCT.Services { /// <summary> /// Super class for all services. /// </summary> public abstract class BaseService : IBaseService { /// <summary> /// Get the rest client being used by the service. /// </summary> public virtual IRestClient RestClient { get; set; } /// <summary> /// Class constructor. /// </summary> public BaseService() { this.RestClient = new RestClient(); } /// <summary> /// Constructor with the option to to supply an alternative rest client to be used. /// </summary> /// <param name="restClient">RestClientInterface implementation to be used in the service.</param> public BaseService(RestClient restClient) { this.RestClient = restClient; } /// <summary> /// Constructs the query with specified parameters. /// </summary> /// <param name="prms">An array of parameter name and value combinations.</param> /// <returns>Returns the query part of the URL.</returns> public static string GetQueryParameters(params object[] prms) { string query = null; if (prms != null) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < prms.Length; i += 2) { if (prms[i + 1] == null) continue; if (sb.Length == 0) { sb.Append("?"); } else if (sb.Length > 0) { sb.Append("&"); } sb.AppendFormat("{0}={1}", HttpUtility.UrlEncode(prms[i].ToString()), HttpUtility.UrlEncode(prms[i + 1].ToString())); } query = sb.ToString(); } return query; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CINProc { public class CINProc { } }
using System; namespace Catalogo.Domain.ValueObjects { public class Dinheiro : ValueObject { public Dinheiro(decimal value) { Value = value; } public decimal Value { get; private set; } public static Dinheiro operator +(Dinheiro a) => a; public static Dinheiro operator +(Dinheiro a, Dinheiro b) => a + b; public static Dinheiro operator -(Dinheiro a) => -a; public static Dinheiro operator -(Dinheiro a, Dinheiro b) => a - b; public static Dinheiro operator /(Dinheiro a, Dinheiro b) { if (b.Value is 0) throw new DivideByZeroException("Operação inválida, o divisor não pode ser 0."); return a / b; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Planning.AdvandcedProjectionActionSelection.PrivacyLeakageCalculation.CalculateLeakageLocally { class LeakageCalculatorAllAgents { // Avg fraction (avg over all agents of prop/gt_prop). // At the end, we can just call the .percentage() function of each property here, // and it will be the avg percentage of leakage over the entire agents of the problem: public Dictionary<LeakagePropertyType, LeakageProperty> propertiesAvg { get; private set; } public LeakageCalculatorAllAgents() { propertiesAvg = new Dictionary<LeakagePropertyType, LeakageProperty>(); foreach (LeakagePropertyType propertyType in Enum.GetValues(typeof(LeakagePropertyType))) { propertiesAvg[propertyType] = new LeakageProperty(propertyType); } } public void CalculateLeakage(List<MapsAgent> mapsAgents) { foreach(MapsAgent chosen in mapsAgents) { List<MapsAgent> adversaries = new List<MapsAgent>(); foreach(MapsAgent a in mapsAgents) { if (a != chosen) adversaries.Add(a); } LeakageCalculatorOneAgent currAgentCalc = new LeakageCalculatorOneAgent(); currAgentCalc.CalculateLeakage(adversaries, chosen); foreach(LeakagePropertyType propertyType in Enum.GetValues(typeof(LeakagePropertyType))) { LeakageProperty avgProp = propertiesAvg[propertyType]; LeakageProperty currAgentProp = currAgentCalc.properties[propertyType]; avgProp.value += currAgentProp.percentage(); // at the end, this will sum all of the percantages of the agents' leakage avgProp.gt_value++; // at the end, this will be the amount of agents in the problem } } } } }
// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.PowerShell.EditorServices.Logging; using Microsoft.PowerShell.EditorServices.Services; using Microsoft.PowerShell.EditorServices.Services.Symbols; using Microsoft.PowerShell.EditorServices.Services.TextDocument; using Microsoft.PowerShell.EditorServices.Utility; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Server; namespace Microsoft.PowerShell.EditorServices.Handlers { public class DocumentSymbolHandler : IDocumentSymbolHandler { private readonly DocumentSelector _documentSelector = new DocumentSelector( new DocumentFilter { Language = "powershell" } ); private readonly ILogger _logger; private readonly WorkspaceService _workspaceService; private readonly IDocumentSymbolProvider[] _providers; private DocumentSymbolCapability _capability; public DocumentSymbolHandler(ILoggerFactory factory, ConfigurationService configurationService, WorkspaceService workspaceService) { _logger = factory.CreateLogger<FoldingRangeHandler>(); _workspaceService = workspaceService; _providers = new IDocumentSymbolProvider[] { new ScriptDocumentSymbolProvider(), new PsdDocumentSymbolProvider(), new PesterDocumentSymbolProvider() }; } public TextDocumentRegistrationOptions GetRegistrationOptions() { return new TextDocumentRegistrationOptions { DocumentSelector = _documentSelector, }; } public Task<SymbolInformationOrDocumentSymbolContainer> Handle(DocumentSymbolParams request, CancellationToken cancellationToken) { ScriptFile scriptFile = _workspaceService.GetFile( request.TextDocument.Uri.ToString()); IEnumerable<SymbolReference> foundSymbols = this.ProvideDocumentSymbols(scriptFile); SymbolInformationOrDocumentSymbol[] symbols = null; string containerName = Path.GetFileNameWithoutExtension(scriptFile.FilePath); if (foundSymbols != null) { symbols = foundSymbols .Select(r => { return new SymbolInformationOrDocumentSymbol(new SymbolInformation { ContainerName = containerName, Kind = GetSymbolKind(r.SymbolType), Location = new Location { Uri = PathUtils.ToUri(r.FilePath), Range = GetRangeFromScriptRegion(r.ScriptRegion) }, Name = GetDecoratedSymbolName(r) }); }) .ToArray(); } else { symbols = new SymbolInformationOrDocumentSymbol[0]; } return Task.FromResult(new SymbolInformationOrDocumentSymbolContainer(symbols)); } public void SetCapability(DocumentSymbolCapability capability) { _capability = capability; } private IEnumerable<SymbolReference> ProvideDocumentSymbols( ScriptFile scriptFile) { return this.InvokeProviders(p => p.ProvideDocumentSymbols(scriptFile)) .SelectMany(r => r); } /// <summary> /// Invokes the given function synchronously against all /// registered providers. /// </summary> /// <param name="invokeFunc">The function to be invoked.</param> /// <returns> /// An IEnumerable containing the results of all providers /// that were invoked successfully. /// </returns> protected IEnumerable<TResult> InvokeProviders<TResult>( Func<IDocumentSymbolProvider, TResult> invokeFunc) { Stopwatch invokeTimer = new Stopwatch(); List<TResult> providerResults = new List<TResult>(); foreach (var provider in this._providers) { try { invokeTimer.Restart(); providerResults.Add(invokeFunc(provider)); invokeTimer.Stop(); this._logger.LogTrace( $"Invocation of provider '{provider.GetType().Name}' completed in {invokeTimer.ElapsedMilliseconds}ms."); } catch (Exception e) { this._logger.LogException( $"Exception caught while invoking provider {provider.GetType().Name}:", e); } } return providerResults; } private static SymbolKind GetSymbolKind(SymbolType symbolType) { switch (symbolType) { case SymbolType.Configuration: case SymbolType.Function: case SymbolType.Workflow: return SymbolKind.Function; default: return SymbolKind.Variable; } } private static string GetDecoratedSymbolName(SymbolReference symbolReference) { string name = symbolReference.SymbolName; if (symbolReference.SymbolType == SymbolType.Configuration || symbolReference.SymbolType == SymbolType.Function || symbolReference.SymbolType == SymbolType.Workflow) { name += " { }"; } return name; } private static Range GetRangeFromScriptRegion(ScriptRegion scriptRegion) { return new Range { Start = new Position { Line = scriptRegion.StartLineNumber - 1, Character = scriptRegion.StartColumnNumber - 1 }, End = new Position { Line = scriptRegion.EndLineNumber - 1, Character = scriptRegion.EndColumnNumber - 1 } }; } } }
using System; using System.Collections.Generic; using starkdev.spreadrecon.model; using starkdev.spreadrecon.data; using starkdev.spreadrecon.model.Enum; namespace starkdev.spreadrecon.business { public class RelatorioBLL { private RelatorioDAL _dal; public RelatorioBLL() { _dal = new RelatorioDAL(); } public Relatorio ListarRelatorio(long? idLoja, TipoRelatorioEnum tipoRelatorio) { return _dal.ListarRelatorio(idLoja, tipoRelatorio); } /// <summary> /// Relatório 1: Exibir Terminais Achados /// </summary> /// <returns></returns> public Relatorio ExibirTerminaisAchados(long idLoja, string ciclo) { return _dal.GerarRelatorio(TipoRelatorioEnum.ExibirTerminaisAchados, idLoja, ciclo); } /// <summary> /// Relatório 2: Exibir Terminais Pagos Sem Venda /// </summary> /// <returns></returns> public Relatorio ExibirTerminaisPagosSemVenda(long idLoja, string ciclo) { return _dal.GerarRelatorio(TipoRelatorioEnum.ExibirTerminaisPagosSemVenda, idLoja, ciclo); } } }
using Model.Numbers; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; 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; namespace View.Controls { /// <summary> /// Interaction logic for Digit.xaml /// </summary> public partial class Digit : UserControl { public Number Number { set { TopSegment.Color = value.Segments.ElementAt(0) ? value.Color : Colors.Black; TopLeftSegment.Color = value.Segments.ElementAt(1) ? value.Color : Colors.Black; TopRightSegment.Color = value.Segments.ElementAt(2) ? value.Color : Colors.Black; MiddleSegment.Color = value.Segments.ElementAt(3) ? value.Color : Colors.Black; BottomLeftSegment.Color = value.Segments.ElementAt(4) ? value.Color : Colors.Black; BottomRightSegment.Color = value.Segments.ElementAt(5) ? value.Color : Colors.Black; BottomSegment.Color = value.Segments.ElementAt(6) ? value.Color : Colors.Black; } } public Digit() { InitializeComponent(); Number = Numbers.None; } } }
using System; using Sample.Domain.Shared; namespace Sample.Domain.V4 { public class Appointment { public Guid Id { get; private set; } public Guid JobId { get; set; } public TimeSlot TimeSlot { get; private set; } public Guid? StaffMemberId { get; private set; } public Status Status { get; private set; } public string Comments { get; private set; } private Appointment(Guid id, Guid jobId, DateTime? from = null, DateTime? to = null, Guid? staffMemberId = null) { if (from == null && to == null && staffMemberId == null) throw new Exception("You have to either select time frame or select staff member"); if(from != null && to != null) TimeSlot = new TimeSlot(from.Value, to.Value); Id = id; JobId = jobId; StaffMemberId = staffMemberId; Status = Status.Initiated; } public void AssignStaffMember(Guid staffMemberId) { Printer.Print(ConsoleColor.Cyan); StaffMemberId = staffMemberId; } public void Reschedule(DateTime from, DateTime to) { Printer.Print( ConsoleColor.Cyan); TimeSlot = new TimeSlot(from, to); } public void Start() { Printer.Print(ConsoleColor.Cyan); if (Status == Status.Canceled) throw new Exception("Appointment is cancelled, can not mark it in progress"); Status = Status.InProgress; DomainEvents.Publish(new AppointmentStarted(this)); } public void Finish(string comments = null) { Printer.Print(ConsoleColor.Cyan); Status = Status.Completed; Comments = comments; DomainEvents.Publish(new AppointmentCompleted(this)); } public bool IsInProgress() { return Status == Status.InProgress; } public bool IsCompleted() { return Status == Status.Completed; } public void Cancel() { Printer.Print(ConsoleColor.Cyan); Status = Status.Canceled; } public bool IsCanceled() { return Status == Status.Canceled; } public static Appointment Schedule(Guid jobId, DateTime from, DateTime to, Guid? memberId = null) { Printer.Print(ConsoleColor.Cyan); return new Appointment(Guid.NewGuid(), jobId, from, to, memberId); } } }
// Copyright (c) 2018 James Skimming. All rights reserved. namespace Cbc.Identity { using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Logging; using Serilog; using Serilog.AspNetCore; using Serilog.Events; /// <summary> /// The entry point for the application. /// </summary> public class Program { private static string _microserviceName; private static string _buildVersion; /// <summary> /// The entry point for the application. /// </summary> /// <param name="args">The start-up arguments.</param> public static void Main(string[] args) { _microserviceName = typeof(Program).Assembly.GetName().Name; _buildVersion = typeof(Startup).GetTypeInfo().Assembly.GetName().Version.ToString(); Console.Title = _microserviceName; try { BuildWebHost(args).Run(); } catch (Exception ex) { Log.Fatal(ex, "Host terminated unexpectedly."); } finally { Log.CloseAndFlush(); } } /// <summary> /// Gets the <see cref="IWebHost"/>. /// </summary> /// <param name="args">The start-up arguments.</param> /// <returns>The <see cref="IWebHost"/>.</returns> public static IWebHost BuildWebHost(string[] args) => WebHost.CreateDefaultBuilder(args) .ConfigureServices(ConfigureServices) .UseStartup<Startup>() .UseApplicationInsights() .Build(); private static void ConfigureServices(WebHostBuilderContext context, IServiceCollection services) { Serilog.ILogger log = new LoggerConfiguration() .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .Enrich.FromLogContext() .Enrich.WithMachineName() .Enrich.WithProcessId() .Enrich.WithThreadId() .Enrich.WithProperty("BuildVersion", _buildVersion) .Enrich.WithProperty("Microservice", _microserviceName.ToLowerInvariant()) .WriteTo.Console() .ReadFrom.Configuration(context.Configuration) .CreateLogger(); Log.Logger = log; services.AddSingleton<ILoggerFactory>(_ => new SerilogLoggerFactory(log)); services.TryAddSingleton(log); } } }
using System; namespace Tff.Panzer.Models.Campaign { public enum CampaignStepTypeEnum { MajorVictory = 0, MinorVictory = 1, Loss = 2 } }
using System; using System.Collections; using UnityEngine; using VavilichevGD.GameServices.AD.Unity; namespace VavilichevGD.GameServices.AD { public sealed class ADSService : GameServiceBase { #region CONSTANTS private const bool SUCCESS = true; private const bool FAIL = false; #endregion #region EVENTS public override event Action OnInitializedEvent; public event Action OnVideoADStartedEvent { add => behavior.OnVideoADStartedEvent += value; remove => behavior.OnVideoADStartedEvent -= value; } public event Action OnRewardedVideoStartedEvent{ add => behavior.OnRewardedVideoStartedEvent += value; remove => behavior.OnRewardedVideoStartedEvent -= value; } public event Action OnInterstitialStartedEvent{ add => behavior.OnInterstitialStartedEvent += value; remove => behavior.OnInterstitialStartedEvent -= value; } public event Action OnVideoADFinishedEvent{ add => behavior.OnVideoADFinishedEvent += value; remove => behavior.OnVideoADFinishedEvent -= value; } public event Action OnRewardedVideoFinishedEvent{ add => behavior.OnRewardedVideoFinishedEvent += value; remove => behavior.OnRewardedVideoFinishedEvent -= value; } public event Action OnInterstitialFinishedEvent{ add => behavior.OnInterstitialFinishedEvent += value; remove => behavior.OnInterstitialFinishedEvent -= value; } #endregion public bool isInterstitialAndBannerActive { get; private set; } = true; private ADSBehavior behavior; protected override IEnumerator InitializeAsyncRoutine() { this.CreateBehavior(); this.InitFasade(); this.OnInitializedEvent?.Invoke(); yield break; } private void CreateBehavior() { this.behavior = new ADSBehaviorUnity(); this.PrintLog($"ADS SERVICE: Behavior created ({this.behavior.GetType().Name})"); this.behavior.Initialize(); } private void InitFasade() { ADS.Initialize(this); this.PrintLog($"ADS SERVICE: Fasade Initialized (ADS.cs)"); } public void ShowRewardedVideo(Action<bool> callback) { this.PrintLog($"ADS SERVICE: Try to show Rewarded Video)"); this.behavior.ShowRewardedVideo(callback); } public void ShowInterstitial(Action<bool> callback = null) { this.PrintLog($"ADS SERVICE: Try to show Interstitial (isEnabled = {this.isInterstitialAndBannerActive}))"); if (this.isInterstitialAndBannerActive) { this.behavior.ShowInterstitial(callback); return; } callback?.Invoke(FAIL); } public void ShowBanner(BannerPosition position) { this.PrintLog($"ADS SERVICE: Show Banner"); if (this.isInterstitialAndBannerActive) this.behavior.ShowBanner(position); } public void HideBanner() { this.PrintLog($"ADS SERVICE: Hide Banner"); this.behavior.HideBanner(); } public bool IsRewardedVideoAvailable() { return this.behavior.IsRewardedVideoAvailable(); } public bool IsInterstitialAvailable() { if (!this.isInterstitialAndBannerActive) return false; return this.behavior.IsInterstitialAvailable(); } public bool IsBannerAvailable() { if (!this.isInterstitialAndBannerActive) return false; return this.behavior.IsBannerAvailable(); } public void DeactivateInterstitialAndBanner() { this.isInterstitialAndBannerActive = false; this.HideBanner(); this.PrintLog($"ADS SERVICE: Interstitial and banner deactivated"); } private void PrintLog(string text) { if (this.isLoggingEnabled) Debug.Log(text); } } }
using Repository.Categories; using Repository.Products; using Repository.Purchases; using System.Threading.Tasks; namespace Repository.Manager { public interface IRepositoryManager { ICategoryRepository Category { get; } IProductRepository Product { get; } IPurchaseRepository Purchase { get; } Task SaveAsync(); } }
using Mccole.Geodesy.Calculator; using Microsoft.VisualStudio.TestTools.UnitTesting; using System; namespace Mccole.Geodesy.UnitTesting.Calculator { [TestClass] public class CoordinateFactory_Tests { [TestMethod] public void Create_Valid_Assert() { Func<ICoordinate> func = new Func<ICoordinate>(() => { return new TestCoordinate(); }); ((ICoordinateFactory)RhumbCalculator.Instance).SetFactoryMethod(func); var result = ((ICoordinateFactory)RhumbCalculator.Instance).Create(); Assert.IsInstanceOfType(result, typeof(TestCoordinate)); } [TestMethod] [ExpectedException(typeof(ArgumentNullException))] public void SetFactoryMethod_Func_Null_ThrowsException() { ((ICoordinateFactory)RhumbCalculator.Instance).SetFactoryMethod(null); } [TestMethod] public void SetFactoryMethod_Valid_Assert() { Func<ICoordinate> func = new Func<ICoordinate>(() => { return new TestCoordinate(); }); var result = ((ICoordinateFactory)RhumbCalculator.Instance).SetFactoryMethod(func); Assert.IsTrue(result); } } public class TestCoordinate : ICoordinate { public double Latitude { get; set; } public double Longitude { get; set; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace SpiderCore { public interface IDownloader { Response Download(Request request); } }
using System; using System.Linq; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.Entity; using System.Threading.Tasks; using CriticalPath.Data; using CriticalPath.Web.Models; using System.Net; using System.Web.Mvc; using OzzUtils.Web.Mvc; namespace CriticalPath.Web.Controllers { public partial class ProcessesController { protected virtual async Task<IQueryable<Process>> GetProcessQuery(QueryParameters qParams) { var query = GetProcessQuery(); if (!string.IsNullOrEmpty(qParams.SearchString)) { query = from a in query where a.PurchaseOrder.PoNr.Contains(qParams.SearchString) | a.PurchaseOrder.Product.ProductCode.Contains(qParams.SearchString) | a.PurchaseOrder.Product.Description.Contains(qParams.SearchString) | a.PurchaseOrder.Customer.CompanyName.Contains(qParams.SearchString) | a.PurchaseOrder.Customer.CustomerCode.Contains(qParams.SearchString) | a.PurchaseOrder.Supplier.CompanyName.Contains(qParams.SearchString) | a.PurchaseOrder.Supplier.SupplierCode.Contains(qParams.SearchString) | a.Description.Contains(qParams.SearchString) select a; } if (qParams.PurchaseOrderId != null) { query = query.Where(x => x.PurchaseOrderId == qParams.PurchaseOrderId); } if (qParams.SupplierId != null) { query = query.Where(x => x.PurchaseOrder.SupplierId == qParams.SupplierId); } if (qParams.ProductId != null) { query = query.Where(x => x.PurchaseOrder.ProductId == qParams.ProductId); } if (qParams.CustomerId != null) { query = query.Where(x => x.PurchaseOrder.CustomerId == qParams.CustomerId); } if (qParams.ProcessTemplateId != null) { query = query.Where(x => x.ProcessTemplateId == qParams.ProcessTemplateId); } if (qParams.IsCompleted != null) { query = query.Where(x => x.IsCompleted == qParams.IsCompleted.Value); } if (qParams.Cancelled != null) { query = query.Where(x => x.Cancelled == qParams.Cancelled.Value); } if (qParams.StartDateMin != null) { query = query.Where(x => x.StartDate >= qParams.StartDateMin.Value); } if (qParams.StartDateMax != null) { query = query.Where(x => x.StartDate <= qParams.StartDateMax.Value); } if (qParams.TargetDateMin != null) { query = query.Where(x => x.TargetDate >= qParams.TargetDateMin.Value); } if (qParams.TargetDateMax != null) { query = query.Where(x => x.TargetDate <= qParams.TargetDateMax.Value); } if (qParams.ForecastDateMin != null) { query = query.Where(x => x.ForecastDate >= qParams.ForecastDateMin.Value); } if (qParams.ForecastDateMax != null) { query = query.Where(x => x.ForecastDate <= qParams.ForecastDateMax.Value); } if (qParams.RealizedDateMin != null) { query = query.Where(x => x.RealizedDate >= qParams.RealizedDateMin.Value); } if (qParams.RealizedDateMax != null) { query = query.Where(x => x.RealizedDate <= qParams.RealizedDateMax.Value); } if (qParams.CancelDateMin != null) { query = query.Where(x => x.CancelDate >= qParams.CancelDateMin.Value); } if (qParams.CancelDateMax != null) { query = query.Where(x => x.CancelDate <= qParams.CancelDateMax.Value); } qParams.TotalCount = await query.CountAsync(); return query.Skip(qParams.Skip).Take(qParams.PageSize); } protected virtual async Task<List<ProcessDTO>> GetProcessDtoList(QueryParameters qParams) { var query = await GetProcessQuery(qParams); var list = qParams.TotalCount > 0 ? await DataContext.GetProcessDtoQuery(query).ToListAsync() : new List<ProcessDTO>(); if (list.Count > 0) { var ids = from p in query select p.Id; var querySteps = GetProcessStepQuery() .Where(s => ids.Contains(s.ProcessId)); var steps = await DataContext.GetProcessStepDtoQuery(querySteps).ToListAsync(); foreach (var item in list) { item.ProcessSteps = steps.Where(s => s.ProcessId == item.Id).ToList(); } } return list; } [Authorize] public async Task<ActionResult> GetProcessList(QueryParameters qParams) { var result = await GetProcessDtoList(qParams); return Content(result.ToJson(false), "text/json"); } [Authorize] public async Task<ActionResult> GetProcessPagedList(QueryParameters qParams) { var items = await GetProcessDtoList(qParams); var result = new PagedList<ProcessDTO>(qParams, items); return Content(result.ToJson(false), "text/json"); } [Authorize] public async Task<ActionResult> GetProcess(int? id) { if (id == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var query = GetProcessQuery().Where(p => p.Id == id.Value); var process = await DataContext.GetProcessDtoQuery(query).FirstOrDefaultAsync(); var querySteps = GetProcessStepQuery() .Where(s => s.ProcessId == id.Value) .OrderBy(s => s.DisplayOrder); process.ProcessSteps = await DataContext.GetProcessStepDtoQuery(querySteps).ToListAsync(); if (process == null) { return HttpNotFound(); } return Content(process.ToJson(), "text/json"); } [Authorize] public async Task<ActionResult> Index(QueryParameters qParams) { var items = await GetProcessDtoList(qParams); int processTemplateId = (qParams.ProcessTemplateId ?? 0) > 0 ? qParams.ProcessTemplateId.Value : items.FirstOrDefault()?.ProcessTemplateId ?? 0; if (processTemplateId > 0) { var query = GetProcessStepTemplateQuery() .Where(t => t.ProcessTemplateId == processTemplateId) .OrderBy(t => t.DisplayOrder); var templates = await DataContext.GetProcessStepTemplateDtoQuery(query).ToArrayAsync(); ViewBag.templates = templates; } else { ViewBag.templates = new ProcessStepTemplateDTO[0]; } await PutCanUserInViewBag(); ViewBag.totalCount = qParams.TotalCount; var result = new PagedList<ProcessDTO>(qParams, items); ViewBag.result = result.ToJson(false); return View(); } protected override async Task PutCanUserInViewBag() { ViewBag.canUserApprove = await CanUserApprove(); ViewBag.canUserCancelPO = await CanUserCancelPO(); await base.PutCanUserInViewBag(); } [Authorize(Roles = "admin, supervisor")] public async Task<ActionResult> ApproveProcess(int? id) //GET: /PurchaseOrders/Edit/5 { if (id == null) return new HttpStatusCodeResult(HttpStatusCode.BadRequest); var process = await FindAsyncProcess(id.Value); if (process == null) return HttpNotFound(); if (process.IsApproved) return new HttpStatusCodeResult(HttpStatusCode.BadRequest); return View("Approve", process); } [HttpPost] [ValidateAntiForgeryToken] [Authorize(Roles = "admin, supervisor")] public async Task<ActionResult> ApproveProcess(ProcessDTO vm) { var process = await FindAsyncProcess(vm.Id); if (vm.IsApproved && process != null) { await ApproveSaveAsync(process); return RedirectToAction("Details", new { id = process.Id }); } return View("Approve", process); } private async Task SetProcessTemplateSelectList(Process process) { var queryTemplateId = DataContext .GetProcessTemplateDtoQuery() .Where(t => t.IsApproved); var templates =await queryTemplateId.ToListAsync(); int processTemplateId = process == null ? 0 : process.ProcessTemplateId; if (processTemplateId == 0 && templates.Count > 0) { processTemplateId = templates.FirstOrDefault().Id; } ViewBag.ProcessTemplateId = new SelectList(templates, "Id", "TemplateName", processTemplateId); } [HttpGet] [Authorize(Roles = "admin, supervisor, clerk")] [Route("Processes/Create/{purchaseOrderId:int?}")] public async Task<ActionResult> Create(int? purchaseOrderId) //GET: /Processes/Create { var process = new Process(); if (purchaseOrderId != null) { var purchaseOrder = await FindAsyncPurchaseOrder(purchaseOrderId.Value); if (purchaseOrder == null) return HttpNotFound(); process.PurchaseOrder = purchaseOrder; } await SetProcessDefaults(process); await SetProcessTemplateSelectList(process); return View(process); } [HttpPost] [Authorize(Roles = "admin, supervisor, clerk")] [ValidateAntiForgeryToken] [Route("Processes/Create/{purchaseOrderId:int?}")] public async Task<ActionResult> Create(int? purchaseOrderId, Process process) //POST: /Processes/Create { DataContext.SetInsertDefaults(process, this); if (ModelState.IsValid) { await OnCreateSaving(process); DataContext.Processes.Add(process); await DataContext.SaveChangesAsync(this); await OnCreateSaved(process); return RedirectToAction("Index"); } await SetProcessTemplateSelectList(process); return View(process); } async Task OnCreateSaved(Process process) { var currentStep = process .ProcessSteps .OrderBy(s => s.DisplayOrder) .FirstOrDefault(); if (currentStep != null) { process.CurrentStepId = currentStep.Id; await DataContext.SaveChangesAsync(this); } } async Task OnCreateSaving(Process process) { var purchaseOrder = process.PurchaseOrder; if (purchaseOrder == null) purchaseOrder = await FindAsyncPurchaseOrder(process.PurchaseOrderId); var query = GetProcessStepTemplateQuery(); query = query.Where(s => s.ProcessTemplateId == process.ProcessTemplateId) .OrderBy(s => s.DisplayOrder); if (purchaseOrder.IsRepeat) query = query.Where(s => !s.IgnoreInRepeat); var templates = await query.ToListAsync(); //DateTime startDate = process.StartDate; foreach (var template in query) { var step = new ProcessStep() { Title = template.Title, DisplayOrder = template.DisplayOrder, TemplateId = template.Id, //TargetDate = template.RequiredWorkDays > 0 ? startDate : process.StartDate }; //startDate = startDate.AddDays(template.RequiredWorkDays); process.ProcessSteps.Add(step); } } protected override Task SetProcessDefaults(Process process) { //TODO: Get 39 days from an AppSetting, ProcessesController process.TargetDate = process.PurchaseOrder?.SupplierDueDate ?? DateTime.Today.AddDays(39); process.StartDate = DateTime.Today; return Task.FromResult(default(object)); } public new partial class QueryParameters { protected override void Constructing() { Page = 1; PageSize = 20; } public int? CustomerId { get; set; } public int? ProductId { get; set; } public int? SupplierId { get; set; } } } }
using System; namespace RollingStones { public class Exceptions : Exception { public Exceptions(string message) : base(message) { } static public void CheckCondition(int condition) { if (condition == 0) { throw new Exceptions("Введен неправильный символ или значение. Попробуйте снова: "); } } static public void CheckValue(int value) { if (value <= 1) { throw new Exceptions("Количество камней для победы не может быть меньше, чем 1. Попробуйте снова: "); } } static public void CheckDuplicate(string condition1, string condition2) { if (condition1 == condition2) { throw new Exceptions("Такое условие уже задано. Попробуйте снова: "); } } static public void CheckDuplicate(string condition1, string condition2, string condition3) { if (condition3 == condition1 || condition3 == condition2) { throw new Exceptions("Такое условие уже задано. Попробуйте снова: "); } } } }
using System; using MonoFlash.Display; using MonoFlash; using System.Diagnostics; using MonoFlash.Events; using Microsoft.Xna.Framework; using Lidgren.Network; using PlanesGame.Network; using Microsoft.Xna.Framework.Input; using System.Collections.Generic; using MonoFlash.Text; namespace PlanesGame.Screens { public class GameScreen : Screen { // Game private Player localPlayer, remotePlayer; private Sprite worldContainer, gameContainer, guiContainer, bgContainer; private Sprite[] bgLayers; private float inputX = 0, inputY = 1; private float reloadTime; private float[] LAYER_DEPTHS = { 0, 0.5f, 0.75f }; private List<Bullet> bullets; private int levelNumber; #if __MOBILE__ private Bitmap decelerateButton; private Bitmap leftButton; private Bitmap rightButton; private Bitmap fireButton; #endif private NetClient client; private string localNick, remoteNick; public const int WORLD_WIDTH = 140; private bool isHost; private float respTime; private float RespawnTime { get { return respTime; } set { respTime = value; respTime = Math.Max(0, respTime); } } private TextField resultLabel, countLabel; public GameScreen(NetClient client, string localNick, string remoteNick, bool isHost) { this.client = client; this.localNick = localNick; this.remoteNick = remoteNick; this.isHost = isHost; } public override void Load() { worldContainer = new Sprite(); AddChild(worldContainer); bullets = new List<Bullet>(); reloadTime = 0; // Фон bgLayers = new Sprite[3]; bgContainer = new Sprite(); worldContainer.AddChild(bgContainer); LoadBackground(levelNumber); // Игра gameContainer = new Sprite(); worldContainer.AddChild(gameContainer); localPlayer = new Player(localNick, true); remotePlayer = new Player(remoteNick, false); if (isHost) { localPlayer.X = localPlayer.Y = remotePlayer.Y = 10; remotePlayer.X = WORLD_WIDTH - GameMain.ScreenWidth / 2; remotePlayer.Rotation = 180; remotePlayer.ScaleY = -1; } else { remotePlayer.X = remotePlayer.Y = localPlayer.Y = 10; localPlayer.X = WORLD_WIDTH - GameMain.ScreenWidth / 2; localPlayer.Rotation = 180; localPlayer.ScaleY = -1; } gameContainer.AddChild(localPlayer); gameContainer.AddChild(remotePlayer); // Интерфейс guiContainer = new Sprite(); AddChild(guiContainer); #if __MOBILE__ // Кнопка тормоза decelerateButton = new Bitmap(Assets.GetBitmapData("assets/ui/down")); decelerateButton.Y = GameMain.ScreenHeight - decelerateButton.Height; guiContainer.AddChild(decelerateButton); decelerateButton.AddEventListener(Event.TOUCH_MOVE, onDecelerateBegin); decelerateButton.AddEventListener(Event.TOUCH_END, onDecelerateEnd); // Кнопка вправо rightButton = new Bitmap(Assets.GetBitmapData("assets/ui/right")); rightButton.X = GameMain.ScreenWidth - rightButton.Width; rightButton.Y = decelerateButton.Y; guiContainer.AddChild(rightButton); rightButton.AddEventListener(Event.TOUCH_MOVE, onRotateBegin); rightButton.AddEventListener(Event.TOUCH_END, onRotateEnd); // Кнопка вправо leftButton = new Bitmap(Assets.GetBitmapData("assets/ui/left")); leftButton.X = rightButton.X - leftButton.Width; leftButton.Y = rightButton.Y; guiContainer.AddChild(leftButton); leftButton.AddEventListener(Event.TOUCH_MOVE, onRotateBegin); leftButton.AddEventListener(Event.TOUCH_END, onRotateEnd); // Кнопка стрельбы fireButton = new Bitmap(Assets.GetBitmapData("assets/ui/fire")); fireButton.X = decelerateButton.X + decelerateButton.Width; fireButton.Y = decelerateButton.Y; guiContainer.AddChild(fireButton); fireButton.AddEventListener(Event.TOUCH_END, onFireBegin); leftButton.color = rightButton.color = decelerateButton.color = fireButton.color = new Color(Color.DarkGray, 20); #endif if (isHost) ChangeLevel(); resultLabel = new TextField(); resultLabel.font = Assets.GetFont("assets/MainFont"); resultLabel.visible = false; countLabel = new TextField(); countLabel.font = resultLabel.font; countLabel.visible = false; guiContainer.AddChild(resultLabel); guiContainer.AddChild(countLabel); } #if __MOBILE__ void onDecelerateBegin(Event e) { inputY = -1; } void onDecelerateEnd(Event e) { inputY = 1; } void onRotateBegin(Event e) { if (e.currentTarget == leftButton) inputX = -1; if (e.currentTarget == rightButton) inputX = 1; } void onRotateEnd(Event e) { inputX = 0; } void onFireBegin(Event e) { CreateLocalShot(); } #endif void LoadBackground(int levelNumber) { levelNumber += 1; if (levelNumber > 4) throw new IndexOutOfRangeException(); // Удаляем старый фон for (int i = 0; i < 3; ++i) { bgContainer.RemoveChild(bgLayers[i]); bgLayers[i] = null; } for (int i = 0; i < 3; ++i) { bgLayers[i] = new Sprite(); BitmapData bmpData = Assets.GetBitmapData("assets/background/" + levelNumber + "/"+ (i + 1).ToString(), true); var bmp1 = new Bitmap(bmpData); var bmp2 = new Bitmap(bmpData); bmp2.X = bmp1.Width; bgLayers[i].AddChild(bmp1); bgLayers[i].AddChild(bmp2); bgContainer.AddChild(bgLayers[i]); } } private void ChangeLevel() { NetOutgoingMessage outMsg = client.CreateMessage(); outMsg.Write((byte)GameClient.DataMessageTypes.LocalChangeLevel); var newLevelIndex = new Random((int)DateTime.Now.Ticks).Next(0, 4); outMsg.Write((byte)newLevelIndex); client.SendMessage(outMsg, NetDeliveryMethod.ReliableOrdered); LoadBackground(newLevelIndex); } public void CreateLocalShot() { if ((reloadTime >= Player.RELOAD_TIME) && (!localPlayer.isDead)) { reloadTime = 0; var newBullet = CreateBullet(localPlayer); gameContainer.AddChildAt(newBullet, gameContainer.GetChildIndex(localPlayer) - 1); bullets.Add(newBullet); NetOutgoingMessage bulMsg = client.CreateMessage(); bulMsg.Write((byte)GameClient.DataMessageTypes.LocalShooting); client.SendMessage(bulMsg, NetDeliveryMethod.Unreliable); } } public Bullet CreateBullet(Player belongsTo) { var bullet = new Bullet(belongsTo.X, belongsTo.Y, belongsTo.Rotation, belongsTo == localPlayer); return bullet; } public override void Unload() { throw new NotImplementedException(); } public void ShowLabel(bool lost = false) { resultLabel.text = (lost) ? "YOU LOST" : "YOU WON"; resultLabel.textColor = (lost) ? Color.LightSalmon : Color.LightGreen; resultLabel.X = GameMain.ScreenWidth / 2 - resultLabel.Width / 2; resultLabel.Y = GameMain.ScreenHeight / 2 - resultLabel.Height * 1.25f; resultLabel.visible = true; countLabel.text = "3"; countLabel.X = GameMain.ScreenWidth / 2 - countLabel.Width / 2; countLabel.Y = resultLabel.Y + resultLabel.Height; countLabel.textColor = resultLabel.textColor; countLabel.visible = true; RespawnTime = 3; } private void RespawnLocalPlayer() { if (isHost) { localPlayer.X = localPlayer.Y = 10; } else { localPlayer.Y = 10; localPlayer.X = WORLD_WIDTH - GameMain.ScreenWidth / 2; localPlayer.Rotation = 180; } localPlayer.HP = Player.MAX_HP; localPlayer.isDead = false; localPlayer.visible = true; } public override void Update(float deltaTime) { reloadTime += deltaTime; // TODO: maybe replace updates? localPlayer.Update(deltaTime); remotePlayer.Update(deltaTime); // Debug.WriteLine(bullets.Count); var worldX = -localPlayer.X + GameMain.ScreenWidth / 2; worldX = Math.Max(worldX, -WORLD_WIDTH + GameMain.ScreenWidth); worldX = Math.Min(worldX, 0); var dx = worldX - worldContainer.X; for (int i = 0; i < 3; ++i) { var layer = bgLayers[i]; layer.X += dx * LAYER_DEPTHS[i]; if (layer.X + layer.Width < GameMain.ScreenWidth) { layer.X += layer.Width / 2; } else if (layer.X > 0) { layer.X -= layer.Width / 2; } } worldContainer.X = worldX; for (int i = 0; i < bullets.Count; ++i) { if (bullets[i] == null) continue; var cB = bullets[i]; cB.Update(deltaTime); if (cB.lifeTime <= 0) { gameContainer.RemoveChild(cB); bullets[i] = null; continue; } Player playerToHit = cB.isLocal ? remotePlayer : localPlayer; if (cB.HitTestObject(playerToHit)) { gameContainer.RemoveChild(cB); bullets[i] = null; // Если игрок локальный, то отсылаем серверу попадания if (playerToHit == localPlayer) { localPlayer.HP--; if (localPlayer.HP <= 0) { localPlayer.isDead = true; localPlayer.visible = false; ShowLabel(true); } NetOutgoingMessage hitMsg = client.CreateMessage(); hitMsg.Write((byte)GameClient.DataMessageTypes.LocalHit); client.SendMessage(hitMsg, NetDeliveryMethod.Unreliable); } continue; } } bullets.RemoveAll(x => x == null); #if !__MOBILE__ var kbState = Keyboard.GetState(); if (kbState.IsKeyDown(Keys.Left)) inputX = -1; else if (kbState.IsKeyDown(Keys.Right)) inputX = 1; else if (kbState.IsKeyUp(Keys.Left) || kbState.IsKeyUp(Keys.Right)) inputX = 0; if (kbState.IsKeyDown(Keys.Down)) inputY = -1; else if (kbState.IsKeyUp(Keys.Down)) inputY = 1; if (kbState.IsKeyDown(Keys.Space)) CreateLocalShot(); #endif localPlayer.Rotation += inputX * Player.ROTATION_SPEED * deltaTime; localPlayer.Power += inputY * Player.POWER_SPEED * deltaTime; if (localPlayer.X + localPlayer.Width / 2 < 0) { localPlayer.X = WORLD_WIDTH - localPlayer.Width / 2; } if (localPlayer.X - localPlayer.Width / 2 > WORLD_WIDTH) { localPlayer.X = -localPlayer.Width / 2; } #if DEBUG if (client == null) return; #endif // Send coordinates if (!localPlayer.isDead) { NetOutgoingMessage outMsg = client.CreateMessage(); outMsg.Write((byte)GameClient.DataMessageTypes.LocalCoordinates); outMsg.Write(localPlayer.X); outMsg.Write(localPlayer.Y); outMsg.Write(localPlayer.Rotation); client.SendMessage(outMsg, NetDeliveryMethod.Unreliable); } if (localPlayer.isDead || remotePlayer.isDead) { RespawnTime -= deltaTime; countLabel.text = Math.Round(RespawnTime).ToString(); if (localPlayer.isDead && RespawnTime <= 0) { RespawnLocalPlayer(); NetOutgoingMessage respMsg = client.CreateMessage(); respMsg.Write((byte)GameClient.DataMessageTypes.LocalRespawn); client.SendMessage(respMsg, NetDeliveryMethod.ReliableOrdered); resultLabel.visible = false; countLabel.visible = false; if (isHost) ChangeLevel(); } } NetIncomingMessage msg; while ((msg = client.ReadMessage()) != null) { switch (msg.MessageType) { case NetIncomingMessageType.Data: byte msgCode = msg.ReadByte(); if (msgCode == (byte)GameClient.DataMessageTypes.RemoteCoordinates) { remotePlayer.X = msg.ReadFloat(); remotePlayer.Y = msg.ReadFloat(); remotePlayer.Rotation = msg.ReadFloat(); } if (msgCode == (byte)GameClient.DataMessageTypes.RemoteShooting) { var newBullet = CreateBullet(remotePlayer); gameContainer.AddChildAt(newBullet, gameContainer.GetChildIndex(localPlayer) - 1); bullets.Add(newBullet); } if (msgCode == (byte)GameClient.DataMessageTypes.RemoteChangeLevel) { LoadBackground(msg.ReadByte()); } if (msgCode == (byte)GameClient.DataMessageTypes.RemoteHit) { remotePlayer.HP--; if (remotePlayer.HP <= 0) { remotePlayer.isDead = true; remotePlayer.visible = false; ShowLabel(); } } if (msgCode == (byte)GameClient.DataMessageTypes.RemoteRespawn) { remotePlayer.HP = Player.MAX_HP; remotePlayer.isDead = false; remotePlayer.visible = true; localPlayer.HP = Player.MAX_HP; resultLabel.visible = countLabel.visible = false; if (isHost) ChangeLevel(); } break; default: break; } client.Recycle(msg); } } } }
// *** WARNING: this file was generated by pulumigen. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Pulumi.Serialization; namespace Pulumi.Kubernetes.Types.Inputs.Core.V1 { /// <summary> /// ServicePort contains information on service's port. /// </summary> public class ServicePortArgs : Pulumi.ResourceArgs { /// <summary> /// The application protocol for this port. This field follows standard Kubernetes label syntax. Un-prefixed names are reserved for IANA standard service names (as per RFC-6335 and http://www.iana.org/assignments/service-names). Non-standard protocols should use prefixed names such as mycompany.com/my-custom-protocol. /// </summary> [Input("appProtocol")] public Input<string>? AppProtocol { get; set; } /// <summary> /// The name of this port within the service. This must be a DNS_LABEL. All ports within a ServiceSpec must have unique names. When considering the endpoints for a Service, this must match the 'name' field in the EndpointPort. Optional if only one ServicePort is defined on this service. /// </summary> [Input("name")] public Input<string>? Name { get; set; } /// <summary> /// The port on each node on which this service is exposed when type is NodePort or LoadBalancer. Usually assigned by the system. If a value is specified, in-range, and not in use it will be used, otherwise the operation will fail. If not specified, a port will be allocated if this Service requires one. If this field is specified when creating a Service which does not need it, creation will fail. This field will be wiped when updating a Service to no longer need it (e.g. changing type from NodePort to ClusterIP). More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport /// </summary> [Input("nodePort")] public Input<int>? NodePort { get; set; } /// <summary> /// The port that will be exposed by this service. /// </summary> [Input("port", required: true)] public Input<int> Port { get; set; } = null!; /// <summary> /// The IP protocol for this port. Supports "TCP", "UDP", and "SCTP". Default is TCP. /// </summary> [Input("protocol")] public Input<string>? Protocol { get; set; } /// <summary> /// Number or name of the port to access on the pods targeted by the service. Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME. If this is a string, it will be looked up as a named port in the target Pod's container ports. If this is not specified, the value of the 'port' field is used (an identity map). This field is ignored for services with clusterIP=None, and should be omitted or set equal to the 'port' field. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service /// </summary> [Input("targetPort")] public InputUnion<int, string>? TargetPort { get; set; } public ServicePortArgs() { } } }
#if UNITY_5 || UNITY_4 || UNITY_4_6 || UNITY_2017 || UNITY_2018 #define Unity #endif using System; using System.Collections.Generic; using System.Text; using System.Collections; using System.Linq; using cn.bmob.io; using cn.bmob.http; using cn.bmob.config; using cn.bmob.exception; using cn.bmob.response; using System.Text.RegularExpressions; #if Unity using UnityEngine; using System.Collections.ObjectModel; using cn.bmob.tools; namespace System { //public delegate void Action<in T1, in T2>(T1 arg1, T2 arg2); public delegate TResult Func<T1, T2, T3, T4, T5, T6, TResult>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); public class AggregateException : Exception { // // Properties // public ReadOnlyCollection<Exception> InnerExceptions { get; private set; } // // Constructors // public AggregateException(IEnumerable<Exception> innerExceptions) { this.InnerExceptions = new ReadOnlyCollection<Exception>(innerExceptions.ToList<Exception>()); } // // Methods // public AggregateException Flatten() { List<Exception> list = new List<Exception>(); foreach (Exception current in this.InnerExceptions) { AggregateException ex = current as AggregateException; if (ex != null) { list.AddRange(ex.Flatten().InnerExceptions); } else { list.Add(current); } } return new AggregateException(list); } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(base.ToString()); foreach (Exception current in this.InnerExceptions) { stringBuilder.AppendLine("\n-----------------"); stringBuilder.AppendLine(current.ToString()); } return stringBuilder.ToString(); } } namespace Threading { namespace Tasks { } } } namespace cn.bmob.api { public partial class Bmob : MonoBehaviour { } /// <summary> /// Bmob SDK入口类,开发者直接调用该类即可获取Bmob提供的各种服务。 /// </summary> public class BmobUnity : Bmob { private MonoBehaviour go; /// <summary> /// Unity Behavior /// </summary> public void Update() { } public BmobUnity() { Configuration.PLATFORM = SDKTarget.Unity; go = this; } /// <summary> /// 仅用于在界面设置 /// </summary> public String ApplicationId; public String RestKey; internal override string appKey { get { return ApplicationId; } set { ApplicationId = value; base.appKey = value; } } internal override String restKey { get { return RestKey; } set { RestKey = value; base.restKey = value; } } internal override void submit<T>(BmobCommand<T> command, BmobCallback<T> callback) { this.go.StartCoroutine(execute<T>(command, callback)); } /// <summary> /// 调用 /// </summary> private IEnumerator execute<T>(BmobCommand<T> command, BmobCallback<T> callback) { return command.execute<IEnumerator>(Request, callback); } protected virtual IEnumerator Request(String url, String method, String contentType, byte[] postData, IDictionary<String, String> headers, Action<String, Status, BmobException> callback) { BmobOutput.Save(headers, "Content-Type", contentType); // http://answers.unity3d.com/questions/785798/put-with-wwwform.html // www不支持PUT和DELETE操作,需要服务端支持!!服务端已添加filter 2015年9月25日09:57:52 BmobOutput.Save(headers, "X-HTTP-Method-Override", method); return RequestInternal(url, method, postData, headers, callback); } private IEnumerator RequestInternal(String url, String method, byte[] postData, IDictionary<String, String> headers, Action<String, Status, BmobException> callback) { var table = new Dictionary<String, String>(); foreach (var header in headers) { table.Add(header.Key, header.Value); } WWW www = new WWW(url, method.Equals("GET") ? null : postData, table); yield return www; var error = www.error; var text = www.text; BmobDebug.T("[ BmobUnity ] after fetch www message, Response: '" + text + "', Error: ' " + error + "'"); var status = new Status(200, error); // if (www.responseHeaders.ContainsKey("STATUS")) // { // var respStatus = www.responseHeaders["STATUS"]; // var statusCode = Regex.Replace(respStatus, @"[^ ]* (\d*) .*", "$1"); // status.code = Convert.ToInt32(statusCode); // } try{ if (www.responseHeaders.ContainsKey("STATUS")) { var respStatus = www.responseHeaders["STATUS"]; var statusCode = Regex.Replace(respStatus, @"[^ ]* (\d*) .*", "$1"); status.code = Convert.ToInt32(statusCode); } }catch(NullReferenceException e){ BmobDebug.T("www.responseHeaders方法有问题: "+e); // Unity 2017.2.0f3 (64-bit) 版本,www.responseHeaders方法在真机上有问题。zq,2017.10.24 if(error != null){ foreach (Match match in Regex.Matches(error, @" *(\d*) *")){ status.code = Convert.ToInt32(match.Value); break; } } } if (error != null && error != "") { // 返回了错误的内容,不表示返回的内容就为空!! callback(text, status, new BmobException(error)); } else { callback(text, status, null); } } } } #endif
using System; using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Options; using Microsoft.IdentityModel.Tokens; using PointOfSalesV2.Common; using PointOfSalesV2.Entities; using PointOfSalesV2.Entities.Model; using PointOfSalesV2.Repository; using PointOfSalesV2.Repository.Helpers; namespace PointOfSalesV2.Api.Controllers { [Route("api/[controller]")] [ApiController] public class LoginController : ControllerBase { private readonly IOptions<AppSettings> _appSettings; private readonly IMemoryCache _cache; private readonly IBase<User> users; private readonly IDataRepositoryFactory dataRepositoryFactory; public LoginController(IMemoryCache cache, IOptions<AppSettings> appSettings, IDataRepositoryFactory repositoryFactory) { this._appSettings = appSettings; this._cache = cache; this.users = repositoryFactory.GetDataRepositories<User>(); this.dataRepositoryFactory = repositoryFactory; } [HttpPost] public IActionResult Post([FromBody] Login model) { try { UsersHelper.VerifyAdminUser(this.dataRepositoryFactory); User user = users.Get(x => x.Where(u => u.Active == true && u.Email == model.Email && u.Password == MD5.Encrypt(model.Password, _appSettings.Value.TokenKey))); if (user == null) return Ok(new { status = -1, message = "Invalid credentials" }); var claims = new[] { new Claim(JwtRegisteredClaimNames.UniqueName, user.Email), new Claim(JwtRegisteredClaimNames.Sid, user.Id.ToString()), //new Claim("miValor", "Lo que yo quiera"), new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) }; var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_appSettings.Value.TokenKey)); var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); var expiration = DateTime.UtcNow.AddHours(_appSettings.Value.TokenTimeHours); JwtSecurityToken token = new JwtSecurityToken( issuer: _appSettings.Value.Domain, audience: _appSettings.Value.Domain, claims: claims, expires: expiration, signingCredentials: creds ); string tokenString = new JwtSecurityTokenHandler().WriteToken(token); user.TokenKey = tokenString; _cache.Set<User>(tokenString, user, DateTimeOffset.Now.AddHours(_appSettings.Value.TokenTimeHours)); return Ok(new { message = "OK", status = 1, token = tokenString, expiration = expiration, user = user }); } catch (Exception ex) { return Ok(new { status = -1, message = ex.Message }); } } } }
// // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See LICENSE file in the project root for full license information. // using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; using DotNetNuke.Entities; using DotNetNuke.Tests.Utilities; using NUnit.Framework; namespace DotNetNuke.Tests.Core.Entities.Portals { public class PortalSettingsControllerTestFactory // ReSharper disable once InconsistentNaming { internal static string FilePath { get { var uri = new System.Uri(Assembly.GetExecutingAssembly().CodeBase); string path = Path.GetFullPath(uri.AbsolutePath).Replace("%20", " "); return Path.Combine(path.Substring(0, path.IndexOf("bin", System.StringComparison.Ordinal)), "Entities\\Portals\\TestFiles"); } } internal static Dictionary<string, string> GetHostSettings() { var settings = new Dictionary<string, string>(); //Read Test Settings Util.ReadStream(FilePath, "HostSettings", (line, header) => { string[] fields = line.Split(','); string key = fields[0].Trim(); string value = fields[1].Trim(); settings.Add(key, value); }); return settings; } internal static IEnumerable LoadPortalSettings_Loads_Default_Value { get { var testData = new ArrayList(); Util.ReadStream(FilePath, "DefaultValues", (line, header) => { var fieldList = new Dictionary<string, string>(); var testName = "Load_Default_Value"; string[] headers = header.Split(','); string[] fields = line.Split(','); for (int i = 0; i < fields.Length; i++ ) { string key = headers[i].Trim(new[] { '\t', '"' }); string val = fields[i].Trim(new[] {'\t', '"'}); fieldList[key] = val; } testName += "_"; testName += fields[0]; testData.Add(new TestCaseData(fieldList).SetName(testName)); }); return testData; } } internal static IEnumerable LoadPortalSettings_Loads_Setting_Value { get { var testData = new ArrayList(); Util.ReadStream(FilePath, "SettingValues", (line, header) => { var fieldList = new Dictionary<string, string>(); var testName = "Load_Setting_Value"; string[] headers = header.Split(','); string[] fields = line.Split(','); for (int i = 0; i < fields.Length; i++) { string key = headers[i].Trim(new[] { '\t', '"' }); string val = fields[i].Trim(new[] { '\t', '"' }); fieldList[key] = val; } testName += "_"; testName += fields[0]; testData.Add(new TestCaseData(fieldList).SetName(testName)); }); return testData; } } } }
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Input; using Project_GE.Framework.Input; namespace LMPoser { public class Camera3D { public Vector3 Position { get; set; } = new Vector3(0f, 0f, 10f); public Quaternion Orientation { get; set; } = Quaternion.Identity; public float FieldOfView { get; set; } = MathHelper.ToRadians(60f); public Vector2 Dimensions { get; set; } = new Vector2(1280, 720); public float AspectRatio { get { return Dimensions.X / Dimensions.Y; } } public float NearPlaneDistance { get; set; } = 1f; public float FarPlaneDistance { get; set; } = 1000f; public float Speed { get; set; } = 10f; public void Input(InputManager input, GameTime time) { var delta = (float)time.ElapsedGameTime.TotalSeconds; var speed = Speed * delta; if (input.IsKeyDown(Keys.W)) { Position += Vector3.Transform(Vector3.Forward, Orientation) * speed; } if (input.IsKeyDown(Keys.A)) { Position += Vector3.Transform(Vector3.Left, Orientation) * speed; } if (input.IsKeyDown(Keys.S)) { Position += Vector3.Transform(Vector3.Backward, Orientation) * speed; } if (input.IsKeyDown(Keys.D)) { Position += Vector3.Transform(Vector3.Right, Orientation) * speed; } if (input.IsKeyDown(Keys.E)) { Position += Vector3.Transform(Vector3.Up, Orientation) * speed; } if (input.IsKeyDown(Keys.Q)) { Position += Vector3.Transform(Vector3.Down, Orientation) * speed; } var amount = MathHelper.PiOver4 * delta; if (input.IsKeyDown(Keys.Up)) { Orientation *= Quaternion.CreateFromYawPitchRoll(0f, amount, 0f); } if (input.IsKeyDown(Keys.Down)) { Orientation *= Quaternion.CreateFromYawPitchRoll(0f, -amount, 0f); } if (input.IsKeyDown(Keys.Left)) { Orientation *= Quaternion.CreateFromYawPitchRoll(amount, 0f, 0f); } if (input.IsKeyDown(Keys.Right)) { Orientation *= Quaternion.CreateFromYawPitchRoll(-amount, 0f, 0f); } } public Matrix GetViewMatrix() { return Matrix.CreateLookAt( Position, Position + Vector3.Transform(Vector3.Forward, Orientation), Vector3.Up ); } public Matrix GetOrthographicProjectionMatrix() { return Matrix.CreateOrthographic(Dimensions.X, Dimensions.Y, NearPlaneDistance, FarPlaneDistance); } public Matrix GetPerspectiveProjectionMatrix() { return Matrix.CreatePerspectiveFieldOfView( FieldOfView, AspectRatio, NearPlaneDistance, FarPlaneDistance ); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using Newtonsoft.Json; namespace CommonCore.Config { public class PersistState { private static readonly string Path = CCParams.PersistentDataPath + "/persist.json"; public static PersistState Instance { get; private set; } internal static void Load() { Instance = CCBaseUtil.LoadExternalJson<PersistState>(Path); if (Instance == null) Instance = new PersistState(); } internal static void Save() { CCBaseUtil.SaveExternalJson(Path, Instance); } //set defaults in constructor [JsonConstructor] private PersistState() { ExtraStore = new Dictionary<string, object>(); } //actual persist data here (TODO) public Dictionary<string, System.Object> ExtraStore { get; private set; } } }
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using DevExpress.XtraReports.UI; using PDV.DAO.Entidades; using PDV.CONTROLER.Funcoes; using System.IO; using System.Data; namespace PDV.REPORTS.Reports.Email_Gestor { public partial class PosicaoDeEstoqueReport : DevExpress.XtraReports.UI.XtraReport { public PosicaoDeEstoqueReport() { InitializeComponent(); Emitente Emit = FuncoesEmitente.GetEmitente(); Endereco End = FuncoesEndereco.GetEndereco(Emit.IDEndereco); UnidadeFederativa UnFed = FuncoesUF.GetUnidadeFederativa(End.IDUnidadeFederativa.Value); Municipio Mun = FuncoesMunicipio.GetMunicipio(End.IDMunicipio.Value); using (var ms = new MemoryStream(Emit.Logomarca)) xrPictureBox1.Image = Image.FromStream(ms); DataTable dt = FuncoesProduto.GetPosicaoEstoque(); dt.TableName = "objectDataSource1"; objectDataSource1.DataSource = dt; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using MediaManager.API.Models; using Microsoft.AspNetCore.Mvc; namespace MediaManager.API.Controllers { /// <summary> /// A controller which /// </summary> public class RootController : Controller { private IUrlHelper urlHelper; public RootController(IUrlHelper urlHelper) { this.urlHelper = urlHelper; } [HttpGet(Name = "GetRoot")] public IActionResult GetRoot([FromHeader(Name = "Accept")] string mediaType) { if(mediaType == "application/vnd.ak.hateoas+json") { var links = new List<LinkDTO>(); return Ok(links); } return NoContent(); } } }
using System; using System.Collections.Generic; using System.IO; using UnityEngine; using XLua; using XLua.LuaDLL; namespace Assets.DebugTest { public class LuaManager : Singleton<LuaManager> { private readonly char[] pathSep = { '#', '.', '@' }; private readonly Dictionary<string, string> luaFilePath = new Dictionary<string, string>(); private LuaEnv luaEnv; private Dictionary<string, string[]> luaSourceFile; private readonly Dictionary<string, LuaTable> staticLuaTable = new Dictionary<string, LuaTable>(); private readonly Dictionary<string, Dictionary<string, LuaFunction>> staticLuaFunc = new Dictionary<string, Dictionary<string, LuaFunction>>(); private LuaFunction includeFunction; private string debugLibPath; private string LuaSourceFolder { get { return Path.GetFullPath("lua"); } } public void Init() { luaEnv = new LuaEnv(); luaEnv.AddLoader(LoadSource); Lua.lua_pushstdcallcfunction(luaEnv.L, Print); if (0 != Lua.xlua_setglobal(luaEnv.L, "print")) { throw new Exception("call xlua_setglobal fail!"); } //object[] results = luaEnv.DoString("return require 'Debug'"); //if (results != null && results.Length > 0 && results[0] is string) //{ // debugLibPath = results[0] as string; // luaEnv.Global.SetInPath("debugMode", true); // luaEnv.AddLoader(LoadDebug); //} luaEnv.DoString("require 'Entry'"); includeFunction = luaEnv.Global.Get<LuaFunction>("include"); } public object[] CallStaticLuaFunc(string clazz, string func, params object[] parameters) { LuaFunction f = GetStaticLuaTable(clazz, func); return f != null ? f.Call(parameters) : null; } private LuaFunction GetStaticLuaTable(string tableName, string func) { if (includeFunction == null) return null; LuaFunction result = null; if (!staticLuaTable.ContainsKey(tableName)) { LuaTable table = includeFunction.Func<string, LuaTable>(tableName); if (table != null) { staticLuaTable[tableName] = table; staticLuaFunc[tableName] = new Dictionary<string, LuaFunction>(); result = table.Get<LuaFunction>(func); if (result != null) { staticLuaFunc[tableName][func] = result; } } } else { var funcs = staticLuaFunc[tableName]; if (funcs.ContainsKey(func)) result = funcs[func]; else { result = staticLuaTable[tableName].Get<LuaFunction>(func); if (result != null) { funcs[func] = result; } } } return result; } private byte[] LoadDebug(ref string filepath) { filepath = Path.Combine(debugLibPath, filepath.Replace(".", "/") + ".lua"); if (filepath != null && File.Exists(filepath)) { return File.ReadAllBytes(filepath); } return null; } private byte[] LoadSource(ref string filepath) { byte[] str = null; string path = luaFilePath.ContainsKey(filepath) ? luaFilePath[filepath] : luaFilePath[filepath] = GetLuaSourceFile(filepath); if (File.Exists(path)) { str = File.ReadAllBytes(path); filepath = path; } else { throw new Exception("Load lua source failed " + filepath); } return str; } private string GetLuaSourceFile(string name) { var first = name[0]; if (first == '#' || first == '@') { int index = name.LastIndexOfAny(pathSep); if (index >= 0) { string filename = name.Substring(index + 1); string fullname = name.Substring(1); string[] files = GetLuaFiles(filename); for (int i = 0; i < files.Length; i++) { if (first == '@' || CheckLuaFileWithNamespace(files[i], fullname, filename)) return files[i]; } } return null; } var pathName = name.Replace('.', '/') + ".lua"; return LuaSourceFolder + "/" + pathName; } private string[] GetLuaFiles(string filename) { if (luaSourceFile == null) { var dict = new Dictionary<string, List<string>>(StringComparer.Ordinal); foreach (var file in Directory.GetFiles(LuaSourceFolder, "*.lua", SearchOption.AllDirectories)) { var name = Path.GetFileNameWithoutExtension(file); if (!dict.ContainsKey(name)) { dict[name] = new List<string>(); } dict[name].Add(file); } luaSourceFile = new Dictionary<string, string[]>(dict.Count, StringComparer.Ordinal); foreach (var item in dict) { luaSourceFile[item.Key] = item.Value.ToArray(); } } return luaSourceFile.ContainsKey(filename) ? luaSourceFile[filename] : new string[0]; } private string GetLuaFileNamespace(string path) { using (var f = File.OpenText(path)) { string line; while ((line = f.ReadLine()) != null) { line = line.Trim(); if (line.StartsWith("namespace", StringComparison.Ordinal)) { line = line.Substring(10).Trim(); line = line.Substring(1, line.Length - 2); return line; } if (line != "" && !line.StartsWith("--", StringComparison.Ordinal)) { return null; } } } return null; } private bool CheckLuaFileWithNamespace(string path, string filename, string fullname) { return GetLuaFileNamespace(path) + "." + filename == fullname; } [MonoPInvokeCallback(typeof(lua_CSFunction))] protected static int Print(IntPtr L) { try { int n = Lua.lua_gettop(L); string s = String.Empty; if (0 != Lua.xlua_getglobal(L, "tostring")) { return Lua.luaL_error(L, "can not get tostring in print:"); } for (int i = 1; i <= n; i++) { Lua.lua_pushvalue(L, -1); /* function to be called */ Lua.lua_pushvalue(L, i); /* value to print */ if (0 != Lua.lua_pcall(L, 1, 1, 0)) { return Lua.lua_error(L); } s += Lua.lua_tostring(L, -1); if (i != n) s += "\t"; Lua.lua_pop(L, 1); /* pop result */ } Debug.Log("LUA_PRINT: " + s); return 0; } catch (Exception e) { return Lua.luaL_error(L, "c# exception in print:" + e); } } } }
using System; using System.Globalization; using System.Windows.Data; using LandscapeBuilderLib; namespace LandscapeBuilderGUI.Converters { class DrawingColorToThermalColor : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { System.Drawing.Color color = (System.Drawing.Color)value; uint uintColor = (uint)((color.A << 24) | (color.R << 16) | (color.G << 8) | (color.B << 0)); ThermalColor thermalColor = (ThermalColor)uintColor; //if(!Enum.IsDefined(typeof(ThermalColor), thermalColor)) //{ // thermalColor = ThermalColor.Custom; //} return thermalColor; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { uint thermalColor = (uint)value; byte a = (byte)(thermalColor >> 24); byte r = (byte)(thermalColor >> 16); byte g = (byte)(thermalColor >> 8); byte b = (byte)(thermalColor >> 0); return System.Drawing.Color.FromArgb(a, r, g, b); } } }
using LuaInterface; using SLua; using System; using UnityEngine; public class Lua_UnityEngine_SliderJoint2D : LuaObject { [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int constructor(IntPtr l) { int result; try { SliderJoint2D o = new SliderJoint2D(); LuaObject.pushValue(l, true); LuaObject.pushValue(l, o); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int GetMotorForce(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); float num; LuaObject.checkType(l, 2, out num); float motorForce = sliderJoint2D.GetMotorForce(num); LuaObject.pushValue(l, true); LuaObject.pushValue(l, motorForce); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_angle(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_angle()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_angle(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); float angle; LuaObject.checkType(l, 2, out angle); sliderJoint2D.set_angle(angle); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_useMotor(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_useMotor()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_useMotor(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); bool useMotor; LuaObject.checkType(l, 2, out useMotor); sliderJoint2D.set_useMotor(useMotor); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_useLimits(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_useLimits()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_useLimits(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); bool useLimits; LuaObject.checkType(l, 2, out useLimits); sliderJoint2D.set_useLimits(useLimits); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_motor(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_motor()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_motor(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); JointMotor2D motor; LuaObject.checkValueType<JointMotor2D>(l, 2, out motor); sliderJoint2D.set_motor(motor); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_limits(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_limits()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int set_limits(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); JointTranslationLimits2D limits; LuaObject.checkValueType<JointTranslationLimits2D>(l, 2, out limits); sliderJoint2D.set_limits(limits); LuaObject.pushValue(l, true); result = 1; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_limitState(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushEnum(l, sliderJoint2D.get_limitState()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_referenceAngle(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_referenceAngle()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_jointTranslation(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_jointTranslation()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } [MonoPInvokeCallback(typeof(LuaCSFunction))] public static int get_jointSpeed(IntPtr l) { int result; try { SliderJoint2D sliderJoint2D = (SliderJoint2D)LuaObject.checkSelf(l); LuaObject.pushValue(l, true); LuaObject.pushValue(l, sliderJoint2D.get_jointSpeed()); result = 2; } catch (Exception e) { result = LuaObject.error(l, e); } return result; } public static void reg(IntPtr l) { LuaObject.getTypeTable(l, "UnityEngine.SliderJoint2D"); LuaObject.addMember(l, new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.GetMotorForce)); LuaObject.addMember(l, "angle", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_angle), new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.set_angle), true); LuaObject.addMember(l, "useMotor", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_useMotor), new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.set_useMotor), true); LuaObject.addMember(l, "useLimits", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_useLimits), new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.set_useLimits), true); LuaObject.addMember(l, "motor", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_motor), new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.set_motor), true); LuaObject.addMember(l, "limits", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_limits), new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.set_limits), true); LuaObject.addMember(l, "limitState", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_limitState), null, true); LuaObject.addMember(l, "referenceAngle", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_referenceAngle), null, true); LuaObject.addMember(l, "jointTranslation", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_jointTranslation), null, true); LuaObject.addMember(l, "jointSpeed", new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.get_jointSpeed), null, true); LuaObject.createTypeMetatable(l, new LuaCSFunction(Lua_UnityEngine_SliderJoint2D.constructor), typeof(SliderJoint2D), typeof(AnchoredJoint2D)); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class ObstacleCube : MonoBehaviour { Transform obstacle; public float minDist, maxDist, initialPosition, speed = 1; float distance; void Start() { distance = maxDist - minDist; } // Update is called once per frame void Update () { transform.position = new Vector3((Mathf.PingPong(Time.time * speed, distance) + initialPosition), transform.position.y, transform.position.z); } }
using Newtonsoft.Json; using System.Collections.ObjectModel; using System.IO; namespace DropLogger { public class JSONDriver { public static string jsonpath = Directory.GetParent("Save").Parent.Parent.FullName + @"\Save\data.json"; public JSONDriver() { } /// <summary> /// Write data to a json file /// </summary> /// <param name="observableCollection"></param> public static void WriteJson(ObservableCollection<ProfileModel> observableCollection) { string jsondata = JsonConvert.SerializeObject(observableCollection); WriteLineDebug.Write(jsondata); File.WriteAllText(jsonpath, jsondata); } /// <summary> /// Read json file /// </summary> public static void ReadJson() { if (!File.Exists(jsonpath)) return; using (StreamReader r = new StreamReader(jsonpath)) { string json = r.ReadToEnd(); ProfileViewModel.ProfileList = JsonConvert.DeserializeObject<ObservableCollection<ProfileModel>>(json); } } /// <summary> /// Get the path of the folder in the app /// </summary> /// <returns></returns> public string GetDataPath() { return Directory.GetParent("Save").Parent.Parent.FullName + @"\Save\"; } } }
using ApplicationCore.Entities; namespace ApplicationCore.Entities.PatientAggregate { public class PayForm { public string FormId{get; set;} public string FormName{get; set;} } }
using UnityEngine; using System.Collections; using System.Collections.Generic; using System; using xy3d.tstd.lib.superTween; namespace xy3d.tstd.lib.battleHeroTools { public class BattleHeroHpBarUnit { private const float hpChangeTime = 1;//血条变化需要时间 public Vector3 pos = new Vector3(); public Vector3 scale = new Vector3(1, 1, 1); public Quaternion rotation = Quaternion.Euler(0, 0, 0); private Matrix4x4 matrix = new Matrix4x4(); private Vector4 posVec = new Vector4(); private Vector4 stateInfoVec = new Vector4(); private Vector4 fixVec = new Vector4(); private float alpha = 0; public float Alpha { get { return alpha; } set { alpha = value; } } private int state; public int State { get { return state; } set { state = value; } } private bool isChange = true; public bool IsChange { get { return isChange; } set { isChange = value; } } public float angerUFix; public float angerXFix; // private float angerNum; public float hpUFix; public float hpXFix; // private float targetHp; private float _hp; private float maxHp; private GameObject go; public BattleHeroHpBarUnit() { } public float Hp { get { return _hp; } set { hpUFix = (value / maxHp - 1) * BattleHeroHpBar.hpBarWidth / BattleHeroHpBar.TEXTURE_WIDTH; hpXFix = (value / maxHp - 1) * BattleHeroHpBar.hpBarWidth; _hp = value; } } public void SetHp(float _targetHp) { // targetHp = _targetHp; SuperTween.Instance.To(Hp, _targetHp, hpChangeTime, UpdateHp, null); } private void UpdateHp(float value) { Hp = value; } public void Init(float _nowhp, float _maxHp, int _nowAnger, GameObject _go) { maxHp = _maxHp; Hp = _nowhp; go = _go; UpdateAnger(_nowAnger); } public Vector4 GetPositionsVec() { if (go != null) { posVec.x = go.transform.position.x; posVec.y = go.transform.position.y + 1.2f; posVec.z = go.transform.position.z; posVec.w = 1; } return posVec; } public Vector4 GetStateInfoVec() { stateInfoVec.x = alpha; stateInfoVec.y = State; return stateInfoVec; } public Matrix4x4 GetMatrix() { if (go != null) { //rotation = Quaternion.Euler(go.transform.eulerAngles.x, go.transform.eulerAngles.y, go.transform.eulerAngles.z); scale.x = go.transform.localScale.x; scale.y = go.transform.localScale.y; scale.z = go.transform.localScale.z; matrix.SetTRS(pos, rotation, scale); } return matrix; } public Vector4 GetFixVec() { if (go != null) { fixVec.x = hpUFix; fixVec.y = hpXFix; fixVec.z = angerUFix; fixVec.w = angerXFix; } return fixVec; } public void resetHp(float _nowHp, float _maxHp) { maxHp = _maxHp; Hp = _nowHp; } public void UpdateAnger(float value) { angerUFix = (value / 10 - 1) * BattleHeroHpBar.angerBarWidth / BattleHeroHpBar.TEXTURE_WIDTH; angerXFix = (value / 10 - 1) * BattleHeroHpBar.angerBarWidth; // angerNum = value; } } }
using System; /// <summary> /// Options for dynamically playing sounds /// </summary> /// <seealso cref="AudioManager"/> [Serializable] public struct AudioOptions { /// <summary> /// Repeat when complete. /// </summary> public bool loop; /// <summary> /// -3, 3. Randomize pitch slightly for variation. /// </summary> public bool pitchShift; /// <summary> /// How much time should this clip should be played for. /// </summary> public float duration; /// <summary> /// Slowly fade out old track to replace with this one. Useful for background music. /// </summary> public float crossfade; /// <summary> /// 0.0 - 1.0 /// </summary> public float volume; /// <summary> /// 1 (high) - 256 (low) /// </summary> public int priority; #region Constructors - nada //nope //public AudioOptions() //{ // loop = false; // pitchShift = true; // volume = 1; // priority = 128; //} //no guarantee this gets called.Don't rely on it. public AudioOptions(bool loop = false, bool pitchShift = true, float volume = 1.0f, int priority = 128, float duration = 1.0f, float crossfade = 0.0f) { this.loop = loop; this.pitchShift = pitchShift; this.priority = priority; this.volume = volume; this.duration = duration; this.crossfade = crossfade; } #endregion public static AudioOptions Default { get => new AudioOptions( loop: false, pitchShift: true, priority: 128, duration: -1, crossfade: 0); } }
/* 08. Write a program that extracts from a given text all sentences containing given word. */ using System; using System.Text; using System.Text.RegularExpressions; class ExtractSentence { static void Main() { StringBuilder sb = new StringBuilder(); string str = "We are living in a yellow submarine. We don't have anything else. Inside the submarine is very tight. So we are drinking all the day. We will move out of it in 5 days."; Console.WriteLine("Enter the word you want your sentences extracted by: "); string extractPattern = Console.ReadLine(); string[] split = str.Split('.'); for (int i = 0; i < split.Length; i++) { split[i] = split[i].TrimStart(); if (Regex.Matches(split[i], @"\b" + extractPattern + @"\b", RegexOptions.IgnoreCase).Count > 0) { sb.Append(split[i]); sb.Append(". "); } } string result = sb.ToString(); Console.WriteLine(result); } }
using FiveOhFirstDataCore.Core.Account; using FiveOhFirstDataCore.Core.Data; using FiveOhFirstDataCore.Core.Data.Roster; using FiveOhFirstDataCore.Core.Structures; using FiveOhFirstDataCore.Core.Structures.Updates; using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Security.Claims; using System.Threading.Tasks; namespace FiveOhFirstDataCore.Core.Services { public interface IRosterService { #region Roster Data public Task<List<Trooper>> GetPlacedRosterAsync(); public Task<List<Trooper>> GetActiveReservesAsync(); public Task<List<Trooper>> GetInactiveReservesAsync(); public Task<List<Trooper>> GetArchivedTroopersAsync(); public Task<List<Trooper>> GetAllTroopersAsync(bool includeAdmin = false); public Task<List<Trooper>> GetFullRosterAsync(); public Task<List<Trooper>> GetUnregisteredTroopersAsync(); public Task<OrbatData> GetOrbatDataAsync(); public Task<ZetaOrbatData> GetZetaOrbatDataAsync(); public Task<(HashSet<int>, HashSet<string>)> GetInUseUserDataAsync(); public Task<Trooper?> GetTrooperFromClaimsPrincipalAsync(ClaimsPrincipal claims); public Task<Trooper?> GetTrooperFromIdAsync(int id); public Task<List<Trooper>> GetDirectSubordinates(Trooper t); #endregion #region Roster Registration public Task<RegisterTrooperResult> RegisterTrooper(NewTrooperData trooperData, ClaimsPrincipal user); #endregion #region Data Updates public Task<Dictionary<CShop, List<ClaimUpdateData>>> GetCShopClaimsAsync(Trooper trooper); public Task<ResultBase> UpdateAsync(Trooper edit, List<ClaimUpdateData> claimsToAdd, List<ClaimUpdateData> claimsToRemove, ClaimsPrincipal submitter); public Task SaveNewFlag(ClaimsPrincipal claim, Trooper trooper, TrooperFlag flag); public Task<ResultBase> UpdateAllowedNameChangersAsync(List<Trooper> allowedTroopers); public Task<ResultBase> UpdateNickNameAsync(Trooper trooper, int approver); public Task<RegisterTrooperResult> ResetAccountAsync(Trooper trooper); #endregion #region Permissions public Task<bool[]> GetC1PermissionsAsync(ClaimsPrincipal claims); public Task<bool[]> GetC3PermissionsAsync(ClaimsPrincipal claims); public Task<bool[]> GetC4PermissionsAsync(ClaimsPrincipal claims); public Task<bool[]> GetC5PermissionsAsync(ClaimsPrincipal claims); public Task<bool[]> GetC6PermissionsAsync(ClaimsPrincipal claims); public Task<bool[]> GetC7PermissionsAsync(ClaimsPrincipal claims); public Task<bool[]> GetC8PermissionsAsync(ClaimsPrincipal claims); /// <summary> /// Checks the premissions of an ID to determine its permission level. /// </summary> /// <param name="id">ID of a Trooper.</param> /// <returns>Two true or false values for if the user is an admin and if they are a manager. Item1 is for Admin, Item2 is for Manager.</returns> public Task<(bool, bool)> GetAdminAndManagerValuesAsync(string id); /// <summary> /// Updates the permissions of an ID to match the admin and manager roles. /// </summary> /// <param name="admin">Is the ID an Admin?</param> /// <param name="manager">Is the ID a Manager?</param> /// <param name="id">The ID representing the Trooper.</param> /// <returns>A Task for this operation.</returns> public Task SaveAdminAndManagerValuesAsync(bool admin, bool manager, string id); /// <summary> /// Gets the Troopers who are allowed to change names. /// </summary> /// <returns>A list of troopers explicitly allowed to change names.</returns> public Task<List<Trooper>> GetAllowedNameChangersAsync(); #endregion #region Data Loading public Task LoadPublicProfileDataAsync(Trooper trooper); #endregion #region Account Management public Task<ResultBase> UpdateUserNameAsync(Trooper trooper); public Task<ResultBase> DeleteAccountAsync(Trooper trooper, string password, ClaimsPrincipal claims); public Task<ResultBase> AddClaimAsync(Trooper trooper, Claim claim, int manager); public Task<ResultBase> RemoveClaimAsync(Trooper trooper, Claim claim, int manager); public Task<List<Claim>> GetAllClaimsFromTrooperAsync(Trooper trooper); #endregion } }
using NCrontab; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace Aix.TimerManage { /// <summary> /// 废弃了,请使用CrontabTask /// </summary> public class CrontabByTimerTask : ITimerTask { public event Func<string, Task> OnException; private System.Threading.Timer Timer = null; private IMyJob Job = null; private CrontabSchedule Schedule = null; private DateTime LastDueTime = DateTime.MinValue; public CrontabByTimerTask(string expression, IMyJob job) { this.Job = job; var options = new CrontabSchedule.ParseOptions { IncludingSeconds = expression.Split(' ').Length > 5, }; Schedule = CrontabSchedule.Parse(expression, options); } public Task Start(MyJobContext context) { if (this.Job == null) return Task.CompletedTask; LastDueTime = DateTime.Now; var dueTime = GetNextDueTime(); this.Timer = new System.Threading.Timer(CallBack, context, dueTime, TimeSpan.Zero); return Task.CompletedTask; } public Task Stop() { if (this.Timer != null) { try { this.Timer.Dispose(); } catch { } } return Task.CompletedTask; } #region private private TimeSpan GetNextDueTime() { var nextOccurrence = Schedule.GetNextOccurrence(LastDueTime); TimeSpan dueTime = nextOccurrence - DateTime.Now; LastDueTime = nextOccurrence; if (dueTime.TotalMilliseconds < 0) { dueTime = TimeSpan.Zero; LastDueTime = DateTime.Now; } return dueTime; } private void CallBack(object state) { Execute(state).Wait(); } private async Task Execute(object state) { MyJobContext context = state as MyJobContext; try { await this.Job.Execute(context); } catch (Exception ex) { string message = string.Format("执行定时任务{0}出错:message={1},StackTrace={2}", this.Job.GetType().FullName, ex.Message, ex.StackTrace); await this.Exception(message); } finally { var dueTime = GetNextDueTime(); this.Timer.Change(dueTime, TimeSpan.Zero); } } private async Task Exception(string message) { if (this.OnException != null) { await this.OnException(message); } } #endregion } }
using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Dapper; using MediatR; using Npgsql; namespace DDDSouthWest.Domain.Features.Account.Admin.ManageNews.ListNews { public class ListAllNews { public class Query : IRequest<Response> { } public class Handler : IRequestHandler<Query, Response> { private readonly ClientConfigurationOptions _options; public Handler(ClientConfigurationOptions options) { _options = options; } public async Task<Response> Handle(Query message, CancellationToken cancellationToken) { using (var connection = new NpgsqlConnection(_options.Database.ConnectionString)) { const string sql = "SELECT Id, Title, Filename, IsLive, DatePosted FROM news WHERE IsDeleted = FALSE ORDER BY DatePosted"; var results = await connection.QueryAsync<NewsListModel>(sql); return new Response { News = results.ToList() }; } } } public class Response { public IList<NewsListModel> News { get; set; } } } }
using System; using System.Linq; namespace _01._MatrixOfPalindromes { class MatrixOfPalindromes { static void Main(string[] args) { int[] colRow = Console.ReadLine().Split().Select(int.Parse).ToArray(); string[,] matrix = new string[colRow[0], colRow[1]]; char[] alphabet = "abcdefghijklmnopqrstuvwxyz".ToCharArray(); for (int row = 0; row < colRow[0]; row++) { int countOfMiddleLetter = row; for (int col = 0; col < colRow[1]; col++) { string str = string.Empty; str += alphabet[row]; str += alphabet[countOfMiddleLetter]; str += alphabet[row]; matrix[row, col] = str; countOfMiddleLetter++; } } for (int i = 0; i < matrix.GetLength(0); i++) { for (int j = 0; j < matrix.GetLength(1); j++) { Console.Write(matrix[i,j] + " "); } Console.WriteLine(); } } } }
using System; using System.Windows.Forms; using System.Diagnostics; using MathNet.Numerics.LinearAlgebra; namespace Supervisoria___tcc { public partial class UCAutonoma : UserControl { public UCAutonoma() { InitializeComponent(); } static int[] vet = new int[] { 12, 12, 12, 12 }; static MLP teste = new MLP(0.3, 0.000001, vet, 6, 12000); private void BotaoDemanda_Click(object sender, EventArgs e) { if (caixaDemanda1.Text != "" && caixaDemanda2.Text != "" && caixaDemanda1.Text != "") { Auxiliar.demandaProdutos[0] = Convert.ToDouble(caixaDemanda1.Text); Auxiliar.demandaProdutos[1] = Convert.ToDouble(caixaDemanda2.Text); Auxiliar.demandaProdutos[2] = Convert.ToDouble(caixaDemanda3.Text); } else { MessageBox.Show("Algum dos campos não foi preenchido corretamente!"); } } private void aplicarRede() { Auxiliar.buscarValoresProducao(); double[] vetorEntrada = new double[6]; for (var index = 0; index < 3; index++) { if (Auxiliar.bitFuncionamento[index] == true) { vetorEntrada[index] = 0; } else { vetorEntrada[index] = 1; } } for (var index = 0; index < 3; index++) { vetorEntrada[index] = Auxiliar.demandaProdutos[index]; } for (var index = 0; index < 3; index++) { vetorEntrada[index + 3] = Auxiliar.qtdProduzidaProdutos[index]; } var retorno = (Matrix<double>)teste.aplicacao(vetorEntrada); Console.WriteLine(retorno); for (var index = 0; index < 6; index++) { if (retorno[index, 0] == 1) { Auxiliar.bitProdutos[index] = true; } else { Auxiliar.bitProdutos[index] = false; } } Auxiliar.enviarBitProdutos(); } private void Botao_Treinamento_Click(object sender, EventArgs e) { var eqm = teste.treinamento(); Console.WriteLine("Erro quadrático médio do treinamento:" + eqm); MessageBox.Show("Terminado o treinamento"); } private void TimerAtualizacao_Tick(object sender, EventArgs e) { aplicarRede(); atualizarProdutos(); AtualizarSimbolos(); Auxiliar.timer--; Auxiliar.gravarHistoricoProducao(); } private void TimerCiclo_Tick(object sender, EventArgs e) { //Timer referente a atualização de um novo ciclo produtivo Auxiliar.reinicializacaoSistema(); pausarTimers(); } public void atualizarProdutos() { for (var index = 0; index < 6; index = index + 2) { if (index == 0) { if (Auxiliar.bitProdutos[index] == false && Auxiliar.bitProdutos[index + 1] == true) { labelProduto1.Text = "1"; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == false) { labelProduto1.Text = "2"; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == true) { labelProduto1.Text = "3"; } else { labelProduto1.Text = "Parado"; } } else if (index == 2) { if (Auxiliar.bitProdutos[index] == false && Auxiliar.bitProdutos[index + 1] == true) { labelProduto2.Text = "1"; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == false) { labelProduto2.Text = "2"; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == true) { labelProduto2.Text = "3"; } else { labelProduto2.Text = "Parado"; } } else if (index == 4) { if (Auxiliar.bitProdutos[index] == false && Auxiliar.bitProdutos[index + 1] == true) { labelProduto3.Text = "1"; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == false) { labelProduto3.Text = "2"; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == true) { labelProduto3.Text = "3"; } else { labelProduto3.Text = "Parado"; } } } } private void Botao_Aplicacao_Click(object sender, EventArgs e) { Console.WriteLine("Demanda:" + Auxiliar.demandaProdutos[0] + ":" + Auxiliar.demandaProdutos[1] + ":" + Auxiliar.demandaProdutos[2]); timerAtualizacao.Enabled = true; timerCiclo.Enabled = true; aplicarRede(); Auxiliar.enviarBitLigar(); } private void pausarTimers() { timerAtualizacao.Enabled = false; timerCiclo.Enabled = false; timerCiclo.Interval = 570000; timerAtualizacao.Interval = 1000; } public void desabilitarTela() { timerAtualizacaoDemanda.Enabled = false; } public void habilitarTela() { timerAtualizacaoDemanda.Enabled = true; } private void TimerAtualizacaoDemanda_Tick(object sender, EventArgs e) { caixaDemanda1.Text = Auxiliar.demandaProdutos[0].ToString(); caixaDemanda2.Text = Auxiliar.demandaProdutos[1].ToString(); caixaDemanda3.Text = Auxiliar.demandaProdutos[2].ToString(); } private void AtualizarSimbolos() { for (var index = 0; index < 6; index = index + 2) { if (index == 0) { if (Auxiliar.bitProdutos[index] == false && Auxiliar.bitProdutos[index + 1] == true) { imagemEsteira1Lenta.BackgroundImage = Properties.Resources.elementoVerde; imagemEsteira1Media.BackgroundImage = Properties.Resources.X; imagemEsteira1Rapida.BackgroundImage = Properties.Resources.elementoCinza; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == false) { imagemEsteira1Lenta.BackgroundImage = Properties.Resources.elementoVerde; imagemEsteira1Media.BackgroundImage = Properties.Resources.elementoAzul; imagemEsteira1Rapida.BackgroundImage = Properties.Resources.X; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == true) { imagemEsteira1Lenta.BackgroundImage = Properties.Resources.X; imagemEsteira1Media.BackgroundImage = Properties.Resources.elementoAzul; imagemEsteira1Rapida.BackgroundImage = Properties.Resources.elementoCinza; } else { imagemEsteira1Lenta.BackgroundImage = Properties.Resources.X; imagemEsteira1Media.BackgroundImage = Properties.Resources.X; imagemEsteira1Rapida.BackgroundImage = Properties.Resources.X; } } else if (index == 2) { if (Auxiliar.bitProdutos[index] == false && Auxiliar.bitProdutos[index + 1] == true) { imagemEsteira2Lenta.BackgroundImage = Properties.Resources.elementoVerde; imagemEsteira2Media.BackgroundImage = Properties.Resources.X; imagemEsteira2Rapida.BackgroundImage = Properties.Resources.elementoCinza; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == false) { imagemEsteira2Lenta.BackgroundImage = Properties.Resources.elementoVerde; imagemEsteira2Media.BackgroundImage = Properties.Resources.elementoAzul; imagemEsteira2Rapida.BackgroundImage = Properties.Resources.X; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == true) { imagemEsteira2Lenta.BackgroundImage = Properties.Resources.X; imagemEsteira2Media.BackgroundImage = Properties.Resources.elementoAzul; imagemEsteira2Rapida.BackgroundImage = Properties.Resources.elementoCinza; } else { imagemEsteira2Lenta.BackgroundImage = Properties.Resources.X; imagemEsteira2Media.BackgroundImage = Properties.Resources.X; imagemEsteira2Rapida.BackgroundImage = Properties.Resources.X; } } else if (index == 4) { if (Auxiliar.bitProdutos[index] == false && Auxiliar.bitProdutos[index + 1] == true) { imagemEsteira3Lenta.BackgroundImage = Properties.Resources.elementoVerde; imagemEsteira3Media.BackgroundImage = Properties.Resources.X; imagemEsteira3Rapida.BackgroundImage = Properties.Resources.elementoCinza; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == false) { imagemEsteira3Lenta.BackgroundImage = Properties.Resources.elementoVerde; imagemEsteira3Media.BackgroundImage = Properties.Resources.elementoAzul; imagemEsteira3Rapida.BackgroundImage = Properties.Resources.X; } else if (Auxiliar.bitProdutos[index] == true && Auxiliar.bitProdutos[index + 1] == true) { imagemEsteira3Lenta.BackgroundImage = Properties.Resources.X; imagemEsteira3Media.BackgroundImage = Properties.Resources.elementoAzul; imagemEsteira3Rapida.BackgroundImage = Properties.Resources.elementoCinza; } else { imagemEsteira3Lenta.BackgroundImage = Properties.Resources.X; imagemEsteira3Media.BackgroundImage = Properties.Resources.X; imagemEsteira3Rapida.BackgroundImage = Properties.Resources.X; } } } } } }
using UnityEngine; using System.Collections; public class MenuScript : MonoBehaviour { public Texture2D backgroundTexture; public const int mainMenuWidth = 200; public Game gameClass; private int menuType = 0; // Use this for initialization void Start () { if (!gameClass) gameClass = GameObject.FindGameObjectWithTag ("GameScript").GetComponent<Game>(); } // Update is called once per frame void Update () { } void OnGUI(){ if (backgroundTexture != null) GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), backgroundTexture); switch (menuType) { case 0: drawNewGameScreen(); break; case 1: drawLevelChooserScreen(); break; case 2: drawSettingsScreen(); break; default: break; } } void drawNewGameScreen(){ GUI.BeginGroup (new Rect (Screen.width / 2 - mainMenuWidth/2, Screen.height - 180, mainMenuWidth, 240)); if(GUI.Button(new Rect(0, 40, mainMenuWidth, 30) , "New Game")){ menuType = 1; } if(GUI.Button(new Rect(0, 80, mainMenuWidth, 30) , "Settings")){ menuType = 2; } if(GUI.Button(new Rect(0, 120, mainMenuWidth, 30) , "Exit")){ Application.Quit(); } GUI.EndGroup(); } void drawLevelChooserScreen(){ } void drawSettingsScreen(){ } }
/*Sorting an array means to arrange its elements in increasing order. * Write a program to sort an array. Use the "selection sort" algorithm: * Find the smallest element, move it at the first position, * find the smallest from the rest, move it at the second position, etc. */ using System; class SelectionSort { static void Main() { Console.Write("Please enter array lenght: "); int ArrayLenght = int.Parse(Console.ReadLine()); int[] Sequence = new int[ArrayLenght]; for (int i = 0; i < Sequence.Length; i++) { Console.Write("Please enter element: " + i + " : "); Sequence[i] = int.Parse(Console.ReadLine()); } for (int i = 0; i < Sequence.Length - 1; i++) { int LowestElement = i; for (int j = i + 1; j < Sequence.Length; j++) { if (Sequence[j] < Sequence[LowestElement]) { LowestElement = j; } } if (LowestElement != i) { int ChangingVariable = 0; ChangingVariable = Sequence[i]; Sequence[i] = Sequence[LowestElement]; Sequence[LowestElement] = ChangingVariable; } } for (int i = 0; i < Sequence.Length; i++) { Console.Write(Sequence[i] + ","); } } }
using System; using System.Collections.Generic; using Xamarin.Forms; namespace Journal { public partial class JournalTabbedView : TabbedPage { public JournalTabbedView() { InitializeComponent(); } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Globalization; using System.Linq; using System.Xml; using System.Reflection; using System.Data.OleDb; namespace Twinfield_NewFramework { public class SharedThreadData { public Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext _textContext { get; set; } public Dictionary<string, string> threadInputData { get; set; } public int virtualId { get; set; } public bool FirstTimeLogin; public string BuildVersion { get; set; } public string UserName { get; set; } public string Password { get; set; } public string Tenant { get; set; } public string CreatedDate { get; set; } public string hasFullAccess { get; set; } public string CustomerName { get; set; } public string SessionId { get; set; } public string OrganizationId { get; set; } public string BNES_SID { get; set; } public string CompanyName { get; set; } public string ScenarioPrefix { get; set; } //TWO Specific public SharedThreadData(int virtualId,Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext objWebTestContext) { this.virtualId = virtualId; this._textContext = objWebTestContext; } } public class CustomDS { #region Variable Declaration private static readonly CustomDS m_instance = new CustomDS(); private static readonly object m_Padlock_AllTenantInputData = new object(); private DataSet m_datasource_AllTenantInputData = null; private bool m_initialized_AllTenantInputData = false; private DataTable m_dataTable_AllTenantInputData; private static readonly object m_Padlock_CreateInvoice = new object(); private DataSet m_datasource_CreateInvoice = null; private bool m_initialized_CreateInvoice = false; private DataTable m_dataTable_CreateInvoice; private int m_nextPosition_CreateInvoice = 0; private DataTable m_dataTableCreateInvoicetemp = null; public bool Initialized_CreateInvoice { get { return m_initialized_CreateInvoice; } } private static readonly object m_Padlock_ExtendedTBReport = new object(); private DataSet m_datasource_ExtendedTBReport = null; private bool m_initialized_ExtendedTBReport = false; private DataTable m_dataTable_ExtendedTBReport; private int m_nextPosition_ExtendedTBReport = 0; private DataTable m_dataTableExtendedTBReporttemp = null; public bool Initialized_ExtendedTBReport { get { return m_initialized_ExtendedTBReport; } } private static readonly object m_Padlock_NeoFixedAsset = new object(); private DataSet m_datasource_NeoFixedAsset = null; private bool m_initialized_NeoFixedAsset = false; private DataTable m_dataTable_NeoFixedAsset; private int m_nextPosition_NeoFixedAsset = 0; private DataTable m_dataTableNeoFixedAssettemp = null; public bool Initialized_NeoFixedAsset { get { return m_initialized_NeoFixedAsset; } } private static readonly object m_Padlock_NeoSalesInvoices = new object(); private DataSet m_datasource_NeoSalesInvoices = null; private bool m_initialized_NeoSalesInvoices = false; private DataTable m_dataTable_NeoSalesInvoices; private int m_nextPosition_NeoSalesInvoices = 0; private DataTable m_dataTableNeoSalesInvoicestemp = null; public bool Initialized_NeoSalesInvoices { get { return m_initialized_NeoSalesInvoices; } } private static readonly object m_Padlock_ClassicSalesInvoices = new object(); private DataSet m_datasource_ClassicSalesInvoices = null; private bool m_initialized_ClassicSalesInvoices = false; private DataTable m_dataTable_ClassicSalesInvoices; private int m_nextPosition_ClassicSalesInvoices = 0; private DataTable m_dataTableClassicSalesInvoicestemp = null; public bool Initialized_ClassicSalesInvoices { get { return m_initialized_ClassicSalesInvoices; } } private static readonly object m_Padlock_CreateTransaction = new object(); private DataSet m_datasource_CreateTransaction = null; private bool m_initialized_CreateTransaction = false; private DataTable m_dataTable_CreateTransaction; private int m_nextPosition_CreateTransaction = 0; private DataTable m_dataTableCreateTransactiontemp = null; public bool Initialized_CreateTransaction { get { return m_initialized_CreateTransaction; } } private static readonly object m_Padlock_ReadTransaction = new object(); private DataSet m_datasource_ReadTransaction = null; private bool m_initialized_ReadTransaction = false; private DataTable m_dataTable_ReadTransaction; private int m_nextPosition_ReadTransaction = 0; private DataTable m_dataTableReadTransactiontemp = null; public bool Initialized_ReadTransaction { get { return m_initialized_ReadTransaction; } } private static readonly object m_Padlock_CompanySettings = new object(); private DataSet m_datasource_CompanySettings = null; private bool m_initialized_CompanySettings = false; private DataTable m_dataTable_CompanySettings; private int m_nextPosition_CompanySettings = 0; private DataTable m_dataTableCompanySettingstemp = null; public bool Initialized_CompanySettings { get { return m_initialized_CompanySettings; } } private static readonly object m_Padlock_UserAccessSettings = new object(); private DataSet m_datasource_UserAccessSettings = null; private bool m_initialized_UserAccessSettings = false; private DataTable m_dataTable_UserAccessSettings; private int m_nextPosition_UserAccessSettings = 0; private DataTable m_dataTableUserAccessSettingstemp = null; public bool Initialized_UserAccessSettings { get { return m_initialized_UserAccessSettings; } } private static readonly object m_Padlock_DocumentManagement = new object(); private DataSet m_datasource_DocumentManagement = null; private bool m_initialized_DocumentManagement = false; private DataTable m_dataTable_DocumentManagement; private int m_nextPosition_DocumentManagement = 0; private DataTable m_dataTableDocumentManagementtemp = null; public bool Initialized_DocumentManagement { get { return m_initialized_DocumentManagement; } } private static readonly object m_Padlock_PayAndCollectRun = new object(); private DataSet m_datasource_PayAndCollectRun = null; private bool m_initialized_PayAndCollectRun = false; private DataTable m_dataTable_PayAndCollectRun; private int m_nextPosition_PayAndCollectRun = 0; private DataTable m_dataTablePayAndCollectRuntemp = null; public bool Initialized_PayAndCollectRun { get { return m_initialized_PayAndCollectRun; } } private static readonly object m_Padlock_ExportCustomers = new object(); private DataSet m_datasource_ExportCustomers = null; private bool m_initialized_ExportCustomers = false; private DataTable m_dataTable_ExportCustomers; private int m_nextPosition_ExportCustomers = 0; private DataTable m_dataTableExportCustomerstemp = null; public bool Initialized_ExportCustomers { get { return m_initialized_ExportCustomers; } } private static readonly object m_Padlock_EditInvoice = new object(); private DataSet m_datasource_EditInvoice = null; private bool m_initialized_EditInvoice = false; private DataTable m_dataTable_EditInvoice; private int m_nextPosition_EditInvoice = 0; private DataTable m_dataTableEditInvoicetemp = null; public bool Initialized_EditInvoice { get { return m_initialized_EditInvoice; } } //private static readonly object m_Padlock_CompanySettings = new object(); //private DataSet m_datasource_CompanySettings = null; //private bool m_initialized_CompanySettings = false; //private DataTable m_dataTable_CompanySettings; //private int m_nextPosition_CompanySettings = 0; //private DataTable m_dataTableCompanySettingstemp = null; //public bool Initialized_CompanySettings //{ // get { return m_initialized_CompanySettings; } //} public bool Initialized_AllTenantInputData { get { return m_initialized_AllTenantInputData; } } public static CustomDS Instance { get { return m_instance; } } #endregion #region InitializeWeb public void InitializeWeb(string connectionString, Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext utc) { double maxUserCount = 200000; try { //Single State Create Return with UserData Input Data SqlDataAdapter sqlDataAdapter = null; lock (m_Padlock_AllTenantInputData) { if (m_datasource_AllTenantInputData == null && Initialized_AllTenantInputData == false) { string AllTenantInputData = GetsqlSelectStatement(utc, AssemblyLoad.objTableType.AllTenantInputTable, maxUserCount); Logger.WriteGeneralLog("Sql statement " + AllTenantInputData); //load the data and create adapter sqlDataAdapter = new SqlDataAdapter(AllTenantInputData, connectionString); //create the dataset m_datasource_AllTenantInputData = new DataSet(); m_datasource_AllTenantInputData.Locale = CultureInfo.CurrentCulture; //load the data sqlDataAdapter.Fill(m_datasource_AllTenantInputData); m_dataTable_AllTenantInputData = m_datasource_AllTenantInputData.Tables[0]; } m_initialized_AllTenantInputData = true; } #region Commented // lock (m_Padlock_CreateInvoice) //{ // if (m_datasource_CreateInvoice == null && Initialized_CreateInvoice == false) // { // string CreateInvoice = GetsqlSelectStatement(utc, AssemblyLoad.objTableType.AllTenantInputTable, maxUserCount); // Logger.WriteGeneralLog("Sql statement " + CreateInvoice); // //load the data and create adapter // sqlDataAdapter = new SqlDataAdapter(CreateInvoice, connectionString); // //create the dataset // m_datasource_CreateInvoice = new DataSet(); // m_datasource_CreateInvoice.Locale = CultureInfo.CurrentCulture; // //load the data // sqlDataAdapter.Fill(m_datasource_CreateInvoice); // m_dataTable_CreateInvoice = m_datasource_CreateInvoice.Tables[0]; // } // m_initialized_CreateInvoice = true; //} // #endregion CreateInvoice User Data // #region EditInvoice User Data // sqlDataAdapter = null; // lock (m_Padlock_EditInvoice) // { // if (m_datasource_EditInvoice == null && Initialized_EditInvoice == false) // { // string EditInvoice = GetsqlSelectStatement(utc, AssemblyLoad.objTableType.AllTenantInputTable, maxUserCount); // Logger.WriteGeneralLog("Sql statement " + EditInvoice); // //load the data and create adapter // sqlDataAdapter = new SqlDataAdapter(EditInvoice, connectionString); // //create the dataset // m_datasource_EditInvoice = new DataSet(); // m_datasource_EditInvoice.Locale = CultureInfo.CurrentCulture; // //load the data // sqlDataAdapter.Fill(m_datasource_EditInvoice); // m_dataTable_EditInvoice = m_datasource_EditInvoice.Tables[0]; // } // m_initialized_EditInvoice = true; // } // #endregion EditInvoice User Data #endregion DataView DVTemp = m_dataTable_AllTenantInputData.DefaultView; DVTemp.RowFilter = "ScenarioName = 'CreateInvoice' and DataSet in (" + AssemblyLoad.DataSetToUse_CreateInvoice + ")"; DVTemp.Sort= "Thread " + AssemblyLoad.InputSetOrder_CreateInvoice; m_dataTable_CreateInvoice = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'EditInvoice' and DataSet in (" + AssemblyLoad.DataSetToUse_EditInvoice + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_EditInvoice; m_dataTable_EditInvoice = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'CompanySettings' and DataSet in (" + AssemblyLoad.DataSetToUse_CompanySettings + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_CompanySettings; m_dataTable_CompanySettings = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'ExtendedTBReport' and DataSet in (" + AssemblyLoad.DataSetToUse_ExtendedTBReport + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_ExtendedTBReport; m_dataTable_ExtendedTBReport = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'NeoFixedAsset' and DataSet in (" + AssemblyLoad.DataSetToUse_NeoFixedAsset + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_NeoFixedAsset; m_dataTable_NeoFixedAsset = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'NeoSalesInvoices' and DataSet in (" + AssemblyLoad.DataSetToUse_NeoSalesInvoices + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_NeoSalesInvoices; m_dataTable_NeoSalesInvoices = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'ClassicSalesInvoices' and DataSet in (" + AssemblyLoad.DataSetToUse_ClassicSalesInvoices + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_ClassicSalesInvoices; m_dataTable_ClassicSalesInvoices = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'CreateTransaction' and DataSet in (" + AssemblyLoad.DataSetToUse_CreateTransaction + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_CreateTransaction; m_dataTable_CreateTransaction = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'ReadTransaction' and DataSet in (" + AssemblyLoad.DataSetToUse_ReadTransaction + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_ReadTransaction; m_dataTable_ReadTransaction = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'UserAccessSettings' and DataSet in (" + AssemblyLoad.DataSetToUse_UserAccessSettings + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_UserAccessSettings; m_dataTable_UserAccessSettings = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'DocumentManagement' and DataSet in (" + AssemblyLoad.DataSetToUse_DocumentManagement + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_DocumentManagement; m_dataTable_DocumentManagement = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'PayAndCollectRun' and DataSet in (" + AssemblyLoad.DataSetToUse_PayAndCollectRun + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_PayAndCollectRun; m_dataTable_PayAndCollectRun = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; DVTemp.RowFilter = "ScenarioName = 'ExportCustomers' and DataSet in (" + AssemblyLoad.DataSetToUse_ExportCustomers + ")"; DVTemp.Sort = "Thread " + AssemblyLoad.InputSetOrder_ExportCustomers; m_dataTable_ExportCustomers = DVTemp.ToTable(); DVTemp.RowFilter = "1=1"; } catch (Exception ex) { Logger.WriteGeneralLog("Error in Getting data from IPO input table : " + ex.Message); throw new Exception("Error in Getting data from IPO input table : " + ex.Message); } } private string GetsqlSelectStatement(Microsoft.VisualStudio.TestTools.WebTesting.WebTestContext utc, string tablename, double maxUserCount) { double tempCount = Math.Round(maxUserCount); if (AssemblyLoad.agentCount > 1) { AssemblyLoad.sAgentId = "Agent " + Convert.ToString(1 + (utc.AgentId)); Logger.WriteGeneralLog("Debug : " + AssemblyLoad.controllerName.ToString() + " env name" + Environment.MachineName.ToString() + "Scenario : "+ utc["ScenarioName"].ToString()); //return "select top " + tempCount + " * from " + tablename + " with(nolock) WHERE [" + AssemblyLoad.controllerName + "] = '" + Environment.MachineName + "' and IsActive = 1" string SqlQuery = ""; if (tablename.Contains("_InputData")) { SqlQuery = "select top " + tempCount + " * from " + tablename + " with(nolock) Where Used = 0 and [" + AssemblyLoad.controllerName + "] = '" + Environment.MachineName + "'"; SqlQuery="select * from " + tablename + " with(nolock) WHERE [" + /*theController*/AssemblyLoad.controllerName + "] = '" + Convert.ToInt32(utc.AgentId) + "'"; } else { SqlQuery = "select top " + tempCount + " * from " + tablename + " with(nolock) Where [" + AssemblyLoad.controllerName + "] = '" + Environment.MachineName + "'"; } return SqlQuery; } AssemblyLoad.sAgentId = "Agent - Local"; if(tablename.Contains("_InputData") ) return "select top " + tempCount + " * from " + tablename + " with(nolock) Where Used = 0"; else return "select top " + tempCount + " * from " + tablename; } #endregion public Dictionary<String, String> GetNextRowTwinfield(TwinfieldDBTenant DBTenant, TwinfieldScenarioName scenarioName) { DataView dvt=new DataView(); switch (scenarioName) { #region CreateInvoice //start case TwinfieldScenarioName.CreateInvoice: if (m_dataTable_CreateInvoice != null) { //lock the thread lock (m_Padlock_CreateInvoice) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch(DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_CreateInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableCreateInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_CreateInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableCreateInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_CreateInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableCreateInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_CreateInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableCreateInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_CreateInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableCreateInvoicetemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_CreateInvoice == m_dataTableCreateInvoicetemp.Rows.Count) { m_nextPosition_CreateInvoice = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableCreateInvoicetemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableCreateInvoicetemp.Rows[m_nextPosition_CreateInvoice][c].ToString()); } m_nextPosition_CreateInvoice++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableCreateInvoicetemp = m_dataTable_CreateInvoice; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_CreateInvoice == m_dataTableCreateInvoicetemp.Rows.Count) // { // m_nextPosition_CreateInvoice = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableCreateInvoicetemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableCreateInvoicetemp.Rows[m_nextPosition_CreateInvoice][c].ToString()); // } // m_nextPosition_CreateInvoice++; // // break; //} return dictionary; } } break; #endregion CreateInvoice #region CompanySettings //start case TwinfieldScenarioName.CompanySettings: if (m_dataTable_CompanySettings != null) { //lock the thread lock (m_Padlock_CompanySettings) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_CompanySettings.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableCompanySettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_CompanySettings.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableCompanySettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_CompanySettings.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableCompanySettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_CompanySettings.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableCompanySettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_CompanySettings.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableCompanySettingstemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_CompanySettings == m_dataTableCompanySettingstemp.Rows.Count) { m_nextPosition_CompanySettings = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableCompanySettingstemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableCompanySettingstemp.Rows[m_nextPosition_CompanySettings][c].ToString()); } m_nextPosition_CompanySettings++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableCompanySettingstemp = m_dataTable_CompanySettings; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_CompanySettings == m_dataTableCompanySettingstemp.Rows.Count) // { // m_nextPosition_CompanySettings = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableCompanySettingstemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableCompanySettingstemp.Rows[m_nextPosition_CompanySettings][c].ToString()); // } // m_nextPosition_CompanySettings++; // // break; //} return dictionary; } } break; #endregion CompanySettings #region EditInvoice //start case TwinfieldScenarioName.EditInvoice: if (m_dataTable_EditInvoice != null) { //lock the thread lock (m_Padlock_EditInvoice) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_EditInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'A'"; m_dataTableEditInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_EditInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableEditInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_EditInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableEditInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_EditInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableEditInvoicetemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_EditInvoice.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableEditInvoicetemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_EditInvoice == m_dataTableEditInvoicetemp.Rows.Count) { m_nextPosition_EditInvoice = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableEditInvoicetemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableEditInvoicetemp.Rows[m_nextPosition_EditInvoice][c].ToString()); } m_nextPosition_EditInvoice++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableEditInvoicetemp = m_dataTable_EditInvoice; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_EditInvoice == m_dataTableEditInvoicetemp.Rows.Count) // { // m_nextPosition_EditInvoice = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableEditInvoicetemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableEditInvoicetemp.Rows[m_nextPosition_EditInvoice][c].ToString()); // } // m_nextPosition_EditInvoice++; // // break; //} return dictionary; } } break; #endregion EditInvoice #region ExtendedTBReport //start case TwinfieldScenarioName.ExtendedTBReport: if (m_dataTable_ExtendedTBReport != null) { //lock the thread lock (m_Padlock_ExtendedTBReport) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_ExtendedTBReport.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableExtendedTBReporttemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_ExtendedTBReport.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableExtendedTBReporttemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_ExtendedTBReport.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableExtendedTBReporttemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_ExtendedTBReport.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableExtendedTBReporttemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_ExtendedTBReport.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableExtendedTBReporttemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_ExtendedTBReport == m_dataTableExtendedTBReporttemp.Rows.Count) { m_nextPosition_ExtendedTBReport = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableExtendedTBReporttemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableExtendedTBReporttemp.Rows[m_nextPosition_ExtendedTBReport][c].ToString()); } m_nextPosition_ExtendedTBReport++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableExtendedTBReporttemp = m_dataTable_ExtendedTBReport; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_ExtendedTBReport == m_dataTableExtendedTBReporttemp.Rows.Count) // { // m_nextPosition_ExtendedTBReport = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableExtendedTBReporttemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableExtendedTBReporttemp.Rows[m_nextPosition_ExtendedTBReport][c].ToString()); // } // m_nextPosition_ExtendedTBReport++; // // break; //} return dictionary; } } break; #endregion ExtendedTBReport #region NeoFixedAsset //start case TwinfieldScenarioName.NeoFixedAsset: if (m_dataTable_NeoFixedAsset != null) { //lock the thread lock (m_Padlock_NeoFixedAsset) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_NeoFixedAsset.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableNeoFixedAssettemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_NeoFixedAsset.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableNeoFixedAssettemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_NeoFixedAsset.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableNeoFixedAssettemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_NeoFixedAsset.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableNeoFixedAssettemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_NeoFixedAsset.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableNeoFixedAssettemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_NeoFixedAsset == m_dataTableNeoFixedAssettemp.Rows.Count) { m_nextPosition_NeoFixedAsset = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableNeoFixedAssettemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableNeoFixedAssettemp.Rows[m_nextPosition_NeoFixedAsset][c].ToString()); } m_nextPosition_NeoFixedAsset++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableNeoFixedAssettemp = m_dataTable_NeoFixedAsset; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_NeoFixedAsset == m_dataTableNeoFixedAssettemp.Rows.Count) // { // m_nextPosition_NeoFixedAsset = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableNeoFixedAssettemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableNeoFixedAssettemp.Rows[m_nextPosition_NeoFixedAsset][c].ToString()); // } // m_nextPosition_NeoFixedAsset++; // // break; //} return dictionary; } } break; #endregion NeoFixedAsset #region NeoSalesInvoices //start case TwinfieldScenarioName.NeoSalesInvoices: if (m_dataTable_NeoSalesInvoices != null) { //lock the thread lock (m_Padlock_NeoSalesInvoices) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_NeoSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableNeoSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_NeoSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableNeoSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_NeoSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableNeoSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_NeoSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableNeoSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_NeoSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableNeoSalesInvoicestemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_NeoSalesInvoices == m_dataTableNeoSalesInvoicestemp.Rows.Count) { m_nextPosition_NeoSalesInvoices = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableNeoSalesInvoicestemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableNeoSalesInvoicestemp.Rows[m_nextPosition_NeoSalesInvoices][c].ToString()); } m_nextPosition_NeoSalesInvoices++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableNeoSalesInvoicestemp = m_dataTable_NeoSalesInvoices; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_NeoSalesInvoices == m_dataTableNeoSalesInvoicestemp.Rows.Count) // { // m_nextPosition_NeoSalesInvoices = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableNeoSalesInvoicestemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableNeoSalesInvoicestemp.Rows[m_nextPosition_NeoSalesInvoices][c].ToString()); // } // m_nextPosition_NeoSalesInvoices++; // // break; //} return dictionary; } } break; #endregion NeoSalesInvoices #region ClassicSalesInvoices //start case TwinfieldScenarioName.ClassicSalesInvoices: if (m_dataTable_ClassicSalesInvoices != null) { //lock the thread lock (m_Padlock_ClassicSalesInvoices) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_ClassicSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableClassicSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_ClassicSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableClassicSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_ClassicSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableClassicSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_ClassicSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableClassicSalesInvoicestemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_ClassicSalesInvoices.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableClassicSalesInvoicestemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_ClassicSalesInvoices == m_dataTableClassicSalesInvoicestemp.Rows.Count) { m_nextPosition_ClassicSalesInvoices = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableClassicSalesInvoicestemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableClassicSalesInvoicestemp.Rows[m_nextPosition_ClassicSalesInvoices][c].ToString()); } m_nextPosition_ClassicSalesInvoices++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableClassicSalesInvoicestemp = m_dataTable_ClassicSalesInvoices; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_ClassicSalesInvoices == m_dataTableClassicSalesInvoicestemp.Rows.Count) // { // m_nextPosition_ClassicSalesInvoices = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableClassicSalesInvoicestemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableClassicSalesInvoicestemp.Rows[m_nextPosition_ClassicSalesInvoices][c].ToString()); // } // m_nextPosition_ClassicSalesInvoices++; // // break; //} return dictionary; } } break; #endregion ClassicSalesInvoices #region CreateTransaction //start case TwinfieldScenarioName.CreateTransaction: if (m_dataTable_CreateTransaction != null) { //lock the thread lock (m_Padlock_CreateTransaction) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_CreateTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableCreateTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_CreateTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableCreateTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_CreateTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableCreateTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_CreateTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableCreateTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_CreateTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableCreateTransactiontemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_CreateTransaction == m_dataTableCreateTransactiontemp.Rows.Count) { m_nextPosition_CreateTransaction = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableCreateTransactiontemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableCreateTransactiontemp.Rows[m_nextPosition_CreateTransaction][c].ToString()); } m_nextPosition_CreateTransaction++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableCreateTransactiontemp = m_dataTable_CreateTransaction; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_CreateTransaction == m_dataTableCreateTransactiontemp.Rows.Count) // { // m_nextPosition_CreateTransaction = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableCreateTransactiontemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableCreateTransactiontemp.Rows[m_nextPosition_CreateTransaction][c].ToString()); // } // m_nextPosition_CreateTransaction++; // // break; //} return dictionary; } } break; #endregion CreateTransaction #region ReadTransaction //start case TwinfieldScenarioName.ReadTransaction: if (m_dataTable_ReadTransaction != null) { //lock the thread lock (m_Padlock_ReadTransaction) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_ReadTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableReadTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_ReadTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableReadTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_ReadTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableReadTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_ReadTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableReadTransactiontemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_ReadTransaction.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableReadTransactiontemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_ReadTransaction == m_dataTableReadTransactiontemp.Rows.Count) { m_nextPosition_ReadTransaction = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableReadTransactiontemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableReadTransactiontemp.Rows[m_nextPosition_ReadTransaction][c].ToString()); } m_nextPosition_ReadTransaction++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableReadTransactiontemp = m_dataTable_ReadTransaction; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_ReadTransaction == m_dataTableReadTransactiontemp.Rows.Count) // { // m_nextPosition_ReadTransaction = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableReadTransactiontemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableReadTransactiontemp.Rows[m_nextPosition_ReadTransaction][c].ToString()); // } // m_nextPosition_ReadTransaction++; // // break; //} return dictionary; } } break; #endregion ReadTransaction #region UserAccessSettings //start case TwinfieldScenarioName.UserAccessSettings: if (m_dataTable_UserAccessSettings != null) { //lock the thread lock (m_Padlock_UserAccessSettings) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_UserAccessSettings.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableUserAccessSettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_UserAccessSettings.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableUserAccessSettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_UserAccessSettings.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableUserAccessSettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_UserAccessSettings.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableUserAccessSettingstemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_UserAccessSettings.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableUserAccessSettingstemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_UserAccessSettings == m_dataTableUserAccessSettingstemp.Rows.Count) { m_nextPosition_UserAccessSettings = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableUserAccessSettingstemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableUserAccessSettingstemp.Rows[m_nextPosition_UserAccessSettings][c].ToString()); } m_nextPosition_UserAccessSettings++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableUserAccessSettingstemp = m_dataTable_UserAccessSettings; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_UserAccessSettings == m_dataTableUserAccessSettingstemp.Rows.Count) // { // m_nextPosition_UserAccessSettings = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableUserAccessSettingstemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableUserAccessSettingstemp.Rows[m_nextPosition_UserAccessSettings][c].ToString()); // } // m_nextPosition_UserAccessSettings++; // // break; //} return dictionary; } } break; #endregion UserAccessSettings #region DocumentManagement //start case TwinfieldScenarioName.DocumentManagement: if (m_dataTable_DocumentManagement != null) { //lock the thread lock (m_Padlock_DocumentManagement) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_DocumentManagement.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableDocumentManagementtemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_DocumentManagement.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableDocumentManagementtemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_DocumentManagement.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableDocumentManagementtemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_DocumentManagement.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableDocumentManagementtemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_DocumentManagement.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableDocumentManagementtemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_DocumentManagement == m_dataTableDocumentManagementtemp.Rows.Count) { m_nextPosition_DocumentManagement = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableDocumentManagementtemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableDocumentManagementtemp.Rows[m_nextPosition_DocumentManagement][c].ToString()); } m_nextPosition_DocumentManagement++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableDocumentManagementtemp = m_dataTable_DocumentManagement; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_DocumentManagement == m_dataTableDocumentManagementtemp.Rows.Count) // { // m_nextPosition_DocumentManagement = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableDocumentManagementtemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableDocumentManagementtemp.Rows[m_nextPosition_DocumentManagement][c].ToString()); // } // m_nextPosition_DocumentManagement++; // // break; //} return dictionary; } } break; #endregion DocumentManagement #region PayAndCollectRun //start case TwinfieldScenarioName.PayAndCollectRun: if (m_dataTable_PayAndCollectRun != null) { //lock the thread lock (m_Padlock_PayAndCollectRun) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_PayAndCollectRun.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-nl'"; m_dataTablePayAndCollectRuntemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_PayAndCollectRun.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTablePayAndCollectRuntemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_PayAndCollectRun.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTablePayAndCollectRuntemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_PayAndCollectRun.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTablePayAndCollectRuntemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_PayAndCollectRun.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTablePayAndCollectRuntemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_PayAndCollectRun == m_dataTablePayAndCollectRuntemp.Rows.Count) { m_nextPosition_PayAndCollectRun = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTablePayAndCollectRuntemp.Columns) { dictionary.Add(c.ColumnName, m_dataTablePayAndCollectRuntemp.Rows[m_nextPosition_PayAndCollectRun][c].ToString()); } m_nextPosition_PayAndCollectRun++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTablePayAndCollectRuntemp = m_dataTable_PayAndCollectRun; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_PayAndCollectRun == m_dataTablePayAndCollectRuntemp.Rows.Count) // { // m_nextPosition_PayAndCollectRun = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTablePayAndCollectRuntemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTablePayAndCollectRuntemp.Rows[m_nextPosition_PayAndCollectRun][c].ToString()); // } // m_nextPosition_PayAndCollectRun++; // // break; //} return dictionary; } } break; #endregion PayAndCollectRun #region ExportCustomers //start case TwinfieldScenarioName.ExportCustomers: if (m_dataTable_ExportCustomers != null) { //lock the thread lock (m_Padlock_ExportCustomers) { //create an object to hold the name value pairs Dictionary<String, String> dictionary = new Dictionary<string, string>(); switch (DBTenant) { case TwinfieldDBTenant.A: dvt = m_dataTable_ExportCustomers.DefaultView; dvt.RowFilter = "DBTenant = 'azure-test-perf'"; m_dataTableExportCustomerstemp = dvt.ToTable(); break; case TwinfieldDBTenant.B: dvt = m_dataTable_ExportCustomers.DefaultView; dvt.RowFilter = "DBTenant = 'B'"; m_dataTableExportCustomerstemp = dvt.ToTable(); break; case TwinfieldDBTenant.C: dvt = m_dataTable_ExportCustomers.DefaultView; dvt.RowFilter = "DBTenant = 'C'"; m_dataTableExportCustomerstemp = dvt.ToTable(); break; case TwinfieldDBTenant.D: dvt = m_dataTable_ExportCustomers.DefaultView; dvt.RowFilter = "DBTenant = 'D'"; m_dataTableExportCustomerstemp = dvt.ToTable(); break; case TwinfieldDBTenant.E: dvt = m_dataTable_ExportCustomers.DefaultView; dvt.RowFilter = "DBTenant = 'E'"; m_dataTableExportCustomerstemp = dvt.ToTable(); break; } //if you have reached the end of the cursor, loop back around to the beginning if (m_nextPosition_ExportCustomers == m_dataTableExportCustomerstemp.Rows.Count) { m_nextPosition_ExportCustomers = 0; } //add each column to the dictionary foreach (DataColumn c in m_dataTableExportCustomerstemp.Columns) { dictionary.Add(c.ColumnName, m_dataTableExportCustomerstemp.Rows[m_nextPosition_ExportCustomers][c].ToString()); } m_nextPosition_ExportCustomers++; ////switch (scenarioName) //{ // //case TWOScenarioName.FilterReturnGridView: // m_dataTableExportCustomerstemp = m_dataTable_ExportCustomers; // //if you have reached the end of the cursor, loop back around to the beginning // if (m_nextPosition_ExportCustomers == m_dataTableExportCustomerstemp.Rows.Count) // { // m_nextPosition_ExportCustomers = 0; // } // //add each column to the dictionary // foreach (DataColumn c in m_dataTableExportCustomerstemp.Columns) // { // dictionary.Add(c.ColumnName, m_dataTableExportCustomerstemp.Rows[m_nextPosition_ExportCustomers][c].ToString()); // } // m_nextPosition_ExportCustomers++; // // break; //} return dictionary; } } break; #endregion ExportCustomers } return null; } #region ReducedLogin #region Dictionary and Lock Declaration for each scenario private static readonly object CreateInvoice_A_Lock = new object(); private static readonly object CreateInvoice_B_Lock = new object(); private static readonly object CreateInvoice_C_Lock = new object(); private static readonly object CreateInvoice_D_Lock = new object(); private static readonly object CreateInvoice_E_Lock = new object(); private static Dictionary<int, SharedThreadData> CreateInvoice_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateInvoice_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateInvoice_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateInvoice_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateInvoice_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object CompanySettings_A_Lock = new object(); private static readonly object CompanySettings_B_Lock = new object(); private static readonly object CompanySettings_C_Lock = new object(); private static readonly object CompanySettings_D_Lock = new object(); private static readonly object CompanySettings_E_Lock = new object(); private static Dictionary<int, SharedThreadData> CompanySettings_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CompanySettings_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CompanySettings_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CompanySettings_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CompanySettings_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object ExtendedTBReport_A_Lock = new object(); private static readonly object ExtendedTBReport_B_Lock = new object(); private static readonly object ExtendedTBReport_C_Lock = new object(); private static readonly object ExtendedTBReport_D_Lock = new object(); private static readonly object ExtendedTBReport_E_Lock = new object(); private static Dictionary<int, SharedThreadData> ExtendedTBReport_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExtendedTBReport_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExtendedTBReport_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExtendedTBReport_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExtendedTBReport_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object NeoFixedAsset_A_Lock = new object(); private static readonly object NeoFixedAsset_B_Lock = new object(); private static readonly object NeoFixedAsset_C_Lock = new object(); private static readonly object NeoFixedAsset_D_Lock = new object(); private static readonly object NeoFixedAsset_E_Lock = new object(); private static Dictionary<int, SharedThreadData> NeoFixedAsset_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoFixedAsset_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoFixedAsset_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoFixedAsset_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoFixedAsset_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object NeoSalesInvoices_A_Lock = new object(); private static readonly object NeoSalesInvoices_B_Lock = new object(); private static readonly object NeoSalesInvoices_C_Lock = new object(); private static readonly object NeoSalesInvoices_D_Lock = new object(); private static readonly object NeoSalesInvoices_E_Lock = new object(); private static Dictionary<int, SharedThreadData> NeoSalesInvoices_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoSalesInvoices_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoSalesInvoices_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoSalesInvoices_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> NeoSalesInvoices_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object ClassicSalesInvoices_A_Lock = new object(); private static readonly object ClassicSalesInvoices_B_Lock = new object(); private static readonly object ClassicSalesInvoices_C_Lock = new object(); private static readonly object ClassicSalesInvoices_D_Lock = new object(); private static readonly object ClassicSalesInvoices_E_Lock = new object(); private static Dictionary<int, SharedThreadData> ClassicSalesInvoices_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ClassicSalesInvoices_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ClassicSalesInvoices_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ClassicSalesInvoices_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ClassicSalesInvoices_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object CreateTransaction_A_Lock = new object(); private static readonly object CreateTransaction_B_Lock = new object(); private static readonly object CreateTransaction_C_Lock = new object(); private static readonly object CreateTransaction_D_Lock = new object(); private static readonly object CreateTransaction_E_Lock = new object(); private static Dictionary<int, SharedThreadData> CreateTransaction_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateTransaction_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateTransaction_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateTransaction_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> CreateTransaction_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object ReadTransaction_A_Lock = new object(); private static readonly object ReadTransaction_B_Lock = new object(); private static readonly object ReadTransaction_C_Lock = new object(); private static readonly object ReadTransaction_D_Lock = new object(); private static readonly object ReadTransaction_E_Lock = new object(); private static Dictionary<int, SharedThreadData> ReadTransaction_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ReadTransaction_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ReadTransaction_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ReadTransaction_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ReadTransaction_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object UserAccessSettings_A_Lock = new object(); private static readonly object UserAccessSettings_B_Lock = new object(); private static readonly object UserAccessSettings_C_Lock = new object(); private static readonly object UserAccessSettings_D_Lock = new object(); private static readonly object UserAccessSettings_E_Lock = new object(); private static Dictionary<int, SharedThreadData> UserAccessSettings_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> UserAccessSettings_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> UserAccessSettings_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> UserAccessSettings_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> UserAccessSettings_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object DocumentManagement_A_Lock = new object(); private static readonly object DocumentManagement_B_Lock = new object(); private static readonly object DocumentManagement_C_Lock = new object(); private static readonly object DocumentManagement_D_Lock = new object(); private static readonly object DocumentManagement_E_Lock = new object(); private static Dictionary<int, SharedThreadData> DocumentManagement_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> DocumentManagement_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> DocumentManagement_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> DocumentManagement_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> DocumentManagement_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object PayAndCollectRun_A_Lock = new object(); private static readonly object PayAndCollectRun_B_Lock = new object(); private static readonly object PayAndCollectRun_C_Lock = new object(); private static readonly object PayAndCollectRun_D_Lock = new object(); private static readonly object PayAndCollectRun_E_Lock = new object(); private static Dictionary<int, SharedThreadData> PayAndCollectRun_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> PayAndCollectRun_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> PayAndCollectRun_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> PayAndCollectRun_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> PayAndCollectRun_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object ExportCustomers_A_Lock = new object(); private static readonly object ExportCustomers_B_Lock = new object(); private static readonly object ExportCustomers_C_Lock = new object(); private static readonly object ExportCustomers_D_Lock = new object(); private static readonly object ExportCustomers_E_Lock = new object(); private static Dictionary<int, SharedThreadData> ExportCustomers_A_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExportCustomers_B_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExportCustomers_C_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExportCustomers_D_UserData = new Dictionary<int, SharedThreadData>(); private static Dictionary<int, SharedThreadData> ExportCustomers_E_UserData = new Dictionary<int, SharedThreadData>(); private static readonly object EditInvoice_Lock = new object(); private static Dictionary<int, SharedThreadData> EditInvoiceUserData_Web = new Dictionary<int, SharedThreadData>(); #endregion public void Save_CreateInvoice_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch(DBTenant) { case TwinfieldDBTenant.A: lock (CreateInvoice_A_Lock) { if (CreateInvoice_A_UserData.ContainsKey(UserId)) { CreateInvoice_A_UserData[UserId] = sharedThreadData; } else { CreateInvoice_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (CreateInvoice_B_Lock) { if (CreateInvoice_B_UserData.ContainsKey(UserId)) { CreateInvoice_B_UserData[UserId] = sharedThreadData; } else { CreateInvoice_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (CreateInvoice_C_Lock) { if (CreateInvoice_C_UserData.ContainsKey(UserId)) { CreateInvoice_C_UserData[UserId] = sharedThreadData; } else { CreateInvoice_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (CreateInvoice_D_Lock) { if (CreateInvoice_D_UserData.ContainsKey(UserId)) { CreateInvoice_D_UserData[UserId] = sharedThreadData; } else { CreateInvoice_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (CreateInvoice_E_Lock) { if (CreateInvoice_E_UserData.ContainsKey(UserId)) { CreateInvoice_E_UserData[UserId] = sharedThreadData; } else { CreateInvoice_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_CreateInvoice_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (CreateInvoice_A_Lock) { return CreateInvoice_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (CreateInvoice_B_Lock) { return CreateInvoice_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (CreateInvoice_C_Lock) { return CreateInvoice_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (CreateInvoice_D_Lock) { return CreateInvoice_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (CreateInvoice_E_Lock) { return CreateInvoice_E_UserData[UserId]; } break; default: return null; break; } } public void Save_CompanySettings_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (CompanySettings_A_Lock) { if (CompanySettings_A_UserData.ContainsKey(UserId)) { CompanySettings_A_UserData[UserId] = sharedThreadData; } else { CompanySettings_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (CompanySettings_B_Lock) { if (CompanySettings_B_UserData.ContainsKey(UserId)) { CompanySettings_B_UserData[UserId] = sharedThreadData; } else { CompanySettings_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (CompanySettings_C_Lock) { if (CompanySettings_C_UserData.ContainsKey(UserId)) { CompanySettings_C_UserData[UserId] = sharedThreadData; } else { CompanySettings_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (CompanySettings_D_Lock) { if (CompanySettings_D_UserData.ContainsKey(UserId)) { CompanySettings_D_UserData[UserId] = sharedThreadData; } else { CompanySettings_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (CompanySettings_E_Lock) { if (CompanySettings_E_UserData.ContainsKey(UserId)) { CompanySettings_E_UserData[UserId] = sharedThreadData; } else { CompanySettings_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_CompanySettings_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (CompanySettings_A_Lock) { return CompanySettings_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (CompanySettings_B_Lock) { return CompanySettings_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (CompanySettings_C_Lock) { return CompanySettings_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (CompanySettings_D_Lock) { return CompanySettings_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (CompanySettings_E_Lock) { return CompanySettings_E_UserData[UserId]; } break; default: return null; break; } } public void SaveEditInvoiceUserDataWeb(int UserId, SharedThreadData sharedThreadData) { lock (EditInvoice_Lock) { if (EditInvoiceUserData_Web.ContainsKey(UserId)) { EditInvoiceUserData_Web[UserId] = sharedThreadData; } else { EditInvoiceUserData_Web.Add(UserId, sharedThreadData); } } } public SharedThreadData GetEditInvoiceUserData_Web(int UserId) { lock (EditInvoice_Lock) { return EditInvoiceUserData_Web[UserId]; } } public void Save_ExtendedTBReport_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ExtendedTBReport_A_Lock) { if (ExtendedTBReport_A_UserData.ContainsKey(UserId)) { ExtendedTBReport_A_UserData[UserId] = sharedThreadData; } else { ExtendedTBReport_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (ExtendedTBReport_B_Lock) { if (ExtendedTBReport_B_UserData.ContainsKey(UserId)) { ExtendedTBReport_B_UserData[UserId] = sharedThreadData; } else { ExtendedTBReport_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (ExtendedTBReport_C_Lock) { if (ExtendedTBReport_C_UserData.ContainsKey(UserId)) { ExtendedTBReport_C_UserData[UserId] = sharedThreadData; } else { ExtendedTBReport_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (ExtendedTBReport_D_Lock) { if (ExtendedTBReport_D_UserData.ContainsKey(UserId)) { ExtendedTBReport_D_UserData[UserId] = sharedThreadData; } else { ExtendedTBReport_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (ExtendedTBReport_E_Lock) { if (ExtendedTBReport_E_UserData.ContainsKey(UserId)) { ExtendedTBReport_E_UserData[UserId] = sharedThreadData; } else { ExtendedTBReport_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_ExtendedTBReport_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ExtendedTBReport_A_Lock) { return ExtendedTBReport_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (ExtendedTBReport_B_Lock) { return ExtendedTBReport_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (ExtendedTBReport_C_Lock) { return ExtendedTBReport_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (ExtendedTBReport_D_Lock) { return ExtendedTBReport_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (ExtendedTBReport_E_Lock) { return ExtendedTBReport_E_UserData[UserId]; } break; default: return null; break; } } public void Save_NeoFixedAsset_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (NeoFixedAsset_A_Lock) { if (NeoFixedAsset_A_UserData.ContainsKey(UserId)) { NeoFixedAsset_A_UserData[UserId] = sharedThreadData; } else { NeoFixedAsset_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (NeoFixedAsset_B_Lock) { if (NeoFixedAsset_B_UserData.ContainsKey(UserId)) { NeoFixedAsset_B_UserData[UserId] = sharedThreadData; } else { NeoFixedAsset_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (NeoFixedAsset_C_Lock) { if (NeoFixedAsset_C_UserData.ContainsKey(UserId)) { NeoFixedAsset_C_UserData[UserId] = sharedThreadData; } else { NeoFixedAsset_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (NeoFixedAsset_D_Lock) { if (NeoFixedAsset_D_UserData.ContainsKey(UserId)) { NeoFixedAsset_D_UserData[UserId] = sharedThreadData; } else { NeoFixedAsset_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (NeoFixedAsset_E_Lock) { if (NeoFixedAsset_E_UserData.ContainsKey(UserId)) { NeoFixedAsset_E_UserData[UserId] = sharedThreadData; } else { NeoFixedAsset_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_NeoFixedAsset_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (NeoFixedAsset_A_Lock) { return NeoFixedAsset_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (NeoFixedAsset_B_Lock) { return NeoFixedAsset_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (NeoFixedAsset_C_Lock) { return NeoFixedAsset_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (NeoFixedAsset_D_Lock) { return NeoFixedAsset_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (NeoFixedAsset_E_Lock) { return NeoFixedAsset_E_UserData[UserId]; } break; default: return null; break; } } public void Save_NeoSalesInvoices_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (NeoSalesInvoices_A_Lock) { if (NeoSalesInvoices_A_UserData.ContainsKey(UserId)) { NeoSalesInvoices_A_UserData[UserId] = sharedThreadData; } else { NeoSalesInvoices_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (NeoSalesInvoices_B_Lock) { if (NeoSalesInvoices_B_UserData.ContainsKey(UserId)) { NeoSalesInvoices_B_UserData[UserId] = sharedThreadData; } else { NeoSalesInvoices_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (NeoSalesInvoices_C_Lock) { if (NeoSalesInvoices_C_UserData.ContainsKey(UserId)) { NeoSalesInvoices_C_UserData[UserId] = sharedThreadData; } else { NeoSalesInvoices_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (NeoSalesInvoices_D_Lock) { if (NeoSalesInvoices_D_UserData.ContainsKey(UserId)) { NeoSalesInvoices_D_UserData[UserId] = sharedThreadData; } else { NeoSalesInvoices_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (NeoSalesInvoices_E_Lock) { if (NeoSalesInvoices_E_UserData.ContainsKey(UserId)) { NeoSalesInvoices_E_UserData[UserId] = sharedThreadData; } else { NeoSalesInvoices_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_NeoSalesInvoices_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (NeoSalesInvoices_A_Lock) { return NeoSalesInvoices_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (NeoSalesInvoices_B_Lock) { return NeoSalesInvoices_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (NeoSalesInvoices_C_Lock) { return NeoSalesInvoices_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (NeoSalesInvoices_D_Lock) { return NeoSalesInvoices_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (NeoSalesInvoices_E_Lock) { return NeoSalesInvoices_E_UserData[UserId]; } break; default: return null; break; } } public void Save_ClassicSalesInvoices_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ClassicSalesInvoices_A_Lock) { if (ClassicSalesInvoices_A_UserData.ContainsKey(UserId)) { ClassicSalesInvoices_A_UserData[UserId] = sharedThreadData; } else { ClassicSalesInvoices_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (ClassicSalesInvoices_B_Lock) { if (ClassicSalesInvoices_B_UserData.ContainsKey(UserId)) { ClassicSalesInvoices_B_UserData[UserId] = sharedThreadData; } else { ClassicSalesInvoices_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (ClassicSalesInvoices_C_Lock) { if (ClassicSalesInvoices_C_UserData.ContainsKey(UserId)) { ClassicSalesInvoices_C_UserData[UserId] = sharedThreadData; } else { ClassicSalesInvoices_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (ClassicSalesInvoices_D_Lock) { if (ClassicSalesInvoices_D_UserData.ContainsKey(UserId)) { ClassicSalesInvoices_D_UserData[UserId] = sharedThreadData; } else { ClassicSalesInvoices_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (ClassicSalesInvoices_E_Lock) { if (ClassicSalesInvoices_E_UserData.ContainsKey(UserId)) { ClassicSalesInvoices_E_UserData[UserId] = sharedThreadData; } else { ClassicSalesInvoices_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_ClassicSalesInvoices_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ClassicSalesInvoices_A_Lock) { return ClassicSalesInvoices_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (ClassicSalesInvoices_B_Lock) { return ClassicSalesInvoices_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (ClassicSalesInvoices_C_Lock) { return ClassicSalesInvoices_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (ClassicSalesInvoices_D_Lock) { return ClassicSalesInvoices_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (ClassicSalesInvoices_E_Lock) { return ClassicSalesInvoices_E_UserData[UserId]; } break; default: return null; break; } } public void Save_CreateTransaction_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (CreateTransaction_A_Lock) { if (CreateTransaction_A_UserData.ContainsKey(UserId)) { CreateTransaction_A_UserData[UserId] = sharedThreadData; } else { CreateTransaction_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (CreateTransaction_B_Lock) { if (CreateTransaction_B_UserData.ContainsKey(UserId)) { CreateTransaction_B_UserData[UserId] = sharedThreadData; } else { CreateTransaction_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (CreateTransaction_C_Lock) { if (CreateTransaction_C_UserData.ContainsKey(UserId)) { CreateTransaction_C_UserData[UserId] = sharedThreadData; } else { CreateTransaction_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (CreateTransaction_D_Lock) { if (CreateTransaction_D_UserData.ContainsKey(UserId)) { CreateTransaction_D_UserData[UserId] = sharedThreadData; } else { CreateTransaction_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (CreateTransaction_E_Lock) { if (CreateTransaction_E_UserData.ContainsKey(UserId)) { CreateTransaction_E_UserData[UserId] = sharedThreadData; } else { CreateTransaction_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_CreateTransaction_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (CreateTransaction_A_Lock) { return CreateTransaction_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (CreateTransaction_B_Lock) { return CreateTransaction_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (CreateTransaction_C_Lock) { return CreateTransaction_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (CreateTransaction_D_Lock) { return CreateTransaction_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (CreateTransaction_E_Lock) { return CreateTransaction_E_UserData[UserId]; } break; default: return null; break; } } public void Save_ReadTransaction_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ReadTransaction_A_Lock) { if (ReadTransaction_A_UserData.ContainsKey(UserId)) { ReadTransaction_A_UserData[UserId] = sharedThreadData; } else { ReadTransaction_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (ReadTransaction_B_Lock) { if (ReadTransaction_B_UserData.ContainsKey(UserId)) { ReadTransaction_B_UserData[UserId] = sharedThreadData; } else { ReadTransaction_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (ReadTransaction_C_Lock) { if (ReadTransaction_C_UserData.ContainsKey(UserId)) { ReadTransaction_C_UserData[UserId] = sharedThreadData; } else { ReadTransaction_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (ReadTransaction_D_Lock) { if (ReadTransaction_D_UserData.ContainsKey(UserId)) { ReadTransaction_D_UserData[UserId] = sharedThreadData; } else { ReadTransaction_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (ReadTransaction_E_Lock) { if (ReadTransaction_E_UserData.ContainsKey(UserId)) { ReadTransaction_E_UserData[UserId] = sharedThreadData; } else { ReadTransaction_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_ReadTransaction_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ReadTransaction_A_Lock) { return ReadTransaction_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (ReadTransaction_B_Lock) { return ReadTransaction_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (ReadTransaction_C_Lock) { return ReadTransaction_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (ReadTransaction_D_Lock) { return ReadTransaction_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (ReadTransaction_E_Lock) { return ReadTransaction_E_UserData[UserId]; } break; default: return null; break; } } public void Save_UserAccessSettings_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (UserAccessSettings_A_Lock) { if (UserAccessSettings_A_UserData.ContainsKey(UserId)) { UserAccessSettings_A_UserData[UserId] = sharedThreadData; } else { UserAccessSettings_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (UserAccessSettings_B_Lock) { if (UserAccessSettings_B_UserData.ContainsKey(UserId)) { UserAccessSettings_B_UserData[UserId] = sharedThreadData; } else { UserAccessSettings_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (UserAccessSettings_C_Lock) { if (UserAccessSettings_C_UserData.ContainsKey(UserId)) { UserAccessSettings_C_UserData[UserId] = sharedThreadData; } else { UserAccessSettings_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (UserAccessSettings_D_Lock) { if (UserAccessSettings_D_UserData.ContainsKey(UserId)) { UserAccessSettings_D_UserData[UserId] = sharedThreadData; } else { UserAccessSettings_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (UserAccessSettings_E_Lock) { if (UserAccessSettings_E_UserData.ContainsKey(UserId)) { UserAccessSettings_E_UserData[UserId] = sharedThreadData; } else { UserAccessSettings_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_UserAccessSettings_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (UserAccessSettings_A_Lock) { return UserAccessSettings_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (UserAccessSettings_B_Lock) { return UserAccessSettings_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (UserAccessSettings_C_Lock) { return UserAccessSettings_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (UserAccessSettings_D_Lock) { return UserAccessSettings_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (UserAccessSettings_E_Lock) { return UserAccessSettings_E_UserData[UserId]; } break; default: return null; break; } } public void Save_DocumentManagement_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (DocumentManagement_A_Lock) { if (DocumentManagement_A_UserData.ContainsKey(UserId)) { DocumentManagement_A_UserData[UserId] = sharedThreadData; } else { DocumentManagement_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (DocumentManagement_B_Lock) { if (DocumentManagement_B_UserData.ContainsKey(UserId)) { DocumentManagement_B_UserData[UserId] = sharedThreadData; } else { DocumentManagement_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (DocumentManagement_C_Lock) { if (DocumentManagement_C_UserData.ContainsKey(UserId)) { DocumentManagement_C_UserData[UserId] = sharedThreadData; } else { DocumentManagement_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (DocumentManagement_D_Lock) { if (DocumentManagement_D_UserData.ContainsKey(UserId)) { DocumentManagement_D_UserData[UserId] = sharedThreadData; } else { DocumentManagement_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (DocumentManagement_E_Lock) { if (DocumentManagement_E_UserData.ContainsKey(UserId)) { DocumentManagement_E_UserData[UserId] = sharedThreadData; } else { DocumentManagement_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_DocumentManagement_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (DocumentManagement_A_Lock) { return DocumentManagement_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (DocumentManagement_B_Lock) { return DocumentManagement_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (DocumentManagement_C_Lock) { return DocumentManagement_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (DocumentManagement_D_Lock) { return DocumentManagement_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (DocumentManagement_E_Lock) { return DocumentManagement_E_UserData[UserId]; } break; default: return null; break; } } public void Save_PayAndCollectRun_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (PayAndCollectRun_A_Lock) { if (PayAndCollectRun_A_UserData.ContainsKey(UserId)) { PayAndCollectRun_A_UserData[UserId] = sharedThreadData; } else { PayAndCollectRun_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (PayAndCollectRun_B_Lock) { if (PayAndCollectRun_B_UserData.ContainsKey(UserId)) { PayAndCollectRun_B_UserData[UserId] = sharedThreadData; } else { PayAndCollectRun_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (PayAndCollectRun_C_Lock) { if (PayAndCollectRun_C_UserData.ContainsKey(UserId)) { PayAndCollectRun_C_UserData[UserId] = sharedThreadData; } else { PayAndCollectRun_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (PayAndCollectRun_D_Lock) { if (PayAndCollectRun_D_UserData.ContainsKey(UserId)) { PayAndCollectRun_D_UserData[UserId] = sharedThreadData; } else { PayAndCollectRun_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (PayAndCollectRun_E_Lock) { if (PayAndCollectRun_E_UserData.ContainsKey(UserId)) { PayAndCollectRun_E_UserData[UserId] = sharedThreadData; } else { PayAndCollectRun_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_PayAndCollectRun_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (PayAndCollectRun_A_Lock) { return PayAndCollectRun_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (PayAndCollectRun_B_Lock) { return PayAndCollectRun_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (PayAndCollectRun_C_Lock) { return PayAndCollectRun_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (PayAndCollectRun_D_Lock) { return PayAndCollectRun_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (PayAndCollectRun_E_Lock) { return PayAndCollectRun_E_UserData[UserId]; } break; default: return null; break; } } public void Save_ExportCustomers_UserData(int UserId, SharedThreadData sharedThreadData, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ExportCustomers_A_Lock) { if (ExportCustomers_A_UserData.ContainsKey(UserId)) { ExportCustomers_A_UserData[UserId] = sharedThreadData; } else { ExportCustomers_A_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.B: lock (ExportCustomers_B_Lock) { if (ExportCustomers_B_UserData.ContainsKey(UserId)) { ExportCustomers_B_UserData[UserId] = sharedThreadData; } else { ExportCustomers_B_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.C: lock (ExportCustomers_C_Lock) { if (ExportCustomers_C_UserData.ContainsKey(UserId)) { ExportCustomers_C_UserData[UserId] = sharedThreadData; } else { ExportCustomers_C_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.D: lock (ExportCustomers_D_Lock) { if (ExportCustomers_D_UserData.ContainsKey(UserId)) { ExportCustomers_D_UserData[UserId] = sharedThreadData; } else { ExportCustomers_D_UserData.Add(UserId, sharedThreadData); } } break; case TwinfieldDBTenant.E: lock (ExportCustomers_E_Lock) { if (ExportCustomers_E_UserData.ContainsKey(UserId)) { ExportCustomers_E_UserData[UserId] = sharedThreadData; } else { ExportCustomers_E_UserData.Add(UserId, sharedThreadData); } } break; } } public SharedThreadData Get_ExportCustomers_UserData(int UserId, TwinfieldDBTenant DBTenant) { switch (DBTenant) { case TwinfieldDBTenant.A: lock (ExportCustomers_A_Lock) { return ExportCustomers_A_UserData[UserId]; } break; case TwinfieldDBTenant.B: lock (ExportCustomers_B_Lock) { return ExportCustomers_B_UserData[UserId]; } break; case TwinfieldDBTenant.C: lock (ExportCustomers_C_Lock) { return ExportCustomers_C_UserData[UserId]; } break; case TwinfieldDBTenant.D: lock (ExportCustomers_D_Lock) { return ExportCustomers_D_UserData[UserId]; } break; case TwinfieldDBTenant.E: lock (ExportCustomers_E_Lock) { return ExportCustomers_E_UserData[UserId]; } break; default: return null; break; } } #endregion ReducedLogin } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Forms.DataVisualization.Charting; namespace Image_processing { public partial class Form2 : Form { public Form2() { InitializeComponent(); } public void Add(int[] R, int[] G, int[] B) { chart1.Series.Add("R"); chart1.Series.Add("G"); chart1.Series.Add("B"); chart1.Series["R"].Color = Color.Red; chart1.Series["G"].Color = Color.Green; chart1.Series["B"].Color = Color.Blue; chart1.Series["R"].ChartType = SeriesChartType.Area; chart1.Series["G"].ChartType = SeriesChartType.Area; chart1.Series["B"].ChartType = SeriesChartType.Area; for (int i = 0; i < 256; i++) { chart1.Series["R"].Points.AddY(R[i]); chart1.Series["G"].Points.AddY(G[i]); chart1.Series["B"].Points.AddY(B[i]); } } private void cbx_CheckedChanged(object sender, EventArgs e) { CheckBox cb = sender as CheckBox; chart1.Series[cb.Text].Enabled = cb.Checked; chart1.Invalidate(); } } }
namespace Triton.Game.Mapping { using ns25; using ns26; using System; using System.Collections.Generic; using Triton.Game.Mono; [Attribute38("TagDeltaSet")] public class TagDeltaSet : MonoClass { public TagDeltaSet(IntPtr address) : this(address, "TagDeltaSet") { } public TagDeltaSet(IntPtr address, string className) : base(address, className) { } public void Add(int tag, int prev, int curr) { object[] objArray1 = new object[] { tag, prev, curr }; base.method_9("Add", new Class272.Enum20[] { Class272.Enum20.I4 }, objArray1); } public List<TagDelta> GetList() { Class267<TagDelta> class2 = base.method_14<Class267<TagDelta>>("GetList", Array.Empty<object>()); if (class2 != null) { return class2.method_25(); } return null; } public int NewValue(int index) { object[] objArray1 = new object[] { index }; return base.method_11<int>("NewValue", objArray1); } public int OldValue(int index) { object[] objArray1 = new object[] { index }; return base.method_11<int>("OldValue", objArray1); } public int Size() { return base.method_11<int>("Size", Array.Empty<object>()); } public int Tag(int index) { object[] objArray1 = new object[] { index }; return base.method_11<int>("Tag", objArray1); } public List<TagDelta> m_deltas { get { Class267<TagDelta> class2 = base.method_3<Class267<TagDelta>>("m_deltas"); if (class2 != null) { return class2.method_25(); } return null; } } } }
using System.Collections.Generic; using System.Threading.Tasks; using Archimedes.Library.Message.Dto; namespace Archimedes.Service.Ui.Http { public interface IHttpHealthMonitorClient { Task<IEnumerable<HealthMonitorDto>> GetHealthMonitor(); } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApp15 { public partial class Form1 : Form { public Form1() { InitializeComponent(); button1.Text = "Сажать"; } private void button1_Click(object sender, EventArgs e) { Random rd = new Random(); listBox1.Items.Clear(); int n = Convert.ToInt32(textBox1.Text),po=0,ot=0,z=0; for (int i = 1; i <= n; i++) { int a = rd.Next(-5000, 5000); listBox1.Items.Add(a); if (a == 0) z++; if (a < 0) ot++; if (a > 0) po++; } label2.Text = "Положительных чисел " + po.ToString() + " Отрицательные числа " + ot.ToString() + " Zero " + z.ToString(); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UnityEngine.SceneManagement; //2018-11-17 宋柏慧 //--------------------------------------------------------- //这个脚本内包含: // 小球控制 // 死亡判断 // 音效 // 得分更新 储存 // 碰撞事件 // gameover界面 //--------------------------------------------------------- public class PlayerController : MonoBehaviour { public float speed; //小球运动速度 public Text countText; //得分文本 public Image loseImage; //GameOver图片 public AudioSource coinSound; //得到金币声音 public AudioSource dieSound; //死亡声音 private Rigidbody rb; private int count; //得分 void Start () { rb = GetComponent<Rigidbody>(); count = 0; SetCountText(); } void FixedUpdate() { float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical); rb.AddForce(movement * speed); } void Update() { LoseJudge(); } private void Lose() { dieSound.Play(); Onfile(); StartCoroutine(WaitSeconds(0.5f)); } private void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Pick Up")) { other.gameObject.SetActive(false); count = count + 1; coinSound.Play(); SetCountText(); } SearchAndSetActive(other); //set music then } //设置得分文本 private void SetCountText() { countText.text = "得分:" + count.ToString(); } //存储得分 public void Onfile() { PlayerPrefs.SetInt("count", count); } //失败判定 private void LoseJudge() { if (gameObject.transform.position.x <-10 || gameObject.transform.position.x > 10 || gameObject.transform.position.z>10 || gameObject.transform.position.z<-10) { loseImage.gameObject.SetActive(true); Lose(); } } //判断若子物体未激活 则随机激活一个 private void SearchAndSetActive(Collider other) { GameObject titleFrame = other.gameObject.transform.parent.gameObject; int i = titleFrame.transform.childCount; foreach (Transform child in titleFrame.transform) { if (child.gameObject.activeSelf == false) { i--; } if (i == 0) { titleFrame.SetActive(false); } } } IEnumerator WaitSeconds(float waitTime) { yield return new WaitForSeconds(waitTime); SceneManager.LoadScene("Final"); } }
namespace Domain.Entities { public class Image { public int Id { get; set; } public string Path { get; set; } public Post Post { get; set; } } }
using Microsoft.AspNetCore.Authorization; namespace DDDSouthWest.Website.Framework { public class OrganiserAuthAttribute : AuthorizeAttribute { public OrganiserAuthAttribute() : base("IsValidUser") { } } }
using FacebookFeeder.Helpers; using Orchard.ContentManagement; using System; using System.ComponentModel.DataAnnotations; namespace FacebookFeeder.Models { public class FacebookFeederPart : ContentPart { [Required] public string Page { get { return this.Retrieve(r => r.Page); } set { this.Store(r => r.Page, value); } } [Required] public string PageId { get { return this.Retrieve(r => r.PageId); } set { this.Store(r => r.PageId, value); } } [Required] public string AccessToken { get { return this.Retrieve(r => r.AccessToken); } set { this.Store(r => r.AccessToken, value); } } [Required] public int Limit { get { return this.Retrieve(r => r.Limit); } set { this.Store(r => r.Limit, value); } } [Required] public string FeedType { get { return this.Retrieve(r => r.FeedType); } set { this.Store(r => r.FeedType, value); } } } public partial class FacebookPost { private const string postUrl = "https://www.facebook.com/{0}/posts/{1}"; public string PageId { get; set; } public string PostId { get; set; } public string Story { get; set; } public string Message { get; set; } public FacebookImage Photo { get; set; } public StatusType Status { get; set; } public PostType Type { get; set; } public FacebookUser PostedBy { get; set; } public DateTime Created { get; set; } public string PostUrl { get { return string.Format(postUrl, this.PageId, this.PostId); } } } public class FacebookUser { private const string url = "https://www.facebook.com/{0}"; public string Id { get; set; } public string Name { get; set; } public string Url { get { return string.Format(url, this.Id); } } } public class FacebookImage { public string ImagePage { get; set; } public string ImageSource { get; set; } } }