1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-05-08 20:34:05 +02:00

Fix missing spaces in C#/F# code

This commit is contained in:
chylex 2019-08-22 09:34:15 +02:00
parent bd0be65038
commit 19f104239a
58 changed files with 200 additions and 200 deletions

View File

@ -9,7 +9,7 @@ public enum Environment{
public static string GenerateScript(Environment environment){
static string Bool(bool value) => value ? "true;" : "false;";
static string Str(string value) => '"'+value+"\";";
static string Str(string value) => $"\"{value}\";";
UserConfig config = Program.Config.User;
StringBuilder build = new StringBuilder(128).Append("(function(x){");

View File

@ -30,17 +30,17 @@ public static bool IsFullyOutsideView(this Form form){
}
public static void MoveToCenter(this Form targetForm, Form parentForm){
targetForm.Location = new Point(parentForm.Location.X+parentForm.Width/2-targetForm.Width/2, parentForm.Location.Y+parentForm.Height/2-targetForm.Height/2);
targetForm.Location = new Point(parentForm.Location.X + (parentForm.Width / 2) - (targetForm.Width / 2), parentForm.Location.Y + (parentForm.Height / 2) - (targetForm.Height / 2));
}
public static void SetValueInstant(this ProgressBar bar, int value){
if (value == bar.Maximum){
bar.Value = value;
bar.Value = value-1;
bar.Value = value - 1;
bar.Value = value;
}
else{
bar.Value = value+1;
bar.Value = value + 1;
bar.Value = value;
}
}
@ -59,7 +59,7 @@ public static void SetValueSafe(this TrackBar trackBar, int value){
public static bool AlignValueToTick(this TrackBar trackBar){
if (trackBar.Value % trackBar.SmallChange != 0){
trackBar.Value = trackBar.SmallChange*(int)Math.Floor(((double)trackBar.Value/trackBar.SmallChange)+0.5);
trackBar.Value = trackBar.SmallChange * (int)Math.Floor(((double)trackBar.Value / trackBar.SmallChange) + 0.5);
return false;
}

View File

@ -23,7 +23,7 @@ protected override void OnPaint(PaintEventArgs e){
}
Rectangle rect = e.ClipRectangle;
rect.Width = (int)(rect.Width*((double)Value/Maximum));
rect.Width = (int)(rect.Width * ((double)Value / Maximum));
e.Graphics.FillRectangle(brush, rect);
}

View File

@ -7,12 +7,12 @@ sealed class LabelVertical : Label{
public int LineHeight { get; set; }
protected override void OnPaint(PaintEventArgs e){
int y = (int)Math.Floor((ClientRectangle.Height-Text.Length*LineHeight)/2F)-1;
int y = (int)Math.Floor((ClientRectangle.Height - Text.Length * LineHeight) / 2F) - 1;
using Brush brush = new SolidBrush(ForeColor);
foreach(char chr in Text){
string str = chr.ToString();
float x = (ClientRectangle.Width-e.Graphics.MeasureString(str, Font).Width)/2F;
float x = (ClientRectangle.Width - e.Graphics.MeasureString(str, Font).Width) / 2F;
e.Graphics.DrawString(str, Font, brush, x, y);
y += LineHeight;

View File

@ -289,7 +289,7 @@ void OnFinished(){
UpdateInstallerPath = update.InstallerPath;
ForceClose();
}
else if (status != UpdateDownloadStatus.Canceled && FormMessage.Error("Update Has Failed", "Could not automatically download the update: "+(update.DownloadError?.Message ?? "unknown error")+"\n\nWould you like to open the website and try downloading the update manually?", FormMessage.Yes, FormMessage.No)){
else if (status != UpdateDownloadStatus.Canceled && FormMessage.Error("Update Has Failed", "Could not automatically download the update: " + (update.DownloadError?.Message ?? "unknown error") + "\n\nWould you like to open the website and try downloading the update manually?", FormMessage.Yes, FormMessage.No)){
BrowserUtils.OpenExternalBrowser(Program.Website);
ForceClose();
}

View File

@ -56,9 +56,9 @@ public virtual void OnBeforeContextMenu(IWebBrowser browserControl, IBrowser bro
model.AddSeparator();
}
static string TextOpen(string name) => "Open "+name+" in browser";
static string TextCopy(string name) => "Copy "+name+" address";
static string TextSave(string name) => "Save "+name+" as...";
static string TextOpen(string name) => "Open " + name + " in browser";
static string TextCopy(string name) => "Copy " + name + " address";
static string TextSave(string name) => "Save " + name + " as...";
if (Context.Types.HasFlag(ContextInfo.ContextType.Link) && !Context.UnsafeLinkUrl.EndsWith("tweetdeck.twitter.com/#", StringComparison.Ordinal)){
if (TwitterUrls.RegexAccount.IsMatch(Context.UnsafeLinkUrl)){
@ -206,7 +206,7 @@ protected static void SetClipboardText(Control control, string text){
}
protected static void InsertSelectionSearchItem(IMenuModel model, CefMenuCommand insertCommand, string insertLabel){
model.InsertItemAt(model.GetIndexOf(MenuSearchInBrowser)+1, insertCommand, insertLabel);
model.InsertItemAt(model.GetIndexOf(MenuSearchInBrowser) + 1, insertCommand, insertLabel);
}
protected static void AddDebugMenuItems(IMenuModel model){
@ -217,13 +217,13 @@ protected static void AddDebugMenuItems(IMenuModel model){
}
protected static void RemoveSeparatorIfLast(IMenuModel model){
if (model.Count > 0 && model.GetTypeAt(model.Count-1) == MenuItemType.Separator){
model.RemoveAt(model.Count-1);
if (model.Count > 0 && model.GetTypeAt(model.Count - 1) == MenuItemType.Separator){
model.RemoveAt(model.Count - 1);
}
}
protected static void AddSeparator(IMenuModel model){
if (model.Count > 0 && model.GetTypeAt(model.Count-1) != MenuItemType.Separator){ // do not add separators if there is nothing to separate
if (model.Count > 0 && model.GetTypeAt(model.Count - 1) != MenuItemType.Separator){ // do not add separators if there is nothing to separate
model.AddSeparator();
}
}

View File

@ -24,7 +24,7 @@ sealed class ContextMenuBrowser : ContextMenuBase{
private const string TitleMuteNotifications = "Mute notifications";
private const string TitleSettings = "Options";
private const string TitlePlugins = "Plugins";
private const string TitleAboutProgram = "About "+Program.BrandName;
private const string TitleAboutProgram = "About " + Program.BrandName;
private readonly FormBrowser form;

View File

@ -25,7 +25,7 @@ FilterStatus IResponseFilter.Filter(Stream dataIn, out long dataInRead, Stream d
int responseLength = responseData.Length;
if (state == State.Reading){
int bytesToRead = Math.Min(responseLength-offset, (int)Math.Min(dataIn?.Length ?? 0, int.MaxValue));
int bytesToRead = Math.Min(responseLength - offset, (int)Math.Min(dataIn?.Length ?? 0, int.MaxValue));
dataIn?.Read(responseData, offset, bytesToRead);
offset += bytesToRead;
@ -42,7 +42,7 @@ FilterStatus IResponseFilter.Filter(Stream dataIn, out long dataInRead, Stream d
return FilterStatus.NeedMoreData;
}
else if (state == State.Writing){
int bytesToWrite = Math.Min(responseLength-offset, (int)Math.Min(dataOut.Length, int.MaxValue));
int bytesToWrite = Math.Min(responseLength - offset, (int)Math.Min(dataOut.Length, int.MaxValue));
if (bytesToWrite > 0){
dataOut.Write(responseData, offset, bytesToWrite);

View File

@ -53,13 +53,13 @@ bool IJsDialogHandler.OnJSDialog(IWebBrowser browserControl, IBrowser browser, s
input = new TextBox{
Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Bottom,
Font = SystemFonts.MessageBoxFont,
Location = new Point(BrowserUtils.Scale(22+inputPad, dpiScale), form.ActionPanelY-BrowserUtils.Scale(46, dpiScale)),
Size = new Size(form.ClientSize.Width-BrowserUtils.Scale(44+inputPad, dpiScale), BrowserUtils.Scale(23, dpiScale))
Location = new Point(BrowserUtils.Scale(22 + inputPad, dpiScale), form.ActionPanelY - BrowserUtils.Scale(46, dpiScale)),
Size = new Size(form.ClientSize.Width - BrowserUtils.Scale(44 + inputPad, dpiScale), BrowserUtils.Scale(23, dpiScale))
};
form.Controls.Add(input);
form.ActiveControl = input;
form.Height += input.Size.Height+input.Margin.Vertical;
form.Height += input.Size.Height + input.Margin.Vertical;
}
else{
callback.Continue(false);

View File

@ -22,7 +22,7 @@ protected virtual bool HandleRawKey(IWebBrowser browserControl, IBrowser browser
extraMessage = "Please download the installer, and tick 'Install dev tools' during the installation process. The installer will automatically find and update your current installation of TweetDuck.";
}
FormMessage.Information("Dev Tools", "You do not have dev tools installed. "+extraMessage, FormMessage.OK);
FormMessage.Information("Dev Tools", "You do not have dev tools installed. " + extraMessage, FormMessage.OK);
});
}

View File

@ -38,7 +38,7 @@ public static void RefreshTimer(){
AutoClearTimer = new Timer(state => {
if (AutoClearTimer != null){
try{
if (CalculateCacheSize() >= Program.Config.System.ClearCacheThreshold*1024L*1024L){
if (CalculateCacheSize() >= Program.Config.System.ClearCacheThreshold * 1024L * 1024L){
SetClearOnExit();
}
}catch(Exception){

View File

@ -49,7 +49,7 @@ public bool Export(Items items){
try{
stream.WriteFile(new string[]{ "plugin.data", plugin.Identifier, path.Relative }, path.Full);
}catch(ArgumentOutOfRangeException e){
FormMessage.Warning("Export Profile", "Could not include a plugin file in the export. "+e.Message, FormMessage.OK);
FormMessage.Warning("Export Profile", "Could not include a plugin file in the export. " + e.Message, FormMessage.OK);
}
}
}
@ -157,7 +157,7 @@ public bool Import(Items items){
}
if (missingPlugins.Count > 0){
FormMessage.Information("Profile Import", "Detected missing plugins when importing plugin data:\n"+string.Join("\n", missingPlugins), FormMessage.OK);
FormMessage.Information("Profile Import", "Detected missing plugins when importing plugin data:\n" + string.Join("\n", missingPlugins), FormMessage.OK);
}
return true;

View File

@ -40,7 +40,7 @@ public void Launch(string url, string username){
if ((process = Process.Start(new ProcessStartInfo{
FileName = Path.Combine(Program.ProgramPath, "TweetDuck.Video.exe"),
Arguments = $"{owner.Handle} {(int)Math.Floor(100F*owner.GetDPIScale())} {Config.VideoPlayerVolume} \"{url}\" \"{pipe.GenerateToken()}\"",
Arguments = $"{owner.Handle} {(int)Math.Floor(100F * owner.GetDPIScale())} {Config.VideoPlayerVolume} \"{url}\" \"{pipe.GenerateToken()}\"",
UseShellExecute = false,
RedirectStandardOutput = true
})) != null){
@ -135,7 +135,7 @@ private void owner_FormClosing(object sender, FormClosingEventArgs e){
private void process_OutputDataReceived(object sender, DataReceivedEventArgs e){
if (!string.IsNullOrEmpty(e.Data)){
Program.Reporter.LogVerbose("[VideoPlayer] "+e.Data);
Program.Reporter.LogVerbose("[VideoPlayer] " + e.Data);
}
}

View File

@ -23,7 +23,7 @@ protected override FormBorderStyle NotificationBorderStyle{
}
}
protected override string BodyClasses => base.BodyClasses+" td-example";
protected override string BodyClasses => base.BodyClasses + " td-example";
public event EventHandler Ready;

View File

@ -36,7 +36,7 @@ protected virtual Point PrimaryLocation{
Screen screen;
if (Config.NotificationDisplay > 0 && Config.NotificationDisplay <= Screen.AllScreens.Length){
screen = Screen.AllScreens[Config.NotificationDisplay-1];
screen = Screen.AllScreens[Config.NotificationDisplay - 1];
}
else{
screen = Screen.FromControl(owner);
@ -46,20 +46,20 @@ protected virtual Point PrimaryLocation{
switch(Config.NotificationPosition){
case DesktopNotification.Position.TopLeft:
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+edgeDist);
return new Point(screen.WorkingArea.X + edgeDist, screen.WorkingArea.Y + edgeDist);
case DesktopNotification.Position.TopRight:
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
return new Point(screen.WorkingArea.X + screen.WorkingArea.Width - edgeDist - Width, screen.WorkingArea.Y + edgeDist);
case DesktopNotification.Position.BottomLeft:
return new Point(screen.WorkingArea.X+edgeDist, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
return new Point(screen.WorkingArea.X + edgeDist, screen.WorkingArea.Y + screen.WorkingArea.Height - edgeDist - Height);
case DesktopNotification.Position.BottomRight:
return new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+screen.WorkingArea.Height-edgeDist-Height);
return new Point(screen.WorkingArea.X + screen.WorkingArea.Width - edgeDist - Width, screen.WorkingArea.Y + screen.WorkingArea.Height - edgeDist - Height);
case DesktopNotification.Position.Custom:
if (!Config.IsCustomNotificationPositionSet){
Config.CustomNotificationPosition = new Point(screen.WorkingArea.X+screen.WorkingArea.Width-edgeDist-Width, screen.WorkingArea.Y+edgeDist);
Config.CustomNotificationPosition = new Point(screen.WorkingArea.X + screen.WorkingArea.Width - edgeDist - Width, screen.WorkingArea.Y + edgeDist);
Config.Save();
}
@ -100,7 +100,7 @@ protected virtual FormBorderStyle NotificationBorderStyle{
protected override bool ShowWithoutActivation => true;
protected float DpiScale { get; }
protected double SizeScale => DpiScale*Config.ZoomLevel/100.0;
protected double SizeScale => DpiScale * Config.ZoomLevel / 100.0;
protected readonly FormBrowser owner;
protected readonly ChromiumWebBrowser browser;

View File

@ -61,7 +61,7 @@ private int BaseClientHeight{
protected virtual string BodyClasses => IsCursorOverBrowser ? "td-notification td-hover" : "td-notification";
public Size BrowserSize => Config.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height-timerBarHeight) : ClientSize;
public Size BrowserSize => Config.DisplayNotificationTimer ? new Size(ClientSize.Width, ClientSize.Height - timerBarHeight) : ClientSize;
protected FormNotificationMain(FormBrowser owner, PluginManager pluginManager, bool enableContextMenu) : base(owner, enableContextMenu){
InitializeComponent();
@ -102,7 +102,7 @@ private IntPtr MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam){
int eventType = wParam.ToInt32();
if (eventType == NativeMethods.WM_MOUSEWHEEL && IsCursorOverBrowser){
browser.SendMouseWheelEvent(0, 0, 0, BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Config.NotificationScrollSpeed*0.01), CefEventFlags.None);
browser.SendMouseWheelEvent(0, 0, 0, BrowserUtils.Scale(NativeMethods.GetMouseHookData(lParam), Config.NotificationScrollSpeed * 0.01), CefEventFlags.None);
return NativeMethods.HOOK_HANDLED;
}
else if (eventType == NativeMethods.WM_XBUTTONDOWN && DesktopBounds.Contains(Cursor.Position)){
@ -172,8 +172,8 @@ private void timerHideProgress_Tick(object sender, EventArgs e){
timeLeft -= timerProgress.Interval;
int value = BrowserUtils.Scale(progressBarTimer.Maximum+25, (totalTime-timeLeft)/(double)totalTime);
progressBarTimer.SetValueInstant(Config.NotificationTimerCountDown ? progressBarTimer.Maximum-value : value);
int value = BrowserUtils.Scale(progressBarTimer.Maximum + 25, (totalTime - timeLeft) / (double)totalTime);
progressBarTimer.SetValueInstant(Config.NotificationTimerCountDown ? progressBarTimer.Maximum - value : value);
if (timeLeft <= 0){
FinishCurrentNotification();
@ -239,7 +239,7 @@ protected override void LoadTweet(DesktopNotification tweet){
protected override void SetNotificationSize(int width, int height){
if (Config.DisplayNotificationTimer){
ClientSize = new Size(width, height+timerBarHeight);
ClientSize = new Size(width, height + timerBarHeight);
progressBarTimer.Visible = true;
}
else{

View File

@ -154,7 +154,7 @@ protected override void UpdateTitle(){
base.UpdateTitle();
if (tweetQueue.Count > 0){
Text = Text+" ("+tweetQueue.Count+" more left)";
Text = Text + " (" + tweetQueue.Count + " more left)";
}
}

View File

@ -134,9 +134,9 @@ private void StartDebugger(){
private void debugger_Tick(object sender, EventArgs e){
if (frameCounter < 63 && screenshot.TakeScreenshot(true)){
try{
Clipboard.GetImage()?.Save(Path.Combine(DebugScreenshotPath, "frame_"+(++frameCounter)+".png"), ImageFormat.Png);
Clipboard.GetImage()?.Save(Path.Combine(DebugScreenshotPath, "frame_" + (++frameCounter) + ".png"), ImageFormat.Png);
}catch{
System.Diagnostics.Debug.WriteLine("Failed generating frame "+frameCounter);
System.Diagnostics.Debug.WriteLine("Failed generating frame " + frameCounter);
}
}
else{

View File

@ -28,12 +28,12 @@ public static IResourceHandler CreateFileHandler(string path){
FormBrowser browser = FormManager.TryFind<FormBrowser>();
browser?.InvokeAsyncSafe(() => {
using(FormMessage form = new FormMessage("Sound Notification Error", "Could not find custom notification sound file:\n"+path, MessageBoxIcon.Error)){
using(FormMessage form = new FormMessage("Sound Notification Error", "Could not find custom notification sound file:\n" + path, MessageBoxIcon.Error)){
form.AddButton(FormMessage.Ignore, ControlType.Cancel | ControlType.Focused);
Button btnViewOptions = form.AddButton("View Options");
btnViewOptions.Width += 16;
btnViewOptions.Location = new Point(btnViewOptions.Location.X-16, btnViewOptions.Location.Y);
btnViewOptions.Location = new Point(btnViewOptions.Location.X - 16, btnViewOptions.Location.Y);
if (form.ShowDialog() == DialogResult.OK && form.ClickedButton == btnViewOptions){
browser.OpenSettings(typeof(TabSettingsSounds));

View File

@ -90,9 +90,9 @@ private void SetLastDataCollectionTime(DateTime dt, string message = null){
private void RestartTimer(){
TimeSpan diff = DateTime.Now.Subtract(File.LastDataCollection);
int minutesTillNext = (int)(CollectionInterval.TotalMinutes-Math.Floor(diff.TotalMinutes));
int minutesTillNext = (int)(CollectionInterval.TotalMinutes - Math.Floor(diff.TotalMinutes));
currentTimer.Interval = Math.Max(minutesTillNext, 2)*60000;
currentTimer.Interval = Math.Max(minutesTillNext, 2) * 60000;
currentTimer.Start();
}
@ -139,7 +139,7 @@ private void SendReport(){
case WebExceptionStatus.ProtocolError:
HttpWebResponse response = e.Response as HttpWebResponse;
message = "HTTP Error "+(response != null ? $"{(int)response.StatusCode} ({response.StatusDescription})" : "(unknown code)");
message = "HTTP Error " + (response != null ? $"{(int)response.StatusCode} ({response.StatusDescription})" : "(unknown code)");
break;
}
@ -152,7 +152,7 @@ private void SendReport(){
#endif
}
ScheduleReportIn(TimeSpan.FromHours(4), message ?? "Error: "+(task.Exception.InnerException?.Message ?? task.Exception.Message));
ScheduleReportIn(TimeSpan.FromHours(4), message ?? "Error: " + (task.Exception.InnerException?.Message ?? task.Exception.Message));
}
}));
}

View File

@ -47,7 +47,7 @@ public override string ToString(){
build.AppendLine();
}
else{
build.AppendLine(entry.Key+": "+entry.Value);
build.AppendLine(entry.Key + ": " + entry.Value);
}
}

View File

@ -126,9 +126,9 @@ public static AnalyticsReport Create(AnalyticsFile file, ExternalInfo info, Plug
private static string Bool(bool value) => value ? "on" : "off";
private static string Exact(int value) => value.ToString();
private static string RoundUp(int value, int multiple) => (multiple*(int)Math.Ceiling((double)value/multiple)).ToString();
private static string RoundUp(int value, int multiple) => (multiple * (int)Math.Ceiling((double)value / multiple)).ToString();
private static string LogRound(int value, int logBase) => (value <= 0 ? 0 : (int)Math.Pow(logBase, Math.Floor(Math.Log(value, logBase)))).ToString();
private static string Plugin(Plugin plugin) => plugin.Group.GetIdentifierPrefixShort()+plugin.Identifier.Substring(plugin.Group.GetIdentifierPrefix().Length);
private static string Plugin(Plugin plugin) => plugin.Group.GetIdentifierPrefixShort() + plugin.Identifier.Substring(plugin.Group.GetIdentifierPrefix().Length);
private static string Dict(Dictionary<string, string> dict, string key, string def = "(unknown)") => dict.TryGetValue(key, out string value) ? value : def;
private static string List(IEnumerable<string> list) => string.Join("|", list.DefaultIfEmpty("(none)"));
@ -170,7 +170,7 @@ static AnalyticsReportGenerator(){
using ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Capacity FROM Win32_PhysicalMemory");
foreach(ManagementBaseObject obj in searcher.Get()){
RamSize += (int)((ulong)obj["Capacity"]/(1024L*1024L));
RamSize += (int)((ulong)obj["Capacity"] / (1024L * 1024L));
}
}catch{
RamSize = 0;
@ -285,7 +285,7 @@ private static string ReplyAccountConfigFromPlugin{
}
string accType = matchType.Groups[1].Value == "#" ? matchType.Groups[2].Value : "account";
return matchAdvanced.Success && !matchAdvanced.Value.Contains("false") ? "advanced/"+accType : accType;
return matchAdvanced.Success && !matchAdvanced.Value.Contains("false") ? "advanced/" + accType : accType;
}catch{
return "(unknown)";
}
@ -306,7 +306,7 @@ public static ExternalInfo From(Form form){
}
return new ExternalInfo{
Resolution = screen.Bounds.Width+"x"+screen.Bounds.Height,
Resolution = screen.Bounds.Width + "x" + screen.Bounds.Height,
DPI = dpi
};
}

View File

@ -12,7 +12,7 @@ sealed partial class FormAbout : Form, FormManager.IAppDialog{
public FormAbout(){
InitializeComponent();
Text = "About "+Program.BrandName+" "+Program.VersionTag;
Text = "About " + Program.BrandName + " " + Program.VersionTag;
labelDescription.Text = "TweetDuck was created by chylex as a replacement to the discontinued official TweetDeck client for Windows.\n\nThe program is available for free under the open source MIT license.";

View File

@ -37,7 +37,7 @@ public static bool CheckGuideUrl(string url, out string hash){
}
public static void Show(string hash = null){
string url = GuideUrl+(hash ?? string.Empty);
string url = GuideUrl + (hash ?? string.Empty);
FormGuide guide = FormManager.TryFind<FormGuide>();
if (guide == null){
@ -60,8 +60,8 @@ public static void Show(string hash = null){
private FormGuide(string url, FormBrowser owner){
InitializeComponent();
Text = Program.BrandName+" Guide";
Size = new Size(owner.Size.Width*3/4, owner.Size.Height*3/4);
Text = Program.BrandName + " Guide";
Size = new Size(owner.Size.Width * 3 / 4, owner.Size.Height * 3 / 4);
VisibleChanged += (sender, args) => this.MoveToCenter(owner);
ResourceHandlerFactory resourceHandlerFactory = new ResourceHandlerFactory();

View File

@ -133,7 +133,7 @@ public Button AddButton(string title, DialogResult result = DialogResult.OK, Con
Font = SystemFonts.MessageBoxFont,
Location = new Point(0, 12),
Size = new Size(BrowserUtils.Scale(88, dpiScale), BrowserUtils.Scale(26, dpiScale)),
TabIndex = 256-buttonCount,
TabIndex = 256 - buttonCount,
Text = title,
UseVisualStyleBackColor = true
};
@ -171,17 +171,17 @@ public void AddActionControl(Control control){
control.Size = new Size(BrowserUtils.Scale(control.Width, dpiScale), BrowserUtils.Scale(control.Height, dpiScale));
minFormWidth += control.Width+control.Margin.Horizontal;
minFormWidth += control.Width + control.Margin.Horizontal;
ClientWidth = Math.Max(realFormWidth, minFormWidth);
}
private void RecalculateButtonLocation(){
int dist = ButtonDistance;
int start = ClientWidth-dist;
int start = ClientWidth - dist;
for(int index = 0; index < buttonCount; index++){
Control control = panelActions.Controls[index];
control.Location = new Point(start-index*dist, control.Location.Y);
control.Location = new Point(start - index * dist, control.Location.Y);
}
}
@ -194,17 +194,17 @@ private void labelMessage_SizeChanged(object sender, EventArgs e){
int labelOffset = BrowserUtils.Scale(8, dpiScale);
if (isMultiline && !wasLabelMultiline){
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y-labelOffset);
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y - labelOffset);
prevLabelHeight += labelOffset;
}
else if (!isMultiline && wasLabelMultiline){
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y+labelOffset);
labelMessage.Location = new Point(labelMessage.Location.X, labelMessage.Location.Y + labelOffset);
prevLabelHeight -= labelOffset;
}
realFormWidth = ClientWidth-(icon == null ? BrowserUtils.Scale(50, dpiScale) : 0)+labelMessage.Width-prevLabelWidth;
realFormWidth = ClientWidth - (icon == null ? BrowserUtils.Scale(50, dpiScale) : 0) + labelMessage.Width - prevLabelWidth;
ClientWidth = Math.Max(realFormWidth, minFormWidth);
Height += labelMessage.Height-prevLabelHeight;
Height += labelMessage.Height - prevLabelHeight;
prevLabelWidth = labelMessage.Width;
prevLabelHeight = labelMessage.Height;
@ -213,7 +213,7 @@ private void labelMessage_SizeChanged(object sender, EventArgs e){
protected override void OnPaint(PaintEventArgs e){
if (icon != null){
e.Graphics.DrawIcon(icon, BrowserUtils.Scale(25, dpiScale), 1+BrowserUtils.Scale(25, dpiScale));
e.Graphics.DrawIcon(icon, BrowserUtils.Scale(25, dpiScale), 1 + BrowserUtils.Scale(25, dpiScale));
}
base.OnPaint(e);

View File

@ -16,7 +16,7 @@ sealed partial class FormPlugins : Form, FormManager.IAppDialog{
public FormPlugins(){
InitializeComponent();
Text = Program.BrandName+" Plugins";
Text = Program.BrandName + " Plugins";
}
public FormPlugins(PluginManager pluginManager) : this(){
@ -69,8 +69,8 @@ private void timerLayout_Tick(object sender, EventArgs e){
timerLayout.Stop();
// stupid WinForms scrollbars and panels
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right+1, Padding.Bottom+1);
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right-1, Padding.Bottom-1);
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right + 1, Padding.Bottom + 1);
Padding = new Padding(Padding.Left, Padding.Top, Padding.Right - 1, Padding.Bottom - 1);
}
public void flowLayoutPlugins_Resize(object sender, EventArgs e){
@ -80,17 +80,17 @@ public void flowLayoutPlugins_Resize(object sender, EventArgs e){
return;
}
bool showScrollBar = lastPlugin.Location.Y+lastPlugin.Height+1 >= flowLayoutPlugins.Height;
bool showScrollBar = lastPlugin.Location.Y + lastPlugin.Height + 1 >= flowLayoutPlugins.Height;
int horizontalOffset = showScrollBar ? SystemInformation.VerticalScrollBarWidth : 0;
flowLayoutPlugins.AutoScroll = showScrollBar;
flowLayoutPlugins.VerticalScroll.Visible = showScrollBar;
foreach(Control control in flowLayoutPlugins.Controls){
control.Width = flowLayoutPlugins.Width-control.Margin.Horizontal-horizontalOffset;
control.Width = flowLayoutPlugins.Width - control.Margin.Horizontal - horizontalOffset;
}
flowLayoutPlugins.Controls[flowLayoutPlugins.Controls.Count-1].Visible = !showScrollBar;
flowLayoutPlugins.Controls[flowLayoutPlugins.Controls.Count - 1].Visible = !showScrollBar;
flowLayoutPlugins.Focus();
}

View File

@ -27,7 +27,7 @@ sealed partial class FormSettings : Form, FormManager.IAppDialog{
public FormSettings(FormBrowser browser, PluginManager plugins, UpdateHandler updates, AnalyticsManager analytics, Type startTab){
InitializeComponent();
Text = Program.BrandName+" Options";
Text = Program.BrandName + " Options";
this.browser = browser;
this.browser.PauseNotification();
@ -110,7 +110,7 @@ private void AddButton<T>(string title, Func<T> constructor) where T : BaseTabSe
BackColor = SystemColors.Control,
FlatStyle = FlatStyle.Flat,
Font = SystemFonts.MessageBoxFont,
Location = new Point(0, (buttonHeight+1)*(panelButtons.Controls.Count/2)),
Location = new Point(0, (buttonHeight + 1) * (panelButtons.Controls.Count / 2)),
Margin = new Padding(0),
Size = new Size(panelButtons.Width, buttonHeight),
Text = title,
@ -125,7 +125,7 @@ private void AddButton<T>(string title, Func<T> constructor) where T : BaseTabSe
panelButtons.Controls.Add(new Panel{
BackColor = Color.DimGray,
Location = new Point(0, panelButtons.Controls[panelButtons.Controls.Count-1].Location.Y+buttonHeight),
Location = new Point(0, panelButtons.Controls[panelButtons.Controls.Count - 1].Location.Y + buttonHeight),
Margin = new Padding(0),
Size = new Size(panelButtons.Width, 1)
});
@ -157,8 +157,8 @@ private void SelectTab(SettingsTab tab){
}
}
if (tab.Control.Height < panelContents.Height-2){
tab.Control.Height = panelContents.Height-2; // fixes off-by-pixel error on high DPI
if (tab.Control.Height < panelContents.Height - 2){
tab.Control.Height = panelContents.Height - 2; // fixes off-by-pixel error on high DPI
}
tab.Control.OnReady();

View File

@ -8,7 +8,7 @@ sealed partial class DialogSettingsAnalytics : Form{
public DialogSettingsAnalytics(AnalyticsReport report){
InitializeComponent();
Text = Program.BrandName+" Options - Analytics Report";
Text = Program.BrandName + " Options - Analytics Report";
textBoxReport.EnableMultilineShortcuts();
textBoxReport.Text = report.ToString().TrimEnd();

View File

@ -16,7 +16,7 @@ sealed partial class DialogSettingsCSS : Form{
public DialogSettingsCSS(string browserCSS, string notificationCSS, Action<string> reinjectBrowserCSS, Action openDevTools){
InitializeComponent();
Text = Program.BrandName+" Options - CSS";
Text = Program.BrandName + " Options - CSS";
this.reinjectBrowserCSS = reinjectBrowserCSS;
this.openDevTools = openDevTools;
@ -64,21 +64,21 @@ private void textBoxCSS_KeyDown(object sender, KeyEventArgs e){
}
}
if (!(deleteTo < text.Length-1 && text[deleteTo] == '\r' && text[deleteTo+1] == '\n')){
if (!(deleteTo < text.Length - 1 && text[deleteTo] == '\r' && text[deleteTo + 1] == '\n')){
++deleteTo;
}
tb.Select(deleteTo, tb.SelectionLength+tb.SelectionStart-deleteTo);
tb.Select(deleteTo, tb.SelectionLength + tb.SelectionStart - deleteTo);
tb.SelectedText = string.Empty;
}
}
else if (e.KeyCode == Keys.Back && e.Modifiers == Keys.None){
int deleteTo = tb.SelectionStart;
if (deleteTo > 1 && text[deleteTo-1] == ' ' && text[deleteTo-2] == ' '){
if (deleteTo > 1 && text[deleteTo - 1] == ' ' && text[deleteTo - 2] == ' '){
e.SuppressKeyPress = true;
tb.Select(deleteTo-2, 2);
tb.Select(deleteTo - 2, 2);
tb.SelectedText = string.Empty;
}
}
@ -89,28 +89,28 @@ private void textBoxCSS_KeyDown(object sender, KeyEventArgs e){
if (insertAt == 0){
return;
}
else if (text[insertAt-1] == '{'){
insertText = Environment.NewLine+" ";
else if (text[insertAt - 1] == '{'){
insertText = Environment.NewLine + " ";
int nextBracket = insertAt < text.Length ? text.IndexOfAny(new char[]{ '{', '}' }, insertAt+1) : -1;
int nextBracket = insertAt < text.Length ? text.IndexOfAny(new char[]{ '{', '}' }, insertAt + 1) : -1;
if (nextBracket == -1 || text[nextBracket] == '{'){
string insertExtra = Environment.NewLine+"}";
string insertExtra = Environment.NewLine + "}";
insertText += insertExtra;
cursorOffset -= insertExtra.Length;
}
}
else{
int lineStart = text.LastIndexOf('\n', tb.SelectionStart-1);
int lineStart = text.LastIndexOf('\n', tb.SelectionStart - 1);
Match match = Regex.Match(text.Substring(lineStart == -1 ? 0 : lineStart+1), "^([ \t]+)");
insertText = match.Success ? Environment.NewLine+match.Groups[1].Value : null;
Match match = Regex.Match(text.Substring(lineStart == -1 ? 0 : lineStart + 1), "^([ \t]+)");
insertText = match.Success ? Environment.NewLine + match.Groups[1].Value : null;
}
if (!string.IsNullOrEmpty(insertText)){
e.SuppressKeyPress = true;
tb.Text = text.Insert(insertAt, insertText);
tb.SelectionStart = insertAt+cursorOffset+insertText.Length;
tb.SelectionStart = insertAt + cursorOffset + insertText.Length;
}
}
}

View File

@ -13,7 +13,7 @@ sealed partial class DialogSettingsCefArgs : Form{
public DialogSettingsCefArgs(string args){
InitializeComponent();
Text = Program.BrandName+" Options - CEF Arguments";
Text = Program.BrandName + " Options - CEF Arguments";
textBoxArgs.EnableMultilineShortcuts();
textBoxArgs.Text = initialArgs = args ?? "";
@ -32,7 +32,7 @@ private void btnApply_Click(object sender, EventArgs e){
}
int count = CommandLineArgs.ReadCefArguments(CefArgs).Count;
string prompt = count == 0 && !string.IsNullOrWhiteSpace(initialArgs) ? "All current arguments will be removed. Continue?" : count+(count == 1 ? " argument was" : " arguments were")+" detected. Continue?";
string prompt = count == 0 && !string.IsNullOrWhiteSpace(initialArgs) ? "All current arguments will be removed. Continue?" : count + (count == 1 ? " argument was" : " arguments were") + " detected. Continue?";
if (FormMessage.Question("Confirm CEF Arguments", prompt, FormMessage.OK, FormMessage.Cancel)){
DialogResult = DialogResult.OK;

View File

@ -124,7 +124,7 @@ private void btnContinue_Click(object sender, EventArgs e){
// Continue...
panelDecision.Visible = false;
panelSelection.Visible = true;
Height += panelSelection.Height-panelDecision.Height;
Height += panelSelection.Height - panelDecision.Height;
break;
case State.Reset:

View File

@ -24,7 +24,7 @@ public DialogSettingsRestart(CommandLineArgs currentArgs){
control_Change(this, EventArgs.Empty);
Text = Program.BrandName+" Arguments";
Text = Program.BrandName + " Arguments";
}
private void control_Change(object sender, EventArgs e){

View File

@ -8,7 +8,7 @@ sealed partial class DialogSettingsSearchEngine : Form{
public DialogSettingsSearchEngine(){
InitializeComponent();
Text = Program.BrandName+" Options - Custom Search Engine";
Text = Program.BrandName + " Options - Custom Search Engine";
textBoxUrl.Text = Program.Config.User.SearchEngineUrl ?? "";
textBoxUrl.Select(textBoxUrl.Text.Length, 0);

View File

@ -36,7 +36,7 @@ public TabSettingsAdvanced(Action<string> reinjectBrowserCSS, Action openDevTool
numClearCacheThreshold.SetValueSafe(SysConfig.ClearCacheThreshold);
BrowserCache.GetCacheSize(task => {
string text = task.Status == TaskStatus.RanToCompletion ? (int)Math.Ceiling(task.Result/(1024.0*1024.0))+" MB" : "unknown";
string text = task.Status == TaskStatus.RanToCompletion ? (int)Math.Ceiling(task.Result / (1024.0 * 1024.0)) + " MB" : "unknown";
this.InvokeSafe(() => btnClearCache.Text = $"Clear Cache ({text})");
});

View File

@ -24,7 +24,7 @@ public TabSettingsFeedback(AnalyticsManager analytics, AnalyticsReportGenerator.
if (analytics != null){
string collectionTime = analyticsFile.LastCollectionMessage;
labelDataCollectionMessage.Text = string.IsNullOrEmpty(collectionTime) ? "No collection yet" : "Last collection: "+collectionTime;
labelDataCollectionMessage.Text = string.IsNullOrEmpty(collectionTime) ? "No collection yet" : "Last collection: " + collectionTime;
}
}

View File

@ -51,7 +51,7 @@ public TabSettingsGeneral(Action reloadColumns, UpdateHandler updates){
checkAnimatedAvatars.Checked = Config.EnableAnimatedImages;
trackBarZoom.SetValueSafe(Config.ZoomLevel);
labelZoomValue.Text = trackBarZoom.Value+"%";
labelZoomValue.Text = trackBarZoom.Value + "%";
// system tray
@ -63,7 +63,7 @@ public TabSettingsGeneral(Action reloadColumns, UpdateHandler updates){
comboBoxTrayType.Items.Add("Minimize to Tray");
comboBoxTrayType.Items.Add("Close to Tray");
comboBoxTrayType.Items.Add("Combined");
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count-1);
comboBoxTrayType.SelectedIndex = Math.Min(Math.Max((int)Config.TrayBehavior, 0), comboBoxTrayType.Items.Count - 1);
checkTrayHighlight.Enabled = Config.TrayBehavior.ShouldDisplayIcon();
checkTrayHighlight.Checked = Config.EnableTrayHighlight;
@ -189,7 +189,7 @@ private void trackBarZoom_ValueChanged(object sender, EventArgs e){
if (trackBarZoom.AlignValueToTick()){
zoomUpdateTimer.Stop();
zoomUpdateTimer.Start();
labelZoomValue.Text = trackBarZoom.Value+"%";
labelZoomValue.Text = trackBarZoom.Value + "%";
}
}

View File

@ -59,7 +59,7 @@ public TabSettingsNotifications(FormNotificationExample notification){
checkTimerCountDown.Checked = Config.NotificationTimerCountDown;
trackBarDuration.SetValueSafe(Config.NotificationDurationValue);
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
labelDurationValue.Text = Config.NotificationDurationValue + " ms/c";
// location
@ -77,13 +77,13 @@ public TabSettingsNotifications(FormNotificationExample notification){
comboBoxDisplay.Items.Add("(Same as TweetDuck)");
foreach(Screen screen in Screen.AllScreens){
comboBoxDisplay.Items.Add(screen.DeviceName.TrimStart('\\', '.')+" ("+screen.Bounds.Width+"x"+screen.Bounds.Height+")");
comboBoxDisplay.Items.Add($"{screen.DeviceName.TrimStart('\\', '.')} ({screen.Bounds.Width}x{screen.Bounds.Height})");
}
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count-1, Config.NotificationDisplay);
comboBoxDisplay.SelectedIndex = Math.Min(comboBoxDisplay.Items.Count - 1, Config.NotificationDisplay);
trackBarEdgeDistance.SetValueSafe(Config.NotificationEdgeDistance);
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value + " px";
// size
@ -96,7 +96,7 @@ public TabSettingsNotifications(FormNotificationExample notification){
}
trackBarScrollSpeed.SetValueSafe(Config.NotificationScrollSpeed);
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value+"%";
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value + "%";
}
public override void OnReady(){
@ -195,7 +195,7 @@ private void trackBarDuration_ValueChanged(object sender, EventArgs e){
durationUpdateTimer.Start();
Config.NotificationDurationValue = trackBarDuration.Value;
labelDurationValue.Text = Config.NotificationDurationValue+" ms/c";
labelDurationValue.Text = Config.NotificationDurationValue + " ms/c";
}
private void btnDurationShort_Click(object sender, EventArgs e){
@ -255,7 +255,7 @@ private void comboBoxDisplay_SelectedValueChanged(object sender, EventArgs e){
}
private void trackBarEdgeDistance_ValueChanged(object sender, EventArgs e){
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value+" px";
labelEdgeDistanceValue.Text = trackBarEdgeDistance.Value + " px";
Config.NotificationEdgeDistance = trackBarEdgeDistance.Value;
notification.ShowExampleNotification(false);
}
@ -282,7 +282,7 @@ private void radioSizeCustom_Click(object sender, EventArgs e){
private void trackBarScrollSpeed_ValueChanged(object sender, EventArgs e){
if (trackBarScrollSpeed.AlignValueToTick()){
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value+"%";
labelScrollSpeedValue.Text = trackBarScrollSpeed.Value + "%";
Config.NotificationScrollSpeed = trackBarScrollSpeed.Value;
}
}

View File

@ -20,7 +20,7 @@ public TabSettingsSounds(Action playSoundNotification){
toolTip.SetToolTip(tbCustomSound, "When empty, the default TweetDeck sound notification is used.");
trackBarVolume.SetValueSafe(Config.NotificationSoundVolume);
labelVolumeValue.Text = trackBarVolume.Value+"%";
labelVolumeValue.Text = trackBarVolume.Value + "%";
tbCustomSound.Text = Config.NotificationSoundPath;
tbCustomSound_TextChanged(tbCustomSound, EventArgs.Empty);
@ -83,7 +83,7 @@ private void btnResetSound_Click(object sender, EventArgs e){
private void trackBarVolume_ValueChanged(object sender, EventArgs e){
volumeUpdateTimer.Stop();
volumeUpdateTimer.Start();
labelVolumeValue.Text = trackBarVolume.Value+"%";
labelVolumeValue.Text = trackBarVolume.Value + "%";
}
private void volumeUpdateTimer_Tick(object sender, EventArgs e){

View File

@ -29,7 +29,7 @@ public static void SetupCefArgs(IDictionary<string, string> args){
args["disable-threaded-scrolling"] = "1";
if (args.TryGetValue("disable-features", out string disabledFeatures)){
args["disable-features"] = "TouchpadAndWheelScrollLatching,"+disabledFeatures;
args["disable-features"] = "TouchpadAndWheelScrollLatching," + disabledFeatures;
}
else{
args["disable-features"] = "TouchpadAndWheelScrollLatching";
@ -48,7 +48,7 @@ public static void SetupCefArgs(IDictionary<string, string> args){
args["enable-system-flash"] = "0";
if (args.TryGetValue("js-flags", out string jsFlags)){
args["js-flags"] = "--expose-gc "+jsFlags;
args["js-flags"] = "--expose-gc " + jsFlags;
}
else{
args["js-flags"] = "--expose-gc";
@ -108,7 +108,7 @@ public static void OpenExternalBrowser(string url){
goto case TwitterUrls.UrlType.Fine;
}
using(FormMessage form = new FormMessage("Blocked URL", "TweetDuck has blocked a tracking url due to privacy concerns. Do you want to visit it anyway?\n"+url, MessageBoxIcon.Warning)){
using(FormMessage form = new FormMessage("Blocked URL", "TweetDuck has blocked a tracking url due to privacy concerns. Do you want to visit it anyway?\n" + url, MessageBoxIcon.Warning)){
form.AddButton(FormMessage.No, DialogResult.No, ControlType.Cancel | ControlType.Focused);
form.AddButton(FormMessage.Yes, DialogResult.Yes, ControlType.Accept);
form.AddButton("Always Visit", DialogResult.Ignore);
@ -128,7 +128,7 @@ public static void OpenExternalBrowser(string url){
break;
case TwitterUrls.UrlType.Invalid:
FormMessage.Warning("Blocked URL", "A potentially malicious URL was blocked from opening:\n"+url, FormMessage.OK);
FormMessage.Warning("Blocked URL", "A potentially malicious URL was blocked from opening:\n" + url, FormMessage.OK);
break;
}
}
@ -158,12 +158,12 @@ public static void OpenExternalSearch(string query){
}
}
else{
OpenExternalBrowser(searchUrl+Uri.EscapeUriString(query));
OpenExternalBrowser(searchUrl + Uri.EscapeUriString(query));
}
}
public static int Scale(int baseValue, double scaleFactor){
return (int)Math.Round(baseValue*scaleFactor);
return (int)Math.Round(baseValue * scaleFactor);
}
}
}

View File

@ -133,7 +133,7 @@ public static int GetIdleSeconds(){
ticks = (uint)Environment.TickCount;
}
int seconds = (int)Math.Floor(TimeSpan.FromMilliseconds(ticks-info.dwTime).TotalSeconds);
int seconds = (int)Math.Floor(TimeSpan.FromMilliseconds(ticks - info.dwTime).TotalSeconds);
return Math.Max(0, seconds); // ignore rollover after several weeks of uptime
}

View File

@ -32,7 +32,7 @@ static void ViewImageInternal(string path){
WindowsUtils.OpenAssociatedProgram(path);
}
else{
FormMessage.Error("Image Download", "Invalid file extension "+ext, FormMessage.OK);
FormMessage.Error("Image Download", "Invalid file extension " + ext, FormMessage.OK);
}
}
@ -45,7 +45,7 @@ static void ViewImageInternal(string path){
DownloadFileAuth(TwitterUrls.GetMediaLink(url, quality), file, () => {
ViewImageInternal(file);
}, ex => {
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
FormMessage.Error("Image Download", "An error occurred while downloading the image: " + ex.Message, FormMessage.OK);
});
}
}
@ -69,12 +69,12 @@ public static void DownloadImages(string[] urls, string username, ImageQuality q
AutoUpgradeEnabled = true,
OverwritePrompt = urls.Length == 1,
Title = "Save Image",
FileName = qualityIndex == -1 ? filename : $"{username} {Path.ChangeExtension(filename, null)} {firstImageLink.Substring(qualityIndex+1)}".Trim()+ext,
Filter = (urls.Length == 1 ? "Image" : "Images")+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
FileName = qualityIndex == -1 ? filename : $"{username} {Path.ChangeExtension(filename, null)} {firstImageLink.Substring(qualityIndex + 1)}".Trim() + ext,
Filter = (urls.Length == 1 ? "Image" : "Images") + (string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
}){
if (dialog.ShowDialog() == DialogResult.OK){
static void OnFailure(Exception ex){
FormMessage.Error("Image Download", "An error occurred while downloading the image: "+ex.Message, FormMessage.OK);
FormMessage.Error("Image Download", "An error occurred while downloading the image: " + ex.Message, FormMessage.OK);
}
if (urls.Length == 1){
@ -85,7 +85,7 @@ static void OnFailure(Exception ex){
string pathExt = Path.GetExtension(dialog.FileName);
for(int index = 0; index < urls.Length; index++){
DownloadFileAuth(TwitterUrls.GetMediaLink(urls[index], quality), $"{pathBase} {index+1}{pathExt}", null, OnFailure);
DownloadFileAuth(TwitterUrls.GetMediaLink(urls[index], quality), $"{pathBase} {index + 1}{pathExt}", null, OnFailure);
}
}
}
@ -101,11 +101,11 @@ public static void DownloadVideo(string url, string username){
OverwritePrompt = true,
Title = "Save Video",
FileName = string.IsNullOrEmpty(username) ? filename : $"{username} {filename}".TrimStart(),
Filter = "Video"+(string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
Filter = "Video" + (string.IsNullOrEmpty(ext) ? " (unknown)|*.*" : $" (*{ext})|*{ext}")
}){
if (dialog.ShowDialog() == DialogResult.OK){
DownloadFileAuth(url, dialog.FileName, null, ex => {
FormMessage.Error("Video Download", "An error occurred while downloading the video: "+ex.Message, FormMessage.OK);
FormMessage.Error("Video Download", "An error occurred while downloading the video: " + ex.Message, FormMessage.OK);
});
}
}

View File

@ -37,7 +37,7 @@ public static bool OpenAssociatedProgram(string file, string arguments = "", boo
}catch(Win32Exception e) when (e.NativeErrorCode == 0x000004C7){ // operation canceled by the user
return false;
}catch(Exception e){
Program.Reporter.HandleException("Error Opening Program", "Could not open the associated program for "+file, true, e);
Program.Reporter.HandleException("Error Opening Program", "Could not open the associated program for " + file, true, e);
return false;
}
}
@ -79,8 +79,8 @@ public static void ClipboardStripHtmlStyles(){
string updatedHtml = RegexStripHtmlStyles.Value.Replace(originalHtml, string.Empty);
int removed = originalHtml.Length-updatedHtml.Length;
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value)-removed).ToString().PadLeft(match.Value.Length, '0'));
int removed = originalHtml.Length - updatedHtml.Length;
updatedHtml = RegexOffsetClipboardHtml.Value.Replace(updatedHtml, match => (int.Parse(match.Value) - removed).ToString().PadLeft(match.Value.Length, '0'));
DataObject obj = new DataObject();
obj.SetText(originalText, TextDataFormat.UnicodeText);
@ -130,8 +130,8 @@ static IEnumerable<Browser> ReadBrowsersFromKey(RegistryHive hive){
continue;
}
if (browserPath[0] == '"' && browserPath[browserPath.Length-1] == '"'){
browserPath = browserPath.Substring(1, browserPath.Length-2);
if (browserPath[0] == '"' && browserPath[browserPath.Length - 1] == '"'){
browserPath = browserPath.Substring(1, browserPath.Length - 2);
}
yield return new Browser(browserName, browserPath);

View File

@ -27,7 +27,7 @@ public PluginControl(PluginManager pluginManager, Plugin plugin) : this(){
float dpiScale = this.GetDPIScale();
if (dpiScale > 1F){
Size = MaximumSize = new Size(MaximumSize.Width, MaximumSize.Height+3);
Size = MaximumSize = new Size(MaximumSize.Width, MaximumSize.Height + 3);
}
this.labelName.Text = plugin.Name;

View File

@ -84,7 +84,7 @@ private static void Main(){
WindowRestoreMessage = NativeMethods.RegisterWindowMessage("TweetDuckRestore");
if (!FileUtils.CheckFolderWritePermission(StoragePath)){
FormMessage.Warning("Permission Error", "TweetDuck does not have write permissions to the storage folder: "+StoragePath, FormMessage.OK);
FormMessage.Warning("Permission Error", "TweetDuck does not have write permissions to the storage folder: " + StoragePath, FormMessage.OK);
return;
}
@ -143,7 +143,7 @@ private static void Main(){
try{
RequestHandlerBase.LoadResourceRewriteRules(Arguments.GetValue(Arguments.ArgFreeze));
}catch(Exception e){
FormMessage.Error("Resource Freeze", "Error parsing resource rewrite rules: "+e.Message, FormMessage.OK);
FormMessage.Error("Resource Freeze", "Error parsing resource rewrite rules: " + e.Message, FormMessage.OK);
return;
}
@ -154,7 +154,7 @@ private static void Main(){
CefSettings settings = new CefSettings{
UserAgent = BrowserUtils.UserAgentChrome,
BrowserSubprocessPath = BrandName+".Browser.exe",
BrowserSubprocessPath = BrandName + ".Browser.exe",
CachePath = StoragePath,
UserDataPath = CefDataPath,
LogFile = ConsoleLogFilePath,
@ -178,7 +178,7 @@ private static void Main(){
ExitCleanup();
// ProgramPath has a trailing backslash
string updaterArgs = "/SP- /SILENT /FORCECLOSEAPPLICATIONS /UPDATEPATH=\""+ProgramPath+"\" /RUNARGS=\""+Arguments.GetCurrentForInstallerCmd()+"\""+(IsPortable ? " /PORTABLE=1" : "");
string updaterArgs = "/SP- /SILENT /FORCECLOSEAPPLICATIONS /UPDATEPATH=\"" + ProgramPath + "\" /RUNARGS=\"" + Arguments.GetCurrentForInstallerCmd() + "\"" + (IsPortable ? " /PORTABLE=1" : "");
bool runElevated = !IsPortable || !FileUtils.CheckFolderWritePermission(ProgramPath);
if (WindowsUtils.OpenAssociatedProgram(mainForm.UpdateInstallerPath, updaterArgs, runElevated)){
@ -195,10 +195,10 @@ private static string GetDataStoragePath(){
if (custom != null && (custom.Contains(Path.DirectorySeparatorChar) || custom.Contains(Path.AltDirectorySeparatorChar))){
if (Path.GetInvalidPathChars().Any(custom.Contains)){
Reporter.HandleEarlyFailure("Data Folder Invalid", "The data folder contains invalid characters:\n"+custom);
Reporter.HandleEarlyFailure("Data Folder Invalid", "The data folder contains invalid characters:\n" + custom);
}
else if (!Path.IsPathRooted(custom)){
Reporter.HandleEarlyFailure("Data Folder Invalid", "The data folder has to be either a simple folder name, or a full path:\n"+custom);
Reporter.HandleEarlyFailure("Data Folder Invalid", "The data folder has to be either a simple folder name, or a full path:\n" + custom);
}
return Environment.ExpandEnvironmentVariables(custom);

View File

@ -58,8 +58,8 @@ bool IAppErrorHandler.Log(string text){
public void HandleException(string caption, string message, bool canIgnore, Exception e){
bool loggedSuccessfully = LogImportant(e.ToString());
string exceptionText = e is ExpandedLogException ? e.Message+"\n\nDetails with potentially sensitive information are in the Error Log." : e.Message;
FormMessage form = new FormMessage(caption, message+"\nError: "+exceptionText, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);
string exceptionText = e is ExpandedLogException ? e.Message + "\n\nDetails with potentially sensitive information are in the Error Log." : e.Message;
FormMessage form = new FormMessage(caption, message + "\nError: " + exceptionText, canIgnore ? MessageBoxIcon.Warning : MessageBoxIcon.Error);
Button btnExit = form.AddButton(FormMessage.Exit);
Button btnIgnore = form.AddButton(FormMessage.Ignore, DialogResult.Ignore, ControlType.Cancel);
@ -115,7 +115,7 @@ public ExpandedLogException(Exception source, string details) : base(source.Mess
this.details = details;
}
public override string ToString() => base.ToString()+"\r\n"+details;
public override string ToString() => base.ToString() + "\r\n" + details;
}
}
}

View File

@ -62,7 +62,7 @@ private string LoadInternal(string path, bool silent){
}
else{
separator = contents.IndexOf('\n');
string fileVersion = contents.Substring(1, separator-1).TrimEnd();
string fileVersion = contents.Substring(1, separator - 1).TrimEnd();
if (fileVersion != Program.VersionTag){
ShowLoadError(silent ? null : sync, $"File {path} is made for a different version of TweetDuck ({fileVersion}) and may not function correctly in this version, please try reinstalling the app.");

View File

@ -11,8 +11,8 @@ public FormUpdateDownload(UpdateInfo info){
this.updateInfo = info;
Text = "Updating "+Program.BrandName;
labelDescription.Text = "Downloading version "+info.VersionTag+"...";
Text = "Updating " + Program.BrandName;
labelDescription.Text = $"Downloading version {info.VersionTag}...";
timerDownloadCheck.Start();
}

View File

@ -13,7 +13,7 @@ public static Server CreateServer(){
public static Client CreateClient(string token){
int space = token.IndexOf(' ');
return new Client(token.Substring(0, space), token.Substring(space+1));
return new Client(token.Substring(0, space), token.Substring(space + 1));
}
protected readonly PipeStream pipeIn;
@ -74,7 +74,7 @@ public sealed class Server : DuplexPipe{
internal Server() : base(new AnonymousPipeServerStream(PipeDirection.In, HandleInheritability.Inheritable), new AnonymousPipeServerStream(PipeDirection.Out, HandleInheritability.Inheritable)){}
public string GenerateToken(){
return ServerPipeIn.GetClientHandleAsString()+" "+ServerPipeOut.GetClientHandleAsString();
return ServerPipeIn.GetClientHandleAsString() + " " + ServerPipeOut.GetClientHandleAsString();
}
public void DisposeToken(){
@ -100,7 +100,7 @@ internal PipeReadEventArgs(string line){
}
else{
Key = line.Substring(0, separatorIndex);
Data = line.Substring(separatorIndex+1);
Data = line.Substring(separatorIndex + 1);
}
}
}

View File

@ -16,7 +16,7 @@ public static void ReadStringArray(char entryChar, string[] array, CommandLineAr
if (entry.Length > 0 && entry[0] == entryChar){
if (index < array.Length - 1){
string potentialValue = array[index+1];
string potentialValue = array[index + 1];
if (potentialValue.Length > 0 && potentialValue[0] == entryChar){
targetArgs.AddFlag(entry);

View File

@ -21,7 +21,7 @@ public void WriteFile(string identifier, string path){
byte[] name = Encoding.UTF8.GetBytes(identifier);
if (name.Length > 255){
throw new ArgumentOutOfRangeException("Identifier cannot be 256 or more characters long: "+identifier);
throw new ArgumentOutOfRangeException("Identifier cannot be 256 or more characters long: " + identifier);
}
byte[] contents;
@ -103,7 +103,7 @@ public string KeyName{
public string[] KeyValue{
get{
int index = Identifier.IndexOf(KeySeparator);
return index == -1 ? StringUtils.EmptyArray : Identifier.Substring(index+1).Split(KeySeparator);
return index == -1 ? StringUtils.EmptyArray : Identifier.Substring(index + 1).Split(KeySeparator);
}
}

View File

@ -24,25 +24,25 @@ private static string UnescapeStream(StreamReader reader){
while(true){
int nextIndex = data.IndexOf('\\', index);
if (nextIndex == -1 || nextIndex+1 >= data.Length){
if (nextIndex == -1 || nextIndex + 1 >= data.Length){
break;
}
else{
build.Append(data.Substring(index, nextIndex-index));
build.Append(data.Substring(index, nextIndex - index));
char next = data[nextIndex+1];
char next = data[nextIndex + 1];
if (next == '\\'){ // convert double backslash to single backslash
build.Append('\\');
index = nextIndex+2;
index = nextIndex + 2;
}
else if (next == '\r' && nextIndex+2 < data.Length && data[nextIndex+2] == '\n'){ // convert backslash followed by CRLF to custom new line
else if (next == '\r' && nextIndex + 2 < data.Length && data[nextIndex + 2] == '\n'){ // convert backslash followed by CRLF to custom new line
build.Append(NewLineCustom);
index = nextIndex+3;
index = nextIndex + 3;
}
else{ // single backslash
build.Append('\\');
index = nextIndex+1;
index = nextIndex + 1;
}
}
}
@ -125,8 +125,8 @@ public void Read(string file, T obj){
}
}
else{
line = contents.Substring(currentPos, nextPos-currentPos);
currentPos = nextPos+NewLineReal.Length;
line = contents.Substring(currentPos, nextPos - currentPos);
currentPos = nextPos + NewLineReal.Length;
}
int space = line.IndexOf(' ');
@ -137,7 +137,7 @@ public void Read(string file, T obj){
}
string property = line.Substring(0, space);
string value = UnescapeLine(line.Substring(space+1));
string value = UnescapeLine(line.Substring(space + 1));
if (props.TryGetValue(property, out PropertyInfo info)){
if (!converters.TryGetValue(info.PropertyType, out ITypeConverter serializer)){

View File

@ -7,7 +7,7 @@ public static void CreateDirectoryForFile(string file){
string dir = Path.GetDirectoryName(file);
if (dir == null){
throw new ArgumentException("Invalid file path: "+file);
throw new ArgumentException("Invalid file path: " + file);
}
else if (dir.Length > 0){
Directory.CreateDirectory(dir);

View File

@ -68,7 +68,7 @@ public void TestEmptyFiles(){
[TestMethod]
public void TestTextFilesAndComplexKeys(){
File.WriteAllText("input_text_1", "Hello World!"+Environment.NewLine);
File.WriteAllText("input_text_1", "Hello World!" + Environment.NewLine);
using(CombinedFileStream cfs = new CombinedFileStream(File.OpenWrite("text_files"))){
cfs.WriteFile(new string[]{ "key1", "a", "bb", "ccc", "dddd" }, "input_text_1");
@ -93,7 +93,7 @@ public void TestTextFilesAndComplexKeys(){
}
Assert.IsTrue(File.Exists("text_file_1"));
Assert.AreEqual("Hello World!"+Environment.NewLine, File.ReadAllText("text_file_1"));
Assert.AreEqual("Hello World!" + Environment.NewLine, File.ReadAllText("text_file_1"));
}
[TestMethod]

View File

@ -30,7 +30,7 @@ public void TestBasicWriteRead(){
TestBool = true,
TestInt = -100,
TestStringBasic = "hello123",
TestStringNewLine = "abc"+Environment.NewLine+"def"+Environment.NewLine,
TestStringNewLine = "abc" + Environment.NewLine + "def" + Environment.NewLine,
TestStringBackslash = @"C:\Test\\\Abc\",
TestStringNull = null,
TestEnum = TestEnum.D
@ -45,7 +45,7 @@ public void TestBasicWriteRead(){
Assert.IsTrue(read.TestBool);
Assert.AreEqual(-100, read.TestInt);
Assert.AreEqual("hello123", read.TestStringBasic);
Assert.AreEqual("abc"+Environment.NewLine+"def"+Environment.NewLine, read.TestStringNewLine);
Assert.AreEqual("abc" + Environment.NewLine + "def" + Environment.NewLine, read.TestStringNewLine);
Assert.AreEqual(@"C:\Test\\\Abc\", read.TestStringBackslash);
Assert.IsNull(read.TestStringNull);
Assert.AreEqual(TestEnum.D, read.TestEnum);

View File

@ -85,15 +85,15 @@ module GetMediaLink_Default =
[<Fact>]
let ``does not modify URL w/o extension`` () =
Assert.Equal(domain+"/media/123", getMediaLinkDefault(domain+"/media/123"))
Assert.Equal(domain + "/media/123", getMediaLinkDefault(domain + "/media/123"))
[<Fact>]
let ``does not modify URL w/o quality suffix`` () =
Assert.Equal(domain+"/media/123.jpg", getMediaLinkDefault(domain+"/media/123.jpg"))
Assert.Equal(domain + "/media/123.jpg", getMediaLinkDefault(domain + "/media/123.jpg"))
[<Fact>]
let ``does not modify URL with quality suffix`` () =
Assert.Equal(domain+"/media/123.jpg:small", getMediaLinkDefault(domain+"/media/123.jpg:small"))
Assert.Equal(domain + "/media/123.jpg:small", getMediaLinkDefault(domain + "/media/123.jpg:small"))
module GetMediaLink_Orig =
@ -102,19 +102,19 @@ module GetMediaLink_Orig =
[<Fact>]
let ``appends :orig to valid URL w/o quality suffix`` () =
Assert.Equal(domain+"/media/123.jpg:orig", getMediaLinkOrig(domain+"/media/123.jpg"))
Assert.Equal(domain + "/media/123.jpg:orig", getMediaLinkOrig(domain + "/media/123.jpg"))
[<Fact>]
let ``rewrites :orig into valid URL with quality suffix`` () =
Assert.Equal(domain+"/media/123.jpg:orig", getMediaLinkOrig(domain+"/media/123.jpg:small"))
Assert.Equal(domain + "/media/123.jpg:orig", getMediaLinkOrig(domain + "/media/123.jpg:small"))
[<Fact>]
let ``does not modify unknown URL w/o quality suffix`` () =
Assert.Equal(domain+"/profile_images/123.jpg", getMediaLinkOrig(domain+"/profile_images/123.jpg"))
Assert.Equal(domain + "/profile_images/123.jpg", getMediaLinkOrig(domain + "/profile_images/123.jpg"))
[<Fact>]
let ``rewrites :orig into unknown URL with quality suffix`` () =
Assert.Equal(domain+"/profile_images/123.jpg:orig", getMediaLinkOrig(domain+"/profile_images/123.jpg:small"))
Assert.Equal(domain + "/profile_images/123.jpg:orig", getMediaLinkOrig(domain + "/profile_images/123.jpg:small"))
module GetImageFileName =
@ -165,13 +165,13 @@ module RegexAccount_IsMatch =
[<InlineData("search-home")>]
[<InlineData("search-advanced")>]
let ``rejects reserved page names`` (name: string) =
Assert.False(isMatch("https://twitter.com/"+name))
Assert.False(isMatch("https://twitter.com/" + name))
[<Theory>]
[<InlineData("tosser")>]
[<InlineData("searching")>]
let ``accepts accounts starting with reserved page names`` (name: string) =
Assert.True(isMatch("https://twitter.com/"+name))
Assert.True(isMatch("https://twitter.com/" + name))
[<Collection("RegexAccount")>]

View File

@ -28,9 +28,9 @@ public void AttachTooltip(Control control, bool followCursor, Func<MouseEventArg
Text = text;
Point loc = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X+(followCursor ? args.X : control.Width/2), 0)));
loc.X = Math.Max(0, Math.Min(form.Width-Width, loc.X-Width/2));
loc.Y -= Height-Margin.Top+Margin.Bottom;
Point loc = form.PointToClient(control.Parent.PointToScreen(new Point(control.Location.X + (followCursor ? args.X : control.Width / 2), 0)));
loc.X = Math.Max(0, Math.Min(form.Width - Width, loc.X - Width / 2));
loc.Y -= Height - Margin.Top + Margin.Bottom;
Location = loc;
ResumeLayout();

View File

@ -19,21 +19,21 @@ public SeekBar(){
}
public double GetProgress(int clientX){
return clientX/(Width-1.0);
return clientX / (Width - 1.0);
}
protected override void OnPaint(PaintEventArgs e){
if (brushFore.Color != ForeColor){
brushFore.Color = ForeColor;
brushHover.Color = Color.FromArgb(128, ForeColor);
brushOverlap.Color = Color.FromArgb(80+ForeColor.R*11/16, 80+ForeColor.G*11/16, 80+ForeColor.B*11/16);
brushOverlap.Color = Color.FromArgb(80 + ForeColor.R * 11 / 16, 80 + ForeColor.G * 11 / 16, 80 + ForeColor.B * 11 / 16);
brushBack.Color = Parent.BackColor;
}
Rectangle rect = new Rectangle(0, 0, Width, Height);
Point cursor = PointToClient(Cursor.Position);
int width = rect.Width-1;
int progress = (int)(width*((double)Value/Maximum));
int width = rect.Width - 1;
int progress = (int)(width * ((double)Value / Maximum));
rect.Width = progress;
rect.Height -= 1;
@ -46,7 +46,7 @@ protected override void OnPaint(PaintEventArgs e){
}
else{
rect.X = progress;
rect.Width = cursor.X-rect.X;
rect.Width = cursor.X - rect.X;
e.Graphics.FillRectangle(brushHover, rect);
}
}
@ -57,7 +57,7 @@ protected override void OnPaint(PaintEventArgs e){
e.Graphics.FillRectangle(brushBack, rect);
rect.X = 0;
rect.Y = rect.Height-1;
rect.Y = rect.Height - 1;
rect.Width = width;
rect.Height = 1;
e.Graphics.FillRectangle(brushBack, rect);

View File

@ -42,7 +42,7 @@ public FormPlayer(IntPtr handle, int dpi, int volume, string url, string token){
if (NativeMethods.GetWindowRect(ownerHandle, out NativeMethods.RECT rect)){
ClientSize = new Size(0, 0);
Location = new Point((rect.Left+rect.Right)/2, (rect.Top+rect.Bottom)/2);
Location = new Point((rect.Left + rect.Right) / 2, (rect.Top + rect.Bottom) / 2);
Opacity = 0;
}
@ -71,11 +71,11 @@ public FormPlayer(IntPtr handle, int dpi, int volume, string url, string token){
}
IWMPMedia media = Player.currentMedia;
int progress = (int)(media.duration*progressSeek.GetProgress(args.X));
int progress = (int)(media.duration * progressSeek.GetProgress(args.X));
Marshal.ReleaseComObject(media);
return $"{(progress/60).ToString("00")}:{(progress%60).ToString("00")}";
return $"{(progress / 60).ToString("00")}:{(progress % 60).ToString("00")}";
});
labelTooltip.AttachTooltip(trackBarVolume, false, args => $"Volume : {trackBarVolume.Value}%");
@ -90,7 +90,7 @@ public FormPlayer(IntPtr handle, int dpi, int volume, string url, string token){
// Layout
private int DpiScaled(int value){
return (int)Math.Round(value*ownerDpi);
return (int)Math.Round(value * ownerDpi);
}
private void RefreshControlPanel(){
@ -197,8 +197,8 @@ private void timerSync_Tick(object sender, EventArgs e){
int ownerLeft = rect.Left;
int ownerTop = rect.Top;
int ownerWidth = rect.Right-rect.Left+1;
int ownerHeight = rect.Bottom-rect.Top+1;
int ownerWidth = rect.Right - rect.Left + 1;
int ownerHeight = rect.Bottom - rect.Top + 1;
// roughly matches MinimumSize for client bounds, adjusted a bit for weirdness with higher DPI
int minWidth = DpiScaled(356);
@ -209,13 +209,13 @@ private void timerSync_Tick(object sender, EventArgs e){
minHeight = Math.Min(minHeight, clientSize.Bottom);
}
int maxWidth = Math.Min(DpiScaled(media.imageSourceWidth), ownerWidth*3/4);
int maxHeight = Math.Min(DpiScaled(media.imageSourceHeight), ownerHeight*3/4);
int maxWidth = Math.Min(DpiScaled(media.imageSourceWidth), ownerWidth * 3 / 4);
int maxHeight = Math.Min(DpiScaled(media.imageSourceHeight), ownerHeight * 3 / 4);
bool isCursorInside = ClientRectangle.Contains(PointToClient(Cursor.Position));
Size newSize = new Size(Math.Max(minWidth+2, maxWidth), Math.Max(minHeight+2, maxHeight));
Point newLocation = new Point(ownerLeft+(ownerWidth-newSize.Width)/2, ownerTop+(ownerHeight-newSize.Height+SystemInformation.CaptionHeight)/2);
Size newSize = new Size(Math.Max(minWidth + 2, maxWidth), Math.Max(minHeight + 2, maxHeight));
Point newLocation = new Point(ownerLeft + (ownerWidth - newSize.Width) / 2, ownerTop + (ownerHeight - newSize.Height + SystemInformation.CaptionHeight) / 2);
if (ClientSize != newSize || Location != newLocation){
ClientSize = newSize;
@ -226,15 +226,15 @@ private void timerSync_Tick(object sender, EventArgs e){
if (isCursorInside || isDragging){
labelTime.Text = $"{controls.currentPositionString} / {media.durationString}";
int value = (int)Math.Round(progressSeek.Maximum*controls.currentPosition/media.duration);
int value = (int)Math.Round(progressSeek.Maximum * controls.currentPosition / media.duration);
if (value >= progressSeek.Maximum){
progressSeek.Value = progressSeek.Maximum;
progressSeek.Value = progressSeek.Maximum-1;
progressSeek.Value = progressSeek.Maximum - 1;
progressSeek.Value = progressSeek.Maximum;
}
else{
progressSeek.Value = value+1;
progressSeek.Value = value + 1;
progressSeek.Value = value;
}
@ -296,7 +296,7 @@ private void progressSeek_MouseDown(object sender, MouseEventArgs e){
IWMPMedia media = Player.currentMedia;
IWMPControls controls = Player.controls;
controls.currentPosition = media.duration*progressSeek.GetProgress(progressSeek.PointToClient(Cursor.Position).X);
controls.currentPosition = media.duration * progressSeek.GetProgress(progressSeek.PointToClient(Cursor.Position).X);
Marshal.ReleaseComObject(media);
Marshal.ReleaseComObject(controls);