public LineHelper(XElement item) : base(item) { if (item.Attribute("showCrosses") != null) { ShowCrosses = bool.Parse(item.Attribute("showCrosses").Value); } var pos = item.Attribute("start").Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(z => double.Parse(z.Replace(",", "."), CultureInfo.InvariantCulture)).ToArray(); Start = new Vector3d(pos[0], pos[1], pos[2]); var nrm = item.Attribute("end").Value.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).Select(z => double.Parse(z.Replace(",", "."), CultureInfo.InvariantCulture)).ToArray(); End = new Vector3d(nrm[0], nrm[1], nrm[2]); if (item.Attribute("drawSize") != null) { DrawSize = StaticHelpers.ParseFloat(item.Attribute("drawSize").Value); } }
private void ___generic_accumulator_8bitsub(byte source, bool borrow) { if (borrow && FCarry) { source++; } byte result = (byte)(AF.HiByte - source); FSign = StaticHelpers.TestBit(result, 7); FZero = result == 0; FHalfCarry = StaticHelpers.TestHalfCarry(AF.HiByte, source, result); FPV = StaticHelpers.TestSubtractionOverflow(AF.HiByte, source, result); FNegative = true; FCarry = (uint)(AF.HiByte - source) > 0xFF; AF.HiByte = result; }
public string Serialize() { Serializing = true; _groupCount = TileGroups.Count(); string nl = StaticHelpers.lineSeperator; string s = "[View]" + nl; s += StaticHelpers.SerializeObject <OldCatanGame>(this, SerializedProperties, false); s += nl; for (int i = 0; i < GroupCount; i++) { s += String.Format($"[TileGroup {i}]{nl}"); s += TileGroups[i].Serialize(i); s += nl; } Serializing = false; return(s); }
public void testWithBadListItems() { XmlNode testNode = StaticHelpers.getNode(@"<random> <li>random 1</li> <bad>bad 1</bad> <li>random 2</li> <bad>bad 2</bad> <li>random 3</li> <bad>bad 3</bad> <li>random 4</li> <bad>bad 4</bad> <li>random 5</li> <bad>bad 5</bad> </random>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.random(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, this.mockResult, testNode); Assert.Contains(this.mockBotTagHandler.Transform(), this.possibleResults); }
private void ___generic_accumulator_8bitadd(byte source, bool carry) { if (carry && FCarry) { source++; } byte result = (byte)(AF.HiByte + source); FSign = StaticHelpers.TestBit(result, 7); FZero = result == 0; FHalfCarry = StaticHelpers.TestHalfCarry(AF.HiByte, source, result); FPV = StaticHelpers.TestAdditionOverflow(AF.HiByte, source, result); FNegative = false; FCarry = (uint)(AF.HiByte + source) > 0xFF; AF.HiByte = result; }
public void ShowSingletonView <T>(IObjectSpace objSpace) { var svp = new ShowViewParameters(); svp.CreatedView = _app.CreateDetailView(objSpace, StaticHelpers.GetInstance <T>(objSpace)); svp.TargetWindow = TargetWindow.NewModalWindow; svp.Context = TemplateContext.PopupWindow; svp.CreateAllControllers = true; if (Accepting != null) { _dc.Accepting += DialogController_Accepting; } svp.Controllers.Add(_dc); _app.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null)); }
public async Task LoadGames() { QueryOptions queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, new[] { MainPage.SAVED_GAME_EXTENSION }) { FolderDepth = FolderDepth.Shallow }; Windows.Storage.StorageFolder folder = await StaticHelpers.GetSaveFolder(); StorageFileQueryResult query = folder.CreateFileQueryWithOptions(queryOptions); System.Collections.Generic.IReadOnlyList <Windows.Storage.StorageFile> files = await query.GetFilesAsync(); foreach (Windows.Storage.StorageFile file in files) { SavedGames.Add(file.Name); } }
public ResponseDetails Login(LoginDTO model) { try { string token = _authService.Login(model.Email, model.Password); if (token == null) { return(StaticHelpers.SetResponSeDetails(false, null, MessageType.Info, "Invalid login data.")); } return(StaticHelpers.SetResponSeDetails(true, token, MessageType.Success, "Successfully logged in.")); } catch (Exception ex) { return(StaticHelpers.SetResponSeDetails(false, ex, MessageType.Error)); } }
private void _rra() { if (DebugMode) { DebugOut("RRA"); } TStates += 4; bool bit = StaticHelpers.TestBit(AF.HiByte, 0); AF.HiByte >>= 1; AF.HiByte = StaticHelpers.SetBit(AF.HiByte, 7, FCarry); FCarry = bit; FHalfCarry = FNegative = false; }
public void Initialize() { StaticHelpers.LogToDebug($"{nameof(IthVnrSharpLib)}.{nameof(EmbedHost)}.{nameof(Initialize)}"); try { _pipeServer = new NamedPipeServerStream(PipeName, PipeDirection.InOut, NamedPipeServerStream.MaxAllowedServerInstances); _listeningThread = new Thread(async() => await ServerThread()) { Name = PipeHostThreadName }; _listeningThread.Start(); } catch (Exception ex) { StaticHelpers.LogToFile(ex); } Initialized = true; }
public async Task Create_Script_Record_Test() { var version = IEVersion.GetIEVersion(); Action <object> writeOut = value => Console.WriteLine(value); var scriptVariablesMap = StaticHelpers.GetScriptVairableMap(); var scripts = new List <Script>(); var websiteDescription = "Horizon NJ Health via NaviNet Submit "; var websiteKey = new Guid("6af63ad0-66cf-4b64-9042-38f061ce5cbd"); var deviceId = "NJHorizon"; var loginScript = Script.CreateScript ( websiteDescription + "001: Login, onlogin error check", NaviNet.LoginScript(version[9]).ToString(), string.Concat(deviceId, "_001"), "Login", websiteKey ); scripts.Add(loginScript); var script5 = Script.CreateScript( websiteDescription + "004: Pause for Submit", NaviNet.Pause().ToString(), string.Concat(deviceId, "_004"), "Extraction", websiteKey ); scripts.Add(script5); Func <Script, string, Task <Guid> > AddScriptMasterRecord = async(sm, connectionString) => { using (IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings[connectionString].ConnectionString)) { var container = new UnityContainer(); container.RegisterType <IScriptCreation, ScriptCreationRepo>(new InjectionConstructor(db)); var repo = container.Resolve <IScriptCreation>(); return(await repo.CreateScritp(sm)); } }; }
public override void Start() { base.Start(); Animator = GetComponentInChildren <Animator>(); Agent = GetComponent <NavMeshAgent>(); Height = Agent.height; if (Health != 0) { StartHealth = Health; var bar = StaticHelpers.SpawnResource("Prefabs/Healthbar"); bar.transform.parent = transform; bar.transform.localPosition = Vector3.up * (Height + 0.1f); HealthBar = bar.GetComponentInChildren <Slider>(); } }
private void _rlca() { if (DebugMode) { DebugOut("RLCA"); } TStates += 4; FCarry = StaticHelpers.TestBit(AF.HiByte, 7); AF.HiByte <<= 1; AF.HiByte = StaticHelpers.SetBit(AF.HiByte, 0, FCarry); FHalfCarry = FNegative = false; FHalfCarry = FNegative = false; }
void Update() { if (Player == null) { return; } var current = GetComponent <NaughtyCharacter.Character>().IsGrounded; if (!grounded && current) { StaticHelpers.EmitParticleDust(transform.position); } grounded = current; if (LastPos != transform.position) { Direction = LastPos - transform.position; LastPos = transform.position; } if (Input.GetKeyDown(KeyCode.F2)) { Player.NextAnimal(); } //if ( Input.GetKeyDown( KeyCode.Escape ) ) //{ // if ( Cursor.visible ) // { // Cursor.visible = false; // Cursor.lockState = CursorLockMode.Locked; // } // else // { // Cursor.visible = true; // Cursor.lockState = CursorLockMode.None; // } //} if (Input.GetMouseButtonDown(0)) { Player.ChirpLocal(); } }
public void testResultHandlers() { XmlNode testNode = StaticHelpers.getNode("<input/>"); Result mockResult = new Result(this.mockUser, this.mockBot, this.mockRequest); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); this.mockRequest = new Request("Sentence 1. Sentence 2", this.mockUser, this.mockBot); mockResult.InputSentences.Add("Result 1"); mockResult.InputSentences.Add("Result 2"); this.mockUser.addResult(mockResult); Result mockResult2 = new Result(this.mockUser, this.mockBot, this.mockRequest); mockResult2.InputSentences.Add("Result 3"); mockResult2.InputSentences.Add("Result 4"); this.mockUser.addResult(mockResult2); Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<input index=\"1\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 3", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<input index=\"2,1\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 1", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<input index=\"1,2\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 4", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<input index=\"2,2\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("Result 2", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<input index=\"1,3\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); testNode = StaticHelpers.getNode("<input index=\"3\"/>"); this.mockBotTagHandler = new AIMLbot.AIMLTagHandlers.input(this.mockBot, this.mockUser, this.mockQuery, this.mockRequest, mockResult, testNode); Assert.AreEqual("", this.mockBotTagHandler.Transform()); }
/// <summary> /// Loads and verifies the current MHW:IB process against the currently supported version. /// </summary> /// TODO: Make it more oo by making this the constructor for an abstract automaton. /// Then have inhertied automatons work based on different versions. /// This would allow for backward compatability /// private void LoadAndVerifyProcess() { Log.Message("Attempting to load MHW:IB Process."); // First set the mhw process _Process = StaticHelpers.GetMHWProcess(); Log.Message("Process Loaded. Retrieving version"); // Now verify the version Match match = Regex.Match(_Process.MainWindowTitle, MHWMemoryValues.SupportedVersionRegex); // If the match is made if (match.Success) { // And we have a capture group if (match.Groups.Count > 1) { // Try to turn it into a number if (int.TryParse(match.Groups[1].Value, out int result)) { Log.Message("Version found: " + result); // If it is a numeber and is the same as the supported version if (result == MHWMemoryValues.SupportedGameVersion) { // Set the flag _IsSupportedVersion = true; return; } Log.Warning( "Version unsupported. Currently supported version: " + MHWMemoryValues.SupportedGameVersion + "\n\t\tAutomaton will still run, however, correct sequences cannot be read" ); return; } } } Log.Error( "Could not verify game version. This is most likely due to a different versioning system being used by Capcom." + "\n\t\tAutomaton will still run, however, correct sequences cannot be read" ); }
public UserViewModel Register(UserViewModel user, string password) { if (_unitOfWork.AuthRepository.EmailExists(user.Email)) { return(null); } StaticHelpers.CreatePasswordHash(password, out byte[] passwordHash, out byte[] passwordSalt); User model = _mapper.Map <User>(user); model.PasswordHash = passwordHash; model.PasswordSalt = passwordSalt; model = _unitOfWork.AuthRepository.Register(model); _unitOfWork.SaveChanges(); return(_mapper.Map <UserViewModel>(model)); }
public bool Deserialize(Dictionary <string, string> sections, Deck deck) { if (sections.Count == 0) { return(false); } Dictionary <string, string> game = StaticHelpers.DeserializeDictionary(sections["Game"]); if (sections == null) { return(false); } if (game["Version"] != SERIALIZATION_VERSION) { return(false); } _dealer = (PlayerType)Enum.Parse(typeof(PlayerType), game["Dealer"]); NewGame(_dealer, deck); CardView shared = StaticHelpers.CardFromString(game["SharedCard"], deck); _deck.SharedCard = shared; _player.Deserialize(sections["Player"], deck); _computer.Deserialize(sections["Computer"], deck); string countingPhase; if (sections.TryGetValue("Counting", out countingPhase)) { _countingPhase = new CountingPhase(_player, _player.Hand.Cards, _computer, _computer.Hand.Cards); _countingPhase.Deserialize(countingPhase, deck); CountingState state = new CountingState(_player, _computer); state.Deserialize(sections["CountingState"]); _countingPhase.State = state; } return(true); }
public static PivotGridLoadedLayout FindLoadedLayout(Session session, UIPlatform platform, string typeName) { var currentUser = StaticHelpers.GetCurrentUser(session); CriteriaOperator criteria = null; if (currentUser == null) { criteria = CriteriaOperator.Parse( "UIPlatform = ? And User Is Null And TypeName = ?", platform, typeName); } else { criteria = CriteriaOperator.Parse( "UIPlatform = ? And User = ? And TypeName = ?", platform, currentUser, typeName); } var loadedLayoutObj = session.FindObject <PivotGridLoadedLayout>(criteria); return(loadedLayoutObj); }
void Start() { Instance = this; RuntimeParent = GameObject.Find("Runtime").transform; PostProcessing = FindObjectOfType <Volume>(); PostProcessing.profile.TryGet(out ChromAb); PostProcessing.profile.TryGet(out ColourAdj); PostProcessing.profile.TryGet(out LensDis); HUDMessage.color = new Color(HUDMessage.color.r, HUDMessage.color.g, HUDMessage.color.b, 0); StaticHelpers.Reset(); StartState(State.Lobby); if (Won && CurrentLevel == "Mission3") { UI.Instance.SwitchLobbyState(UI.LobbyState.Win, false, true); } }
IEnumerator Co_Scoreout() { StaticHelpers.GetOrCreateCachedAudioSource("scoreout", LocalPlayer.Instance.Player.transform, 1, 1, 0, true); // UI var score = ClipboardItems[JustUnlocked].transform.GetChild(0); score.gameObject.SetActive(true); var text = score.GetComponent <Text>(); var length = text.text.Length; text.text = ""; var between = 0.2f / length; for (int i = 0; i < length; i++) { text.text += "-"; yield return(new WaitForSeconds(between)); } }
public async Task <IReadOnlyList <StorageFile> > GetSavedFilesInternal() { var queryOptions = new QueryOptions(CommonFileQuery.DefaultQuery, new[] { ".catangame" }); queryOptions.FolderDepth = FolderDepth.Shallow; var folder = await StaticHelpers.GetSaveFolder(); var query = folder.CreateFileQueryWithOptions(queryOptions); var files = await query.GetFilesAsync(); _savedGameNames.Clear(); _savedStoragefiles.Clear(); foreach (var f in files) { _savedGameNames.Add(f.DisplayName); _savedStoragefiles.Add(f.DisplayName, f); } return(files); }
private void _outd() { if (DebugMode) { DebugOut("OUTD"); } TStates += 16; byte tmp = Memory[HL]; BC.HiByte--; FSign = StaticHelpers.TestBit(BC.HiByte, 7); FZero = BC.HiByte == 0; FNegative = true; WriteIOPort(BC.HiByte, BC.LoByte, tmp); HL.Word--; }
public async Task <bool> SendSettings() { if (!_pipeServer.IsConnected) { return(false); } try { var data = GetDataBytes("settings", new EmbedSettings()); var allBytes = BitConverter.GetBytes(data.Length).Reverse().Concat(data).ToArray(); await _pipeServer.WriteAsync(allBytes, 0, allBytes.Length, _threadToken.Token); return(true); } catch (Exception ex) { StaticHelpers.LogToFile(ex); return(false); } }
public ActionResult DeleteBySplitId(string splitName) { List <int> idsList = StaticHelpers.GetIdsBySplitName(splitName); IEnumerable <Article> articles = _articleContext.Articles .Include(m => m.Source) .Include(n => n.Informations) .OrderBy(x => x.Date) //najstarsze .Where(m => idsList.Contains(m.Id)); if (articles == null) { return(NotFound()); } _articleContext.RemoveRange(articles); _articleContext.SaveChanges(); return(NoContent()); }
private void GetBookingListByStatus() { try { UserDialogs.Instance.ShowLoading(""); //BookingList.Clear(); if (PendingBgColor == StaticHelpers.BlueColor) { searchbookingList = StaticHelpers.ConvertintoObservable <MyBookingModel>(AllBookingList.Where(x => x.JobStatus == Convert.ToInt32(RequestStatus.InProgress) && x.TimerStartTime == null).OrderByDescending(x => x.Id)); } else if (InprogressBgColor == StaticHelpers.BlueColor) { searchbookingList = StaticHelpers.ConvertintoObservable <MyBookingModel>(AllBookingList.Where(x => x.JobStatus.Value == Convert.ToInt32(RequestStatus.InProgress) && x.TimerStartTime != null).OrderByDescending(x => x.Id)); } else if (CompletedBgColor == StaticHelpers.BlueColor) { searchbookingList = StaticHelpers.ConvertintoObservable <MyBookingModel>(AllBookingList.Where(x => x.JobStatus.Value == Convert.ToInt32(RequestStatus.Completed)).OrderByDescending(x => x.Id)); } else if (CanceledBgColor == StaticHelpers.BlueColor) { searchbookingList = StaticHelpers.ConvertintoObservable <MyBookingModel>(AllBookingList.Where(x => (x.JobStatus.Value == Convert.ToInt32(RequestStatus.Canceled) || x.JobStatus.Value == Convert.ToInt32(RequestStatus.QuoteCanceled))).OrderByDescending(x => x.Id)); } if (!string.IsNullOrEmpty(SearchBarText) && !string.IsNullOrWhiteSpace(SearchBarText)) { BookingList = new ObservableCollection <MyBookingModel>(searchbookingList.Where(x => x.CategoryName.ToLower().StartsWith(SearchBarText.ToLower())).ToList()); } else { BookingList = searchbookingList; } } catch (Exception ex) { Console.WriteLine("BookingListbyStatus_Exception:- " + ex.Message); } finally { UserDialogs.Instance.HideLoading(); } }
private void _neg() { if (DebugMode) { DebugOut("NEG"); } TStates += 8; FPV = (AF.HiByte == 0x80); FCarry = (AF.HiByte != 0x00); byte result = (byte)(0 - AF.HiByte); FSign = StaticHelpers.TestBit(result, 7); FZero = (result == 0); FHalfCarry = StaticHelpers.TestHalfCarry(0, AF.HiByte, result); FNegative = true; AF.HiByte = result; }
public async Task <IEnumerable <ScriptMaster> > GetScripts(Guid websiteKey) { if (StaticHelpers.CheckForNullOrWhiteSpace(websiteKey)) { throw new ArgumentNullException(); } var query = @"SELECT scriptKey, scriptDesc, ScriptCode, websiteKey FROM ScriptingAgentDatabase.dbo.dsa_scriptMaster WHERE websiteKey = @websiteKey ORDER BY scriptDesc"; var p = new DynamicParameters(); p.Add("@websiteKey", websiteKey); try { return(await _db.QueryAsync <ScriptMaster>(query, p)); } catch (Exception) { throw; } }
public void Execute(ref IBaseMessage inmsg, IPipelineContext pc) { try { object value = null; value = StaticHelpers.ReadFromSSO(_SSOApplication, _SSOKey); if (promotion == ContextInstructionTypeEnum.Write) { inmsg.Context.Write(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type)); } else if (promotion == ContextInstructionTypeEnum.Promote) { inmsg.Context.Promote(propertyName, propertyNamespace, TypeCaster.GetTypedObject(value, type)); } } catch (Exception e) { throw new Exception("Unable to set context property " + propertyNamespace + "#" + propertyName + " from SSO application " + _SSOApplication + " and SSO Key " + _SSOKey + ". Encountered error - " + e.ToString()); } }
private void _cpd() { if (DebugMode) { DebugOut("CPD"); } TStates += 16; byte compare = (byte)(AF.HiByte - Memory[HL]); BC.Word--; FSign = StaticHelpers.TestBit(compare, 7); FZero = (compare == 0); FHalfCarry = StaticHelpers.TestHalfCarry(AF.HiByte, Memory[HL], compare); FPV = (BC.Word != 0); FNegative = true; HL.Word--; }