public static Packet[] Package(int id, Enums.MessageTarget target, byte[] img) { int totalPackets = img.Length % 512 > 1 ? img.Length / 512 : (img.Length / 512) - 1; bool first = true; var packets = new List<Packet>(); while (true) { if (first) { packets.Add(ProcessFirstChunk(img.Length, img.Take(512).ToArray(), id, target)); first = false; img = img.Skip(512).ToArray(); } else { if (img.Length > 512) { packets.Add(ProcessBodyChunk(img.Take(512).ToArray(), id, target)); img = img.Skip(512).ToArray(); } else { packets.Add(ProcessLastChunk(img, id, target)); break; } } } return packets.ToArray(); }
public Luxury(string aer, string sistem, string enterain, string marca, int nrUsi, Enums.Culori culoare, Categorie categ, string serieSasiu) : base(marca, nrUsi, culoare, categ, serieSasiu) { this.AerConditionatC = aer; this.SistemParktronic = sistem; this.EntertainmentSystem = enterain; }
public RolDialog(String _descripcion, Enums.tipoDialog tipoDialog) { InitializeComponent(); this.tipo = tipoDialog; this.descripcionTextbox.Text = _descripcion; this.dr = DialogResult.Cancel; }
private void ProcessTurnOutcome(Enums.TurnOutcome turnOutcome) { if (turnOutcome != Enums.TurnOutcome.MoveMadeAndPointScored) _numberOfTurnsWithNoPointsGained++; else _numberOfTurnsWithNoPointsGained = 0; }
public FileManagerForm(Enums.TypePath tp, long id_controller) { InitializeComponent(); path_work = getPath(tp, id_controller); searchFiles(); webBrowser.DocumentText = TruckSystem.Properties.Resources.SelectOneFile; }
public static void DrawNpc(RendererDestinationData destData, Map activeMap, Enums.MapID targetMapID, int npcSlot) { MapNpc npc = activeMap.MapNpcs[npcSlot]; if (npc != null && npc.Num > 0 && npc.ScreenActive) { SpriteRenderer.DrawSprite(destData, activeMap, targetMapID, npc); } }
public Hetman(Enums.Kolor_pionków kolor, int x, int y, bool ruch) { if (kolor == Enums.Kolor_pionków.Biale) { this.grafika = BasicBlue.Properties.Resources.HetmanWhite; this.kolor = Enums.Kolor_pionków.Biale; } else { this.grafika = BasicBlue.Properties.Resources.hetmanBlack; this.kolor = Enums.Kolor_pionków.Czarne; } this.pozycjaX = x; this.pozycjaY = y; this.zasieg = 8; this.punkty = 400;// Paweł Potera & Krzysztof Sakowicz this.litera = "Q"; this.bylRuch = ruch; kierunkiRuchu.Add(Enums.KierunekRuchu.Skos); kierunkiRuchu.Add(Enums.KierunekRuchu.Gora); kierunkiRuchu.Add(Enums.KierunekRuchu.Dol); kierunkiRuchu.Add(Enums.KierunekRuchu.Bok); kierunekBicia.Add(Enums.KierunekRuchu.Gora); kierunekBicia.Add(Enums.KierunekRuchu.Dol); kierunekBicia.Add(Enums.KierunekRuchu.Bok); kierunekBicia.Add(Enums.KierunekRuchu.Skos); }
public ManageFormResponse(Enums.ManageFormState responseCommand, string name, string picture, string newName) { Name = name; NewName = newName; Picture = picture; RespondCommand = responseCommand; }
public static int DetermineMissionExpRequirement(Enums.ExplorerRank rank) { switch (rank) { case Enums.ExplorerRank.Normal: return 0; case Enums.ExplorerRank.Bronze: return 100; case Enums.ExplorerRank.Silver: return 300; case Enums.ExplorerRank.Gold: return 1600; case Enums.ExplorerRank.Diamond: return 3200; case Enums.ExplorerRank.Super: return 5000; case Enums.ExplorerRank.Ultra: return 7500; case Enums.ExplorerRank.Hyper: return 10500; case Enums.ExplorerRank.Master: return 13500; case Enums.ExplorerRank.MasterX: return 17000; case Enums.ExplorerRank.MasterXX: return 21000; case Enums.ExplorerRank.MasterXXX: return 25000; case Enums.ExplorerRank.Guildmaster: return 100000; default: return -1; } }
public County CreateCounty(string name, Enums.Provinces province) { using (countyViewContext) { return countyViewContext.CreateCounty(name, province); } }
public bool Edit(Guid id, string description, bool active, Enums.StartType startType, string trigger, string className, out string message) { using (var conn = this.OpenConnection()) { string sql = @" UPDATE TOP(1) [Job] SET Description=@Description,Active=@Active,StartType=@StartType,ClassName=@ClassName,[Trigger]=@Trigger WHERE ID=@ID "; var para = new { ID = id, Description = description, Active = active, StartType = (byte)startType, Trigger = trigger, ClassName = className }; var rows = conn.Execute(sql, para); if (rows > 0) { message = null; return true; } else { message = "Job不存在"; return false; } } }
public static List<Photo> GetAllByFieldValue(string fieldName, Guid fieldValue, string fieldName2, Guid fieldValue2,Enums.ContextSubType ContextSubTypeId, Enums.PhotoCategory PhotoCategoryId) { List<Photo> returnEntityCollection = new List<Photo>(); Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand dbCommand = db.GetStoredProcCommand("usp_PhotoSelectAllBy" + fieldName2); db.AddInParameter(dbCommand, fieldName, DbType.Guid, fieldValue); db.AddInParameter(dbCommand, fieldName2, DbType.Guid, fieldValue2); db.AddInParameter(dbCommand, "ContextSubTypeId", DbType.Int32, (int)ContextSubTypeId); db.AddInParameter(dbCommand, "PhotoCategoryId", DbType.Int32, (int)PhotoCategoryId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { Photo entity = new Photo(); Utility.Generic.AssignDataReaderToEntity(dataReader, entity); returnEntityCollection.Add(entity); } } return returnEntityCollection; }
public GameRound(Player player, IEnumerable<Enums.Colors> choices, Enums.Colors answer) { _player = player; _date = DateTime.Now; _choices = convertFrom(choices); _answer = answer; }
public bool Move(BaseEntity entity, Enums.Intent action) { entity.OldY = entity.Y; entity.OldX = entity.X; switch (action) { case Infrastructure.Enums.Intent.Idle: break; case Infrastructure.Enums.Intent.MoveUp: entity.Y -= 1; break; case Infrastructure.Enums.Intent.MoveDown: entity.Y += 1; break; case Infrastructure.Enums.Intent.MoveRight: entity.X += 1; break; case Infrastructure.Enums.Intent.MoveLeft: entity.X -= 1; break; default: return false; } if (!IsLegal(entity.X, entity.Y)) { entity.X = entity.OldX; entity.Y = entity.OldY; return false; } return true; }
public Energy(int value, Enums.Element type, bool special, int BOGUS_ID) : base(BOGUS_ID) { this.value = value; this.type = type; this.special = special; }
public MailSend(Invoice invoice, Enums.MessageType type) { ID = 0; this.Invoice = invoice; MessageType = type; Status = Enums.MailStatus.WAITING; }
public bool Login( string username, string password, Enums.OnlineStatus onlineStatus = Enums.OnlineStatus.Online, Enums.DeviceType deviceType = Enums.DeviceType.Android) { try { Current = this; PacketManager.InitializeHandlers(); CommandManager.InitializeCommands(); Username = username; Password = password; OnlineStatus = onlineStatus; DeviceType = deviceType; _tcpClient = new TcpClient(_host, _port); Current = this; _networkStream = _tcpClient.GetStream(); SendPacket(PacketTemplates.Logon(Username, DeviceType)); _networkStream.BeginRead(_buffer, 0, _buffer.Length, ReadCallback, null); Console.WriteLine(_buffer.Length); return true; } catch (Exception a) { return false; } }
public List<RideHostSession> GetPostedRides(int inAmt_, Enums.SortRideBy inSortRideBy_, FacebookUser inFacebookUser_ = null) { if (inFacebookUser_ != null) return _rideManager.GetRideSessions(inFacebookUser_); else return _rideManager.GetRideSessions(inSortRideBy_, inAmt_); }
public static void DrawMapItem(RendererDestinationData destData, Map map, Enums.MapID targetMapID, int itemSlot) { Item item = ItemHelper.Items[map.MapItems[itemSlot].Num]; Rectangle cropRect = new Rectangle((item.Pic - (item.Pic / 6) * 6) * Constants.TILE_WIDTH, (item.Pic / 6) * Constants.TILE_HEIGHT, Constants.TILE_WIDTH, Constants.TILE_HEIGHT); int itemX= map.MapItems[itemSlot].X; int itemY = map.MapItems[itemSlot].Y; Renderers.Maps.SeamlessWorldHelper.ConvertCoordinatesToBorderless(map, targetMapID, ref itemX, ref itemY); Point dstPoint = new Point(ScreenRenderer.ToScreenX(itemX * Constants.TILE_WIDTH), ScreenRenderer.ToScreenY(itemY * Constants.TILE_HEIGHT)); //Surface itemSurface = new Surface(32,32); //itemSurface.Blit(Graphics.GraphicsManager.Items, cropRect); //if (darkness != null && !darkness.Disposed) { // Point darknessPoint = new Point(darkness.Buffer.Width / 2 + dstPoint.X - darkness.Focus.X, darkness.Buffer.Height / 2 + dstPoint.Y - darkness.Focus.Y); // Surface darknessSurface = new Surface(32, 32); // darknessSurface.Blit(darkness.Buffer, new Point(0, 0), new Rectangle(darknessPoint, new Size(Constants.TILE_WIDTH, Constants.TILE_HEIGHT))); //} //destData.Blit(itemSurface, dstPoint); destData.Blit(Graphics.GraphicsManager.Items, dstPoint, cropRect); }
/// <summary> /// Init fight with mobs /// </summary> public Fight(Fighter fighter1, Engines.Map.MonsterGroup monsters, Engines.MapEngine map, Enums.FightTypeEnum fightType = Enums.FightTypeEnum.PvM) { //Stop the bonus timer monsters.StopBonusTimer(); this.FightType = fightType; this.Map = map; this.ID = this.Map.GetActorAvailableID; this.RedTeam = new FightTeam(0, fighter1, this, false); this.BlueTeam = new FightTeam(1, new Fighter(-9, monsters.Leader, monsters), this, true); this.InitPlaces(); this.InitMontersGroup(monsters); this.InitTimeline(); this.PlacePlayer(fighter1); this.StartTime = Environment.TickCount; this.InitCheckFight(); if (FightType == Enums.FightTypeEnum.PvM) { this.StartTimer = new System.Timers.Timer(30000); this.StartTimer.Enabled = true; this.StartTimer.Elapsed += new System.Timers.ElapsedEventHandler(StartTimer_Elapsed); this.StartTimer.Start(); } }
public void PrepareModel(RiotApiConfig.Regions region, Enums.GameQueueType gameQueueType, LeaderboardModel model, List<LeagueDto.LeagueEntryDto> topEntries) { var ddragonVersions = _memoryCache.Get(CacheKeys.DataDragonVersionByRegionKey, DateTime.UtcNow.AddDays(1), () => _riotClient.LolStaticData.GetVersionData(region)); var summonerOrTeamIds = topEntries.Select(x => x.PlayerOrTeamId).ToArray(); var summonerCacheKey = string.Format(CacheKeys.SummonerByRegionAndIdCacheKey, region, summonerOrTeamIds); var summoners = _cacheManager.Get(summonerCacheKey, DateTime.UtcNow.AddDays(1), () => _riotClient.Summoner.GetSummonersById(region, summonerOrTeamIds)); model.LeagueEntryModels = new List<LeaderboardModel.SummonerEntryModel>(); foreach (var topEntry in topEntries) { LeaderboardModel.SummonerEntryModel summonerEntryModel = new LeaderboardModel.SummonerEntryModel(); summonerEntryModel.LeagueEntry = topEntry; if (gameQueueType == Enums.GameQueueType.RANKED_SOLO_5x5) { var summonerDto = summoners[topEntry.PlayerOrTeamId]; if (summonerDto != null) { summonerEntryModel.SummonerIcon = $"http://ddragon.leagueoflegends.com/cdn/{ddragonVersions.FirstOrDefault()}/img/profileicon/{summonerDto.ProfileIconId}.png"; } } model.LeagueEntryModels.Add(summonerEntryModel); } }
internal FacebookExtendedPermission(Uri loginUrl, Enums.Extended_Permissions permission, FacebookService service) : this() { _facebookService = service; _permission = permission; wbFacebookLogin.Navigate(loginUrl); }
public bool Add(Interfaces.IConquerItem item, Enums.ItemUse use) { try { if (item.Position < 20) { if (objects[item.Position - 1] == null) { objects[item.Position - 1] = item; item.Mode = Enums.ItemMode.Default; if (use != Enums.ItemUse.None) { UpdateItemview(item); EntityEquipment equips = new EntityEquipment(true); equips.ParseHero(Owner); Owner.Send(equips); item.Send(Owner); Owner.LoadItemStats(item); } return true; } else return false; } else return false; } catch { return false; } }
/// <summary> /// Constructor. Construct a mailaudit object based on a mailmessage object. /// </summary> /// <param name="mailMessage"></param> public EmailAudit(MailMessage mailMessage, Enums.MailCategory? category, int? relatedEntityID) { _mailAudit = new MailAudit(); // Copy data from the MailMessage object to the MailAudit object. _mailAudit.FromAddress = mailMessage.From.Address; _mailAudit.ToAddresses = MailAddressesToString(mailMessage.To); _mailAudit.CCAddresses = MailAddressesToString(mailMessage.CC); _mailAudit.BccAddresses = MailAddressesToString(mailMessage.Bcc); _mailAudit.Subject = mailMessage.Subject; _mailAudit.Body = mailMessage.Body; _mailAudit.isHtmlMail = mailMessage.IsBodyHtml; // Initialize the mailstatus to Unsent and set the creation date. _mailAudit.MailStatus = (int)Enums.MailStatus.Unsent; _mailAudit.DateCreated = System.DateTime.Now; // Set the mailcateogry and related entity (both can be null) if (category.HasValue) { _mailAudit.mailCategoryID = (int)category.Value; } if (relatedEntityID.HasValue) { _mailAudit.relatedEntityID = relatedEntityID.Value; } }
public static void ChangeDungeonCoords(Client client, Enums.Direction dir) { int dist = 1; int rand = Server.Math.Rand(1, 10000); if (rand <= 66) { //.66% chance warp exPlayer.Get(client).DungeonX = Server.Math.Rand(0, exPlayer.Get(client).DungeonMaxX-1); exPlayer.Get(client).DungeonY = Server.Math.Rand(0, exPlayer.Get(client).DungeonMaxY-1); return; } else if (rand <= 666) { //6% chance skip dist = 2; } if (dir == Enums.Direction.Up) { exPlayer.Get(client).DungeonY = exPlayer.Get(client).DungeonY - dist; if (exPlayer.Get(client).DungeonY < 0) { exPlayer.Get(client).DungeonY += exPlayer.Get(client).DungeonMaxY; } } else if (dir == Enums.Direction.Down) { exPlayer.Get(client).DungeonY = (exPlayer.Get(client).DungeonY + dist) % exPlayer.Get(client).DungeonMaxY; } else if (dir == Enums.Direction.Left) { exPlayer.Get(client).DungeonX = exPlayer.Get(client).DungeonX - dist; if (exPlayer.Get(client).DungeonX < 0) { exPlayer.Get(client).DungeonX += exPlayer.Get(client).DungeonMaxX; } } else if (dir == Enums.Direction.Right) { exPlayer.Get(client).DungeonX = (exPlayer.Get(client).DungeonX + dist) % exPlayer.Get(client).DungeonMaxX; } }
/// <summary> /// Writes message to console output. Maintains foreground color while applying a temporary color. Locks output to ensure color is applied (may be incorrect way to go about it) /// </summary> /// <param name="message"></param> /// <param name="includeDate"></param> /// <param name="includeTime"></param> /// <param name="type"></param> public static void Log(string message, bool includeDate = false, bool includeTime = false, Enums.LogType type = Enums.LogType.Normal) { lock (Console.Out) { ConsoleColor prevColor = Console.ForegroundColor; switch (type) { case Enums.LogType.Normal: Console.ForegroundColor = ConsoleColor.White; break; case Enums.LogType.Success: Console.ForegroundColor = ConsoleColor.Green; break; case Enums.LogType.Failure: Console.ForegroundColor = ConsoleColor.Red; break; } string dateTimeStr = ""; if (includeDate && includeTime) dateTimeStr = $"{DateTime.UtcNow}"; else if (includeDate) dateTimeStr = $"{DateTime.UtcNow.ToShortDateString()}"; else dateTimeStr = $"{DateTime.UtcNow.ToShortTimeString()}"; if (includeDate || includeTime) Console.WriteLine($"[TwitchLib - {dateTimeStr}] {message}"); else Console.WriteLine($"[TwitchLib] {message}"); Console.ForegroundColor = prevColor; } }
public byte[] GenerateGraph(string dotFile, Enums.GraphReturnType returnType) { byte[] output; if (!ConfigExists) _registerLayoutPlugincommand.Invoke(); string fileType = GetReturnType(returnType); var processStartInfo = GetProcessStartInfo(fileType); using (var process = _startProcessQuery.Invoke(processStartInfo)) { using (var stdIn = process.StandardInput) { stdIn.WriteLine(dotFile); } using (var stdOut = process.StandardOutput) { var baseStream = stdOut.BaseStream; output = ReadFully(baseStream); } } return output; }
public void PaintLazerValue(Enums.Lazer inLazer) { switch (inLazer) { case Enums.Lazer.LAZER_5: { pbL5.Visible = true; pbL20.Visible = false; pbL55.Visible = false; break; } case Enums.Lazer.LAZER_25: { pbL5.Visible = false; pbL20.Visible = true; pbL55.Visible = false; break; } case Enums.Lazer.LAZER_55: { pbL5.Visible = false; pbL20.Visible = false; pbL55.Visible = true; break; } } }
public static void AppendChangeWeatherAction(StoryBuilderSegment story, Enums.Weather weather) { StorySegment segment = new StorySegment(); segment.Action = Enums.StoryAction.ChangeWeather; segment.AddParameter("Weather", ((int)weather).ToString()); story.Segments.Add(segment); }
/// <summary> /// Collapses a range or selection to the starting or ending position. After a range or selection is collapsed, the starting and ending points are equal. /// </summary> /// <param name="direction">The direction in which to collapse the range or selection.</param> public void Collapse(Enums.CollapseDirection? direction = null) { List<object> args = new List<object>(); args.Add(direction ?? (object)System.Reflection.Missing.Value); InternalObject.GetType().InvokeMember("Collapse", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, args.ToArray()); }