Skip to content

Commit

Permalink
Merge pull request #21 from NaroZeol/work
Browse files Browse the repository at this point in the history
各种更新
  • Loading branch information
NaroZeol authored Feb 21, 2024
2 parents b839fd6 + 6baa283 commit 8159bc8
Show file tree
Hide file tree
Showing 12 changed files with 193 additions and 188 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
从西南交通大学官方网站获取通知,目前实现对教务网,计院官网,扬华素质网的支持。

目前主要维护.net 8.0版本,随缘更新Framework 4.8版本
目前主要维护.net 8.0版本,随缘更新Framework 4.8版本

图标来源于 [iconfinder](https://www.iconfinder.com/)

- [常规图标](https://www.iconfinder.com/icons/5173002/alarm_alert_bell_internet_notice_notification_security_icon)
- [通知图标](https://www.iconfinder.com/icons/3993856/alert_bell_notice_notifications_notify_icon)
13 changes: 7 additions & 6 deletions dotnet8.0/Program/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ internal static class Program

static void Main()
{
string? proGramName = Assembly.GetExecutingAssembly().GetName().Name;

using Mutex mutex = new(false, proGramName, out bool createdNew);
if (!createdNew)
//用于确保只有一个实例在运行
string mutexName = "MutexForGetNoticeFromSWJTU";
Mutex mutex = new Mutex(false, mutexName, out bool isCreateNew);
if (!isCreateNew)
{
return;
MessageBox.Show(null, "已存在一个运行实例", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(1);
}

// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new Form1());
Application.Run(new MainForm());
}
}
}
4 changes: 2 additions & 2 deletions dotnet8.0/Program/Program.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>Normal.ico</ApplicationIcon>
<ApplicationIcon>Resources\icons\Normal.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Content Include="Normal.ico" />
<Content Include="Resources\icons\Normal.ico" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 5 additions & 5 deletions dotnet8.0/Program/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions dotnet8.0/Program/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Normal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon\Normal.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>..\Resources\icons\Normal.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="OnNotify" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon\OnNotify.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>..\Resources\icons\OnNotify.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
File renamed without changes.
Binary file added dotnet8.0/Program/Resources/icons/OnNotify.ico
Binary file not shown.
30 changes: 14 additions & 16 deletions dotnet8.0/Program/src/File/FIleData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,25 @@ public static string CheckDiff(string newText, string oldText)
{
return newText;
}
List<string> newTextList = newText.Split('\n').ToList();
List<string> oldTextList = oldText.Split('\n').ToList();

string ret = "";
int indexOfNewText = 0;
int indexOfOldText = 0;

while (indexOfNewText < newTextList.Count && indexOfOldText < oldTextList.Count)
HashSet<string> newTextSet = new HashSet<string>(newText.Split('\n').ToList());
HashSet<string> oldTextSet = new HashSet<string>(oldText.Split('\n').ToList());

string ret = "";
int i = 0;
foreach (string line in newTextSet)
{
if (newTextList[indexOfNewText] == oldTextList[indexOfOldText])
if (!oldTextSet.Contains(line))
{
indexOfNewText++;
indexOfOldText++;
}
else
{
ret += newTextList[indexOfNewText] + "\n";
indexOfNewText++;
ret += line + "\n";
i += 1;
if (i % 2 == 0)
{
ret += "\n";
}
}
}

return ret.TrimEnd();
}
}
148 changes: 74 additions & 74 deletions dotnet8.0/Program/src/UI/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8159bc8

Please sign in to comment.