mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-01 04:30:49 +12:00
Make sure window title and process name length is max 255 chars
This commit is contained in:
parent
eb0e88ee57
commit
ffc0712276
|
@ -84,9 +84,9 @@ public string Parse(string pattern)
|
|||
if (WindowText != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@ -322,9 +322,9 @@ public string Parse(string pattern)
|
|||
result = Helpers.GetValidURL(result);
|
||||
}
|
||||
|
||||
if (MaxNameLength > 0 && result.Length > MaxNameLength)
|
||||
if (MaxNameLength > 0)
|
||||
{
|
||||
result = result.Remove(MaxNameLength);
|
||||
result = result.Truncate(MaxNameLength);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -32,8 +32,34 @@ namespace ShareX
|
|||
public class ImageInfo : IDisposable
|
||||
{
|
||||
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()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue