public void Reset() { m_file = null; m_command = m_connection.CreateCommand(); m_command.CommandText = string.Format(@"SELECT ""{0}"".""TargetPath"", ""Blockset"".""FullHash"", ""{0}"".""ID"", ""Blockset"".""Length"", ""Block"".""Hash"", ""BlocksetEntry"".""Index"", ""Block"".""Size"" FROM ""{0}"", ""Blockset"", ""BlocksetEntry"", ""Block"" WHERE ""{0}"".""BlocksetID"" = ""Blockset"".""ID"" AND ""BlocksetEntry"".""BlocksetID"" = ""{0}"".""BlocksetID"" AND ""BlocksetEntry"".""BlockID"" = ""Block"".""ID"" ORDER BY ""{0}"".""TargetPath"", ""BlocksetEntry"".""Index""", m_tablename); m_reader = m_command.ExecuteReader(); m_file = new ExistingFile(m_reader); m_current = null; }
public void SendPhotoAsUrlTest() { ExistingFile existing = new ExistingFile { Url = "https://proglib.io/wp-content/uploads/2017/07/telegram-bot-na-Python-s-ispolzovaniem-tolko-requests.jpg" }; SendMessageResult sendMessage = mTelegramBot.SendPhoto("@telebotTestChannel", existing); Assert.AreEqual("AgADBAADEsg4GwoeZAcwyq9C0fVhKANXvRkABDMpTvt2GGzZ-2UEAAEC", sendMessage.Result.Photo[0].FileId); }
public void SendPhotoAsFileIdTest() { ExistingFile existing = new ExistingFile { FileId = "AgADAgADaagxG-_buUmX76y6cGpluPA7Sw0ABJFnmSfjBBfrk5QPAAEC" }; SendMessageResult sendMessage = mTelegramBot.SendPhoto("@telebotTestChannel", existing); Console.WriteLine(sendMessage.Result.Photo[0].FileId); Assert.AreEqual("AgADAgADaagxG-_buUmX76y6cGpluPA7Sw0ABJFnmSfjBBfrk5QPAAEC", sendMessage.Result.Photo[0].FileId); }
public static IEnumerable<IExistingFile> GetExistingFilesWithBlocks(System.Data.IDbConnection connection, string tablename) { using(var cmd = connection.CreateCommand()) { cmd.CommandText = string.Format(@"SELECT ""{0}"".""TargetPath"", ""Blockset"".""FullHash"", ""{0}"".""ID"", ""Blockset"".""Length"", ""Block"".""Hash"", ""BlocksetEntry"".""Index"", ""Block"".""Size"" FROM ""{0}"", ""Blockset"", ""BlocksetEntry"", ""Block"" WHERE ""{0}"".""BlocksetID"" = ""Blockset"".""ID"" AND ""BlocksetEntry"".""BlocksetID"" = ""{0}"".""BlocksetID"" AND ""BlocksetEntry"".""BlockID"" = ""Block"".""ID"" ORDER BY ""{0}"".""TargetPath"", ""BlocksetEntry"".""Index""", tablename); using(var rd = cmd.ExecuteReader()) if (rd.Read()) { var more = true; while(more) { var f = new ExistingFile(rd); string current = f.TargetPath; yield return f; more = f.HasMore; while (more && current == f.TargetPath) more = rd.Read(); } } } }
public ExistingFileBlockEnumerator(System.Data.IDataReader reader, ExistingFile file) { m_reader = reader; m_file = file; this.Reset(); }
public ExistingFileBlockEnumerable(System.Data.IDataReader reader, ExistingFile file) { m_reader = reader; m_file = file; }