diff --git a/Sunfish/Sunfish/Form1.Designer.cs b/Sunfish/Sunfish/Form1.Designer.cs index e2388c7..77178ea 100644 --- a/Sunfish/Sunfish/Form1.Designer.cs +++ b/Sunfish/Sunfish/Form1.Designer.cs @@ -38,16 +38,16 @@ this.btSub = new System.Windows.Forms.Button(); this.lbPaths = new System.Windows.Forms.ListBox(); this.cmsItem = new System.Windows.Forms.ContextMenuStrip(this.components); + this.añadirToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.editarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.borrarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.btShowIp = new System.Windows.Forms.Button(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.btGeneralOptions = new System.Windows.Forms.Button(); this.cmsGOptions = new System.Windows.Forms.ContextMenuStrip(this.components); this.shareScreenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.tstbPassword = new System.Windows.Forms.ToolStripTextBox(); - this.añadirToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.borrarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); ((System.ComponentModel.ISupportInitialize)(this.nudPort)).BeginInit(); this.cmsItem.SuspendLayout(); this.cmsGOptions.SuspendLayout(); @@ -136,6 +136,7 @@ // // lbPaths // + this.lbPaths.AllowDrop = true; this.lbPaths.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))); @@ -150,6 +151,8 @@ this.lbPaths.TabIndex = 7; this.lbPaths.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lbPaths_DrawItem); this.lbPaths.SelectedIndexChanged += new System.EventHandler(this.lbPaths_SelectedIndexChanged); + this.lbPaths.DragDrop += new System.Windows.Forms.DragEventHandler(this.lbPaths_DragDrop); + this.lbPaths.DragEnter += new System.Windows.Forms.DragEventHandler(this.lbPaths_DragEnter); this.lbPaths.DoubleClick += new System.EventHandler(this.clbPaths_DoubleClick); // // cmsItem @@ -160,16 +163,37 @@ this.borrarToolStripMenuItem, this.toolStripSeparator1}); this.cmsItem.Name = "cmsItem"; - this.cmsItem.Size = new System.Drawing.Size(153, 98); + this.cmsItem.Size = new System.Drawing.Size(132, 76); this.cmsItem.Opening += new System.ComponentModel.CancelEventHandler(this.cmsItem_Opening); // + // añadirToolStripMenuItem + // + this.añadirToolStripMenuItem.Name = "añadirToolStripMenuItem"; + this.añadirToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert; + this.añadirToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.añadirToolStripMenuItem.Text = "Añadir"; + this.añadirToolStripMenuItem.Click += new System.EventHandler(this.btAdd_Click); + // // editarToolStripMenuItem // this.editarToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold); this.editarToolStripMenuItem.Name = "editarToolStripMenuItem"; - this.editarToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.editarToolStripMenuItem.Size = new System.Drawing.Size(131, 22); this.editarToolStripMenuItem.Text = "Editar"; // + // borrarToolStripMenuItem + // + this.borrarToolStripMenuItem.Name = "borrarToolStripMenuItem"; + this.borrarToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete; + this.borrarToolStripMenuItem.Size = new System.Drawing.Size(131, 22); + this.borrarToolStripMenuItem.Text = "Borrar"; + this.borrarToolStripMenuItem.Click += new System.EventHandler(this.btSub_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(128, 6); + // // btShowIp // this.btShowIp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -220,27 +244,6 @@ this.tstbPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tstbPassword_KeyPress); this.tstbPassword.TextChanged += new System.EventHandler(this.tstbPassword_TextChanged); // - // añadirToolStripMenuItem - // - this.añadirToolStripMenuItem.Name = "añadirToolStripMenuItem"; - this.añadirToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Insert; - this.añadirToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.añadirToolStripMenuItem.Text = "Añadir"; - this.añadirToolStripMenuItem.Click += new System.EventHandler(this.btAdd_Click); - // - // borrarToolStripMenuItem - // - this.borrarToolStripMenuItem.Name = "borrarToolStripMenuItem"; - this.borrarToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Delete; - this.borrarToolStripMenuItem.Size = new System.Drawing.Size(152, 22); - this.borrarToolStripMenuItem.Text = "Borrar"; - this.borrarToolStripMenuItem.Click += new System.EventHandler(this.btSub_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); - // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/Sunfish/Sunfish/Form1.cs b/Sunfish/Sunfish/Form1.cs index 36c531d..4678d8a 100644 --- a/Sunfish/Sunfish/Form1.cs +++ b/Sunfish/Sunfish/Form1.cs @@ -22,14 +22,14 @@ { InitializeComponent(); itembrushgray = new SolidBrush(Color.Gray); - smallfont = new Font(Font.FontFamily,7, FontStyle.Regular); + smallfont = new Font(Font.FontFamily, 7, FontStyle.Regular); Icon = Resources.sunfishWebServer; if (File.Exists(conffile)) { WebXplorer.Load(conffile); } PopulateData(); - Text += " "+Program.VERSION; + Text += " " + Program.VERSION; myscreen = Screen.FromControl(this); } @@ -37,12 +37,12 @@ { Enabled = false; nudPort.Value = WebXplorer.Port; - cbActive.Checked=WebXplorer.Active; + cbActive.Checked = WebXplorer.Active; shareScreenToolStripMenuItem.Checked = WebXplorer.SharedScreen; tstbPassword.Text = WebXplorer.SharedScreenPassword; lbPaths.Items.Clear(); foreach (WShared sh in WebXplorer.Shares) - lbPaths.Items.Add(sh); + lbPaths.Items.Add(sh); Enabled = true; } @@ -86,7 +86,7 @@ { if (!Enabled) return; - WebXplorer.Port = (int) nudPort.Value; + WebXplorer.Port = (int)nudPort.Value; } private void btAdd_Click(object sender, EventArgs e) @@ -113,7 +113,7 @@ private void clbPaths_DoubleClick(object sender, EventArgs e) { WShared sh = (WShared)lbPaths.SelectedItem; - if (sh==null) + if (sh == null) return; if (FShared.Execute(sh)) lbPaths.Update(); @@ -126,8 +126,8 @@ if (e.Index < 0) return; WShared sh = (WShared)lbPaths.Items[e.Index]; - Graphics g=e.Graphics; - int y=e.Bounds.Top+2; + Graphics g = e.Graphics; + int y = e.Bounds.Top + 2; using (Brush itembrush = new SolidBrush(e.ForeColor)) { g.DrawImage(sh.Enabled ? Resources.foldericon : Resources.foldericond, 1, y, 24, 24); @@ -148,7 +148,7 @@ private void btSub_Click(object sender, EventArgs e) { WShared sh = (WShared)lbPaths.SelectedItem; - if (sh==null) + if (sh == null) return; if (MessageBox.Show("Delete access " + sh.Name + "? Can not be undone!", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes) { @@ -159,7 +159,7 @@ private void btShowIp_Click(object sender, EventArgs e) { - StringBuilder sb = new StringBuilder(WebXplorer.Active?"A":"ina"); + StringBuilder sb = new StringBuilder(WebXplorer.Active ? "A" : "ina"); sb.Append("ctive.\r\n"); foreach (IpInfo ip in ListInterfacesIPs()) { @@ -175,12 +175,12 @@ sb.Append("\r\nSunfish "); sb.Append(Program.VERSION); sb.Append(" (C) XWolfOverride@gmail.com 2007-2015\r\nEasy folder shares"); - MessageBox.Show(sb.ToString(),"Sunfish information",MessageBoxButtons.OK,MessageBoxIcon.Information); + MessageBox.Show(sb.ToString(), "Sunfish information", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void cmsItem_Opening(object sender, CancelEventArgs e) { - WShared sh = lbPaths.SelectedItem as WShared; + WShared sh = lbPaths.SelectedItem as WShared; editarToolStripMenuItem.Enabled = sh != null; borrarToolStripMenuItem.Enabled = sh != null; toolStripSeparator1.Visible = sh != null; @@ -230,5 +230,36 @@ lock (this) myscreen = Screen.FromControl(this); } + + private void lbPaths_DragEnter(object sender, DragEventArgs e) + { + if (e.Data.GetDataPresent(DataFormats.FileDrop)) + e.Effect = DragDropEffects.Copy; + else + e.Effect = DragDropEffects.None; + } + + private void lbPaths_DragDrop(object sender, DragEventArgs e) + { + string[] files = e.Data.GetData(DataFormats.FileDrop) as string[]; + if (files != null) + { + foreach (string file in files) + { + WShared sh; + string fil = file; + if (!Directory.Exists(file)) + fil = Path.GetDirectoryName(fil); + sh = new WShared(Path.GetFileName(fil), fil); + sh.Enabled = true; + if (FShared.Execute(sh)) + { + WebXplorer.Add(sh); + lbPaths.Items.Add(sh); + } + } + Activate(); + } + } } } diff --git a/Sunfish/Sunfish/Form1.resx b/Sunfish/Sunfish/Form1.resx index d533893..092f2db 100644 --- a/Sunfish/Sunfish/Form1.resx +++ b/Sunfish/Sunfish/Form1.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAq - AQAAAk1TRnQBSQFMAgEBAgEAAUgBAAFIAQABEAEAARABAAT/AQUBAAj/AUIBTQF2BwABdgMAASgDAAFA + AQAAAk1TRnQBSQFMAgEBAgEAAVABAAFQAQABEAEAARABAAT/AQUBAAj/AUIBTQF2BwABdgMAASgDAAFA AwABEAMAAQEBAAEEBgABAhgAAYACAAGAAwACgAEAAYADAAGAAQABgAEAAoACAAPAAQADgAMAAf8CAAH/ AwAC/wEAAf8DAAH/AQAB/wEAAv8CAAP//wD/AAMAAUIBTQE+BwABPgMAASgDAAFAAwABEAMAAQEBAAEB BQABgBcAA/8BAAT/BAAE/wQABP8EAAH8AT8C/wQAAfwBPwL/BAAB/AE/Av8EAAHgAQcB4AEHBAAB4AEH diff --git a/Sunfish/Sunfish/Program.cs b/Sunfish/Sunfish/Program.cs index e8be5f6..3757a97 100644 --- a/Sunfish/Sunfish/Program.cs +++ b/Sunfish/Sunfish/Program.cs @@ -8,7 +8,7 @@ { static class Program { - public static string VERSION = "1.0"; + public static string VERSION = "1.0a"; private static Form1 mainform; /// /// Punto de entrada principal para la aplicación.