mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
Make sure window title and process name length is max 255 chars
This commit is contained in:
parent
eb0e88ee57
commit
ffc0712276
2 changed files with 32 additions and 6 deletions
|
@ -84,9 +84,9 @@ public string Parse(string pattern)
|
||||||
if (WindowText != null)
|
if (WindowText != null)
|
||||||
{
|
{
|
||||||
string windowText = WindowText.Trim().Replace(' ', '_');
|
string windowText = WindowText.Trim().Replace(' ', '_');
|
||||||
if (MaxTitleLength > 0 && windowText.Length > MaxTitleLength)
|
if (MaxTitleLength > 0)
|
||||||
{
|
{
|
||||||
windowText = windowText.Remove(MaxTitleLength);
|
windowText = windowText.Truncate(MaxTitleLength);
|
||||||
}
|
}
|
||||||
sb.Replace(CodeMenuEntryFilename.t.ToPrefixString(), windowText);
|
sb.Replace(CodeMenuEntryFilename.t.ToPrefixString(), windowText);
|
||||||
}
|
}
|
||||||
|
@ -322,9 +322,9 @@ public string Parse(string pattern)
|
||||||
result = Helpers.GetValidURL(result);
|
result = Helpers.GetValidURL(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MaxNameLength > 0 && result.Length > MaxNameLength)
|
if (MaxNameLength > 0)
|
||||||
{
|
{
|
||||||
result = result.Remove(MaxNameLength);
|
result = result.Truncate(MaxNameLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
@ -32,8 +32,34 @@ namespace ShareX
|
||||||
public class ImageInfo : IDisposable
|
public class ImageInfo : IDisposable
|
||||||
{
|
{
|
||||||
public Bitmap Image { get; set; }
|
public Bitmap Image { get; set; }
|
||||||
public string WindowTitle { get; set; }
|
|
||||||
public string ProcessName { get; set; }
|
private string windowTitle;
|
||||||
|
|
||||||
|
public string WindowTitle
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return windowTitle;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
windowTitle = value.Truncate(255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string processName;
|
||||||
|
|
||||||
|
public string ProcessName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return processName;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
processName = value.Truncate(255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ImageInfo()
|
public ImageInfo()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue