Skip to content
Browse files

Imported source code

Imported source code from http://wpiconmaker.codeplex.com/
It is the latest version of the source dated 2011/09/28
  • Loading branch information...
1 parent 78790e6 commit a9906c1bffa086657d416dd8c1a26ee2f821308f @DavidBurela committed Jan 6, 2013
View
8 ImageShrinker/App.xaml
@@ -0,0 +1,8 @@
+<Application x:Class="ImageShrinker.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Startup="app_Startup" StartupUri="Window1.xaml">
+ <Application.Resources>
+
+ </Application.Resources>
+</Application>
View
37 ImageShrinker/App.xaml.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Linq;
+using System.Windows;
+using System.Globalization;
+
+namespace ImageShrinker
+{
+ /// <summary>
+ /// App.xaml の相互作用ロジック
+ /// </summary>
+ public partial class App : Application
+ {
+ public static string Language;
+ /// <summary>
+ /// コマンドラインを処理するスタートアップ
+ /// </summary>
+ void app_Startup(object sender, StartupEventArgs e)
+ {
+ if (e.Args.Length == 0) return;
+ foreach (string argument in e.Args)
+ {
+ if (argument.Contains("-E") || argument.Contains("-e"))
+ {
+ Language = "English";
+ //vga.Save();
+ }
+ else if (argument.Contains("-J") || argument.Contains("-j"))
+ {
+ Language = "Japanese";
+ }
+ }
+ }
+ }
+}
View
56 ImageShrinker/Properties/AssemblyInfo.cs
@@ -0,0 +1,56 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
+// アセンブリに関連付けられている情報を変更するには、
+// これらの属性値を変更してください。
+[assembly: AssemblyTitle("ImageShrinker")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("ImageShrinker")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2009")]
+[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 つの値で構成されています:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
+// 既定値にすることができます:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.1.0.0")]
+[assembly: AssemblyFileVersion("1.1.0.0")]
+[assembly: NeutralResourcesLanguageAttribute("ja-JP")]
View
63 ImageShrinker/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// このコードはツールによって生成されました。
+// ランタイム バージョン:4.0.30319.235
+//
+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
+// コードが再生成されるときに損失したりします。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace IconMaker.Properties {
+ using System;
+
+
+ /// <summary>
+ /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
+ /// </summary>
+ // このクラスは StronglyTypedResourceBuilder クラスが ResGen
+ // または Visual Studio のようなツールを使用して自動生成されました。
+ // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
+ // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("IconMaker.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// 厳密に型指定されたこのリソース クラスを使用して、すべての検索リソースに対し、
+ /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
View
117 ImageShrinker/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
View
26 ImageShrinker/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// このコードはツールによって生成されました。
+// ランタイム バージョン:4.0.30319.235
+//
+// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
+// コードが再生成されるときに損失したりします。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace IconMaker.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
View
7 ImageShrinker/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
View
26 ImageShrinker/Properties/app.manifest
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
+ <!-- UAC マニフェスト オプション
+ Windows のユーザー アカウント制御のレベルを変更するには、
+ requestedExecutionLevel ノードを以下のいずれかで置換します。
+
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
+ <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <requestedExecutionLevel level="highestAvailable" uiAccess="false" />
+
+ 下位互換性のためにファイルおよびレジストリの仮想化を
+ 利用する場合は、requestedExecutionLevel ノードを削除してください。
+ -->
+ <requestedExecutionLevel level="asInvoker" uiAccess="false" />
+ </requestedPrivileges>
+ <applicationRequestMinimum>
+ <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
+ <defaultAssemblyRequest permissionSetReference="Custom" />
+ </applicationRequestMinimum>
+ </security>
+ </trustInfo>
+</asmv1:assembly>
View
174 ImageShrinker/WP_IconMaker.csproj
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{945A2F41-1EEB-4D77-8516-D7A757ACE0D8}</ProjectGuid>
+ <OutputType>WinExe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>IconMaker</RootNamespace>
+ <AssemblyName>WP_IconMaker</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <WarningLevel>4</WarningLevel>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <ManifestCertificateThumbprint>C8C09AD85DEF54C699E5C745FE12CE697086BB7B</ManifestCertificateThumbprint>
+ <ManifestKeyFile>ImageShrinker_TemporaryKey.pfx</ManifestKeyFile>
+ <GenerateManifests>false</GenerateManifests>
+ <TargetZone>LocalIntranet</TargetZone>
+ <SignManifests>false</SignManifests>
+ <ApplicationIcon>WP_IconMaker.ico</ApplicationIcon>
+ <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>3.5</OldToolsVersion>
+ <UpgradeBackupLocation />
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>1</ApplicationRevision>
+ <ApplicationVersion>2.2.0.%2a</ApplicationVersion>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Xml.Linq">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data.DataSetExtensions">
+ <RequiredTargetFramework>3.5</RequiredTargetFramework>
+ </Reference>
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </ApplicationDefinition>
+ <Page Include="Window1.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Window1.xaml.cs">
+ <DependentUpon>Window1.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>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
+ <None Include="app.config" />
+ <None Include="Properties\app.manifest" />
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <AppDesigner Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows インストーラー 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="WP_IconMaker.ico" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
View
BIN ImageShrinker/WP_IconMaker.ico
Binary file not shown.
View
63 ImageShrinker/Window1.xaml
@@ -0,0 +1,63 @@
+<Window x:Class="ImageShrinker.Window1"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="Windows Phone Icons Maker 1.0" SizeToContent="WidthAndHeight" Icon="WP_IconMaker.ico"
+ AllowDrop="True" PreviewDrop="myImage_Drop" PreviewDragOver="myImage_PreviewDragOver" Loaded="Window_Loaded" Keyboard.PreviewKeyDown="Window_PreviewKeyDown" >
+ <Window.Resources>
+ <Storyboard x:Key="Storyboard1" FillBehavior="Stop">
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="iconPanel">
+ <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
+ <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0.8"/>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="iconPanel">
+ <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
+ <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0.8"/>
+ </DoubleAnimationUsingKeyFrames>
+ <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="iconPanel">
+ <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0" KeySpline="1,0,1,1"/>
+ <SplineDoubleKeyFrame KeyTime="0:0:2" Value="2000" KeySpline="1,0,1,1"/>
+ </DoubleAnimationUsingKeyFrames>
+ </Storyboard>
+ </Window.Resources>
+
+ <Grid Background="DarkGray">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="30" />
+ <RowDefinition Height="600" />
+ <RowDefinition Height="30" />
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="800" />
+ <ColumnDefinition Width="220" />
+ </Grid.ColumnDefinitions>
+ <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
+ <Button Margin="10,2,10,2" Height="23" Name="Open" Width="91" Click="Open_Click" >Open Image</Button>
+ <Button Margin="10,2,10,2" Height="23" Name="Save" Width="91" Click="Save_Click" >Save Icons</Button>
+ <Label Name="projectLabel" Margin="10,2,10,2">Project Name</Label>
+ <TextBox Name="projectName" Margin="2,2,10,2" Width="150" TextChanged="projectName_TextChanged" />
+
+ </StackPanel>
+ <Canvas Name="myCanvas" Width="800" Height="600" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="0,0,0,0" Grid.Row="1" PreviewMouseLeftButtonDown="UC_MouseLeftButtonDown" PreviewMouseMove="UC_MouseMove" PreviewMouseLeftButtonUp="myCanvas_PreviewMouseLeftButtonUp" >
+ <Image Name="grayImage" Canvas.Top="0" Canvas.Left="0" Width="800" Height="600" MouseLeftButtonDown="UC_MouseLeftButtonDown" MouseMove="UC_MouseMove" HorizontalAlignment="Left" VerticalAlignment="Top" SizeChanged="grayImage_SizeChanged" />
+ </Canvas>
+ <StackPanel Name="iconPanel" Grid.RowSpan="2" Grid.Column="1" Orientation="Vertical" HorizontalAlignment="Right" Width="220" RenderTransformOrigin="0.5,0.5">
+ <StackPanel.RenderTransform>
+ <TransformGroup>
+ <ScaleTransform/>
+ <SkewTransform/>
+ <RotateTransform/>
+ <TranslateTransform/>
+ </TransformGroup>
+ </StackPanel.RenderTransform>
+ <Rectangle Name="Icon200" Width="200" Height="200" Margin="0,5,0,0" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" />
+ <TextBlock Name="name200" FontFamily="Arial" FontSize="12" HorizontalAlignment="Center" Margin="0,2,0,0"/>
+ <Rectangle Name="Icon173" Width="173" Height="173" Margin="0,5,0,0" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" />
+ <TextBlock Name="name173" FontFamily="Arial" FontSize="12" HorizontalAlignment="Center" Margin="0,2,0,0"/>
+ <Rectangle Name="Icon99" Width="99" Height="99" Margin="0,5,0,0" HorizontalAlignment="Center" RenderTransformOrigin="0.5,0.5" />
+ <TextBlock Name="name99" FontFamily="Arial" FontSize="12" HorizontalAlignment="Center" Margin="0,2,0,0"/>
+ <Rectangle Name="Icon62" Width="62" Height="62" Margin="0,5,0,0" HorizontalAlignment="Center" />
+ <TextBlock Name="name62" FontFamily="Arial" FontSize="12" HorizontalAlignment="Center" Margin="0,2,0,0"/>
+ </StackPanel>
+ <Label Grid.Row="2" Name="CompleteNotice" Margin="10,2,10,2" Foreground="Black" Visibility="Visible">"Copy and Past from Clipboard, or Click [Open Image], or Drag and Drop a Picture to be icons"</Label>
+ </Grid>
+</Window>
View
377 ImageShrinker/Window1.xaml.cs
@@ -0,0 +1,377 @@
+using System;
+using System.Collections.Generic;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
+using System.IO;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using System.Globalization;
+using System.Windows.Media.Animation;
+
+namespace ImageShrinker
+{
+ /// <summary>
+ /// Window1.xaml の相互作用ロジック
+ /// </summary>
+ public partial class Window1 : Window
+ {
+ public Window1()
+ {
+ InitializeComponent();
+ }
+
+ #region InitializeText
+ private string notice1 = "Trim area to be Icon by Mouse";
+ private string notice2 = "Click [Save Icons] button if satisfied";
+ private string notice3 = "Created folder and Save Completed";
+ private string openFilter = "Image Files (*.png, *.jpg)|*.png;*.jpg|All files (*.*)|*.*";
+ private string openFolder = "Icons with same project name are already exist, please change your project name";
+ private string notice4 = "Please load .PNG or .JPG";
+ private string notice5 = "Fail to make icons, Trim area to be Icon by Mouse";
+ private bool IsPasted = false;
+ private bool IsJapanese = false;
+
+ private void Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (CultureInfo.CurrentUICulture.Name == "ja-JP" || App.Language == "Japanese") IsJapanese = true;
+ if (App.Language == "English") IsJapanese = false;
+ if (IsJapanese)
+ {
+ Save.Content = "アイコン保存";
+ Open.Content = "画像を開く";
+ projectLabel.Content = "プロジェクト名";
+ CompleteNotice.Content = "クリップボードからコピー&貼り付けするか、画像をドラッグ&ドロップするか、[画像を開く]をクリック";
+ notice1 = "アイコンにしたい部分をマウスで囲む";
+ notice2 = "気に入ったら[アイコン保存]ボタンをクリック";
+ notice3 = "フォルダーを作成し、保存しました";
+ notice4 = "PNG ファイルか JPG ファイルをロードしてください";
+ notice5 = "アイコン作成に失敗、"+notice1;
+ openFilter = "画像ファイル (*.png, *.jpg)|*.png;*.jpg|すべてのファイル (*.*)|*.*";
+ openFolder = "同じプロジェクト名のアイコンが既にあります、別のプロジェクト名に変更してください";
+ }
+ }
+ #endregion InitializeText
+
+ #region OpenImage
+
+ private void Open_Click(object sender, RoutedEventArgs e)
+ {
+ Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
+ dlg.Filter = openFilter;
+
+ Nullable<bool> result = dlg.ShowDialog();
+
+ if (result.Value)
+ {
+ ShowImage(dlg.FileName);
+ }
+ IsPasted = false;
+ }
+
+ /// <summary>
+ /// Handle Copy & Past (ctrl+V)
+ /// </summary>
+ /// <param name="sender"></param>
+ /// <param name="e"></param>
+ private void Window_PreviewKeyDown(object sender, KeyEventArgs e)
+ {
+ if ((e.KeyboardDevice.IsKeyDown(Key.LeftCtrl) || e.KeyboardDevice.IsKeyDown(Key.RightCtrl)) && (e.Key == Key.V))
+ {
+ if (Clipboard.ContainsImage())
+ {
+ BitmapSource source = Clipboard.GetImage();
+ ShowImage(source);
+ }
+ }
+
+ }
+ #endregion OpenImage
+
+ #region ShowImage
+
+ // Show Image for Copy & Paste
+ private void ShowImage(BitmapSource source)
+ {
+ projectName.Text = "MyProject";
+ fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\MyProject";
+ BmpBitmapEncoder encoder = new BmpBitmapEncoder();
+ MemoryStream memoryStream = new MemoryStream();
+ imageSource = new BitmapImage();
+ encoder.Frames.Add(BitmapFrame.Create(source));
+ encoder.Save(memoryStream);
+ imageSource.BeginInit();
+ imageSource.StreamSource = new MemoryStream(memoryStream.ToArray());
+ imageSource.EndInit(); memoryStream.Close();
+
+ grayImage.Source = imageSource;
+ if (imageSource.PixelHeight < 600 && imageSource.PixelWidth < 800)
+ {
+ grayImage.Width = imageSource.PixelWidth;
+ grayImage.Height = imageSource.PixelHeight;
+ }
+ else
+ {
+ grayImage.Width = 800;
+ grayImage.Height = 600;
+ }
+ NewImageDisplayed();
+ }
+
+ // Show Image for file load and drag
+ private void ShowImage(string filename)
+ {
+ fileName = filename;
+ imageSource = new BitmapImage();
+ imageSource.BeginInit();
+ imageSource.UriSource = new Uri(fileName);
+ imageSource.EndInit();
+
+ grayImage.Source = imageSource;
+ if (imageSource.PixelHeight < 600 && imageSource.PixelWidth < 800)
+ {
+ grayImage.Width = imageSource.PixelWidth;
+ grayImage.Height = imageSource.PixelHeight;
+ }
+ else
+ {
+ grayImage.Width = 800;
+ grayImage.Height = 600;
+ }
+ NewImageDisplayed();
+ }
+ private void DisplayIconNames()
+ {
+ string name = projectName.Text;
+ name200.Text = name + "_200.png";
+ name200.Visibility = Visibility.Visible;
+ name173.Text = name + "_173.png";
+ name173.Visibility = Visibility.Visible;
+ name99.Text = name + "_99.png";
+ name99.Visibility = Visibility.Visible;
+ name62.Text = name + "_62.png";
+ name62.Visibility = Visibility.Visible;
+ }
+ private void projectName_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ DisplayIconNames();
+ }
+ #endregion ShowImage
+
+ #region SaveIcons
+ private void Save_Click(object sender, RoutedEventArgs e)
+ {
+
+ if (Icon200.Fill != null)
+ {
+ string path = System.IO.Path.GetDirectoryName(this.fileName);
+ path = path + "\\" + projectName.Text + " Icons";
+ if (Directory.Exists(path))
+ {
+ MessageBox.Show(openFolder);
+ return;
+ }
+ System.IO.Directory.CreateDirectory(path);
+ EncodeAndSave(Icon200, name200.Text as string, path);
+ EncodeAndSave(Icon173, name173.Text as string, path);
+ EncodeAndSave(Icon173, "Background.png", path);
+ EncodeAndSave(Icon99, name99.Text as string, path);
+ EncodeAndSave(Icon62, name62.Text as string, path);
+ EncodeAndSave(Icon62, "ApplicationIcon.png", path);
+ string folder = "On same folder with your image";
+ if (IsPasted) folder = "On your desktop";
+ if (IsJapanese)
+ {
+ folder = "画像と同じフォルダーに";
+ if (IsPasted) folder = "デスクトップに";
+ }
+ CompleteNotice.Content = folder + projectName.Text + " Icons" + notice3;
+ CompleteNotice.Visibility = Visibility.Visible;
+
+ Storyboard effect = (Storyboard)this.FindResource("Storyboard1");
+ BeginStoryboard(effect);
+ }
+ else
+ {
+ CompleteNotice.Content = notice5;
+ }
+
+ }
+ private void EncodeAndSave(FrameworkElement icon, string name, string filePath)
+ {
+ // Create BitmapFrame for Icon
+ RenderTargetBitmap rtb = new RenderTargetBitmap((int)icon.Width, (int)icon.Height, 96.0, 96.0, PixelFormats.Pbgra32);
+ DrawingVisual dv = new DrawingVisual();
+ using (DrawingContext dc = dv.RenderOpen())
+ {
+ VisualBrush vb = new VisualBrush(icon);
+ dc.DrawRectangle(vb, null, new Rect(new Point(), new Size((int)icon.Width, (int)icon.Height)));
+ }
+ rtb.Render(dv);
+ BitmapFrame bmf = BitmapFrame.Create(rtb);
+ bmf.Freeze();
+ //Icon200.Fill = new ImageBrush(bmf) ;
+ //string filePath = System.IO.Path.GetDirectoryName(this.fileName);
+ string fileOut = filePath + "\\" + name;
+ FileStream stream = new FileStream(fileOut, FileMode.Create);
+
+ // PNGにエンコード
+ PngBitmapEncoder encoder = new PngBitmapEncoder();
+ encoder.Frames.Add(bmf);
+ encoder.Save(stream);
+ stream.Close();
+ }
+
+ #endregion SaveIcons
+
+ #region DragAndDrop
+
+ private string fileName;
+ BitmapImage imageSource;
+ double scale = 1.0;
+
+ private void myImage_Drop(object sender, DragEventArgs e)
+ {
+ e.Handled = true;
+ string draggedFileName = IsSingleFile(e);
+
+ if (draggedFileName.Contains(".png") || draggedFileName.Contains(".PNG") || draggedFileName.Contains(".jpg") || draggedFileName.Contains(".JPG"))
+ {
+ //MessageBoxResult mbr = MessageBoxResult.OK;
+ //if (fileName != null)
+ // mbr = System.Windows.MessageBox.Show("表示されている画像と入れ替えますか?", "relace ?", MessageBoxButton.OKCancel);
+
+ //if (mbr == MessageBoxResult.OK)
+ //{
+ ShowImage(draggedFileName);
+ //}
+ IsPasted = false;
+ }
+ else
+ {
+ System.Windows.MessageBox.Show(notice4, "Please drag png/jpg file", MessageBoxButton.OK);
+ }
+
+ }
+
+ private void grayImage_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ NewImageDisplayed();
+ }
+ private void NewImageDisplayed()
+ {
+ scale = imageSource.Width / grayImage.ActualWidth;
+ string name = System.IO.Path.GetFileNameWithoutExtension(fileName);
+ projectName.Text = name;
+ name200.Visibility = Visibility.Hidden;
+ name173.Visibility = Visibility.Hidden;
+ name62.Visibility = Visibility.Hidden;
+ name99.Visibility = Visibility.Hidden;
+ CompleteNotice.Content = notice1;
+ Icon200.Fill = null;
+ Icon173.Fill = null;
+ Icon99.Fill = null;
+ Icon62.Fill = null;
+ myCanvas.Children.Remove(rectFrame);
+ }
+
+ private string IsSingleFile(DragEventArgs args)
+ {
+ // データオブジェクト内のファイルをチェック
+ if (args.Data.GetDataPresent(DataFormats.FileDrop, true))
+ {
+ string[] fileNames = args.Data.GetData(DataFormats.FileDrop, true) as string[];
+ // 単一ファイル/フォルダをチェック
+ if (fileNames.Length == 1)
+ {
+ // ファイルをチェック(ディレクトリはfalseを返す)
+ if (File.Exists(fileNames[0]))
+ {
+ // この時点で単一ファイルであることが分かる
+ return fileNames[0];
+ }
+ }
+ }
+ return null;
+ }
+
+ private void myImage_PreviewDragOver(object sender, DragEventArgs args)
+ {
+ // 単一ファイルだけを処理したい
+ if (IsSingleFile(args) != null) args.Effects = DragDropEffects.Copy;
+ else args.Effects = DragDropEffects.None;
+
+ // イベントをHandledに、するとDragOverハンドラがキャンセルされる
+ args.Handled = true;
+ }
+ #endregion DragAndDrop
+
+ #region MouseMove
+ private Point p1 = new Point();
+ private Point p2 = new Point();
+
+
+ private void myCanvas_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
+ {
+ CompleteNotice.Content = notice2;
+ }
+ /// <summary>
+ /// マウス左ボタン押下用のコールバック
+ /// </summary>
+ private void UC_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ p1 = e.GetPosition(grayImage);
+ CompleteNotice.Content = notice1;
+ }
+ private Rectangle rectFrame = new Rectangle();
+
+ /// <summary>
+ /// マウス移動用のコールバック
+ /// </summary>
+ private void UC_MouseMove(object sender, MouseEventArgs e)
+ {
+ p2 = e.GetPosition(grayImage);
+ if (e.LeftButton == MouseButtonState.Pressed)
+ {
+ double w = Math.Abs(p1.X - p2.X);
+ double h = Math.Abs(p1.Y - p2.Y);
+ if (w > h)
+ p2.Y = (p2.Y > p1.Y) ? p1.Y + w : p1.Y - w;
+ else
+ p2.X = (p2.X > p1.X) ? p1.X + h : p1.X - w;
+
+ Point lt = new Point((p1.X > p2.X) ? p2.X : p1.X, (p1.Y > p2.Y) ? p2.Y : p1.Y);
+ Point rb = new Point((p1.X > p2.X) ? p1.X : p2.X, (p1.Y > p2.Y) ? p1.Y : p2.Y);
+
+ // rabber band
+ myCanvas.Children.Remove(rectFrame);
+ rectFrame.Stroke = Brushes.Gray;
+ rectFrame.StrokeThickness = 1.0;
+ rectFrame.Width = rb.X - lt.X;
+ rectFrame.Height = rb.Y - lt.Y;
+ rectFrame.RenderTransform = new TranslateTransform(lt.X, lt.Y);
+ myCanvas.Children.Add(rectFrame);
+
+ // Icon Images
+ Point sourceLt = new Point(lt.X * scale, lt.Y * scale);
+ Point sourceRb = new Point(rb.X * scale, rb.Y * scale);
+
+ ImageBrush brush = new ImageBrush();
+ brush.ImageSource = imageSource;
+ brush.Viewbox = new Rect(sourceLt, sourceRb);
+ brush.ViewboxUnits = BrushMappingMode.Absolute;
+ brush.Stretch = Stretch.Fill;
+
+ Icon200.Fill = brush;
+ Icon173.Fill = brush;
+ Icon99.Fill = brush;
+ Icon62.Fill = brush;
+ DisplayIconNames();
+ }
+ }
+
+ #endregion MouseMove
+
+ }
+}
View
3 ImageShrinker/app.config
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
View
20 WP_IconMaker.sln
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WP_IconMaker", "ImageShrinker\WP_IconMaker.csproj", "{945A2F41-1EEB-4D77-8516-D7A757ACE0D8}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {945A2F41-1EEB-4D77-8516-D7A757ACE0D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {945A2F41-1EEB-4D77-8516-D7A757ACE0D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {945A2F41-1EEB-4D77-8516-D7A757ACE0D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {945A2F41-1EEB-4D77-8516-D7A757ACE0D8}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal

0 comments on commit a9906c1

Please sign in to comment.
Something went wrong with that request. Please try again.