public int Create(Announces announce) { using (SqlCommand commander = new SqlCommand("SP_create_announce", connection)) { commander.CommandType = CommandType.StoredProcedure; commander.Parameters.AddWithValue("Name", announce.Name); commander.Parameters.AddWithValue("SubName", announce.SubName); commander.Parameters.AddWithValue("Desc", announce.Desc); commander.Parameters.AddWithValue("UserID", announce.UserID); commander.Parameters.AddWithValue("StartDate", announce.StartDate); commander.Parameters.AddWithValue("EndDate", announce.EndDate); commander.Parameters.AddWithValue("Vues", announce.Vues); commander.Parameters.AddWithValue("UserValid", announce.UserValid); commander.Parameters.AddWithValue("AdminValid", announce.AdminValid); commander.Parameters.AddWithValue("CreateDate", announce.CreateDate); commander.Parameters.AddWithValue("AddressPays", announce.AddressPays); commander.Parameters.AddWithValue("AddressVille", announce.AddressVille); commander.Parameters.AddWithValue("AddressRue", announce.AddressRue); commander.Parameters.AddWithValue("AddressCodePostal", announce.AddressCodePostal); commander.Parameters.AddWithValue("AddressNumero", announce.AddressNumero); int NewAnnID = (int)commander.ExecuteScalar(); return(NewAnnID); //on peux passer au mtm de tout le reste } }
public ContentItem(Announces a) { Titel = a.Title; Caption = a.Description; date = DateTimeHelper.GetDateString(a.RegDate, a.RegTime); if (a.SeenInfo == null) { GreenNote = string.Empty; RedNote = "جدید"; } else { GreenNote = "دیده شده در "; var inf = JsonConvert.DeserializeObject <SeenInformation>(a.SeenInfo); RedNote = DateTimeHelper.GetDateString(inf.VisitDate, inf.VisitTime); } Def = a.AnnounceID.ToString(); if (a.FileName == string.Empty) { Link = ""; } else { Link = StaticData.DownloadannouncesURL + a.FileName; } LinkTitel = "فایل پیوست"; Image = ImageType.Motif; ClearNull(); }
public Announce(Game game, long eventTime, Announces id, bool isMapSpecific) { IsAnnounced = false; EventTime = eventTime; _messageId = id; _isMapSpecific = isMapSpecific; _game = game; }
async Task Announce(ITracker tracker, TorrentEvent clientEvent) { if (ResponseDelay != TimeSpan.Zero) { await Task.Delay(ResponseDelay); } Announces.Add(Tuple.Create(tracker, clientEvent)); }
async ReusableTask AnnounceAsync(ITracker tracker, TorrentEvent clientEvent, CancellationToken token) { if (ResponseDelay != TimeSpan.Zero) { await Task.Delay(ResponseDelay); } Announces.Add(Tuple.Create(tracker, clientEvent)); }
public Announce(Announces messageId, int mapId = 0) : base(PacketCmd.PKT_S2C_Announce) { buffer.Write((byte)messageId); buffer.Write((long)0); if (mapId > 0) { buffer.Write(mapId); } }
public Announce(Announces messageId, int mapId = 0) : base(PacketCmd.PKT_S2C_ANNOUNCE) { Write((byte)messageId); Write((long)0); if (mapId > 0) { Write((int)mapId); } }
public Announces Get(int AnnID) { Announces GetAnnounces = new Announces(); using (SqlCommand commander = new SqlCommand("SP_get_announce_by_AnnID", connection)) { commander.CommandType = CommandType.StoredProcedure; commander.Parameters.AddWithValue("AnnID", AnnID); using (SqlDataReader reader = commander.ExecuteReader()) { if (reader.Read()) { GetAnnounces.AnnID = (int)reader["AnnID"]; GetAnnounces.Name = reader["Name"] == DBNull.Value ? string.Empty : (string)reader["Name"]; GetAnnounces.SubName = reader["SubName"] == DBNull.Value ? string.Empty : (string)reader["SubName"]; GetAnnounces.Desc = reader["Desc"] == DBNull.Value ? string.Empty : (string)reader["Desc"]; GetAnnounces.UserID = reader["UserID"] == DBNull.Value ? 0 : (int)reader["UserID"]; GetAnnounces.StartDate = reader["StartDate"] == DBNull.Value ? DateTime.Now : (DateTime)reader["StartDate"]; GetAnnounces.EndDate = reader["EndDate"] == DBNull.Value ? DateTime.Now : (DateTime)reader["EndDate"]; GetAnnounces.Vues = reader["Vues"] == DBNull.Value ? 0 : (int)reader["Vues"]; GetAnnounces.UserValid = reader["UserValid"] == DBNull.Value ? false : (bool)reader["UserValid"]; GetAnnounces.AdminValid = reader["AdminValid"] == DBNull.Value ? false : (bool)reader["AdminValid"]; GetAnnounces.CreateDate = reader["CreateDate"] == DBNull.Value ? DateTime.Now : (DateTime)reader["CreateDate"]; GetAnnounces.AddressPays = reader["AddressPays"] == DBNull.Value ? string.Empty : (string)reader["AddressPays"]; GetAnnounces.AddressVille = reader["AddressVille"] == DBNull.Value ? string.Empty : (string)reader["AddressVille"]; GetAnnounces.AddressCodePostal = reader["AddressCodePostal"] == DBNull.Value ? string.Empty : (string)reader["AddressCodePostal"]; GetAnnounces.AddressRue = reader["AddressRue"] == DBNull.Value ? string.Empty : (string)reader["AddressRue"]; GetAnnounces.AddressNumero = reader["AddressNumero"] == DBNull.Value ? string.Empty : (string)reader["AddressNumero"]; } } } GetAnnounces.ListSport = GetSport(AnnID); GetAnnounces.ListActivity = GetActivity(AnnID); GetAnnounces.ListCommoditer = GetCommoditer(AnnID); GetAnnounces.ListTypeHoliday = GetTypeHoliday(AnnID); GetAnnounces.TypeHabitat = GetTypeHabitat(AnnID); return(GetAnnounces); }
public Metainfo(byte[] data, Encoding encoding) { Protocol = encoding.GetBytes("BitTorrent protocol"); _encoding = encoding; _bencoder = new Bencoder(); var metainfoDict = (Dictionary <string, object>)_bencoder.DecodeElement(data); var infoDict = (Dictionary <string, object>)metainfoDict[InfoDictionaryKey]; PieceLength = (int)infoDict[PieceLengthKey]; PiecesHash = (byte[])infoDict[PiecesKey]; InfoHash = CalcInfoHashBytes(infoDict); Nodes = GetNodes(metainfoDict); Announces = GetAnnounces(metainfoDict); if (metainfoDict.ContainsKey(AnnounceKey)) { Announces.Add(_bencoder.Encoding.GetString((byte[])metainfoDict[AnnounceKey])); } Files = GetFiles(infoDict); TotalLength = CalcTotalLength(Files); PiecesCount = (int)Math.Ceiling((double)(TotalLength / PieceLength)); }
public void Update(Announces announce) { using (SqlCommand commander = new SqlCommand("SP_update_announce", connection)) { commander.CommandType = CommandType.StoredProcedure; commander.Parameters.AddWithValue("AnnID", announce.AnnID); commander.Parameters.AddWithValue("Name", announce.Name); commander.Parameters.AddWithValue("SubName", announce.SubName); commander.Parameters.AddWithValue("Desc", announce.Desc); commander.Parameters.AddWithValue("StartDate", announce.StartDate); commander.Parameters.AddWithValue("EndDate", announce.EndDate); commander.Parameters.AddWithValue("AddressPays", announce.AddressPays); commander.Parameters.AddWithValue("AddressVille", announce.AddressVille); commander.Parameters.AddWithValue("AddressRue", announce.AddressRue); commander.Parameters.AddWithValue("AddressCodePostal", announce.AddressCodePostal); commander.Parameters.AddWithValue("AddressNumero", announce.AddressNumero); commander.ExecuteNonQuery(); } }
public void GetPeers(string path) { try { Peers.Clear(); Announces.Clear(); Files.Clear(); AddMessage("Attempting to open torrent file."); torrent = new TorrentTransfer(path); PieceLength = torrent.Data.PieceLength; PieceCount = torrent.Data.Checksums.Count; Name = torrent.Data.Name; Hash = BitConverter.ToString(torrent.Data.InfoHash).Replace("-", string.Empty); PieceLength = torrent.Data.PieceLength; AnnounceURL = torrent.Data.AnnounceURL; torrent.Data.Files.ForEach(f => Files.Add(f)); if (torrent.Data.AnnounceList != null) { torrent.Data.AnnounceList.ForEach(a => Announces.Add(a)); } filesSize = 0; foreach (var file in files) { filesSize += file.Length; } totalSize = Global.Instance.FileSizeFormat(filesSize); torrent.RaisedException += torrent_RaisedException; torrent.ReportStats += torrent_ReportStatsChanged; torrent.StateChanged += torrent_StateChanged; torrent.Start(); } catch (Exception e) { HandleException(e); System.Windows.MessageBox.Show("Damn: " + e); } }
public void notifyAnnounceEvent(Announces messageId, bool isMapSpecific) { var announce = new Announce(messageId, isMapSpecific ? _game.Map.GetMapId() : 0); _game.PacketHandlerManager.broadcastPacket(announce, Channel.CHL_S2C); }
internal void Tick() { Announces.Tick(); Scrapes.Tick(); }
internal void AnnounceReceived() => Announces.AddDelta(1);
public AnnounceEventResponse(int mapId, Announces messageId, bool isMapSpecific) { MapId = mapId; MessageId = messageId; IsMapSpecific = isMapSpecific; }
public void NotifyAnnounceEvent(int mapId, Announces messageId, bool isMapSpecific) { var announce = new Announce(messageId, isMapSpecific ? mapId : 0); _packetHandlerManager.BroadcastPacket(announce, Channel.CHL_S2C); }
Task Announce(ITracker tracker, TorrentEvent clientEvent) { Announces.Add(Tuple.Create(tracker, clientEvent)); return(Task.CompletedTask); }