Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbu committed Sep 1, 2015
0 parents commit 34272b3
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

*.jpg binary
*.png binary
*.gif binary

*.cs text=auto diff=csharp
*.vb text=auto
*.resx text=auto
*.c text=auto
*.cpp text=auto
*.cxx text=auto
*.h text=auto
*.hxx text=auto
*.py text=auto
*.rb text=auto
*.java text=auto
*.html text=auto
*.htm text=auto
*.css text=auto
*.scss text=auto
*.sass text=auto
*.less text=auto
*.js text=auto
*.lisp text=auto
*.clj text=auto
*.sql text=auto
*.php text=auto
*.lua text=auto
*.m text=auto
*.asm text=auto
*.erl text=auto
*.fs text=auto
*.fsx text=auto
*.hs text=auto

*.csproj text=auto
*.vbproj text=auto
*.fsproj text=auto
*.dbproj text=auto
*.sln text=auto eol=crlf
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[Oo]bj/
[Bb]in/
TestResults/
.nuget/
*.sln.ide/
_ReSharper.*/
packages/
artifacts/
PublishProfiles/
.vs/
bower_components/
node_modules/
**/wwwroot/lib/
debugSettings.json
project.lock.json
*.user
*.suo
*.cache
*.docstates
_ReSharper.*
nuget.exe
*net45.csproj
*net451.csproj
*k10.csproj
*.psess
*.vsp
*.pidb
*.userprefs
*DS_Store
*.ncrunchsolution
*.*sdf
*.ipch
.settings
*.sln.ide
node_modules
**/[Cc]ompiler/[Rr]esources/**/*.js
6 changes: 6 additions & 0 deletions NuGet.Config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="api.nuget.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>
33 changes: 33 additions & 0 deletions WatchLots.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B641BF61-0C5C-429F-ADC4-7EC52E57B205}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6262D40A-B965-4E55-BF40-C3CA8FE551DC}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
NuGet.Config = NuGet.Config
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "WatchLots", "src\WatchLots\WatchLots.xproj", "{284454FE-ED93-4108-927D-01562B5CE3A7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{284454FE-ED93-4108-927D-01562B5CE3A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{284454FE-ED93-4108-927D-01562B5CE3A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{284454FE-ED93-4108-927D-01562B5CE3A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{284454FE-ED93-4108-927D-01562B5CE3A7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{284454FE-ED93-4108-927D-01562B5CE3A7} = {B641BF61-0C5C-429F-ADC4-7EC52E57B205}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "default"
}
}
74 changes: 74 additions & 0 deletions src/WatchLots/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.IO;

namespace WatchLots
{
public class Program
{
public int Main(string[] args)
{
var watchers = new List<FileSystemWatcher>();
var current = Directory.GetCurrentDirectory();
for (var i = 0; i < 25; i++)
{
for (var j = 0; j < 10; j++)
{
foreach (var file in Directory.EnumerateFiles(current, "project.json", SearchOption.AllDirectories))
{
var directory = Path.GetDirectoryName(file);
var watcher = new FileSystemWatcher(directory)
{
IncludeSubdirectories = true,
};
watcher.Changed += OnChanged;
watcher.Created += OnChanged;
watcher.Deleted += OnChanged;
watcher.Error += OnError;
watcher.Renamed += OnRenamed;

try
{
watcher.EnableRaisingEvents = true;
}
catch (IOException exception)
{
Console.Error.WriteLine(
$"Caught Exception with HResult '{ exception.HResult }' after creating " +
$"{ watchers.Count } instances:" +
Environment.NewLine +
$"{ exception }");
return 1;
}

watchers.Add(watcher);
}
}

Console.WriteLine($"Completed { 10 * (i + 1) } iterations.");
}

return 0;
}

private static void OnChanged(object sender, FileSystemEventArgs e)
{
Console.WriteLine($"File '{ e.FullPath }' had a '{ e.ChangeType }' change.");
}

private static void OnError(object sender, ErrorEventArgs e)
{
var exception = e.GetException();
Console.Error.WriteLine($"Hit an Exception with HResult '{ exception.HResult }'" +
Environment.NewLine +
$"{ exception }");

Environment.FailFast(exception.Message);
}

private static void OnRenamed(object sender, RenamedEventArgs e)
{
Console.WriteLine($"File '{ e.OldFullPath }' renamed ('{ e.ChangeType }') to '{ e.FullPath }'.");
}
}
}
20 changes: 20 additions & 0 deletions src/WatchLots/WatchLots.xproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>

<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>284454fe-ed93-4108-927d-01562b5ce3a7</ProjectGuid>
<RootNamespace>WatchLots</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>

<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
29 changes: 29 additions & 0 deletions src/WatchLots/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"version": "1.0.0-*",
"description": "WatchLots Console Application",
"authors": [ "dougbu" ],
"tags": [ "" ],
"projectUrl": "",
"licenseUrl": "",

"dependencies": {
},

"commands": {
"WatchLots": "WatchLots"
},

"frameworks": {
"dnx451": { },
"dnxcore50": {
"dependencies": {
"System.Collections": "4.0.10-beta-*",
"System.Console": "4.0.0-beta-*",
"System.IO.FileSystem.Watcher": "4.0.0-beta-*",
"System.Linq": "4.0.0-beta-*",
"System.Threading": "4.0.10-beta-*",
"Microsoft.CSharp": "4.0.0-beta-*"
}
}
}
}

0 comments on commit 34272b3

Please sign in to comment.