-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kn0ws
committed
Mar 21, 2022
0 parents
commit e7c1deb
Showing
58 changed files
with
1,375 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.1.32210.238 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AntiSpamAttachment", "AntiSpamAttachment\AntiSpamAttachment.csproj", "{C827CE96-0EC0-440C-A8D8-9F81C9F514D8}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{C827CE96-0EC0-440C-A8D8-9F81C9F514D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{C827CE96-0EC0-440C-A8D8-9F81C9F514D8}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{C827CE96-0EC0-440C-A8D8-9F81C9F514D8}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{C827CE96-0EC0-440C-A8D8-9F81C9F514D8}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {90E770EE-70A5-4E6C-8D99-F9B067E4781B} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{C827CE96-0EC0-440C-A8D8-9F81C9F514D8}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<RootNamespace>AntiSpamAttachment</RootNamespace> | ||
<AssemblyName>AntiSpamAttachment</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> | ||
<WarningLevel>4</WarningLevel> | ||
<Deterministic>true</Deterministic> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="WindowsBase" /> | ||
<Reference Include="PresentationCore" /> | ||
<Reference Include="PresentationFramework" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ApplicationDefinition Include="App.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
<SubType>Designer</SubType> | ||
</ApplicationDefinition> | ||
<Page Include="MainWindow.xaml"> | ||
<Generator>MSBuild:Compile</Generator> | ||
<SubType>Designer</SubType> | ||
</Page> | ||
<Compile Include="App.xaml.cs"> | ||
<DependentUpon>App.xaml</DependentUpon> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Include="MainWindow.xaml.cs"> | ||
<DependentUpon>MainWindow.xaml</DependentUpon> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Properties\AssemblyInfo.cs"> | ||
<SubType>Code</SubType> | ||
</Compile> | ||
<Compile Include="Properties\Resources.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DesignTime>True</DesignTime> | ||
<DependentUpon>Resources.resx</DependentUpon> | ||
</Compile> | ||
<Compile Include="Properties\Settings.Designer.cs"> | ||
<AutoGen>True</AutoGen> | ||
<DependentUpon>Settings.settings</DependentUpon> | ||
<DesignTimeSharedInput>True</DesignTimeSharedInput> | ||
</Compile> | ||
<EmbeddedResource Include="Properties\Resources.resx"> | ||
<Generator>ResXFileCodeGenerator</Generator> | ||
<LastGenOutput>Resources.Designer.cs</LastGenOutput> | ||
</EmbeddedResource> | ||
<None Include="Properties\Settings.settings"> | ||
<Generator>SettingsSingleFileGenerator</Generator> | ||
<LastGenOutput>Settings.Designer.cs</LastGenOutput> | ||
</None> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="AntiSpamAttachment.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:AntiSpamAttachment" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Linq; | ||
using System.Windows; | ||
|
||
namespace AntiSpamAttachment | ||
{ | ||
/// <summary> | ||
/// App.xaml の相互作用ロジック | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Window x:Class="AntiSpamAttachment.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:AntiSpamAttachment" | ||
mc:Ignorable="d" | ||
Title="アンチスパムメールアタッチメント. Developed by Kn0ws" Height="390" Width="524"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="0*"/> | ||
<ColumnDefinition/> | ||
</Grid.ColumnDefinitions> | ||
<TextBox Name="extensions" Text=".xlsm;" HorizontalAlignment="Center" Margin="0,141,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="466" Height="22" Grid.Column="1"/> | ||
<Button Name="submit" Content="実行" HorizontalAlignment="Left" Height="59" Margin="215,227,0,0" VerticalAlignment="Top" Width="98" Grid.Column="1" FontSize="20" Click="submit_Click"/> | ||
<Label Content="アンチスパムメールアタッチメントは、昨今急増中の迷惑メールに添付されている
添付ファイルをOutlook上からブロック・非表示にします。
以下の手順に沿って「実行ボタン」を押してください。" HorizontalAlignment="Left" Height="64" Margin="14,10,0,0" VerticalAlignment="Top" Width="500" Grid.Column="1"/> | ||
<Label Content="1. ブロックする添付ファイルの拡張子(.〇〇)を入力ください。
(複数の場合は「;」[セミコロン]で区切ります。)" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="14,88,0,0" VerticalAlignment="Top" Height="48" Width="500"/> | ||
|
||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
using System; | ||
using System.Reflection; | ||
using System.Windows; | ||
|
||
|
||
namespace AntiSpamAttachment | ||
{ | ||
/// <summary> | ||
/// MainWindow.xaml の相互作用ロジック | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
public double version; | ||
|
||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
// Excelでバージョンチェック | ||
double version = checkOffice("Excel.Application"); | ||
bool isEmptyRegistry = LoadRegistry(version); | ||
if(isEmptyRegistry) | ||
{ | ||
MessageBox.Show("既にブロックする拡張子が設定済みです。\r\nその他の拡張子を設定する場合は続行してください。"); | ||
} | ||
else | ||
{ | ||
MessageBox.Show("ブロックする拡張子を入力して「実行」ボタンを押してください。"); | ||
} | ||
} | ||
|
||
private double checkOffice(string applicationID) | ||
{ | ||
var type = Type.GetTypeFromProgID(applicationID); | ||
var application = Activator.CreateInstance(type); | ||
if(application == null) | ||
{ | ||
MessageBox.Show("Officeがインストールされていないか、検出出来ませんでした。\r\nシステムを終了します。"); | ||
Application.Current.Shutdown(); | ||
return 0; | ||
} | ||
else | ||
{ | ||
var ver = application.GetType().InvokeMember("Version", BindingFlags.GetProperty, null, application, null); | ||
Double.TryParse(ver.ToString(), out version); | ||
if (version >= 14.0) | ||
{ | ||
// Office2010以降がインストール済みの場合 | ||
return version; | ||
} | ||
else | ||
{ | ||
// Office 2000より前のバージョン | ||
MessageBox.Show("本ソフトウェアのサポート対象外のOfficeです。システムを終了します。"); | ||
Application.Current.Shutdown(); | ||
return 0; | ||
} | ||
} | ||
} | ||
|
||
private bool LoadRegistry(double version) | ||
{ | ||
|
||
Microsoft.Win32.RegistryKey regkey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\" + version + @".0\Outlook\Security\", false); | ||
string check = (string)regkey.GetValue("Level1Add"); | ||
regkey.Close(); | ||
if(check != null) | ||
{ | ||
extensions.Text = check; | ||
return true; | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
|
||
} | ||
|
||
private void submit_Click(object sender, RoutedEventArgs e) | ||
{ | ||
string extension = extensions.Text; | ||
Microsoft.Win32.RegistryKey regkey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Office\" + version + @".0\Outlook\Security\"); | ||
regkey.SetValue("Level1Add", extension); | ||
regkey.Close(); | ||
MessageBox.Show("変更を適用しました。\r\n この機能は次回Outlookを再起動した際に有効になります。\r\n現在Outlookが起動している場合は一度終了してから再度起動してください。"); | ||
|
||
} | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System.Reflection; | ||
using System.Resources; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
using System.Windows; | ||
|
||
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 | ||
// アセンブリに関連付けられている情報を変更するには、 | ||
// これらの属性値を変更してください。 | ||
[assembly: AssemblyTitle("AntiSpamAttachment")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("AntiSpamAttachment")] | ||
[assembly: AssemblyCopyright("Copyright © 2022")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから | ||
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、 | ||
// その型の ComVisible 属性を true に設定してください。 | ||
[assembly: ComVisible(false)] | ||
|
||
//ローカライズ可能なアプリケーションのビルドを開始するには、 | ||
//.csproj ファイルの <UICulture>CultureYouAreCodingWith</UICulture> を | ||
//<PropertyGroup> 内部で設定します。たとえば、 | ||
//ソース ファイルで英語を使用している場合、<UICulture> を en-US に設定します。次に、 | ||
//下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を | ||
//プロジェクト ファイルの UICulture 設定と一致するよう更新します。 | ||
|
||
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] | ||
|
||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //テーマ固有のリソース ディクショナリが置かれている場所 | ||
//(リソースがページ、 | ||
// またはアプリケーション リソース ディクショナリに見つからない場合に使用されます) | ||
ResourceDictionaryLocation.SourceAssembly //汎用リソース ディクショナリが置かれている場所 | ||
//(リソースがページ、 | ||
//アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます) | ||
)] | ||
|
||
|
||
// アセンブリのバージョン情報は次の 4 つの値で構成されています: | ||
// | ||
// メジャー バージョン | ||
// マイナー バージョン | ||
// ビルド番号 | ||
// リビジョン | ||
// | ||
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます | ||
// 既定値にすることができます: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.