当前位置: 首页>>代码示例>>C#>>正文


C# Deck.GetDeckInfo方法代码示例

本文整理汇总了C#中Hearthstone_Deck_Tracker.Hearthstone.Deck.GetDeckInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Deck.GetDeckInfo方法的具体用法?C# Deck.GetDeckInfo怎么用?C# Deck.GetDeckInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hearthstone_Deck_Tracker.Hearthstone.Deck的用法示例。


在下文中一共展示了Deck.GetDeckInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Export

		public static async Task<bool> Export(Deck deck)
		{
			if(deck == null)
				return false;
			var currentClipboard = "";
			var altScreenCapture = Config.Instance.AlternativeScreenCapture;
			try
			{
				Log.Info("Exporting " + deck.GetDeckInfo());
				if(Config.Instance.ExportPasteClipboard && Clipboard.ContainsText())
					currentClipboard = Clipboard.GetText();

				var info = new ExportingInfo();
				LogDebugInfo(info);

				var inForeground = await ExportingHelper.EnsureHearthstoneInForeground(info.HsHandle);
				if(!inForeground)
					return false;
				Log.Info($"Waiting for {Config.Instance.ExportStartDelay} seconds before starting the export process");
				await Task.Delay(Config.Instance.ExportStartDelay * 1000);
				if(!altScreenCapture)
					Core.Overlay.ForceHide(true);

				await ClearDeck(info);
				await SetDeckName(deck, info);
				await ClearFilters(info);
				var lostFocus = await CreateDeck(deck, info);
				if(lostFocus)
					return false;
				await ClearSearchBox(info.HsHandle, info.SearchBoxPos);

				if(Config.Instance.ExportPasteClipboard)
					Clipboard.Clear();
				Log.Info("Success exporting deck.");
				return true;
			}
			catch(Exception e)
			{
				Log.Error("Error exporting deck: " + e);
				return false;
			}
			finally
			{
				if(!altScreenCapture)
					Core.Overlay.ForceHide(false);
				try
				{
					if(Config.Instance.ExportPasteClipboard && currentClipboard != "")
						Clipboard.SetText(currentClipboard);
				}
				catch(Exception ex)
				{
					Log.Error("Could not restore clipboard content after export: " + ex);
				}
			}
		}
开发者ID:ChuckJrster,项目名称:Hearthstone-Deck-Tracker,代码行数:56,代码来源:DeckExporter.cs

示例2: Export

		public static async Task<bool> Export(Deck deck, Func<Task<bool>> onInterrupt)
		{
			if(deck == null)
				return false;
			var currentClipboard = "";
			try
			{
				Log.Info("Exporting " + deck.GetDeckInfo());
				if(Config.Instance.ExportPasteClipboard && Clipboard.ContainsText())
					currentClipboard = Clipboard.GetText();
				var info = new ExportingInfo();
				LogDebugInfo(info);
				info = await ExportingHelper.EnsureHearthstoneInForeground(info);
				if(info == null)
					return false;
				LogDebugInfo(info);
				Log.Info($"Waiting for {Config.Instance.ExportStartDelay} seconds before starting the export process");
				await Task.Delay(Config.Instance.ExportStartDelay*1000);
				var exporter = new ExportingActions(info, deck, onInterrupt);
				await exporter.ClearDeck();
				await exporter.SetDeckName();
				await exporter.ClearFilters();
				await exporter.CreateDeck();
				await exporter.ClearSearchBox();
				if(Config.Instance.ExportPasteClipboard)
					Clipboard.Clear();
				Log.Info("Success exporting deck.");
				return true;
			}
			catch(ExportingInterruptedException e)
			{
				Log.Warn(e.Message);
				return false;
			}
			catch(Exception e)
			{
				Log.Error("Error exporting deck: " + e);
				return false;
			}
			finally
			{
				try
				{
					if(Config.Instance.ExportPasteClipboard && currentClipboard != "")
						Clipboard.SetText(currentClipboard);
				}
				catch(Exception ex)
				{
					Log.Error("Could not restore clipboard content after export: " + ex);
				}
			}
		}
开发者ID:irufus,项目名称:Hearthstone-Deck-Tracker,代码行数:52,代码来源:DeckExporter.cs

示例3: Export

		public static async Task Export(Deck deck)
		{
			if(deck == null)
				return;
			var currentClipboard = "";
			try
			{
				Logger.WriteLine("Exporting " + deck.GetDeckInfo(), "DeckExporter");
				if(Config.Instance.ExportPasteClipboard && Clipboard.ContainsText())
					currentClipboard = Clipboard.GetText();

				var info = new ExportingInfo();
				LogDebugInfo(info);

				var inForeground = await ExportingHelper.EnsureHearthstoneInForeground(info.HsHandle);
				if(!inForeground)
					return;
				Logger.WriteLine($"Waiting for {Config.Instance.ExportStartDelay} seconds before starting the export process", "DeckExporter");
				await Task.Delay(Config.Instance.ExportStartDelay * 1000);
				Core.Overlay.ForceHide(true);

				await ClearDeck(info);
				await SetDeckName(deck, info);
				await ClearFilters(info);
				var lostFocus = await CreateDeck(deck, info);
				if(lostFocus)
					return;
				await ClearSearchBox(info.HsHandle, info.SearchBoxPos);

				if(Config.Instance.ExportPasteClipboard)
					Clipboard.Clear();
				Logger.WriteLine("Success exporting deck.", "DeckExporter");
			}
			catch(Exception e)
			{
				Logger.WriteLine("Error exporting deck: " + e, "DeckExporter");
			}
			finally
			{
				Core.Overlay.ForceHide(false);
				if(Config.Instance.ExportPasteClipboard && currentClipboard != "")
					Clipboard.SetText(currentClipboard);
			}
		}
开发者ID:Rob2K2,项目名称:Hearthstone-Deck-Tracker,代码行数:44,代码来源:DeckExporter.cs

示例4: Export

		public static async Task Export(Deck deck)
		{
			if(deck == null)
				return;
			string Current_Clipboard = "";

			try
			{
				if(Config.Instance.ExportPasteClipboard && Clipboard.ContainsText())
					Current_Clipboard = Clipboard.GetText();
				Logger.WriteLine(string.Format("Exporting " + deck.GetDeckInfo()), "DeckExporter");
				var hsHandle = User32.GetHearthstoneWindow();

				if(!User32.IsHearthstoneInForeground())
				{
					//restore window and bring to foreground
					User32.ShowWindow(hsHandle, User32.SwRestore);
					User32.SetForegroundWindow(hsHandle);
					//wait it to actually be in foreground, else the rect might be wrong
					await Task.Delay(500);
				}
				if(!User32.IsHearthstoneInForeground())
				{
					MessageBox.Show("Can't find Hearthstone window.");
					Logger.WriteLine("Can't find Hearthstone window.", "DeckExporter");
					return;
				}

				Logger.WriteLine("Waiting for " + Config.Instance.ExportStartDelay + " seconds before starting the export process", "DeckExporter");
				await Task.Delay(Config.Instance.ExportStartDelay * 1000);

				var hsRect = User32.GetHearthstoneRect(false);
				var ratio = (4.0 / 3.0) / ((double)hsRect.Width / hsRect.Height);

				var searchBoxPos = new Point((int)(GetXPos(Config.Instance.ExportSearchBoxX, hsRect.Width, ratio)),
				                             (int)(Config.Instance.ExportSearchBoxY * hsRect.Height));
				var cardPosX = GetXPos(Config.Instance.ExportCard1X, hsRect.Width, ratio);
				var card2PosX = GetXPos(Config.Instance.ExportCard2X, hsRect.Width, ratio);
				var cardPosY = Config.Instance.ExportCardsY * hsRect.Height;


				Helper.MainWindow.Overlay.ForceHidden = true;
				Helper.MainWindow.Overlay.UpdatePosition();

				if(Config.Instance.AutoClearDeck)
					await ClearDeck(hsRect.Width, hsRect.Height, hsHandle, ratio);

				if(Config.Instance.ExportSetDeckName && !deck.TagList.ToLower().Contains("brawl"))
					await SetDeckName(deck.Name, ratio, hsRect.Width, hsRect.Height, hsHandle);

				await ClickAllCrystal(ratio, hsRect.Width, hsRect.Height, hsHandle);

				Logger.WriteLine("Creating deck...", "DeckExporter");
				deck.MissingCards.Clear();
				foreach(var card in deck.Cards)
				{
					var missingCardsCount =
						await AddCardToDeck(card, searchBoxPos, cardPosX, card2PosX, cardPosY, hsRect.Height, hsRect.Width, hsHandle);
					if(missingCardsCount < 0)
						return;
					if(missingCardsCount > 0)
					{
						var missingCard = (Card)card.Clone();
						missingCard.Count = missingCardsCount;
						deck.MissingCards.Add(missingCard);
					}
				}

				if(deck.MissingCards.Any())
					DeckList.Save();

				// Clear search field now all cards have been entered

				await ClickOnPoint(hsHandle, searchBoxPos);
				SendKeys.SendWait("{DELETE}");
				SendKeys.SendWait("{ENTER}");

				if(Config.Instance.ExportPasteClipboard)
					Clipboard.Clear();

				Logger.WriteLine("Done creating deck.", "DeckExporter");
			}
			catch(Exception e)
			{
				Logger.WriteLine("Error exporting deck: " + e, "DeckExporter");
			}
			finally
			{
				Helper.MainWindow.Overlay.ForceHidden = false;
				Helper.MainWindow.Overlay.UpdatePosition();
				if(Config.Instance.ExportPasteClipboard && Current_Clipboard != "")
					Clipboard.SetText(Current_Clipboard);
			}
		}
开发者ID:Jarraximus,项目名称:Hearthstone-Deck-Tracker,代码行数:94,代码来源:DeckExporter.cs


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