mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-09-14 10:32:10 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
82a2455afc | |||
268de676ee | |||
8fe26c07f1 | |||
da3921b1ca | |||
4dd2e787d1 | |||
ce005ae6c2 | |||
1513f46a11 | |||
7543eeb0f4 | |||
873242120c | |||
98f8095a65 | |||
785571a550 | |||
0c4bd4044e | |||
0319543dce | |||
82d70b2d7f | |||
62d18e010a | |||
fc77b85083 | |||
50a8893f4f | |||
9252b3040e | |||
d5141ed020 | |||
7ff9e23283 | |||
89854d527c | |||
6ff0cad2a8 |
@@ -12,9 +12,9 @@ using TweetDck.Plugins;
|
||||
namespace TweetDck.Configuration{
|
||||
[Serializable]
|
||||
sealed class UserConfig{
|
||||
private static readonly IFormatter Formatter = new BinaryFormatter();
|
||||
private static readonly IFormatter Formatter = new BinaryFormatter{ Binder = new CustomBinder() };
|
||||
|
||||
private const int CurrentFileVersion = 5;
|
||||
private const int CurrentFileVersion = 6;
|
||||
|
||||
// START OF CONFIGURATION
|
||||
|
||||
@@ -22,16 +22,15 @@ namespace TweetDck.Configuration{
|
||||
public bool DisplayNotificationTimer { get; set; }
|
||||
public bool NotificationTimerCountDown { get; set; }
|
||||
|
||||
public TweetNotification.Duration NotificationDuration { get; set; }
|
||||
public TweetNotification.Position NotificationPosition { get; set; }
|
||||
public Point CustomNotificationPosition { get; set; }
|
||||
public int NotificationEdgeDistance { get; set; }
|
||||
public int NotificationDisplay { get; set; }
|
||||
public int NotificationDurationValue { get; set; }
|
||||
public bool NotificationLegacyLoad { get; set; }
|
||||
|
||||
public bool EnableSpellCheck { get; set; }
|
||||
public bool ExpandLinksOnHover { get; set; }
|
||||
public bool ShowScreenshotBorder { get; set; }
|
||||
public bool EnableTrayHighlight { get; set; }
|
||||
|
||||
public bool EnableUpdateCheck { get; set; }
|
||||
@@ -113,13 +112,13 @@ namespace TweetDck.Configuration{
|
||||
|
||||
BrowserWindow = new WindowState();
|
||||
DisplayNotificationTimer = true;
|
||||
NotificationDuration = TweetNotification.Duration.Medium;
|
||||
NotificationPosition = TweetNotification.Position.TopRight;
|
||||
CustomNotificationPosition = ControlExtensions.InvisibleLocation;
|
||||
NotificationEdgeDistance = 8;
|
||||
NotificationDurationValue = 25;
|
||||
EnableUpdateCheck = true;
|
||||
ExpandLinksOnHover = true;
|
||||
ShowScreenshotBorder = true;
|
||||
EnableTrayHighlight = true;
|
||||
Plugins = new PluginConfig();
|
||||
PluginsWindow = new WindowState();
|
||||
@@ -154,14 +153,7 @@ namespace TweetDck.Configuration{
|
||||
|
||||
if (fileVersion == 3){
|
||||
EnableTrayHighlight = true;
|
||||
|
||||
switch(NotificationDuration){
|
||||
case TweetNotification.Duration.Short: NotificationDurationValue = 15; break;
|
||||
case TweetNotification.Duration.Medium: NotificationDurationValue = 25; break;
|
||||
case TweetNotification.Duration.Long: NotificationDurationValue = 35; break;
|
||||
case TweetNotification.Duration.VeryLong: NotificationDurationValue = 45; break;
|
||||
}
|
||||
|
||||
NotificationDurationValue = 25;
|
||||
++fileVersion;
|
||||
}
|
||||
|
||||
@@ -171,6 +163,11 @@ namespace TweetDck.Configuration{
|
||||
++fileVersion;
|
||||
}
|
||||
|
||||
if (fileVersion == 5){
|
||||
ShowScreenshotBorder = true;
|
||||
++fileVersion;
|
||||
}
|
||||
|
||||
// update the version
|
||||
fileVersion = CurrentFileVersion;
|
||||
Save();
|
||||
@@ -241,5 +238,15 @@ namespace TweetDck.Configuration{
|
||||
public static string GetBackupFile(string file){
|
||||
return file+".bak";
|
||||
}
|
||||
|
||||
private sealed class CustomBinder : SerializationBinder{
|
||||
public override Type BindToType(string assemblyName, string typeName){
|
||||
if (typeName == "TweetDck.Core.Handling.TweetNotification+Position"){
|
||||
return typeof(TweetNotification.Position);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -117,12 +117,6 @@ namespace TweetDck.Core.Bridge{
|
||||
});
|
||||
}
|
||||
|
||||
public void OnNotificationReady(){
|
||||
if (!Program.UserConfig.NotificationLegacyLoad){
|
||||
notification.InvokeSafe(notification.OnNotificationReady);
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayTooltip(string text, bool showInNotification){
|
||||
if (showInNotification){
|
||||
notification.InvokeSafe(() => notification.DisplayTooltip(text));
|
||||
@@ -172,6 +166,10 @@ namespace TweetDck.Core.Bridge{
|
||||
form.InvokeSafe(() => form.OnTweetScreenshotReady(html, width, height));
|
||||
}
|
||||
|
||||
public void FixClipboard(){
|
||||
form.InvokeSafe(WindowsUtils.ClipboardStripHtmlStyles);
|
||||
}
|
||||
|
||||
public void OpenBrowser(string url){
|
||||
BrowserUtils.OpenExternalBrowser(url);
|
||||
}
|
||||
|
7
Core/FormNotification.Designer.cs
generated
7
Core/FormNotification.Designer.cs
generated
@@ -30,6 +30,7 @@ namespace TweetDck.Core {
|
||||
this.timerProgress = new System.Windows.Forms.Timer(this.components);
|
||||
this.progressBarTimer = new TweetDck.Core.Controls.FlatProgressBar();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.timerDisplayDelay = new System.Windows.Forms.Timer(this.components);
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panelBrowser
|
||||
@@ -61,6 +62,11 @@ namespace TweetDck.Core {
|
||||
this.progressBarTimer.Size = new System.Drawing.Size(284, 4);
|
||||
this.progressBarTimer.TabIndex = 1;
|
||||
//
|
||||
// timerDisplayDelay
|
||||
//
|
||||
this.timerDisplayDelay.Interval = 17;
|
||||
this.timerDisplayDelay.Tick += new System.EventHandler(this.timerDisplayDelay_Tick);
|
||||
//
|
||||
// FormNotification
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@@ -88,5 +94,6 @@ namespace TweetDck.Core {
|
||||
private Controls.FlatProgressBar progressBarTimer;
|
||||
private System.Windows.Forms.Timer timerProgress;
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.Timer timerDisplayDelay;
|
||||
}
|
||||
}
|
@@ -85,7 +85,6 @@ namespace TweetDck.Core{
|
||||
public string CurrentQuotedTweetUrl { get; set; }
|
||||
|
||||
public EventHandler Initialized;
|
||||
private bool isInitialized;
|
||||
|
||||
private int pauseCounter;
|
||||
private bool pausedDuringNotification;
|
||||
@@ -129,6 +128,7 @@ namespace TweetDck.Core{
|
||||
#endif
|
||||
|
||||
browser.IsBrowserInitializedChanged += Browser_IsBrowserInitializedChanged;
|
||||
browser.LoadingStateChanged += Browser_LoadingStateChanged;
|
||||
browser.FrameLoadEnd += Browser_FrameLoadEnd;
|
||||
|
||||
if (!flags.HasFlag(NotificationFlags.DisableScripts)){
|
||||
@@ -194,6 +194,11 @@ namespace TweetDck.Core{
|
||||
|
||||
// event handlers
|
||||
|
||||
private void timerDisplayDelay_Tick(object sender, EventArgs e){
|
||||
OnNotificationReady();
|
||||
timerDisplayDelay.Stop();
|
||||
}
|
||||
|
||||
private void timerHideProgress_Tick(object sender, EventArgs e){
|
||||
if (Bounds.Contains(Cursor.Position) || FreezeTimer || ContextMenuOpen)return;
|
||||
|
||||
@@ -222,17 +227,17 @@ namespace TweetDck.Core{
|
||||
}
|
||||
}
|
||||
|
||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
if (!e.Frame.IsMain)return;
|
||||
|
||||
if (!isInitialized && !Program.UserConfig.NotificationLegacyLoad){
|
||||
isInitialized = true;
|
||||
|
||||
if (Initialized != null){
|
||||
Initialized(this, new EventArgs());
|
||||
}
|
||||
private void Browser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e){
|
||||
if (!e.IsLoading && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.ManualDisplay)){
|
||||
this.InvokeSafe(() => {
|
||||
Visible = true; // ensures repaint before moving the window to a visible location
|
||||
timerDisplayDelay.Start();
|
||||
});
|
||||
}
|
||||
else if (notificationJS != null && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.DisableScripts)){
|
||||
}
|
||||
|
||||
private void Browser_FrameLoadEnd(object sender, FrameLoadEndEventArgs e){
|
||||
if (e.Frame.IsMain && notificationJS != null && browser.Address != "about:blank" && !flags.HasFlag(NotificationFlags.DisableScripts)){
|
||||
ScriptLoader.ExecuteScript(e.Frame, notificationJS, NotificationScriptIdentifier);
|
||||
|
||||
if (plugins != null && plugins.HasAnyPlugin(PluginEnvironment.Notification)){
|
||||
@@ -282,7 +287,7 @@ namespace TweetDck.Core{
|
||||
}
|
||||
|
||||
public void HideNotification(bool loadBlank){
|
||||
if (loadBlank || Program.UserConfig.NotificationLegacyLoad){
|
||||
if (loadBlank){
|
||||
browser.LoadHtml("", "about:blank");
|
||||
}
|
||||
|
||||
@@ -294,12 +299,6 @@ namespace TweetDck.Core{
|
||||
StopMouseHook();
|
||||
}
|
||||
|
||||
public void OnNotificationReady(){
|
||||
UpdateTitle();
|
||||
PrepareAndDisplayWindow();
|
||||
timerProgress.Start();
|
||||
}
|
||||
|
||||
public void FinishCurrentTweet(){
|
||||
if (tweetQueue.Count > 0){
|
||||
LoadNextNotification();
|
||||
@@ -350,10 +349,6 @@ namespace TweetDck.Core{
|
||||
string bodyClasses = browser.Bounds.Contains(PointToClient(Cursor.Position)) ? "td-hover" : string.Empty;
|
||||
|
||||
browser.LoadHtml(tweet.GenerateHtml(bodyClasses), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
||||
|
||||
if (Program.UserConfig.NotificationLegacyLoad){
|
||||
OnNotificationReady();
|
||||
}
|
||||
}
|
||||
|
||||
private void PrepareAndDisplayWindow(){
|
||||
@@ -427,6 +422,12 @@ namespace TweetDck.Core{
|
||||
Text = tweetQueue.Count > 0 ? Program.BrandName+" ("+tweetQueue.Count+" more left)" : Program.BrandName;
|
||||
}
|
||||
|
||||
protected void OnNotificationReady(){
|
||||
UpdateTitle();
|
||||
PrepareAndDisplayWindow();
|
||||
timerProgress.Start();
|
||||
}
|
||||
|
||||
public void DisplayTooltip(string text){
|
||||
if (string.IsNullOrEmpty(text)){
|
||||
toolTip.Hide(this);
|
||||
|
@@ -3,6 +3,7 @@ using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
@@ -21,6 +22,12 @@ namespace TweetDck.Core.Handling{
|
||||
}
|
||||
#endif
|
||||
|
||||
private readonly Form form;
|
||||
|
||||
protected ContextMenuBase(Form form){
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser browser, IFrame frame, IContextMenuParams parameters, IMenuModel model){
|
||||
if (parameters.TypeFlags.HasFlag(ContextMenuType.Link) && !parameters.UnfilteredLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
|
||||
model.AddItem((CefMenuCommand)MenuOpenLinkUrl, "Open link in browser");
|
||||
@@ -43,7 +50,7 @@ namespace TweetDck.Core.Handling{
|
||||
break;
|
||||
|
||||
case MenuCopyLinkUrl:
|
||||
Clipboard.SetText(string.IsNullOrEmpty(TweetDeckBridge.LastRightClickedLink) ? parameters.UnfilteredLinkUrl : TweetDeckBridge.LastRightClickedLink, TextDataFormat.UnicodeText);
|
||||
SetClipboardText(string.IsNullOrEmpty(TweetDeckBridge.LastRightClickedLink) ? parameters.UnfilteredLinkUrl : TweetDeckBridge.LastRightClickedLink);
|
||||
break;
|
||||
|
||||
case MenuOpenImage:
|
||||
@@ -74,7 +81,7 @@ namespace TweetDck.Core.Handling{
|
||||
break;
|
||||
|
||||
case MenuCopyImageUrl:
|
||||
Clipboard.SetText(parameters.SourceUrl, TextDataFormat.UnicodeText);
|
||||
SetClipboardText(parameters.SourceUrl);
|
||||
break;
|
||||
|
||||
#if DEBUG
|
||||
@@ -93,6 +100,10 @@ namespace TweetDck.Core.Handling{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void SetClipboardText(string text){
|
||||
form.InvokeSafe(() => WindowsUtils.SetClipboard(text, TextDataFormat.UnicodeText));
|
||||
}
|
||||
|
||||
protected static void RemoveSeparatorIfLast(IMenuModel model){
|
||||
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
|
||||
model.RemoveAt(model.Count-1);
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using CefSharp;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Bridge;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
@@ -23,7 +22,7 @@ namespace TweetDck.Core.Handling{
|
||||
private string lastHighlightedTweet;
|
||||
private string lastHighlightedQuotedTweet;
|
||||
|
||||
public ContextMenuBrowser(FormBrowser form){
|
||||
public ContextMenuBrowser(FormBrowser form) : base(form){
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
@@ -114,7 +113,7 @@ namespace TweetDck.Core.Handling{
|
||||
return true;
|
||||
|
||||
case MenuCopyTweetUrl:
|
||||
Clipboard.SetText(lastHighlightedTweet, TextDataFormat.UnicodeText);
|
||||
SetClipboardText(lastHighlightedTweet);
|
||||
return true;
|
||||
|
||||
case MenuScreenshotTweet:
|
||||
@@ -126,7 +125,7 @@ namespace TweetDck.Core.Handling{
|
||||
return true;
|
||||
|
||||
case MenuCopyQuotedTweetUrl:
|
||||
Clipboard.SetText(lastHighlightedQuotedTweet, TextDataFormat.UnicodeText);
|
||||
SetClipboardText(lastHighlightedQuotedTweet);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
using System.Windows.Forms;
|
||||
using CefSharp;
|
||||
using CefSharp;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Handling{
|
||||
class ContextMenuNotification : ContextMenuBase{
|
||||
@@ -12,7 +12,7 @@ namespace TweetDck.Core.Handling{
|
||||
private readonly FormNotification form;
|
||||
private readonly bool enableCustomMenu;
|
||||
|
||||
public ContextMenuNotification(FormNotification form, bool enableCustomMenu){
|
||||
public ContextMenuNotification(FormNotification form, bool enableCustomMenu) : base(form){
|
||||
this.form = form;
|
||||
this.enableCustomMenu = enableCustomMenu;
|
||||
}
|
||||
@@ -62,11 +62,11 @@ namespace TweetDck.Core.Handling{
|
||||
return true;
|
||||
|
||||
case MenuCopyTweetUrl:
|
||||
Clipboard.SetText(form.CurrentUrl, TextDataFormat.UnicodeText);
|
||||
SetClipboardText(form.CurrentUrl);
|
||||
return true;
|
||||
|
||||
case MenuCopyQuotedTweetUrl:
|
||||
Clipboard.SetText(form.CurrentQuotedTweetUrl, TextDataFormat.UnicodeText);
|
||||
SetClipboardText(form.CurrentQuotedTweetUrl);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ namespace TweetDck.Core.Notification{
|
||||
AutoHide = 1,
|
||||
DisableScripts = 2,
|
||||
DisableContextMenu = 4,
|
||||
TopMost = 8
|
||||
TopMost = 8,
|
||||
ManualDisplay = 16
|
||||
}
|
||||
}
|
||||
|
@@ -7,11 +7,7 @@ using TweetDck.Resources;
|
||||
|
||||
namespace TweetDck.Core.Notification.Screenshot{
|
||||
sealed class FormNotificationScreenshotable : FormNotification{
|
||||
public FormNotificationScreenshotable(FormBrowser owner, NotificationFlags flags) : base(owner, null, flags){
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public void PrepareNotificationForScreenshot(Action callback){
|
||||
public FormNotificationScreenshotable(Action callback, FormBrowser owner, NotificationFlags flags) : base(owner, null, flags){
|
||||
browser.RegisterAsyncJsObject("$TD_NotificationScreenshot", new CallbackBridge(this, callback));
|
||||
|
||||
browser.FrameLoadEnd += (sender, args) => {
|
||||
@@ -19,12 +15,16 @@ namespace TweetDck.Core.Notification.Screenshot{
|
||||
ScriptLoader.ExecuteScript(args.Frame, "window.setTimeout(() => $TD_NotificationScreenshot.trigger(), 25)", "gen:screenshot");
|
||||
}
|
||||
};
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public void LoadNotificationForScreenshot(TweetNotification tweet, int width, int height){
|
||||
browser.LoadHtml(tweet.GenerateHtml(enableCustomCSS: false), "http://tweetdeck.twitter.com/?"+DateTime.Now.Ticks);
|
||||
|
||||
Location = ControlExtensions.InvisibleLocation;
|
||||
FormBorderStyle = Program.UserConfig.ShowScreenshotBorder ? FormBorderStyle.FixedToolWindow : FormBorderStyle.None;
|
||||
|
||||
SetNotificationSize(width, height, false);
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDck.Core.Controls;
|
||||
using TweetDck.Core.Utils;
|
||||
|
||||
namespace TweetDck.Core.Notification.Screenshot{
|
||||
@@ -13,12 +11,10 @@ namespace TweetDck.Core.Notification.Screenshot{
|
||||
public TweetScreenshotManager(FormBrowser browser){
|
||||
this.browser = browser;
|
||||
|
||||
this.screenshot = new FormNotificationScreenshotable(browser, NotificationFlags.DisableScripts | NotificationFlags.DisableContextMenu | NotificationFlags.TopMost){
|
||||
this.screenshot = new FormNotificationScreenshotable(Callback, browser, NotificationFlags.DisableScripts | NotificationFlags.DisableContextMenu | NotificationFlags.TopMost | NotificationFlags.ManualDisplay){
|
||||
CanMoveWindow = () => false
|
||||
};
|
||||
|
||||
this.screenshot.PrepareNotificationForScreenshot(Callback);
|
||||
|
||||
this.timeout = WindowsUtils.CreateSingleTickTimer(10000);
|
||||
this.timeout.Tick += (sender, args) => screenshot.Reset();
|
||||
}
|
||||
|
@@ -59,10 +59,6 @@ namespace TweetDck.Core.Notification{
|
||||
TopLeft, TopRight, BottomLeft, BottomRight, Custom
|
||||
}
|
||||
|
||||
public enum Duration{
|
||||
Short, Medium, Long, VeryLong
|
||||
}
|
||||
|
||||
public string Url{
|
||||
get{
|
||||
return url;
|
||||
|
@@ -121,8 +121,11 @@ namespace TweetDck.Core.Other.Settings.Export{
|
||||
|
||||
public void WriteToFile(string path, bool createDirectory){
|
||||
if (createDirectory){
|
||||
// ReSharper disable once AssignNullToNotNullAttribute
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path));
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
|
||||
if (!string.IsNullOrEmpty(dir)){
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
}
|
||||
|
||||
File.WriteAllBytes(path, contents);
|
||||
|
19
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
19
Core/Other/Settings/TabSettingsGeneral.Designer.cs
generated
@@ -29,6 +29,7 @@
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.checkTrayHighlight = new System.Windows.Forms.CheckBox();
|
||||
this.checkSpellCheck = new System.Windows.Forms.CheckBox();
|
||||
this.checkScreenshotBorder = new System.Windows.Forms.CheckBox();
|
||||
this.groupTray = new System.Windows.Forms.GroupBox();
|
||||
this.labelTrayIcon = new System.Windows.Forms.Label();
|
||||
this.groupInterface = new System.Windows.Forms.GroupBox();
|
||||
@@ -87,12 +88,24 @@
|
||||
this.checkSpellCheck.UseVisualStyleBackColor = true;
|
||||
this.checkSpellCheck.CheckedChanged += new System.EventHandler(this.checkSpellCheck_CheckedChanged);
|
||||
//
|
||||
// checkScreenshotBorder
|
||||
//
|
||||
this.checkScreenshotBorder.AutoSize = true;
|
||||
this.checkScreenshotBorder.Location = new System.Drawing.Point(9, 67);
|
||||
this.checkScreenshotBorder.Name = "checkScreenshotBorder";
|
||||
this.checkScreenshotBorder.Size = new System.Drawing.Size(169, 17);
|
||||
this.checkScreenshotBorder.TabIndex = 16;
|
||||
this.checkScreenshotBorder.Text = "Include Border In Screenshots";
|
||||
this.toolTip.SetToolTip(this.checkScreenshotBorder, "Shows the window border in tweet screenshots.");
|
||||
this.checkScreenshotBorder.UseVisualStyleBackColor = true;
|
||||
this.checkScreenshotBorder.CheckedChanged += new System.EventHandler(this.checkScreenshotBorder_CheckedChanged);
|
||||
//
|
||||
// groupTray
|
||||
//
|
||||
this.groupTray.Controls.Add(this.checkTrayHighlight);
|
||||
this.groupTray.Controls.Add(this.labelTrayIcon);
|
||||
this.groupTray.Controls.Add(this.comboBoxTrayType);
|
||||
this.groupTray.Location = new System.Drawing.Point(9, 86);
|
||||
this.groupTray.Location = new System.Drawing.Point(9, 109);
|
||||
this.groupTray.Name = "groupTray";
|
||||
this.groupTray.Size = new System.Drawing.Size(183, 93);
|
||||
this.groupTray.TabIndex = 15;
|
||||
@@ -111,11 +124,12 @@
|
||||
//
|
||||
// groupInterface
|
||||
//
|
||||
this.groupInterface.Controls.Add(this.checkScreenshotBorder);
|
||||
this.groupInterface.Controls.Add(this.checkSpellCheck);
|
||||
this.groupInterface.Controls.Add(this.checkExpandLinks);
|
||||
this.groupInterface.Location = new System.Drawing.Point(9, 9);
|
||||
this.groupInterface.Name = "groupInterface";
|
||||
this.groupInterface.Size = new System.Drawing.Size(183, 71);
|
||||
this.groupInterface.Size = new System.Drawing.Size(183, 90);
|
||||
this.groupInterface.TabIndex = 16;
|
||||
this.groupInterface.TabStop = false;
|
||||
this.groupInterface.Text = "User Interface";
|
||||
@@ -146,5 +160,6 @@
|
||||
private System.Windows.Forms.Label labelTrayIcon;
|
||||
private System.Windows.Forms.CheckBox checkTrayHighlight;
|
||||
private System.Windows.Forms.CheckBox checkSpellCheck;
|
||||
private System.Windows.Forms.CheckBox checkScreenshotBorder;
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ namespace TweetDck.Core.Other.Settings{
|
||||
|
||||
checkExpandLinks.Checked = Config.ExpandLinksOnHover;
|
||||
checkSpellCheck.Checked = Config.EnableSpellCheck;
|
||||
checkScreenshotBorder.Checked = Config.ShowScreenshotBorder;
|
||||
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
|
||||
}
|
||||
|
||||
@@ -30,6 +31,12 @@ namespace TweetDck.Core.Other.Settings{
|
||||
PromptRestart();
|
||||
}
|
||||
|
||||
private void checkScreenshotBorder_CheckedChanged(object sender, EventArgs e){
|
||||
if (!Ready)return;
|
||||
|
||||
Config.ShowScreenshotBorder = checkScreenshotBorder.Checked;
|
||||
}
|
||||
|
||||
private void comboBoxTrayType_SelectedIndexChanged(object sender, EventArgs e){
|
||||
if (!Ready)return;
|
||||
|
||||
|
@@ -44,13 +44,12 @@
|
||||
this.trackBarDuration = new System.Windows.Forms.TrackBar();
|
||||
this.groupUserInterface = new System.Windows.Forms.GroupBox();
|
||||
this.checkTimerCountDown = new System.Windows.Forms.CheckBox();
|
||||
this.checkLegacyLoad = new System.Windows.Forms.CheckBox();
|
||||
this.checkNotificationTimer = new System.Windows.Forms.CheckBox();
|
||||
this.toolTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.groupCustomSound = new System.Windows.Forms.GroupBox();
|
||||
this.tbCustomSound = new System.Windows.Forms.TextBox();
|
||||
this.btnBrowseSound = new System.Windows.Forms.Button();
|
||||
this.btnResetSound = new System.Windows.Forms.Button();
|
||||
this.btnBrowseSound = new System.Windows.Forms.Button();
|
||||
this.tbCustomSound = new System.Windows.Forms.TextBox();
|
||||
this.groupNotificationLocation.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.trackBarEdgeDistance)).BeginInit();
|
||||
this.groupNotificationDuration.SuspendLayout();
|
||||
@@ -204,7 +203,7 @@
|
||||
this.groupNotificationDuration.Controls.Add(this.tableLayoutDurationButtons);
|
||||
this.groupNotificationDuration.Controls.Add(this.labelDurationValue);
|
||||
this.groupNotificationDuration.Controls.Add(this.trackBarDuration);
|
||||
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 106);
|
||||
this.groupNotificationDuration.Location = new System.Drawing.Point(9, 83);
|
||||
this.groupNotificationDuration.Name = "groupNotificationDuration";
|
||||
this.groupNotificationDuration.Size = new System.Drawing.Size(183, 89);
|
||||
this.groupNotificationDuration.TabIndex = 9;
|
||||
@@ -307,11 +306,10 @@
|
||||
// groupUserInterface
|
||||
//
|
||||
this.groupUserInterface.Controls.Add(this.checkTimerCountDown);
|
||||
this.groupUserInterface.Controls.Add(this.checkLegacyLoad);
|
||||
this.groupUserInterface.Controls.Add(this.checkNotificationTimer);
|
||||
this.groupUserInterface.Location = new System.Drawing.Point(9, 9);
|
||||
this.groupUserInterface.Name = "groupUserInterface";
|
||||
this.groupUserInterface.Size = new System.Drawing.Size(183, 91);
|
||||
this.groupUserInterface.Size = new System.Drawing.Size(183, 68);
|
||||
this.groupUserInterface.TabIndex = 10;
|
||||
this.groupUserInterface.TabStop = false;
|
||||
this.groupUserInterface.Text = "General";
|
||||
@@ -328,19 +326,6 @@
|
||||
this.checkTimerCountDown.UseVisualStyleBackColor = true;
|
||||
this.checkTimerCountDown.CheckedChanged += new System.EventHandler(this.checkTimerCountDown_CheckedChanged);
|
||||
//
|
||||
// checkLegacyLoad
|
||||
//
|
||||
this.checkLegacyLoad.AutoSize = true;
|
||||
this.checkLegacyLoad.Location = new System.Drawing.Point(6, 67);
|
||||
this.checkLegacyLoad.Name = "checkLegacyLoad";
|
||||
this.checkLegacyLoad.Size = new System.Drawing.Size(139, 17);
|
||||
this.checkLegacyLoad.TabIndex = 5;
|
||||
this.checkLegacyLoad.Text = "Legacy Loading System";
|
||||
this.toolTip.SetToolTip(this.checkLegacyLoad, "Try enabling if notifications do not display.\r\nMight cause delays and visual arti" +
|
||||
"facts.");
|
||||
this.checkLegacyLoad.UseVisualStyleBackColor = true;
|
||||
this.checkLegacyLoad.CheckedChanged += new System.EventHandler(this.checkLegacyLoad_CheckedChanged);
|
||||
//
|
||||
// checkNotificationTimer
|
||||
//
|
||||
this.checkNotificationTimer.AutoSize = true;
|
||||
@@ -359,19 +344,24 @@
|
||||
this.groupCustomSound.Controls.Add(this.btnResetSound);
|
||||
this.groupCustomSound.Controls.Add(this.btnBrowseSound);
|
||||
this.groupCustomSound.Controls.Add(this.tbCustomSound);
|
||||
this.groupCustomSound.Location = new System.Drawing.Point(9, 201);
|
||||
this.groupCustomSound.Location = new System.Drawing.Point(9, 178);
|
||||
this.groupCustomSound.Name = "groupCustomSound";
|
||||
this.groupCustomSound.Size = new System.Drawing.Size(183, 72);
|
||||
this.groupCustomSound.TabIndex = 11;
|
||||
this.groupCustomSound.TabStop = false;
|
||||
this.groupCustomSound.Text = "Custom Sound";
|
||||
//
|
||||
// tbCustomSound
|
||||
// btnResetSound
|
||||
//
|
||||
this.tbCustomSound.Location = new System.Drawing.Point(6, 19);
|
||||
this.tbCustomSound.Name = "tbCustomSound";
|
||||
this.tbCustomSound.Size = new System.Drawing.Size(170, 20);
|
||||
this.tbCustomSound.TabIndex = 0;
|
||||
this.btnResetSound.AutoSize = true;
|
||||
this.btnResetSound.Location = new System.Drawing.Point(126, 43);
|
||||
this.btnResetSound.Name = "btnResetSound";
|
||||
this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.btnResetSound.Size = new System.Drawing.Size(51, 23);
|
||||
this.btnResetSound.TabIndex = 2;
|
||||
this.btnResetSound.Text = "Reset";
|
||||
this.btnResetSound.UseVisualStyleBackColor = true;
|
||||
this.btnResetSound.Click += new System.EventHandler(this.btnResetSound_Click);
|
||||
//
|
||||
// btnBrowseSound
|
||||
//
|
||||
@@ -385,17 +375,12 @@
|
||||
this.btnBrowseSound.UseVisualStyleBackColor = true;
|
||||
this.btnBrowseSound.Click += new System.EventHandler(this.btnBrowseSound_Click);
|
||||
//
|
||||
// btnResetSound
|
||||
// tbCustomSound
|
||||
//
|
||||
this.btnResetSound.AutoSize = true;
|
||||
this.btnResetSound.Location = new System.Drawing.Point(126, 43);
|
||||
this.btnResetSound.Name = "btnResetSound";
|
||||
this.btnResetSound.Padding = new System.Windows.Forms.Padding(3, 0, 3, 0);
|
||||
this.btnResetSound.Size = new System.Drawing.Size(51, 23);
|
||||
this.btnResetSound.TabIndex = 2;
|
||||
this.btnResetSound.Text = "Reset";
|
||||
this.btnResetSound.UseVisualStyleBackColor = true;
|
||||
this.btnResetSound.Click += new System.EventHandler(this.btnResetSound_Click);
|
||||
this.tbCustomSound.Location = new System.Drawing.Point(6, 19);
|
||||
this.tbCustomSound.Name = "tbCustomSound";
|
||||
this.tbCustomSound.Size = new System.Drawing.Size(170, 20);
|
||||
this.tbCustomSound.TabIndex = 0;
|
||||
//
|
||||
// TabSettingsNotifications
|
||||
//
|
||||
@@ -440,7 +425,6 @@
|
||||
private System.Windows.Forms.CheckBox checkNotificationTimer;
|
||||
private System.Windows.Forms.ToolTip toolTip;
|
||||
private System.Windows.Forms.Label labelEdgeDistanceValue;
|
||||
private System.Windows.Forms.CheckBox checkLegacyLoad;
|
||||
private System.Windows.Forms.CheckBox checkTimerCountDown;
|
||||
private System.Windows.Forms.Label labelDurationValue;
|
||||
private System.Windows.Forms.TrackBar trackBarDuration;
|
||||
|
@@ -54,7 +54,6 @@ namespace TweetDck.Core.Other.Settings{
|
||||
checkNotificationTimer.Checked = Config.DisplayNotificationTimer;
|
||||
checkTimerCountDown.Enabled = checkNotificationTimer.Checked;
|
||||
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
|
||||
checkLegacyLoad.Checked = Config.NotificationLegacyLoad;
|
||||
|
||||
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
|
||||
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value.ToString(CultureInfo.InvariantCulture)+" px";
|
||||
@@ -153,12 +152,6 @@ namespace TweetDck.Core.Other.Settings{
|
||||
notification.ShowNotificationForSettings(true);
|
||||
}
|
||||
|
||||
private void checkLegacyLoad_CheckedChanged(object sender, EventArgs e){
|
||||
if (!Ready)return;
|
||||
|
||||
Config.NotificationLegacyLoad = checkLegacyLoad.Checked;
|
||||
}
|
||||
|
||||
private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
|
||||
if (!Ready)return;
|
||||
|
||||
|
@@ -105,7 +105,7 @@ namespace TweetDck.Core.Utils{
|
||||
build.Append(kvp.Key).Append(" \"").Append(kvp.Value).Append("\" ");
|
||||
}
|
||||
|
||||
return build.Remove(build.Length-1, 1).ToString();
|
||||
return build.Length == 0 ? string.Empty : build.Remove(build.Length-1, 1).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -24,13 +24,26 @@ namespace TweetDck.Core.Utils{
|
||||
Left, Right
|
||||
}
|
||||
|
||||
private struct LASTINPUTINFO{
|
||||
public static readonly uint Size = (uint)Marshal.SizeOf(typeof(LASTINPUTINFO));
|
||||
|
||||
// ReSharper disable once NotAccessedField.Local
|
||||
public uint cbSize;
|
||||
#pragma warning disable 649
|
||||
public uint dwTime;
|
||||
#pragma warning restore 649
|
||||
}
|
||||
|
||||
public delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
|
||||
public static extern bool SetWindowPos(int hWnd, int hWndOrder, int x, int y, int width, int height, uint flags);
|
||||
private static extern bool SetWindowPos(int hWnd, int hWndOrder, int x, int y, int width, int height, uint flags);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
|
||||
private static extern void mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool GetLastInputInfo(ref LASTINPUTINFO info);
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, IntPtr lParam);
|
||||
@@ -75,5 +88,23 @@ namespace TweetDck.Core.Utils{
|
||||
mouse_event(flagHold, Cursor.Position.X, Cursor.Position.Y, 0, 0);
|
||||
mouse_event(flagRelease, Cursor.Position.X, Cursor.Position.Y, 0, 0);
|
||||
}
|
||||
|
||||
public static int GetIdleSeconds(){
|
||||
LASTINPUTINFO info = new LASTINPUTINFO();
|
||||
info.cbSize = LASTINPUTINFO.Size;
|
||||
|
||||
if (!GetLastInputInfo(ref info)){
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint ticks;
|
||||
|
||||
unchecked{
|
||||
ticks = (uint)Environment.TickCount;
|
||||
}
|
||||
|
||||
int seconds = (int)Math.Floor(TimeSpan.FromMilliseconds(ticks-info.dwTime).TotalSeconds);
|
||||
return Math.Max(0, seconds); // ignore rollover after several weeks of uptime
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,14 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDck.Core.Utils{
|
||||
static class WindowsUtils{
|
||||
private static readonly Regex RegexStripHtmlStyles = new Regex(@"\s?(?:style|class)="".*?""");
|
||||
private static readonly Regex RegexOffsetClipboardHtml = new Regex(@"(?<=EndHTML:|EndFragment:)(\d+)");
|
||||
|
||||
public static bool CheckFolderWritePermission(string path){
|
||||
string testFile = Path.Combine(path, ".test");
|
||||
|
||||
@@ -39,5 +44,42 @@ namespace TweetDck.Core.Utils{
|
||||
timer.Tick += (sender, args) => timer.Stop();
|
||||
return timer;
|
||||
}
|
||||
|
||||
public static void ClipboardStripHtmlStyles(){
|
||||
if (!Clipboard.ContainsText(TextDataFormat.Html)){
|
||||
return;
|
||||
}
|
||||
|
||||
string originalText = Clipboard.GetText(TextDataFormat.UnicodeText);
|
||||
string originalHtml = Clipboard.GetText(TextDataFormat.Html);
|
||||
|
||||
string updatedHtml = RegexStripHtmlStyles.Replace(originalHtml, string.Empty);
|
||||
|
||||
int removed = originalHtml.Length-updatedHtml.Length;
|
||||
updatedHtml = RegexOffsetClipboardHtml.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
|
||||
|
||||
DataObject obj = new DataObject();
|
||||
obj.SetText(originalText, TextDataFormat.UnicodeText);
|
||||
obj.SetText(updatedHtml, TextDataFormat.Html);
|
||||
SetClipboardData(obj);
|
||||
}
|
||||
|
||||
public static void SetClipboard(string text, TextDataFormat format){
|
||||
if (string.IsNullOrEmpty(text)){
|
||||
return;
|
||||
}
|
||||
|
||||
DataObject obj = new DataObject();
|
||||
obj.SetText(text, format);
|
||||
SetClipboardData(obj);
|
||||
}
|
||||
|
||||
private static void SetClipboardData(DataObject obj){
|
||||
try{
|
||||
Clipboard.SetDataObject(obj);
|
||||
}catch(ExternalException e){
|
||||
Program.Reporter.HandleException("Clipboard Error", Program.BrandName+" could not access the clipboard as it is currently used by another process.", true, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,8 @@ namespace TweetDck{
|
||||
public const string BrandName = "TweetDuck";
|
||||
public const string Website = "https://tweetduck.chylex.com";
|
||||
|
||||
public const string VersionTag = "1.5.1";
|
||||
public const string VersionFull = "1.5.1.0";
|
||||
public const string VersionTag = "1.6.2";
|
||||
public const string VersionFull = "1.6.2.0";
|
||||
|
||||
public static readonly Version Version = new Version(VersionTag);
|
||||
|
||||
|
@@ -36,4 +36,8 @@ using TweetDck;
|
||||
[assembly: AssemblyVersion(Program.VersionFull)]
|
||||
[assembly: AssemblyFileVersion(Program.VersionFull)]
|
||||
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
[assembly: NeutralResourcesLanguageAttribute("en")]
|
||||
|
||||
#if DEBUG
|
||||
[assembly: System.Runtime.CompilerServices.InternalsVisibleTo("UnitTests")]
|
||||
#endif
|
||||
|
@@ -524,6 +524,13 @@
|
||||
});
|
||||
})();
|
||||
|
||||
//
|
||||
// Block: Work around clipboard HTML formatting.
|
||||
//
|
||||
$(document).on("copy", function(e){
|
||||
window.setTimeout($TD.fixClipboard, 0);
|
||||
});
|
||||
|
||||
//
|
||||
// Block: Inject custom CSS and layout into the page.
|
||||
//
|
||||
|
@@ -146,9 +146,4 @@
|
||||
document.body.addEventListener("mouseleave", function(){
|
||||
document.body.classList.remove("td-hover");
|
||||
});
|
||||
|
||||
//
|
||||
// Block: Page fully loaded.
|
||||
//
|
||||
$TD.onNotificationReady();
|
||||
})($TD);
|
||||
})($TD);
|
||||
|
12
TweetDck.sln
12
TweetDck.sln
@@ -1,21 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.40629.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TweetDck", "TweetDck.csproj", "{2389A7CD-E0D3-4706-8294-092929A33A2D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "tests\UnitTests.csproj", "{A958FA7A-4A2C-42A7-BFA0-159343483F4E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.Build.0 = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|x86.ActiveCfg = Release|x86
|
||||
{2389A7CD-E0D3-4706-8294-092929A33A2D}.Release|x86.Build.0 = Release|x86
|
||||
{A958FA7A-4A2C-42A7-BFA0-159343483F4E}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{A958FA7A-4A2C-42A7-BFA0-159343483F4E}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{A958FA7A-4A2C-42A7-BFA0-159343483F4E}.Debug|x86.Build.0 = Debug|x86
|
||||
{A958FA7A-4A2C-42A7-BFA0-159343483F4E}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{A958FA7A-4A2C-42A7-BFA0-159343483F4E}.Release|x86.ActiveCfg = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
2
TweetDck.sln.DotSettings
Normal file
2
TweetDck.sln.DotSettings
Normal file
@@ -0,0 +1,2 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:String x:Key="/Default/FilterSettingsManager/CoverageFilterXml/@EntryValue"><data><IncludeFilters /><ExcludeFilters><Filter ModuleMask="UnitTests" ModuleVersionMask="*" ClassMask="*" FunctionMask="*" IsEnabled="True" /></ExcludeFilters></data></s:String></wpf:ResourceDictionary>
|
@@ -82,7 +82,7 @@ namespace TweetDck.Updates{
|
||||
|
||||
public bool IsSystemSupported{
|
||||
get{
|
||||
return Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
|
||||
return true; // Environment.OSVersion.Version >= new Version("6.1"); // 6.1 NT version = Windows 7
|
||||
}
|
||||
}
|
||||
|
||||
|
143
tests/Core/Settings/TestCombinedFileStream.cs
Normal file
143
tests/Core/Settings/TestCombinedFileStream.cs
Normal file
@@ -0,0 +1,143 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.IO;
|
||||
using TweetDck.Core.Other.Settings.Export;
|
||||
|
||||
namespace UnitTests.Core.Settings{
|
||||
[TestClass]
|
||||
public class TestCombinedFileStream{
|
||||
[TestMethod]
|
||||
public void TestNoFiles(){
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.WriteFile("cfs_empty"))){
|
||||
cfs.Flush();
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists("cfs_empty"));
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.ReadFile("cfs_empty"))){
|
||||
Assert.IsNull(cfs.ReadFile());
|
||||
}
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.ReadFile("cfs_empty"))){
|
||||
Assert.IsNull(cfs.SkipFile());
|
||||
}
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestEmptyFiles(){
|
||||
TestUtils.WriteText("cfs_input_empty_1", string.Empty);
|
||||
TestUtils.WriteText("cfs_input_empty_2", string.Empty);
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.WriteFile("cfs_blank_files"))){
|
||||
cfs.WriteFile("id1", "cfs_input_empty_1");
|
||||
cfs.WriteFile("id2", "cfs_input_empty_2");
|
||||
cfs.WriteFile("id2_clone", "cfs_input_empty_2");
|
||||
cfs.Flush();
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists("cfs_blank_files"));
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.ReadFile("cfs_blank_files"))){
|
||||
CombinedFileStream.Entry entry1 = cfs.ReadFile();
|
||||
string entry2key = cfs.SkipFile();
|
||||
CombinedFileStream.Entry entry3 = cfs.ReadFile();
|
||||
|
||||
Assert.IsNull(cfs.ReadFile());
|
||||
Assert.IsNull(cfs.SkipFile());
|
||||
|
||||
Assert.AreEqual("id1", entry1.KeyName);
|
||||
Assert.AreEqual("id1", entry1.Identifier);
|
||||
CollectionAssert.AreEqual(new string[0], entry1.KeyValue);
|
||||
|
||||
Assert.AreEqual("id2", entry2key);
|
||||
|
||||
Assert.AreEqual("id2_clone", entry3.KeyName);
|
||||
Assert.AreEqual("id2_clone", entry3.Identifier);
|
||||
CollectionAssert.AreEqual(new string[0], entry3.KeyValue);
|
||||
|
||||
entry1.WriteToFile("cfs_blank_file_1");
|
||||
entry3.WriteToFile("cfs_blank_file_2");
|
||||
TestUtils.DeleteFileOnExit("cfs_blank_file_1");
|
||||
TestUtils.DeleteFileOnExit("cfs_blank_file_2");
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists("cfs_blank_file_1"));
|
||||
Assert.IsTrue(File.Exists("cfs_blank_file_2"));
|
||||
Assert.AreEqual(string.Empty, TestUtils.ReadText("cfs_blank_file_1"));
|
||||
Assert.AreEqual(string.Empty, TestUtils.ReadText("cfs_blank_file_2"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestTextFilesAndComplexKeys(){
|
||||
TestUtils.WriteText("cfs_input_text_1", "Hello World!"+Environment.NewLine);
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.WriteFile("cfs_text_files"))){
|
||||
cfs.WriteFile(new string[]{ "key1", "a", "bb", "ccc", "dddd" }, "cfs_input_text_1");
|
||||
cfs.WriteFile(new string[]{ "key2", "a", "bb", "ccc", "dddd" }, "cfs_input_text_1");
|
||||
cfs.Flush();
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists("cfs_text_files"));
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.ReadFile("cfs_text_files"))){
|
||||
CombinedFileStream.Entry entry = cfs.ReadFile();
|
||||
|
||||
Assert.AreEqual("key2", cfs.SkipFile());
|
||||
Assert.IsNull(cfs.ReadFile());
|
||||
Assert.IsNull(cfs.SkipFile());
|
||||
|
||||
Assert.AreEqual("key1|a|bb|ccc|dddd", entry.Identifier);
|
||||
Assert.AreEqual("key1", entry.KeyName);
|
||||
CollectionAssert.AreEqual(new string[]{ "a", "bb", "ccc", "dddd" }, entry.KeyValue);
|
||||
|
||||
entry.WriteToFile("cfs_text_file_1");
|
||||
TestUtils.DeleteFileOnExit("cfs_text_file_1");
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists("cfs_text_file_1"));
|
||||
Assert.AreEqual("Hello World!"+Environment.NewLine, TestUtils.ReadText("cfs_text_file_1"));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestEntryWriteWithDirectory(){
|
||||
if (Directory.Exists("cfs_directory")){
|
||||
Directory.Delete("cfs_directory", true);
|
||||
}
|
||||
|
||||
TestUtils.WriteText("cfs_input_dir_1", "test");
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.WriteFile("cfs_dir_test"))){
|
||||
cfs.WriteFile("key1", "cfs_input_dir_1");
|
||||
cfs.WriteFile("key2", "cfs_input_dir_1");
|
||||
cfs.WriteFile("key3", "cfs_input_dir_1");
|
||||
cfs.WriteFile("key4", "cfs_input_dir_1");
|
||||
cfs.Flush();
|
||||
}
|
||||
|
||||
Assert.IsTrue(File.Exists("cfs_dir_test"));
|
||||
|
||||
using(CombinedFileStream cfs = new CombinedFileStream(TestUtils.ReadFile("cfs_dir_test"))){
|
||||
try{
|
||||
cfs.ReadFile().WriteToFile("cfs_directory/cfs_dir_test_file", false);
|
||||
Assert.Fail("WriteToFile did not trigger an exception.");
|
||||
}catch(DirectoryNotFoundException){}
|
||||
|
||||
cfs.ReadFile().WriteToFile("cfs_directory/cfs_dir_test_file", true);
|
||||
cfs.ReadFile().WriteToFile("cfs_dir_test_file", true);
|
||||
cfs.ReadFile().WriteToFile("cfs_dir_test_file.txt", true);
|
||||
TestUtils.DeleteFileOnExit("cfs_dir_test_file");
|
||||
TestUtils.DeleteFileOnExit("cfs_dir_test_file.txt");
|
||||
}
|
||||
|
||||
Assert.IsTrue(Directory.Exists("cfs_directory"));
|
||||
Assert.IsTrue(File.Exists("cfs_directory/cfs_dir_test_file"));
|
||||
Assert.IsTrue(File.Exists("cfs_dir_test_file"));
|
||||
Assert.IsTrue(File.Exists("cfs_dir_test_file.txt"));
|
||||
Assert.AreEqual("test", TestUtils.ReadText("cfs_directory/cfs_dir_test_file"));
|
||||
Assert.AreEqual("test", TestUtils.ReadText("cfs_dir_test_file"));
|
||||
Assert.AreEqual("test", TestUtils.ReadText("cfs_dir_test_file.txt"));
|
||||
|
||||
Directory.Delete("cfs_directory", true);
|
||||
}
|
||||
}
|
||||
}
|
19
tests/Core/Utils/TestBrowserUtils.cs
Normal file
19
tests/Core/Utils/TestBrowserUtils.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TweetDck.Core.Utils;
|
||||
|
||||
namespace UnitTests.Core.Utils{
|
||||
[TestClass]
|
||||
public class TestBrowserUtils{
|
||||
[TestMethod]
|
||||
public void TestGetFileNameFromUrl(){
|
||||
Assert.AreEqual("index.html", BrowserUtils.GetFileNameFromUrl("http://test.com/index.html"));
|
||||
Assert.AreEqual("index.html", BrowserUtils.GetFileNameFromUrl("http://test.com/index.html?"));
|
||||
Assert.AreEqual("index.html", BrowserUtils.GetFileNameFromUrl("http://test.com/index.html?param1=abc¶m2=false"));
|
||||
|
||||
Assert.AreEqual("index", BrowserUtils.GetFileNameFromUrl("http://test.com/index"));
|
||||
Assert.AreEqual("index.", BrowserUtils.GetFileNameFromUrl("http://test.com/index."));
|
||||
|
||||
Assert.IsNull(BrowserUtils.GetFileNameFromUrl("http://test.com/"));
|
||||
}
|
||||
}
|
||||
}
|
157
tests/Core/Utils/TestCommandLineArgs.cs
Normal file
157
tests/Core/Utils/TestCommandLineArgs.cs
Normal file
@@ -0,0 +1,157 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Collections.Generic;
|
||||
using TweetDck.Core.Utils;
|
||||
|
||||
namespace UnitTests.Core.Utils{
|
||||
[TestClass]
|
||||
public class TestCommandLineArgs{
|
||||
[TestMethod]
|
||||
public void TestEmpty(){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
||||
Assert.AreEqual(0, args.Count);
|
||||
Assert.AreEqual(string.Empty, args.ToString());
|
||||
|
||||
Assert.IsFalse(args.HasFlag("x"));
|
||||
Assert.IsFalse(args.HasValue("x"));
|
||||
Assert.AreEqual("default", args.GetValue("x", "default"));
|
||||
|
||||
args.RemoveFlag("x");
|
||||
args.RemoveValue("x");
|
||||
|
||||
var dict = new Dictionary<string, string>();
|
||||
args.ToDictionary(dict);
|
||||
Assert.AreEqual(0, dict.Count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestFlags(){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
||||
args.AddFlag("my_test_flag_1");
|
||||
args.AddFlag("my_test_flag_2");
|
||||
args.AddFlag("aAaAa");
|
||||
|
||||
Assert.IsFalse(args.HasValue("aAaAa"));
|
||||
|
||||
Assert.AreEqual(3, args.Count);
|
||||
Assert.IsTrue(args.HasFlag("my_test_flag_1"));
|
||||
Assert.IsTrue(args.HasFlag("my_test_flag_2"));
|
||||
Assert.IsTrue(args.HasFlag("aaaaa"));
|
||||
Assert.IsTrue(args.HasFlag("AAAAA"));
|
||||
Assert.AreEqual("my_test_flag_1 my_test_flag_2 aaaaa", args.ToString());
|
||||
|
||||
args.RemoveFlag("Aaaaa");
|
||||
|
||||
Assert.AreEqual(2, args.Count);
|
||||
Assert.IsTrue(args.HasFlag("my_test_flag_1"));
|
||||
Assert.IsTrue(args.HasFlag("my_test_flag_2"));
|
||||
Assert.IsFalse(args.HasFlag("aaaaa"));
|
||||
Assert.AreEqual("my_test_flag_1 my_test_flag_2", args.ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestValues(){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
||||
args.SetValue("test_value", "My Test Value");
|
||||
args.SetValue("aAaAa", "aaaaa");
|
||||
|
||||
Assert.IsFalse(args.HasFlag("aAaAa"));
|
||||
|
||||
Assert.AreEqual(2, args.Count);
|
||||
Assert.IsTrue(args.HasValue("test_value"));
|
||||
Assert.IsTrue(args.HasValue("aaaaa"));
|
||||
Assert.IsTrue(args.HasValue("AAAAA"));
|
||||
Assert.AreEqual("My Test Value", args.GetValue("test_value", string.Empty));
|
||||
Assert.AreEqual("aaaaa", args.GetValue("aaaaa", string.Empty));
|
||||
Assert.AreEqual("test_value \"My Test Value\" aaaaa \"aaaaa\"", args.ToString());
|
||||
|
||||
args.RemoveValue("Aaaaa");
|
||||
|
||||
Assert.AreEqual(1, args.Count);
|
||||
Assert.IsTrue(args.HasValue("test_value"));
|
||||
Assert.IsFalse(args.HasValue("aaaaa"));
|
||||
Assert.AreEqual("test_value \"My Test Value\"", args.ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestFlagAndValueMix(){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
||||
args.AddFlag("my_test_flag_1");
|
||||
args.AddFlag("my_test_flag_2");
|
||||
args.AddFlag("aAaAa");
|
||||
|
||||
args.SetValue("test_value", "My Test Value");
|
||||
args.SetValue("aAaAa", "aaaaa");
|
||||
|
||||
Assert.AreEqual(5, args.Count);
|
||||
Assert.IsTrue(args.HasFlag("aaaaa"));
|
||||
Assert.IsTrue(args.HasValue("aaaaa"));
|
||||
Assert.AreEqual("my_test_flag_1 my_test_flag_2 aaaaa test_value \"My Test Value\" aaaaa \"aaaaa\"", args.ToString());
|
||||
|
||||
var dict = new Dictionary<string, string>();
|
||||
args.ToDictionary(dict); // loses 'aaaaa' flag
|
||||
|
||||
Assert.AreEqual(4, dict.Count);
|
||||
Assert.AreEqual("1", dict["my_test_flag_1"]);
|
||||
Assert.AreEqual("1", dict["my_test_flag_2"]);
|
||||
Assert.AreEqual("My Test Value", dict["test_value"]);
|
||||
Assert.AreEqual("aaaaa", dict["aaaaa"]);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestClone(){
|
||||
CommandLineArgs args = new CommandLineArgs();
|
||||
|
||||
args.AddFlag("my_test_flag_1");
|
||||
args.AddFlag("my_test_flag_2");
|
||||
args.AddFlag("aAaAa");
|
||||
|
||||
args.SetValue("test_value", "My Test Value");
|
||||
args.SetValue("aAaAa", "aaaaa");
|
||||
|
||||
CommandLineArgs clone = args.Clone();
|
||||
args.RemoveFlag("aaaaa");
|
||||
args.RemoveValue("aaaaa");
|
||||
clone.RemoveFlag("my_test_flag_1");
|
||||
clone.RemoveFlag("my_test_flag_2");
|
||||
clone.RemoveValue("test_value");
|
||||
|
||||
Assert.AreEqual(3, args.Count);
|
||||
Assert.AreEqual(2, clone.Count);
|
||||
|
||||
Assert.AreEqual("my_test_flag_1 my_test_flag_2 test_value \"My Test Value\"", args.ToString());
|
||||
Assert.AreEqual("aaaaa aaaaa \"aaaaa\"", clone.ToString());
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestEmptyStringArray(){
|
||||
CommandLineArgs args;
|
||||
|
||||
args = CommandLineArgs.FromStringArray('-', new string[0]);
|
||||
Assert.AreEqual(0, args.Count);
|
||||
|
||||
args = CommandLineArgs.FromStringArray('-', new string[]{ "", "+fail", "@nope" });
|
||||
Assert.AreEqual(0, args.Count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestValidStringArray(){
|
||||
CommandLineArgs args;
|
||||
|
||||
args = CommandLineArgs.FromStringArray('-', new string[]{ "-flag1", "-flag2", "-FLAG3" });
|
||||
Assert.AreEqual(3, args.Count);
|
||||
Assert.IsTrue(args.HasFlag("-flag1"));
|
||||
Assert.IsTrue(args.HasFlag("-flag2"));
|
||||
Assert.IsTrue(args.HasFlag("-flag3"));
|
||||
|
||||
args = CommandLineArgs.FromStringArray('-', new string[]{ "-flag", "-value", "Here is some text!" });
|
||||
Assert.AreEqual(2, args.Count);
|
||||
Assert.IsTrue(args.HasFlag("-flag"));
|
||||
Assert.IsTrue(args.HasValue("-value"));
|
||||
Assert.AreEqual("Here is some text!", args.GetValue("-value", string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
32
tests/Core/Utils/TestCommandLineArgsParser.cs
Normal file
32
tests/Core/Utils/TestCommandLineArgsParser.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TweetDck.Core.Utils;
|
||||
|
||||
namespace UnitTests.Core.Utils{
|
||||
[TestClass]
|
||||
public class TestCommandLineArgsParser{
|
||||
[TestMethod]
|
||||
public void TestEmptyString(){
|
||||
Assert.AreEqual(0, CommandLineArgsParser.ReadCefArguments("").Count);
|
||||
Assert.AreEqual(0, CommandLineArgsParser.ReadCefArguments(" ").Count);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestValidString(){
|
||||
CommandLineArgs args = CommandLineArgsParser.ReadCefArguments("--aaa --bbb --first-value=123 --SECOND-VALUE=\"a b c d e\" --ccc");
|
||||
// cef has no flags, flag arguments have a value of 1
|
||||
// the processing removes all dashes in front of each key
|
||||
|
||||
Assert.AreEqual(5, args.Count);
|
||||
Assert.IsTrue(args.HasValue("aaa"));
|
||||
Assert.IsTrue(args.HasValue("bbb"));
|
||||
Assert.IsTrue(args.HasValue("ccc"));
|
||||
Assert.IsTrue(args.HasValue("first-value"));
|
||||
Assert.IsTrue(args.HasValue("second-value"));
|
||||
Assert.AreEqual("1", args.GetValue("aaa", string.Empty));
|
||||
Assert.AreEqual("1", args.GetValue("bbb", string.Empty));
|
||||
Assert.AreEqual("1", args.GetValue("ccc", string.Empty));
|
||||
Assert.AreEqual("123", args.GetValue("first-value", string.Empty));
|
||||
Assert.AreEqual("a b c d e", args.GetValue("second-value", string.Empty));
|
||||
}
|
||||
}
|
||||
}
|
35
tests/Properties/AssemblyInfo.cs
Normal file
35
tests/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("UnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTests")]
|
||||
[assembly: AssemblyCopyright("")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("99036b78-aad6-4a76-8bf3-40c77eca2464")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
65
tests/TestUtils.cs
Normal file
65
tests/TestUtils.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace UnitTests{
|
||||
public static class TestUtils{
|
||||
private static readonly HashSet<string> CreatedFiles = new HashSet<string>();
|
||||
|
||||
public static void WriteText(string file, string text){
|
||||
DeleteFileOnExit(file);
|
||||
File.WriteAllText(file, text, Encoding.UTF8);
|
||||
}
|
||||
|
||||
public static void WriteLines(string file, IEnumerable<string> lines){
|
||||
DeleteFileOnExit(file);
|
||||
File.WriteAllLines(file, lines, Encoding.UTF8);
|
||||
}
|
||||
|
||||
public static FileStream WriteFile(string file){
|
||||
DeleteFileOnExit(file);
|
||||
return new FileStream(file, FileMode.Create, FileAccess.Write, FileShare.None);
|
||||
}
|
||||
|
||||
public static string ReadText(string file){
|
||||
try{
|
||||
return File.ReadAllText(file, Encoding.UTF8);
|
||||
}catch(Exception){
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static IEnumerable<string> ReadLines(string file){
|
||||
try{
|
||||
return File.ReadLines(file, Encoding.UTF8);
|
||||
}catch(Exception){
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
}
|
||||
|
||||
public static FileStream ReadFile(string file){
|
||||
return new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.None);
|
||||
}
|
||||
|
||||
public static void DeleteFileOnExit(string file){
|
||||
CreatedFiles.Add(file);
|
||||
}
|
||||
|
||||
[TestClass]
|
||||
public static class Cleanup{
|
||||
[AssemblyCleanup]
|
||||
public static void DeleteFilesOnExit(){
|
||||
foreach(string file in CreatedFiles){
|
||||
try{
|
||||
File.Delete(file);
|
||||
}catch(Exception){
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
90
tests/UnitTests.csproj
Normal file
90
tests/UnitTests.csproj
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{A958FA7A-4A2C-42A7-BFA0-159343483F4E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UnitTests</RootNamespace>
|
||||
<AssemblyName>UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
</ItemGroup>
|
||||
</When>
|
||||
<Otherwise>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
|
||||
</ItemGroup>
|
||||
</Otherwise>
|
||||
</Choose>
|
||||
<ItemGroup>
|
||||
<Compile Include="Core\Settings\TestCombinedFileStream.cs" />
|
||||
<Compile Include="Core\Utils\TestBrowserUtils.cs" />
|
||||
<Compile Include="Core\Utils\TestCommandLineArgs.cs" />
|
||||
<Compile Include="Core\Utils\TestCommandLineArgsParser.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TestUtils.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TweetDck.csproj">
|
||||
<Project>{2389a7cd-e0d3-4706-8294-092929a33a2d}</Project>
|
||||
<Name>TweetDck</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
</When>
|
||||
</Choose>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
Reference in New Issue
Block a user