Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,7 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc

# Claude Code project-specific instructions
CLAUDE.md
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,21 @@ CgLogListener
![demo](https://i.imgur.com/xT5ZAwe.png)



目錄下可替換wav

York
20260128
1. 增加 smtp mailsettings (暫時只使用 gmail 進行測試)。
2. 新增物品損壞通知。
3. 設定應用來源,方便信件過濾。
4. 新增吃料偵測,秒數循環提醒。

20260203
1. 預設選項可由 setting.ini 中自由修改命名、regex 規則。
2. 吃料偵測改成計時器功能,可自定義秒數、提示訊息、regex 規則,若須恢復吃料判斷,案預設即可。
3. custom notify 路徑設定改成跟選擇魔力資料夾相同,不用再手動打。
4. custom notify 是否啟用通知,改成跟 sound, mail 一樣,可自行勾選是否啟用。
5. 自訂關鍵字功能,可自行增加、修改,並增加 sound mail, notify, regex 彈性設定。

![demo](https://i.meee.com.tw/QBmHzKn.png)
20 changes: 19 additions & 1 deletion src/CgLogListener/CgLogListener.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<AutorunEnabled>true</AutorunEnabled>
<ApplicationRevision>1</ApplicationRevision>
<ApplicationVersion>2.1.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand All @@ -51,6 +53,18 @@
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>76921EC744D0212480757F6181BD1C3D8ADB9734</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>CgLogListener_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<ItemGroup>
<Reference Include="INIFileParser, Version=2.5.2.0, Culture=neutral, PublicKeyToken=79af7b307b65cf3c, processorArchitecture=MSIL">
<HintPath>..\packages\ini-parser.2.5.2\lib\net20\INIFileParser.dll</HintPath>
Expand Down Expand Up @@ -96,7 +110,10 @@
<DependentUpon>Resource.resx</DependentUpon>
</Compile>
<Compile Include="Settings.cs" />
<Compile Include="TipNotifyOptions.cs" />
<Compile Include="NotifyResult.cs" />
<Compile Include="INotifyMessage.cs" />
<Compile Include="MailHelper.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="CgLogListenerControls.cs">
Expand All @@ -116,6 +133,7 @@
<LastGenOutput>Resource.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="app.config" />
<None Include="CgLogListener_TemporaryKey.pfx" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand Down
51 changes: 38 additions & 13 deletions src/CgLogListener/CgLogListenerControls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ public class CgLogListenerCheckBox : CheckBox, INotifyMessage
public string NameInSetting { get; set; }
public string RegexPattern { get; set; }

public bool Notify(string message)
public NotifyResult Notify(string message)
{
var settings = Settings.GetInstance();

if (settings.StandardTips.TryGetValue(NameInSetting, out bool value) &&
value &&
if (settings.StandardTips.TryGetValue(NameInSetting, out TipNotifyOptions options) &&
options.Enabled &&
Regex.IsMatch(message, RegexPattern))
{
return true;
return NotifyResult.Match(options.PlaySound, options.SendMail, options.CustomNotify);
}

return false;
return NotifyResult.NoMatch;
}
}

Expand All @@ -36,29 +36,54 @@ public class CgLogListenerListBox : ListBox, INotifyMessage
{
public NotifyIcon NotifyIcon { get; set; }

public bool Notify(string message)
public NotifyResult Notify(string message)
{
var settings = Settings.GetInstance();
foreach (var s in settings.CustomizeTips)
foreach (var kv in settings.CustomizeTips)
{
var split = s.Split('|');
var keyword = kv.Key;
var options = kv.Value;

if (message.Contains(split[0]))
if (!options.Enabled) continue;

var split = keyword.Split('|');
var pattern = split[0];

bool isMatch;
if (options.IsRegex)
{
try
{
isMatch = Regex.IsMatch(message, pattern);
}
catch
{
isMatch = false;
}
}
else
{
isMatch = message.Contains(pattern);
}

if (isMatch)
{
if (split.Length > 1)
{
var exps = split[1].Split(',');

return !exps.Any(x => message.Contains(x));// !message.Contains(split[1]);
if (!exps.Any(x => message.Contains(x)))
{
return NotifyResult.Match(options.PlaySound, options.SendMail, options.CustomNotify);
}
}
else
{
return true;
return NotifyResult.Match(options.PlaySound, options.SendMail, options.CustomNotify);
}
}
}

return false;
return NotifyResult.NoMatch;
}
}
}
Loading