• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Update类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Update的典型用法代码示例。如果您正苦于以下问题:C# Update类的具体用法?C# Update怎么用?C# Update使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Update类属于命名空间,在下文中一共展示了Update类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProcessUpdate

        static async void ProcessUpdate(TelegramBotClient bot, Update update, User me)
        {
            // Read Configuration
            var wundergroundKey = ConfigurationManager.AppSettings["WundergroundKey"];
            var bingKey = ConfigurationManager.AppSettings["BingKey"];
            var wolframAppId = ConfigurationManager.AppSettings["WolframAppID"];

            // Process Request
            try
            {
                var httpClient = new ProHttpClient();
                var text = update.Message.Text;
                var replyText = string.Empty;
                var replyTextMarkdown = string.Empty;
                var replyImage = string.Empty;
                var replyImageCaption = string.Empty;
                var replyDocument = string.Empty;

                if (text != null && (text.StartsWith("/", StringComparison.Ordinal) || text.StartsWith("!", StringComparison.Ordinal)))
                {
                    // Log to console
                    Console.WriteLine(update.Message.Chat.Id + " < " + update.Message.From.Username + " - " + text);

                    // Allow ! or /
                    if (text.StartsWith("!", StringComparison.Ordinal))
                    {
                        text = "/" + text.Substring(1);
                    }

                    // Strip @BotName
                    text = text.Replace("@" + me.Username, "");

                    // Parse
                    string command;
                    string body;
                    if (text.StartsWith("/s/", StringComparison.Ordinal))
                    {
                        command = "/s"; // special case for sed
                        body = text.Substring(2);
                    }
                    else
                    {
                        command = text.Split(' ')[0];
                        body = text.Replace(command, "").Trim();
                    }
                    var stringBuilder = new StringBuilder();

                    switch (command.ToLowerInvariant())
                    {
                        case "/beer":
                            if (body == string.Empty)
                            {
                                replyText = "Usage: /beer <Name of beer>";
                                break;
                            }

                            await bot.SendChatActionAsync(update.Message.Chat.Id, ChatAction.Typing);
                            var beerSearch = httpClient.DownloadString("http://www.beeradvocate.com/search/?q=" + HttpUtility.UrlEncode(body) + "&qt=beer").Result.Replace("\r", "").Replace("\n", "");

                            // Load First Result
                            var firstBeer = Regex.Match(beerSearch, @"<div id=""ba-content"">.*?<ul>.*?<li>.*?<a href=""(.*?)"">").Groups[1].Value.Trim();
                            if (firstBeer == string.Empty)
                            {
                                replyText = "The Great & Powerful Trixie was unable to find a beer name matching: " + body;
                                break;
                            }
                            var beer = httpClient.DownloadString("http://www.beeradvocate.com" + firstBeer).Result.Replace("\r", "").Replace("\n", "");
                            var beerName = Regex.Match(beer, @"<title>(.*?)</title>").Groups[1].Value.Replace(" | BeerAdvocate", string.Empty).Trim();
                            beer = Regex.Match(beer, @"<div id=""ba-content"">.*?<div>(.*?)<div style=""clear:both;"">").Groups[1].Value.Trim();
                            replyImage = Regex.Match(beer, @"img src=""(.*?)""").Groups[1].Value.Trim();
                            replyImageCaption = "http://www.beeradvocate.com" + firstBeer;
                            var beerScore = Regex.Match(beer, @"<span class=""BAscore_big ba-score"">(.*?)</span>").Groups[1].Value.Trim();
                            var beerScoreText = Regex.Match(beer, @"<span class=""ba-score_text"">(.*?)</span>").Groups[1].Value.Trim();
                            var beerbroScore = Regex.Match(beer, @"<span class=""BAscore_big ba-bro_score"">(.*?)</span>").Groups[1].Value.Trim();
                            var beerbroScoreText = Regex.Match(beer, @"<b class=""ba-bro_text"">(.*?)</b>").Groups[1].Value.Trim();
                            var beerHads = Regex.Match(beer, @"<span class=""ba-ratings"">(.*?)</span>").Groups[1].Value.Trim();
                            var beerAvg = Regex.Match(beer, @"<span class=""ba-ravg"">(.*?)</span>").Groups[1].Value.Trim();
                            var beerStyle = Regex.Match(beer, @"<b>Style:</b>.*?<b>(.*?)</b>").Groups[1].Value.Trim();
                            var beerAbv = beer.Substring(beer.IndexOf("(ABV):", StringComparison.Ordinal) + 10, 7).Trim();
                            var beerDescription = Regex.Match(beer, @"<b>Notes / Commercial Description:</b>(.*?)</div>").Groups[1].Value.Replace("|", "").Trim();
                            stringBuilder.Append(beerName.Replace("|", "- " + beerStyle + " by") + "\r\nScore: " + beerScore + " (" + beerScoreText + ") | Bros: " + beerbroScore + " (" + beerbroScoreText + ") | Avg: " + beerAvg + " (" + beerHads + " hads)\r\nABV: " + beerAbv + " | ");
                            stringBuilder.Append(HttpUtility.HtmlDecode(beerDescription).Replace("<br>"," ").Trim());
                            break;

                        case "/cat":
                            replyImage = "http://thecatapi.com/api/images/get?format=src&type=jpg,png";
                            break;

                        case "/doge":
                            replyImage = "http://dogr.io/wow/" + body.Replace(",", "/").Replace(" ", "") + ".png";
                            replyImageCaption = "wow";
                            break;

                        case "/echo":
                            replyText = body;
                            break;

                        case "/fat":
                            if (body == string.Empty)
                            {
//.........这里部分代码省略.........
开发者ID:ScottRFrost,项目名称:TelegramBot,代码行数:101,代码来源:Bot.cs


示例2: ChangeFormulaYear

 public string ChangeFormulaYear(string tableName,IList<FormulaYear> deleteItems, IList<FormulaYear> updateItems, IList<FormulaYear> insertItems)
 {
     try
     {
         foreach (var item in deleteItems)
         {
             Delete delete = new Delete(tableName);
             delete.AddCriterions("KeyID","myKeyID", item.KeyID, CriteriaOperator.Equal);
             delete.AddCriterions("ID","myID", item.ID, CriteriaOperator.Equal);
             delete.AddSqlOperator(SqlOperator.AND);
             dataFactory.Remove(delete);
         }
         foreach (var item in updateItems)
         {
             Update<FormulaYear> update = new Update<FormulaYear>(tableName, item);
             update.AddCriterion("KeyID", "myKeyID",item.KeyID, CriteriaOperator.Equal);
             update.AddCriterion("ID", "myID",item.ID, CriteriaOperator.Equal);
             update.AddSqlOperator(SqlOperator.AND);
             update.AddExcludeField("Id");
             dataFactory.Save<FormulaYear>(update);
         }
         foreach (var item in insertItems)
         {
             Insert<FormulaYear> insert = new Insert<FormulaYear>(tableName, item);
             insert.AddExcludeField("Id");
             dataFactory.Save<FormulaYear>(insert);
         }
     }
     catch
     {
         return "0";
     }
     return "1";
 }
开发者ID:nxjcproject,项目名称:nxjc,代码行数:34,代码来源:ReportDataHelper.cs


示例3: Equals

        public bool Equals(Update update)
        {
            bool results = false;

            if ((this.TopPatchId != null) && (update.TopPatchId != null))
            {
                if (this.TopPatchId.Equals(update.TopPatchId))
                {
                    results = true;
                }
            }
            else if ((this.VendorId != null) && (update.VendorId != null))
            {
                if ((this.VendorId.Equals(update.VendorId)) && (this.Name.Equals(update.Name)))
                {
                    results = true;
                }
            }
            else
            {
                if (this.Name.Equals(update.Name))
                {
                    results = true;
                }
            }

            return results;
        }
开发者ID:cengonurozkan,项目名称:vFenseAgent-win,代码行数:28,代码来源:Update.cs


示例4: SavePVFValues

 public void SavePVFValues(IList<PVFItem> inserted, IList<PVFItem> updated, IList<PVFItem> deleted)
 {
     using (TransactionScope scope = new TransactionScope())
     {
         foreach (var item in inserted)
         {
             Insert<PVFItem> insert = new Insert<PVFItem>("PeakValleyFlat", item);
             insert.AddExcludeField("ID");
             dataFactory.Save<PVFItem>(insert);
         }
         foreach (var item1 in updated)
         {
             Update<PVFItem> update = new Update<PVFItem>("PeakValleyFlat", item1);
             update.AddCriterion("ID", "ID", item1.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
             update.AddExcludeField("ID");
             dataFactory.Save<PVFItem>(update);
         }
         foreach (var item2 in deleted)
         {
             Delete delete = new Delete("PeakValleyFlat");
             delete.AddCriterions("ID", "ID",item2.ID, SqlServerDataAdapter.Infrastruction.CriteriaOperator.Equal);
             dataFactory.Remove(delete);
         }
         scope.Complete();
     }
 }
开发者ID:nxjcproject,项目名称:nxjcslim,代码行数:26,代码来源:PVFService.cs


示例5: Download

        public static string Download(Update update, Action<int> progressChanged)
        {
            var tmpFile = Path.GetTempFileName();

            var waiter = new ManualResetEvent(false);
            Exception ex = null;

            var wc = new WebClient();

            wc.DownloadProgressChanged += (sender, e) => progressChanged(e.ProgressPercentage);
            wc.DownloadFileCompleted += (sender, e) =>
            {
                ex = e.Error;
                waiter.Set();
            };

            wc.Headers.Add(HttpRequestHeader.UserAgent, "Azyotter.Updater v" + AssemblyUtil.GetInformationalVersion());
            wc.DownloadFileAsync(update.Uri, tmpFile);

            waiter.WaitOne();

            if (ex != null)
            {
                File.Delete(tmpFile);
                throw ex;
            }

            return tmpFile;
        }
开发者ID:azyobuzin,项目名称:Azyotter,代码行数:29,代码来源:UpdateCore.cs


示例6: MobileGame

 public MobileGame(AndroidContent.Context context, Setup setupDelegate, Update updateDelegate)
     : base(context)
 {
     window = new Window(this);
     this.setupDelegate = setupDelegate;
     this.updateDelegate = updateDelegate;
 }
开发者ID:aiv01,项目名称:aiv-fast2d,代码行数:7,代码来源:MobileGame.cs


示例7: UpdateWindow

 public UpdateWindow(Update update)
 {
     InitializeComponent();
     _update = update;
     updateInfolbl.Text = update.Name;
     TerminateYnoteProcess();
     PopulateUpdateFiles();
 }
开发者ID:samarjeet27,项目名称:ynoteclassic,代码行数:8,代码来源:UpdateWindow.cs


示例8: Update_SimpleSqlCheck

        public void Update_SimpleSqlCheck()
        {
            SubSonic.SqlQuery u = new Update(Product.Schema).Set("UnitPrice").EqualTo(100).Where("productid").IsEqualTo(1);
            string sql = u.BuildSqlStatement();
            //Assert.Fail("sql = " + sql);
            
            //Assert.IsTrue(sql == "UPDATE [dbo].[Products] SET [UnitPrice][email protected]_UnitPrice\r\n WHERE [dbo].[Products].[ProductID] = @ProductID0\r\n");

            Assert.IsTrue(sql == "UPDATE `main`.`Products` SET `UnitPrice`[email protected]_UnitPrice\r\n WHERE `main`.`Products`.`ProductID` = @ProductID0\r\n"); 

        }
开发者ID:howgoo,项目名称:SubSonic-2.0,代码行数:11,代码来源:UpdateTests.cs


示例9: HandleNew

        private void HandleNew(Update update)
        {
            Debug.Assert(update != null);

            if (update.Message == null)
                return;

            Console.WriteLine($" >{update.Message?.From.FirstName ?? "<no fname>"}: {update.Message.Text}");
            
            _pluginOne.Handle(new MessageContext { Update = update });
        }
开发者ID:etherealko,项目名称:Eve,代码行数:11,代码来源:EveBot.cs


示例10: ReleasePlayerTest

        public void ReleasePlayerTest(int playerID)
        {
            //Release Player to Free Agency
            var repo = new Update();
            repo.ReleasePlayer(playerID);

            //Get Free Agency players and check for released player
            var readRepo = new Read();
            var players = readRepo.GetFreeAgents();
            var player = players.FirstOrDefault(p => p.PlayerID == playerID);
            Assert.AreEqual(player.PlayerID, playerID);
        }
开发者ID:anti0xidant,项目名称:BaseballLeague,代码行数:12,代码来源:RepositoryTests.cs


示例11: Update_Simple

        public void Update_Simple()
        {
            int records = new Update(Product.Schema).Set("UnitPrice").EqualTo(100).Where("productid").IsEqualTo(1).Execute();
            Assert.IsTrue(records == 1);

            //pull it back out
            Product p = new Product(1);
            Assert.IsTrue(p.UnitPrice == 100);

            //reset it to 50
            p.UnitPrice = 50;
            p.Save("unit test");
        }
开发者ID:RyanDansie,项目名称:SubSonic-2.0,代码行数:13,代码来源:UpdateTests.cs


示例12: FrmGlobalStatus

        /// <summary>
        /// Generate the form, load configs, show initial settings if needed.
        /// </summary>
        /// <param name="configs">Strings passed on the commandline</param>
        public FrmGlobalStatus(string[] commands)
        {
            InitializeComponent();
            helper.UpdateSettings();

            // if this is the first start: show settings
            if (Properties.Settings.Default.firstStart)
            {
                Properties.Settings.Default.firstStart = false;
                Properties.Settings.Default.Save();
                ShowSettings(true);
            }

            ReadConfigs();

            niIcon.Icon = Properties.Resources.TRAY_Disconnected;

            bool checkupdate = false;
            TimeSpan ts = Properties.Settings.Default.lastUpdateCheck
                - DateTime.Now;

            if (Properties.Settings.Default.searchUpdate == 0 ||
               (ts.Days > 7 && Properties.Settings.Default.searchUpdate == 1) ||
               (ts.Days > 30 && Properties.Settings.Default.searchUpdate == 2))
            {
                checkupdate = true;
                Properties.Settings.Default.lastUpdateCheck = DateTime.Now;
                Properties.Settings.Default.Save();
            }

            if (checkupdate)
            {
                Update u = new Update(true, this);
                if (u.checkUpdate())
                {
                    niIcon.ShowBalloonTip(5000,
                        Program.res.GetString("QUICKINFO_Update"),
                        Program.res.GetString("QUICKINFO_Update_More"),
                        ToolTipIcon.Info);
                }
            }

            m_simpleComm.ReceivedLines += new
                EventHandler<SimpleComm.ReceivedLinesEventArgs>(
                m_simpleComm_ReceivedLines);

            parseCommandLine(commands);

            if(Properties.Settings.Default.allowRemoteControl)
                m_simpleComm.startServer();
        }
开发者ID:PiBa-NL,项目名称:openvpn-manager,代码行数:55,代码来源:FrmGlobalStatus.cs


示例13: OnLoad

 internal void OnLoad(EventArgs args)
 {
     this._menu= new Menu();
     this.spells=new Spells();
     this._update=new Update();
     this._draw=new Drawings();
     this.DmgIndicator=new DamageIndicator();
     DmgIndicator.Initialize(this);
     this.misc=new Misc();
     this.targetSelected = new MyTs();
     Gapcloser.OnGapcloser += this.OnGapCloser;
     EloBuddy.Game.OnUpdate += this.Onupdate;
     EloBuddy.Drawing.OnDraw += this.Ondraw;
 }
开发者ID:Teamkonohabuddy,项目名称:Elobbudy,代码行数:14,代码来源:EkkoCore.cs


示例14: UpdateProjectsInDB

        public static void UpdateProjectsInDB(List<ChildProject> cProjects)
        {
            var userConnection = TerrasoftApi.GetuserConnection();
            foreach (var item in cProjects)
            {

                Update update = new Update(userConnection, "Project")
                    .Set("StartDate", Column.Const(item.StartDate))
                    .Set("EndDate", Column.Const(item.EndDate))
                    .Where("Id").IsEqual(Column.Const(item.ChildId)) as Update;

                update.BuildParametersAsValue = true;

                using (var dbExecutor = userConnection.EnsureDBConnection())
                {
                    try
                    {
                        dbExecutor.StartTransaction();
                        var affectedRowsCount = update.Execute(dbExecutor);
                        dbExecutor.CommitTransaction();
                    }
                    catch (Exception ex)
                    {
                        dbExecutor.RollbackTransaction();
                    }
                }
            }

            var rootProjectId = cProjects[0].GetRootId();
            var endDate = cProjects.Last().EndDate;
            Update updateRoot = new Update(userConnection, "Project")
                    .Set("EndDate", Column.Const(endDate))
                    .Where("Id").IsEqual(Column.Const(rootProjectId)) as Update;

            updateRoot.BuildParametersAsValue = true;

            using (var dbExecutor = userConnection.EnsureDBConnection())
            {
                try
                {
                    dbExecutor.StartTransaction();
                    var affectedRowsCount = updateRoot.Execute(dbExecutor);
                    dbExecutor.CommitTransaction();
                }
                catch (Exception ex)
                {
                    dbExecutor.RollbackTransaction();
                }
            }
        }
开发者ID:vaaaaQ,项目名称:Fiscale-Project-Delivery-Forecast-,代码行数:50,代码来源:ProjectDeliveryForecast.cs


示例15: Main

        static void Main()
        {
            System.Diagnostics.Process.Start("D:\\Solicitação de Prontuarios\\Sistema de Solicitação de Prontuários\\pastaDTI.bat");

            Update updatando = new Update();
            updatando.up();

            if (updatando.Yn == true)
            {
                Environment.Exit(1);
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MenuUpa());
        }
开发者ID:vinidg,项目名称:sistema-solicitacao-prontuarios,代码行数:15,代码来源:Program.cs


示例16: Update

        public Task Update(Update value)
        {
            //Console.WriteLine("enter Update");

            WithConnection(
                c =>
                {


                    value.ExecuteNonQuery(c);
                }
            );

            return Task.FromResult(default(object));
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:15,代码来源:MyDevices.cs


示例17: UpdateForm

 public UpdateForm(Update.UpdateInfo updateinfo)
 {
     InitializeComponent();
     AddToUpdate("Update Version: " + updateinfo.UpdateVersion);
     string[] changeLog = updateinfo.UpdateText.Split('`');
     AddToUpdate("Changelog:");
     for (int i = 0; i < changeLog.Length; i++)
     {
         if (changeLog[i] == "")
         {
             AddToUpdate("");
             continue;
         }
         AddToUpdate("-" + changeLog[i]);
     }
 }
开发者ID:709881059,项目名称:party-buffalo,代码行数:16,代码来源:UpdateForm.cs


示例18: CheckOperators

        public Update CheckOperators(string version)
        {
            Update upd = new Update();
            
            if (Singleton.Instance.LatestVersion == version)
            {
                upd.UpToDate = true;
            }
            else
            {               
                upd.UpToDate = false;
                upd.OperatorList = Singleton.Instance.GatewayTable.Keys.ToArray<string>();
                upd.NewVersion = Singleton.Instance.LatestVersion;
            }

            return upd;
        }
开发者ID:oblivious,项目名称:Oblivious,代码行数:17,代码来源:BalanceClient.cs


示例19: Acc_Update_Expression

        public void Acc_Update_Expression()
        {
            Product p = new Product(1);
            p.UnitPrice = 50;
            p.Save("unit test");

            int records = new Update(Product.Schema)
                .SetExpression("UnitPrice").EqualTo("UnitPrice * 3")
                .Where("productid").IsEqualTo(1)
                .Execute();
            Assert.IsTrue(records == 1);

            //pull it back out
            p = new Product(1);
            Assert.IsTrue(p.UnitPrice == 150);

            //reset it to 50
            p.UnitPrice = 50;
            p.Save("unit test");
        }
开发者ID:bnewland1958,项目名称:SubSonic,代码行数:20,代码来源:UpdateTests.cs


示例20: CheckOperators

        public Update CheckOperators(string version)
        {
            Update upd = new Update();          

            switch (version)
            {
                case "V07051430":
                    upd.NewVersion = DateTime.Now.ToString(Settings.VERSION_PATTERN);
                    upd.OperatorList = new string[] { "SmartBelize", "CubacelCuba", "MobitelSriLanka" };
                    upd.UpToDate = false;
                    break;
                case "V06071434":
                    upd.UpToDate = true;
                    break;
                case "V05061020":
                    upd.NewVersion = DateTime.Now.ToString(Settings.VERSION_PATTERN);
                    upd.OperatorList = new string[] { "SmartBelize", "CubacelCuba", "OrangeDominicanRepublic" };
                    upd.UpToDate = false;
                    break;
            }

            return upd;
        }
开发者ID:oblivious,项目名称:Oblivious,代码行数:23,代码来源:MockClient.cs



注:本文中的Update类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UpdateCommand类代码示例发布时间:2022-05-24
下一篇:
C# UnturnedPlayer类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap