Skip to content

Commit

Permalink
+ added settings dialog
Browse files Browse the repository at this point in the history
+ partly added directory search support (in zips)
~ set version to 1.0.1
  • Loading branch information
Nockiro committed Aug 7, 2017
1 parent da4fee7 commit f966e96
Show file tree
Hide file tree
Showing 18 changed files with 6,600 additions and 44 deletions.
9 changes: 9 additions & 0 deletions PackedFileSearcher/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,22 @@
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="PackedFileSearcher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
<section name="ZipFileSearcher.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
<userSettings>
<PackedFileSearcher.Properties.Settings>
<setting name="UseWholePathForFileNames" serializeAs="String">
<value>True</value>
</setting>
<setting name="SearchInDirs" serializeAs="String">
<value>False</value>
</setting>
</PackedFileSearcher.Properties.Settings>
<ZipFileSearcher.Properties.Settings>
<setting name="UseWholePathForFileNames" serializeAs="String">
<value>True</value>
Expand Down
9 changes: 8 additions & 1 deletion PackedFileSearcher/Classes/SearchResultInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,28 @@ public class SearchResultInstance
/// </summary>
public DateTimeOffset LastWrite { get; }

/// <summary>
/// True if the file is no file but a directory
/// </summary>
public Boolean IsDir { get; }

/// <summary>
/// Represents a search result
/// </summary>
/// <param name="path">Path to the original archive, eg. C:\test\test.zip</param>
/// <param name="insidePath">Path inside the zip, eg. Backup\99AirBaloons.txt</param>
/// <param name="filename">File name</param>
/// <param name="entryLength">Size of the unpacked entry in the archive</param>
public SearchResultInstance(ISearcher si, string path, string insidePath, string filename, ulong entryLength, DateTimeOffset lastWrite)
/// <param name="isDir">True if search result represents a directory</param>
public SearchResultInstance(ISearcher si, string path, string insidePath, string filename, ulong entryLength, DateTimeOffset lastWrite, Boolean isDir)
{
SearcherInstance = si;
PackagePath = path;
FolderPath = insidePath;
FileName = filename;
EntryLength = entryLength;
LastWrite = lastWrite;
IsDir = isDir;
}

}
Expand Down
25 changes: 19 additions & 6 deletions PackedFileSearcher/FrmMain.Designer.cs

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

26 changes: 14 additions & 12 deletions PackedFileSearcher/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,8 @@ private ListViewItem processFilePath(string filePath)
#region toolbar
private void btn_extract_Click(object sender, EventArgs e)
{
if (lv_results.SelectedItems.Count == 1)
{
using (SaveFileDialog sfd = new SaveFileDialog())
{
sfd.FileName = (lv_results.SelectedItems[0].Tag as SearchResultInstance).FileName;
sfd.ShowDialog();

if (sfd.FileName != "")
(lv_results.SelectedItems[0].Tag as SearchResultInstance).SearcherInstance.extract(lv_results.SelectedItems[0].Tag as SearchResultInstance, sfd.FileName);
}
}
else if (lv_results.SelectedItems.Count > 1)
if (lv_results.SelectedItems.Count > 1 || lv_results.SelectedItems.Cast<ListViewItem>().Where(it => (it.Tag as SearchResultInstance).IsDir).Any())
{
VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();
fbd.Multiselect = false;
Expand All @@ -143,6 +133,17 @@ private void btn_extract_Click(object sender, EventArgs e)
}

}
else if (lv_results.SelectedItems.Count == 1)
{
using (SaveFileDialog sfd = new SaveFileDialog())
{
sfd.FileName = (lv_results.SelectedItems[0].Tag as SearchResultInstance).FileName;
sfd.ShowDialog();

if (sfd.FileName != "")
(lv_results.SelectedItems[0].Tag as SearchResultInstance).SearcherInstance.extract(lv_results.SelectedItems[0].Tag as SearchResultInstance, sfd.FileName);
}
}
}

private void btn_copyPath_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -222,6 +223,8 @@ private void btn_removeFiles_Click(object sender, EventArgs e)
lv_files.EndUpdate();
}
private void lbl_caption_Click(object sender, EventArgs e) => Process.Start("https://github.com/Nockiro/packed-file-searcher");

private void btn_settings_Click(object sender, EventArgs e) => new FrmSettings().Show();
#endregion

#region search and status elements
Expand Down Expand Up @@ -477,6 +480,5 @@ private void bw_search_RunWorkerCompleted(object sender, RunWorkerCompletedEvent
tsm_searchText.Enabled = true;
}
#endregion

}
}
108 changes: 108 additions & 0 deletions PackedFileSearcher/FrmSettings.Designer.cs

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

30 changes: 30 additions & 0 deletions PackedFileSearcher/FrmSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PackedFileSearcher
{
public partial class FrmSettings : Form
{
public FrmSettings()
{
InitializeComponent();

cb_useWholeFilePathForName.Checked = Properties.Settings.Default.UseWholePathForFileNames;
cb_includeDirs.Checked = Properties.Settings.Default.SearchInDirs;
}

private void cb_useWholeFilePathForName_CheckedChanged(object sender, EventArgs e)=> Properties.Settings.Default.UseWholePathForFileNames = cb_useWholeFilePathForName.Checked;


private void cb_includeDirs_Click(object sender, EventArgs e) => Properties.Settings.Default.SearchInDirs = cb_includeDirs.Checked;

~FrmSettings() => Properties.Settings.Default.Save();
}
}
Loading

0 comments on commit f966e96

Please sign in to comment.