-
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.
Initial project commit (code created in 2009)
- Loading branch information
1 parent
36ce01d
commit ab54e83
Showing
13 changed files
with
3,714 additions
and
1 deletion.
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,16 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace FileSearching | ||
{ | ||
[Serializable] | ||
public class Config | ||
{ | ||
public List<string> SugFileNames = new List<string>(); | ||
public List<string> SugPaths = new List<string>(); | ||
public List<string> SugInFiles = new List<string>(); | ||
public string arg; | ||
|
||
} | ||
} |
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,119 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="14.0"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>9.0.21022</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{0B125F7C-7F9E-40B7-87B6-CE4ACCEDB791}</ProjectGuid> | ||
<OutputType>WinExe</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>FileSearch</RootNamespace> | ||
<AssemblyName>FileSearch</AssemblyName> | ||
<ApplicationIcon>icon.ico</ApplicationIcon> | ||
<StartupObject>FileSearching.Program</StartupObject> | ||
<FileUpgradeFlags> | ||
</FileUpgradeFlags> | ||
<OldToolsVersion>3.5</OldToolsVersion> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<UpgradeBackupLocation> | ||
</UpgradeBackupLocation> | ||
<IsWebBootstrapper>false</IsWebBootstrapper> | ||
<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>0</ApplicationRevision> | ||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion> | ||
<UseApplicationTrust>false</UseApplicationTrust> | ||
<BootstrapperEnabled>true</BootstrapperEnabled> | ||
<TargetFrameworkProfile /> | ||
</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> | ||
<LangVersion>6</LangVersion> | ||
</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> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Deployment" /> | ||
<Reference Include="System.Drawing" /> | ||
<Reference Include="System.Windows.Forms" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Config.cs" /> | ||
<Compile Include="FileSearcher.cs" /> | ||
<Compile Include="MainWindow.cs"> | ||
<SubType>Form</SubType> | ||
</Compile> | ||
<Compile Include="MainWindow.Designer.cs"> | ||
<DependentUpon>MainWindow.cs</DependentUpon> | ||
</Compile> | ||
<Compile Include="Program.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<EmbeddedResource Include="MainWindow.resx"> | ||
<SubType>Designer</SubType> | ||
<DependentUpon>MainWindow.cs</DependentUpon> | ||
</EmbeddedResource> | ||
<Compile Include="Serializer.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Content Include="icon.ico" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<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 Installer 3.1</ProductName> | ||
<Install>true</Install> | ||
</BootstrapperPackage> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildBinPath)\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> |
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,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.24720.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FileSearch", "FileSearch.csproj", "{0B125F7C-7F9E-40B7-87B6-CE4ACCEDB791}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{0B125F7C-7F9E-40B7-87B6-CE4ACCEDB791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{0B125F7C-7F9E-40B7-87B6-CE4ACCEDB791}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{0B125F7C-7F9E-40B7-87B6-CE4ACCEDB791}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{0B125F7C-7F9E-40B7-87B6-CE4ACCEDB791}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
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,142 @@ | ||
/* | ||
* FileSearcher.java | ||
* | ||
* Created on 9 de Março de 2007, 14:21 | ||
* | ||
* To change this template, choose Tools | Template Manager | ||
* and open the template in the editor. | ||
*/ | ||
|
||
using System.IO; | ||
using System; | ||
using System.Collections.Generic; | ||
|
||
|
||
namespace FileSearching | ||
{ | ||
|
||
|
||
|
||
/** | ||
* | ||
* @author gustavoh | ||
*/ | ||
public class FileSearcher | ||
{ | ||
|
||
public event Estado estado; | ||
|
||
/** Creates a new instance of FileSearcher */ | ||
public FileSearcher() | ||
{ | ||
} | ||
|
||
/** | ||
* | ||
* @param path | ||
* @param filename | ||
* @param infile | ||
* @return | ||
*/ | ||
public List<FileInfo> SearchFiles(String path, String filename, String infile, bool CaseSens) | ||
{ | ||
|
||
List<FileInfo> al = new List<FileInfo>(); | ||
|
||
bool bSearchIn = (infile != ""); | ||
|
||
|
||
try | ||
{ | ||
|
||
string[] files = Directory.GetFiles(path, filename, SearchOption.AllDirectories); | ||
|
||
estado.Invoke("Verifying files..."); | ||
|
||
int Max = files.Length; | ||
int cnt =0; | ||
int show = 0; | ||
|
||
|
||
foreach (string sf in files) | ||
{ | ||
cnt++; | ||
if (bSearchIn) | ||
{ | ||
if (SearchInFile(sf, infile, CaseSens)) | ||
{ | ||
al.Add(new FileInfo(sf)); | ||
} | ||
} | ||
else | ||
{ | ||
al.Add(new FileInfo(sf)); | ||
|
||
} | ||
show++; | ||
if(show > 50){ | ||
show = 0; | ||
estado.Invoke("Verifying files, "+ cnt + " de " + Max + " ..."); | ||
} | ||
} | ||
|
||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
} | ||
|
||
|
||
return al; | ||
|
||
} | ||
|
||
|
||
|
||
private bool SearchInFile(string file, String searchWord, bool CaseSens) | ||
{ | ||
|
||
try | ||
{ | ||
|
||
|
||
using (StreamReader sr = File.OpenText(file)) | ||
{ | ||
string line; | ||
|
||
while ((line = sr.ReadLine()) != null) | ||
{ | ||
|
||
if (CaseSens) | ||
{ | ||
if (line.Contains(searchWord)) | ||
{ | ||
return true; | ||
} | ||
} | ||
else { | ||
if (line.IndexOf(searchWord,StringComparison.InvariantCultureIgnoreCase) > 0) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.StackTrace); | ||
return false; | ||
|
||
} | ||
|
||
return false; | ||
|
||
} | ||
|
||
} | ||
|
||
public delegate void Estado(string value); | ||
|
||
} |
Oops, something went wrong.