Initial commit
This commit is contained in:
36
12.3-FileFind/12.3-FileFind.csproj
Normal file
36
12.3-FileFind/12.3-FileFind.csproj
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{2EEAC6FC-66AD-4B29-8B71-E71CFA048680}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>FileFind</RootNamespace>
|
||||
<AssemblyName>12.3-FileFind</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<Compile Include="FileFind.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
17
12.3-FileFind/12.3-FileFind.sln
Normal file
17
12.3-FileFind/12.3-FileFind.sln
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "12.3-FileFind", "12.3-FileFind.csproj", "{2EEAC6FC-66AD-4B29-8B71-E71CFA048680}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{2EEAC6FC-66AD-4B29-8B71-E71CFA048680}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{2EEAC6FC-66AD-4B29-8B71-E71CFA048680}.Debug|x86.Build.0 = Debug|x86
|
||||
{2EEAC6FC-66AD-4B29-8B71-E71CFA048680}.Release|x86.ActiveCfg = Release|x86
|
||||
{2EEAC6FC-66AD-4B29-8B71-E71CFA048680}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
12
12.3-FileFind/12.3-FileFind.userprefs
Normal file
12
12.3-FileFind/12.3-FileFind.userprefs
Normal file
@@ -0,0 +1,12 @@
|
||||
<Properties StartupItem="12.3-FileFind.csproj">
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="FileFind.cs">
|
||||
<Files>
|
||||
<File FileName="FileFind.cs" Line="13" Column="36" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<BreakpointStore />
|
||||
</MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
|
||||
</Properties>
|
||||
37
12.3-FileFind/FileFind.cs
Normal file
37
12.3-FileFind/FileFind.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
class FileFind {
|
||||
public static void Main() {
|
||||
string fileName = "../../bacon.txt";
|
||||
string word = "pork";
|
||||
|
||||
try {
|
||||
StreamReader reader = new StreamReader(fileName);
|
||||
int occurences = 0;
|
||||
|
||||
string line = reader.ReadLine();
|
||||
|
||||
while (line != null) {
|
||||
int index = line.IndexOf(word);
|
||||
while (index != -1) {
|
||||
occurences++;
|
||||
index = line.IndexOf(word, (index + 1));
|
||||
}
|
||||
line = reader.ReadLine();
|
||||
}
|
||||
Console.WriteLine("Ordet \"{0}\" fanns med {1} i filen: {2}", word, occurences, fileName);
|
||||
reader.Close();
|
||||
}
|
||||
catch (FileNotFoundException fnf) {
|
||||
Console.WriteLine("Kunde inte oppna filen: {0}", fileName);
|
||||
Console.WriteLine(fnf);
|
||||
}
|
||||
catch (IOException ioex) {
|
||||
Console.WriteLine("Kan inte lasa fran filen: {0}", fileName);
|
||||
Console.WriteLine(ioex);
|
||||
}
|
||||
|
||||
Console.WriteLine("Allt klart...");
|
||||
}
|
||||
}
|
||||
17
12.3-FileFind/bacon.txt
Normal file
17
12.3-FileFind/bacon.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
Bacon ipsum dolor amet corned beef turducken sirloin shank
|
||||
tenderloin jerky tongue venison salami chicken prosciutto
|
||||
leberkas spare ribs shankle strip steak. Ball tip picanha
|
||||
turducken prosciutto porchetta. Kevin ham hock shankle cow.
|
||||
Turkey short ribs leberkas, chicken spare ribs corned beef
|
||||
tongue tenderloin pork meatball turducken fatback bresaola.
|
||||
Alcatra tenderloin ham hock landjaeger chicken ball tip
|
||||
picanha andouille filet mignon short ribs strip steak.
|
||||
|
||||
Tri-tip pork chop salami, strip steak flank tongue bacon
|
||||
pancetta. Short ribs ham pig fatback. Tongue alcatra
|
||||
venison swine, strip steak cupim chicken tri-tip fatback
|
||||
turducken bresaola. Hamburger rump pork chop beef ribs
|
||||
pancetta bresaola prosciutto turkey tri-tip tail. Meatloaf
|
||||
jowl prosciutto landjaeger drumstick ham ham hock tongue
|
||||
chuck turkey short ribs bresaola tail pastrami. Beef beef
|
||||
ribs pork loin rump filet mignon buffalo salami.
|
||||
BIN
12.3-FileFind/bin/Debug/12.3-FileFind.exe
Normal file
BIN
12.3-FileFind/bin/Debug/12.3-FileFind.exe
Normal file
Binary file not shown.
BIN
12.3-FileFind/bin/Debug/12.3-FileFind.pdb
Normal file
BIN
12.3-FileFind/bin/Debug/12.3-FileFind.pdb
Normal file
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
C:\Users\Crille\CSharp\12.3-FileFind\bin\Debug\12.3-FileFind.exe
|
||||
C:\Users\Crille\CSharp\12.3-FileFind\bin\Debug\12.3-FileFind.pdb
|
||||
C:\Users\Crille\CSharp\12.3-FileFind\obj\x86\Debug\12.3-FileFind.exe
|
||||
C:\Users\Crille\CSharp\12.3-FileFind\obj\x86\Debug\12.3-FileFind.pdb
|
||||
BIN
12.3-FileFind/obj/x86/Debug/12.3-FileFind.exe
Normal file
BIN
12.3-FileFind/obj/x86/Debug/12.3-FileFind.exe
Normal file
Binary file not shown.
BIN
12.3-FileFind/obj/x86/Debug/12.3-FileFind.pdb
Normal file
BIN
12.3-FileFind/obj/x86/Debug/12.3-FileFind.pdb
Normal file
Binary file not shown.
Reference in New Issue
Block a user