From 2c0cdf9558d3b999f94c588d0eb940dcc1b7fef8 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Sun, 7 Jun 2015 01:28:13 +0200 Subject: [PATCH] Keep original end of line characters. --- .gitignore | 6 +- ImageCrusher.sln | 40 +-- ImageCrusher/FrmImageCrusher.Designer.cs | 252 ++++++++-------- ImageCrusher/FrmImageCrusher.cs | 272 +++++++++--------- ImageCrusher/FrmImageCrusher.resx | 238 +++++++-------- ImageCrusher/ImageCrusher.csproj | 174 +++++------ ImageCrusher/Program.cs | 172 +++++------ ImageCrusher/Properties/AssemblyInfo.cs | 72 ++--- ImageCrusher/Properties/Resources.Designer.cs | 126 ++++---- ImageCrusher/Properties/Resources.resx | 232 +++++++-------- ImageCrusher/Properties/Settings.Designer.cs | 52 ++-- ImageCrusher/Properties/Settings.settings | 14 +- ImageCrusher/app.config | 6 +- 13 files changed, 828 insertions(+), 828 deletions(-) diff --git a/.gitignore b/.gitignore index af226af..b7e436f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -ImageCrusher/bin -ImageCrusher/obj -*.suo +ImageCrusher/bin +ImageCrusher/obj +*.suo diff --git a/ImageCrusher.sln b/ImageCrusher.sln index 46f878e..bbcf33b 100644 --- a/ImageCrusher.sln +++ b/ImageCrusher.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCrusher", "ImageCrusher\ImageCrusher.csproj", "{BFFF979E-15D9-43A5-917D-69A8825C0819}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BFFF979E-15D9-43A5-917D-69A8825C0819}.Debug|x86.ActiveCfg = Debug|x86 - {BFFF979E-15D9-43A5-917D-69A8825C0819}.Debug|x86.Build.0 = Debug|x86 - {BFFF979E-15D9-43A5-917D-69A8825C0819}.Release|x86.ActiveCfg = Release|x86 - {BFFF979E-15D9-43A5-917D-69A8825C0819}.Release|x86.Build.0 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageCrusher", "ImageCrusher\ImageCrusher.csproj", "{BFFF979E-15D9-43A5-917D-69A8825C0819}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BFFF979E-15D9-43A5-917D-69A8825C0819}.Debug|x86.ActiveCfg = Debug|x86 + {BFFF979E-15D9-43A5-917D-69A8825C0819}.Debug|x86.Build.0 = Debug|x86 + {BFFF979E-15D9-43A5-917D-69A8825C0819}.Release|x86.ActiveCfg = Release|x86 + {BFFF979E-15D9-43A5-917D-69A8825C0819}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ImageCrusher/FrmImageCrusher.Designer.cs b/ImageCrusher/FrmImageCrusher.Designer.cs index 164bfae..450240a 100644 --- a/ImageCrusher/FrmImageCrusher.Designer.cs +++ b/ImageCrusher/FrmImageCrusher.Designer.cs @@ -1,126 +1,126 @@ -namespace ImageCrusher -{ - partial class FrmImageCrusher - { - /// - /// Variable del diseñador requerida. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Limpiar los recursos que se estén utilizando. - /// - /// true si los recursos administrados se deben eliminar; false en caso contrario, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Código generado por el Diseñador de Windows Forms - - /// - /// Método necesario para admitir el Diseñador. No se puede modificar - /// el contenido del método con el editor de código. - /// - private void InitializeComponent() - { - this.btnCrush = new System.Windows.Forms.Button(); - this.lstImagenes = new System.Windows.Forms.ListBox(); - this.txtPath = new System.Windows.Forms.TextBox(); - this.lblPath = new System.Windows.Forms.Label(); - this.txtSize = new System.Windows.Forms.TextBox(); - this.lblSize = new System.Windows.Forms.Label(); - this.SuspendLayout(); - // - // btnCrush - // - this.btnCrush.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.btnCrush.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnCrush.Location = new System.Drawing.Point(284, 288); - this.btnCrush.Name = "btnCrush"; - this.btnCrush.Size = new System.Drawing.Size(114, 30); - this.btnCrush.TabIndex = 0; - this.btnCrush.Text = "Crush"; - this.btnCrush.UseVisualStyleBackColor = true; - this.btnCrush.Click += new System.EventHandler(this.btnCrush_Click); - // - // lstImagenes - // - this.lstImagenes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lstImagenes.FormattingEnabled = true; - this.lstImagenes.Location = new System.Drawing.Point(12, 40); - this.lstImagenes.Name = "lstImagenes"; - this.lstImagenes.Size = new System.Drawing.Size(386, 238); - this.lstImagenes.TabIndex = 1; - // - // txtPath - // - this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.txtPath.Location = new System.Drawing.Point(74, 12); - this.txtPath.Name = "txtPath"; - this.txtPath.Size = new System.Drawing.Size(324, 20); - this.txtPath.TabIndex = 2; - // - // lblPath - // - this.lblPath.AutoSize = true; - this.lblPath.Location = new System.Drawing.Point(12, 15); - this.lblPath.Name = "lblPath"; - this.lblPath.Size = new System.Drawing.Size(30, 13); - this.lblPath.TabIndex = 3; - this.lblPath.Text = "Ruta"; - // - // txtSize - // - this.txtSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.txtSize.Location = new System.Drawing.Point(74, 284); - this.txtSize.Name = "txtSize"; - this.txtSize.Size = new System.Drawing.Size(100, 20); - this.txtSize.TabIndex = 4; - // - // lblSize - // - this.lblSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblSize.AutoSize = true; - this.lblSize.Location = new System.Drawing.Point(12, 287); - this.lblSize.Name = "lblSize"; - this.lblSize.Size = new System.Drawing.Size(46, 13); - this.lblSize.TabIndex = 5; - this.lblSize.Text = "Tamaño"; - // - // FrmImageCrusher - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(410, 330); - this.Controls.Add(this.lblSize); - this.Controls.Add(this.txtSize); - this.Controls.Add(this.lblPath); - this.Controls.Add(this.txtPath); - this.Controls.Add(this.lstImagenes); - this.Controls.Add(this.btnCrush); - this.Name = "FrmImageCrusher"; - this.Text = "ImageCrusher"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Button btnCrush; - private System.Windows.Forms.ListBox lstImagenes; - private System.Windows.Forms.TextBox txtPath; - private System.Windows.Forms.Label lblPath; - private System.Windows.Forms.TextBox txtSize; - private System.Windows.Forms.Label lblSize; - } -} - +namespace ImageCrusher +{ + partial class FrmImageCrusher + { + /// + /// Variable del diseñador requerida. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Limpiar los recursos que se estén utilizando. + /// + /// true si los recursos administrados se deben eliminar; false en caso contrario, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Código generado por el Diseñador de Windows Forms + + /// + /// Método necesario para admitir el Diseñador. No se puede modificar + /// el contenido del método con el editor de código. + /// + private void InitializeComponent() + { + this.btnCrush = new System.Windows.Forms.Button(); + this.lstImagenes = new System.Windows.Forms.ListBox(); + this.txtPath = new System.Windows.Forms.TextBox(); + this.lblPath = new System.Windows.Forms.Label(); + this.txtSize = new System.Windows.Forms.TextBox(); + this.lblSize = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // btnCrush + // + this.btnCrush.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnCrush.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnCrush.Location = new System.Drawing.Point(284, 288); + this.btnCrush.Name = "btnCrush"; + this.btnCrush.Size = new System.Drawing.Size(114, 30); + this.btnCrush.TabIndex = 0; + this.btnCrush.Text = "Crush"; + this.btnCrush.UseVisualStyleBackColor = true; + this.btnCrush.Click += new System.EventHandler(this.btnCrush_Click); + // + // lstImagenes + // + this.lstImagenes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lstImagenes.FormattingEnabled = true; + this.lstImagenes.Location = new System.Drawing.Point(12, 40); + this.lstImagenes.Name = "lstImagenes"; + this.lstImagenes.Size = new System.Drawing.Size(386, 238); + this.lstImagenes.TabIndex = 1; + // + // txtPath + // + this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtPath.Location = new System.Drawing.Point(74, 12); + this.txtPath.Name = "txtPath"; + this.txtPath.Size = new System.Drawing.Size(324, 20); + this.txtPath.TabIndex = 2; + // + // lblPath + // + this.lblPath.AutoSize = true; + this.lblPath.Location = new System.Drawing.Point(12, 15); + this.lblPath.Name = "lblPath"; + this.lblPath.Size = new System.Drawing.Size(30, 13); + this.lblPath.TabIndex = 3; + this.lblPath.Text = "Ruta"; + // + // txtSize + // + this.txtSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.txtSize.Location = new System.Drawing.Point(74, 284); + this.txtSize.Name = "txtSize"; + this.txtSize.Size = new System.Drawing.Size(100, 20); + this.txtSize.TabIndex = 4; + // + // lblSize + // + this.lblSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblSize.AutoSize = true; + this.lblSize.Location = new System.Drawing.Point(12, 287); + this.lblSize.Name = "lblSize"; + this.lblSize.Size = new System.Drawing.Size(46, 13); + this.lblSize.TabIndex = 5; + this.lblSize.Text = "Tamaño"; + // + // FrmImageCrusher + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(410, 330); + this.Controls.Add(this.lblSize); + this.Controls.Add(this.txtSize); + this.Controls.Add(this.lblPath); + this.Controls.Add(this.txtPath); + this.Controls.Add(this.lstImagenes); + this.Controls.Add(this.btnCrush); + this.Name = "FrmImageCrusher"; + this.Text = "ImageCrusher"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button btnCrush; + private System.Windows.Forms.ListBox lstImagenes; + private System.Windows.Forms.TextBox txtPath; + private System.Windows.Forms.Label lblPath; + private System.Windows.Forms.TextBox txtSize; + private System.Windows.Forms.Label lblSize; + } +} + diff --git a/ImageCrusher/FrmImageCrusher.cs b/ImageCrusher/FrmImageCrusher.cs index fefc465..6b7281d 100644 --- a/ImageCrusher/FrmImageCrusher.cs +++ b/ImageCrusher/FrmImageCrusher.cs @@ -1,136 +1,136 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Windows.Forms; -using System.IO; -using System.Drawing.Imaging; -using System.Drawing.Drawing2D; - -namespace ImageCrusher -{ - public partial class FrmImageCrusher : Form - { - string _initialPath = string.Empty; - - private void Initialize() - { - InitializeComponent(); - txtPath.Text = _initialPath; - } - - public string InitialPath - { - get { return txtPath.Text; } - set { txtPath.Text = value; } - } - - public int InitialSize - { - get - { - int size; - if (!int.TryParse(txtSize.Text, out size)) - { - size = 640; - } - return size; - } - set { txtSize.Text = value.ToString(); } - } - - public FrmImageCrusher() - { - InitializeComponent(); - txtPath.Text = Directory.GetCurrentDirectory(); - txtSize.Text = InitialSize.ToString(); - } - - private void lstImagenes_Clean() - { - lstImagenes.Items.Clear(); - } - - private void lstImagenes_AddLine(string line) - { - lstImagenes.Items.Add(line); - - Application.DoEvents(); - - int visibleItems = lstImagenes.ClientSize.Height / lstImagenes.ItemHeight; - lstImagenes.TopIndex = Math.Max(lstImagenes.Items.Count - visibleItems + 1, 0); - } - - private void btnCrush_Click(object sender, EventArgs e) - { - string path=txtPath.Text; - if (!Directory.Exists(path)) - { - MessageBox.Show("El directorio no existe"); - return; - } - - String destPath = String.Format("{0}/small", path); - int size = InitialSize; - - lstImagenes_Clean(); - - string[] fileNames = Directory.GetFiles(path); - foreach (string fileName in fileNames) - { - string ext = Path.GetExtension(fileName).ToLower(); - if (ext == ".png" || ext == ".jpg" || ext == ".jpeg") - { - try - { - Image img = Image.FromFile(fileName); - int width = img.Width; - int height = img.Height; - if (width > height) - { - height = (int)(height / (width / (double)size)); - width = size; - } - else - { - width = (int)(width / (height / (double)size)); - height = size; - } - - if (!Directory.Exists(destPath)) - { - Directory.CreateDirectory(destPath); - } - - Image imgThumb = Image_Resize(img, width, height); - string newFileName = String.Format("{0}/{1}.small.jpg", destPath, Path.GetFileNameWithoutExtension(fileName)); - imgThumb.Save(newFileName, ImageFormat.Jpeg); - - lstImagenes_AddLine(string.Format("OK: {0}", newFileName)); - } - catch (Exception ex) - { - lstImagenes_AddLine(string.Format("Error: {0} {1}", fileName, ex.Message)); - } - } - } - lstImagenes_AddLine("End."); - } - - - public Image Image_Resize(Image img, int width, int height) - { - Bitmap bitmap = new Bitmap(width, height); - Graphics imgGraph = Graphics.FromImage(bitmap); - imgGraph.CompositingQuality = CompositingQuality.HighQuality; - imgGraph.SmoothingMode = SmoothingMode.HighQuality; - imgGraph.InterpolationMode = InterpolationMode.HighQualityBicubic; - var imgDimesions = new Rectangle(0, 0, width, height); - imgGraph.DrawImage(img, imgDimesions); - return bitmap; - } - } -} +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Windows.Forms; +using System.IO; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; + +namespace ImageCrusher +{ + public partial class FrmImageCrusher : Form + { + string _initialPath = string.Empty; + + private void Initialize() + { + InitializeComponent(); + txtPath.Text = _initialPath; + } + + public string InitialPath + { + get { return txtPath.Text; } + set { txtPath.Text = value; } + } + + public int InitialSize + { + get + { + int size; + if (!int.TryParse(txtSize.Text, out size)) + { + size = 640; + } + return size; + } + set { txtSize.Text = value.ToString(); } + } + + public FrmImageCrusher() + { + InitializeComponent(); + txtPath.Text = Directory.GetCurrentDirectory(); + txtSize.Text = InitialSize.ToString(); + } + + private void lstImagenes_Clean() + { + lstImagenes.Items.Clear(); + } + + private void lstImagenes_AddLine(string line) + { + lstImagenes.Items.Add(line); + + Application.DoEvents(); + + int visibleItems = lstImagenes.ClientSize.Height / lstImagenes.ItemHeight; + lstImagenes.TopIndex = Math.Max(lstImagenes.Items.Count - visibleItems + 1, 0); + } + + private void btnCrush_Click(object sender, EventArgs e) + { + string path=txtPath.Text; + if (!Directory.Exists(path)) + { + MessageBox.Show("El directorio no existe"); + return; + } + + String destPath = String.Format("{0}/small", path); + int size = InitialSize; + + lstImagenes_Clean(); + + string[] fileNames = Directory.GetFiles(path); + foreach (string fileName in fileNames) + { + string ext = Path.GetExtension(fileName).ToLower(); + if (ext == ".png" || ext == ".jpg" || ext == ".jpeg") + { + try + { + Image img = Image.FromFile(fileName); + int width = img.Width; + int height = img.Height; + if (width > height) + { + height = (int)(height / (width / (double)size)); + width = size; + } + else + { + width = (int)(width / (height / (double)size)); + height = size; + } + + if (!Directory.Exists(destPath)) + { + Directory.CreateDirectory(destPath); + } + + Image imgThumb = Image_Resize(img, width, height); + string newFileName = String.Format("{0}/{1}.small.jpg", destPath, Path.GetFileNameWithoutExtension(fileName)); + imgThumb.Save(newFileName, ImageFormat.Jpeg); + + lstImagenes_AddLine(string.Format("OK: {0}", newFileName)); + } + catch (Exception ex) + { + lstImagenes_AddLine(string.Format("Error: {0} {1}", fileName, ex.Message)); + } + } + } + lstImagenes_AddLine("End."); + } + + + public Image Image_Resize(Image img, int width, int height) + { + Bitmap bitmap = new Bitmap(width, height); + Graphics imgGraph = Graphics.FromImage(bitmap); + imgGraph.CompositingQuality = CompositingQuality.HighQuality; + imgGraph.SmoothingMode = SmoothingMode.HighQuality; + imgGraph.InterpolationMode = InterpolationMode.HighQualityBicubic; + var imgDimesions = new Rectangle(0, 0, width, height); + imgGraph.DrawImage(img, imgDimesions); + return bitmap; + } + } +} diff --git a/ImageCrusher/FrmImageCrusher.resx b/ImageCrusher/FrmImageCrusher.resx index 7080a7d..5ea0895 100644 --- a/ImageCrusher/FrmImageCrusher.resx +++ b/ImageCrusher/FrmImageCrusher.resx @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/ImageCrusher/ImageCrusher.csproj b/ImageCrusher/ImageCrusher.csproj index f2a58f3..f1cbc4d 100644 --- a/ImageCrusher/ImageCrusher.csproj +++ b/ImageCrusher/ImageCrusher.csproj @@ -1,88 +1,88 @@ - - - - Debug - x86 - 8.0.30703 - 2.0 - {BFFF979E-15D9-43A5-917D-69A8825C0819} - WinExe - Properties - ImageCrusher - ImageCrusher - v4.0 - 512 - - - - x86 - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - x86 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - Form - - - FrmImageCrusher.cs - - - - - FrmImageCrusher.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - + + + + Debug + x86 + 8.0.30703 + 2.0 + {BFFF979E-15D9-43A5-917D-69A8825C0819} + WinExe + Properties + ImageCrusher + ImageCrusher + v4.0 + 512 + + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + Form + + + FrmImageCrusher.cs + + + + + FrmImageCrusher.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + \ No newline at end of file diff --git a/ImageCrusher/Program.cs b/ImageCrusher/Program.cs index e0f06f6..26a27d8 100644 --- a/ImageCrusher/Program.cs +++ b/ImageCrusher/Program.cs @@ -1,86 +1,86 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Windows.Forms; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; - -namespace ImageCrusher -{ - static class Program - { - private static bool CreateShortcut(string shortcut, string exe, string dir) - { - bool created = false; - Type t = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")); //Windows Script Host Shell Object - object shell = Activator.CreateInstance(t); - try - { - object lnk = t.InvokeMember("CreateShortcut", BindingFlags.InvokeMethod, null, shell, new object[] { shortcut }); - try - { - string targetPath = (string)t.InvokeMember("TargetPath", BindingFlags.GetProperty, null, lnk, null); - if (targetPath != exe) - { - t.InvokeMember("TargetPath", BindingFlags.SetProperty, null, lnk, new object[] { exe }); - t.InvokeMember("WorkingDirectory", BindingFlags.SetProperty, null, lnk, new object[] { dir }); - t.InvokeMember("IconLocation", BindingFlags.SetProperty, null, lnk, new object[] { String.Format("{0}, 1", exe) }); - t.InvokeMember("Save", BindingFlags.InvokeMethod, null, lnk, null); - created = true; - } - } - finally - { - Marshal.FinalReleaseComObject(lnk); - } - } - finally - { - Marshal.FinalReleaseComObject(shell); - } - return created; - } - - private static bool InstallSendToShortcut() - { - String shortcutPath=String.Format("{0}\\ImageCrusher.lnk",Environment.GetFolderPath(Environment.SpecialFolder.SendTo)); - string exeName = Path.GetFileNameWithoutExtension(Application.ExecutablePath); - string exePath = Path.GetDirectoryName(Application.ExecutablePath); - return CreateShortcut(shortcutPath, string.Format("{0}\\{1}.exe", exePath, exeName), exePath); - } - - /// - /// Punto de entrada principal para la aplicación. - /// - [STAThread] - static void Main(string[] args) - { - if (InstallSendToShortcut()) - { - MessageBox.Show("Acceso directo creado correctamente"); - } - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - FrmImageCrusher frmImageCrusher = new FrmImageCrusher(); - if (args.Count() > 0) - { - String path = args[0]; - if (!Directory.Exists(path)) - { - if (File.Exists(path)) - { - path = Path.GetDirectoryName(path); - frmImageCrusher.InitialPath = path; - } - } - else - { - frmImageCrusher.InitialPath = path; - } - } - Application.Run(frmImageCrusher); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using System.IO; +using System.Reflection; +using System.Runtime.InteropServices; + +namespace ImageCrusher +{ + static class Program + { + private static bool CreateShortcut(string shortcut, string exe, string dir) + { + bool created = false; + Type t = Type.GetTypeFromCLSID(new Guid("72C24DD5-D70A-438B-8A42-98424B88AFB8")); //Windows Script Host Shell Object + object shell = Activator.CreateInstance(t); + try + { + object lnk = t.InvokeMember("CreateShortcut", BindingFlags.InvokeMethod, null, shell, new object[] { shortcut }); + try + { + string targetPath = (string)t.InvokeMember("TargetPath", BindingFlags.GetProperty, null, lnk, null); + if (targetPath != exe) + { + t.InvokeMember("TargetPath", BindingFlags.SetProperty, null, lnk, new object[] { exe }); + t.InvokeMember("WorkingDirectory", BindingFlags.SetProperty, null, lnk, new object[] { dir }); + t.InvokeMember("IconLocation", BindingFlags.SetProperty, null, lnk, new object[] { String.Format("{0}, 1", exe) }); + t.InvokeMember("Save", BindingFlags.InvokeMethod, null, lnk, null); + created = true; + } + } + finally + { + Marshal.FinalReleaseComObject(lnk); + } + } + finally + { + Marshal.FinalReleaseComObject(shell); + } + return created; + } + + private static bool InstallSendToShortcut() + { + String shortcutPath=String.Format("{0}\\ImageCrusher.lnk",Environment.GetFolderPath(Environment.SpecialFolder.SendTo)); + string exeName = Path.GetFileNameWithoutExtension(Application.ExecutablePath); + string exePath = Path.GetDirectoryName(Application.ExecutablePath); + return CreateShortcut(shortcutPath, string.Format("{0}\\{1}.exe", exePath, exeName), exePath); + } + + /// + /// Punto de entrada principal para la aplicación. + /// + [STAThread] + static void Main(string[] args) + { + if (InstallSendToShortcut()) + { + MessageBox.Show("Acceso directo creado correctamente"); + } + + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + FrmImageCrusher frmImageCrusher = new FrmImageCrusher(); + if (args.Count() > 0) + { + String path = args[0]; + if (!Directory.Exists(path)) + { + if (File.Exists(path)) + { + path = Path.GetDirectoryName(path); + frmImageCrusher.InitialPath = path; + } + } + else + { + frmImageCrusher.InitialPath = path; + } + } + Application.Run(frmImageCrusher); + } + } +} diff --git a/ImageCrusher/Properties/AssemblyInfo.cs b/ImageCrusher/Properties/AssemblyInfo.cs index 1020ae8..057dbdd 100644 --- a/ImageCrusher/Properties/AssemblyInfo.cs +++ b/ImageCrusher/Properties/AssemblyInfo.cs @@ -1,36 +1,36 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// La información general sobre un ensamblado se controla mediante el siguiente -// conjunto de atributos. Cambie estos atributos para modificar la información -// asociada con un ensamblado. -[assembly: AssemblyTitle("ImageCrusher")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ImageCrusher")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Si establece ComVisible como false, los tipos de este ensamblado no estarán visibles -// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde -// COM, establezca el atributo ComVisible como true en este tipo. -[assembly: ComVisible(false)] - -// El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM -[assembly: Guid("520da27f-aa14-46ea-a168-2543c594e163")] - -// La información de versión de un ensamblado consta de los cuatro valores siguientes: -// -// Versión principal -// Versión secundaria -// Número de compilación -// Revisión -// -// Puede especificar todos los valores o establecer como predeterminados los números de versión de compilación y de revisión -// mediante el asterisco ('*'), como se muestra a continuación: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// La información general sobre un ensamblado se controla mediante el siguiente +// conjunto de atributos. Cambie estos atributos para modificar la información +// asociada con un ensamblado. +[assembly: AssemblyTitle("ImageCrusher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ImageCrusher")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Si establece ComVisible como false, los tipos de este ensamblado no estarán visibles +// para los componentes COM. Si necesita obtener acceso a un tipo de este ensamblado desde +// COM, establezca el atributo ComVisible como true en este tipo. +[assembly: ComVisible(false)] + +// El siguiente GUID sirve como identificador de typelib si este proyecto se expone a COM +[assembly: Guid("520da27f-aa14-46ea-a168-2543c594e163")] + +// La información de versión de un ensamblado consta de los cuatro valores siguientes: +// +// Versión principal +// Versión secundaria +// Número de compilación +// Revisión +// +// Puede especificar todos los valores o establecer como predeterminados los números de versión de compilación y de revisión +// mediante el asterisco ('*'), como se muestra a continuación: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ImageCrusher/Properties/Resources.Designer.cs b/ImageCrusher/Properties/Resources.Designer.cs index c2d4d31..ce59aef 100644 --- a/ImageCrusher/Properties/Resources.Designer.cs +++ b/ImageCrusher/Properties/Resources.Designer.cs @@ -1,63 +1,63 @@ -//------------------------------------------------------------------------------ -// -// Este código fue generado por una herramienta. -// Versión de runtime:4.0.30319.34014 -// -// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -// se vuelve a generar el código. -// -//------------------------------------------------------------------------------ - -namespace ImageCrusher.Properties { - using System; - - - /// - /// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc. - /// - // StronglyTypedResourceBuilder generó automáticamente esta clase - // a través de una herramienta como ResGen o Visual Studio. - // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen - // con la opción /str o recompile su proyecto de 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() { - } - - /// - /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. - /// - [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("ImageCrusher.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las - /// búsquedas de recursos mediante esta clase de recurso fuertemente tipado. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime:4.0.30319.34014 +// +// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si +// se vuelve a generar el código. +// +//------------------------------------------------------------------------------ + +namespace ImageCrusher.Properties { + using System; + + + /// + /// Clase de recurso fuertemente tipado, para buscar cadenas traducidas, etc. + /// + // StronglyTypedResourceBuilder generó automáticamente esta clase + // a través de una herramienta como ResGen o Visual Studio. + // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen + // con la opción /str o recompile su proyecto de 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() { + } + + /// + /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. + /// + [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("ImageCrusher.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las + /// búsquedas de recursos mediante esta clase de recurso fuertemente tipado. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/ImageCrusher/Properties/Resources.resx b/ImageCrusher/Properties/Resources.resx index af7dbeb..ffecec8 100644 --- a/ImageCrusher/Properties/Resources.resx +++ b/ImageCrusher/Properties/Resources.resx @@ -1,117 +1,117 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/ImageCrusher/Properties/Settings.Designer.cs b/ImageCrusher/Properties/Settings.Designer.cs index 90de053..2125c7c 100644 --- a/ImageCrusher/Properties/Settings.Designer.cs +++ b/ImageCrusher/Properties/Settings.Designer.cs @@ -1,26 +1,26 @@ -//------------------------------------------------------------------------------ -// -// Este código fue generado por una herramienta. -// Versión de runtime:4.0.30319.34014 -// -// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -// se vuelve a generar el código. -// -//------------------------------------------------------------------------------ - -namespace ImageCrusher.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; - } - } - } -} +//------------------------------------------------------------------------------ +// +// Este código fue generado por una herramienta. +// Versión de runtime:4.0.30319.34014 +// +// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si +// se vuelve a generar el código. +// +//------------------------------------------------------------------------------ + +namespace ImageCrusher.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; + } + } + } +} diff --git a/ImageCrusher/Properties/Settings.settings b/ImageCrusher/Properties/Settings.settings index 3964565..abf36c5 100644 --- a/ImageCrusher/Properties/Settings.settings +++ b/ImageCrusher/Properties/Settings.settings @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/ImageCrusher/app.config b/ImageCrusher/app.config index e365603..cb2586b 100644 --- a/ImageCrusher/app.config +++ b/ImageCrusher/app.config @@ -1,3 +1,3 @@ - - - + + +